File tree Expand file tree Collapse file tree
src/main/java/com/github/pinont/singularitylib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .github .pinont .singularitylib .api .annotation ;
22
3+ import java .lang .annotation .ElementType ;
4+ import java .lang .annotation .Target ;
5+
36/**
47 * Annotation to mark classes for automatic registration by the plugin.
58 * This annotation is used to mark classes that need to be registered during the plugin's startup process.
1013 * It should only be used when the class extends {@code CustomItem}, {@code SimpleCommand}, or {@code Listener}.
1114 */
1215
16+ @ Target ({ElementType .TYPE })
1317public @interface AutoRegister {
1418 /**
1519 * Indicates that the annotated class should be automatically registered by the plugin.
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public class CustomItemManager implements SimpleCommand {
3737 * Used when the dev tool plugin is present to provide additional
3838 * development and debugging features for custom items.
3939 */
40- private final CItemManager customItemManager = new CItemManager () ;
40+ private CItemManager customItemManager ;
4141
4242 /**
4343 * Default constructor for CustomItemManager.
@@ -73,7 +73,7 @@ public List<CustomItem> getCustomItems() {
7373 public void register (List <CustomItem > item ) {
7474 if (item .isEmpty ()) return ;
7575 sendConsoleMessage ("Registering " + item .size () + " custom items" );
76- if (getInstance (). getServer (). getPluginManager (). getPlugin ( "SingularityDevTool" ) != null ) {
76+ if (Common . plugin != null ) {
7777 registerAllItems (item , true );
7878 }
7979 registerAllItems (item );
@@ -104,6 +104,9 @@ private void registerAllItems(List<CustomItem> items) {
104104 * @param forDevTool whether to register items with the development tool
105105 */
106106 private void registerAllItems (List <CustomItem > items , boolean forDevTool ) {
107+ if (forDevTool ) {
108+ customItemManager = new CItemManager ();
109+ }
107110 for (CustomItem customItem : items ) {
108111 customItems .add (customItem );
109112 if (forDevTool ) {
Original file line number Diff line number Diff line change 11package com .github .pinont .singularitylib .plugin .register ;
22
3- import com .github .pinont .devtool .api .CItemManager ;
43import com .github .pinont .singularitylib .api .annotation .AutoRegister ;
54import com .github .pinont .singularitylib .api .command .SimpleCommand ;
65import com .github .pinont .singularitylib .api .items .CustomItem ;
You can’t perform that action at this time.
0 commit comments