Skip to content

Commit

Permalink
Protip: if NPC code is unavailable, don't call NPC code on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 2, 2018
1 parent 13eb8d1 commit ef9fcf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -429,8 +429,10 @@ public void onEnable() {
}

try {
// Create the dNPC Registry
dNPCRegistry = new dNPCRegistry(this);
// If Citizens is enabled, Create the dNPC Registry
if (Depends.citizens != null) {
dNPCRegistry = new dNPCRegistry(this);
}

// Create our CommandManager to handle '/denizen' commands
commandManager = new CommandManager();
Expand Down
Expand Up @@ -47,6 +47,7 @@ public dNPCRegistry(Denizen denizen) {
plugin = denizen;
if (Depends.citizens != null) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
INVENTORY_TRAIT_VIEW = ReflectionHelper.getFields(net.citizensnpcs.api.trait.trait.Inventory.class).get("view");
}
actionHandler = new ActionHandler(plugin);
}
Expand Down Expand Up @@ -142,7 +143,7 @@ public static Inventory getInventory(NPC npc) {
}
}

public static Field INVENTORY_TRAIT_VIEW = ReflectionHelper.getFields(net.citizensnpcs.api.trait.trait.Inventory.class).get("view");
public static Field INVENTORY_TRAIT_VIEW;

/**
* Similar to getting NPCs from Citizens' NPCRegistry, but this will filter out
Expand Down

0 comments on commit ef9fcf3

Please sign in to comment.