use of mc.dragons.core.addon.Addon in project DragonsOnline by UniverseCraft.
the class NPCCommand method manageAddons.
private void manageAddons(CommandSender sender, String[] args) {
NPCClass npcClass = lookupNPCClass(sender, args[0]);
if (npcClass == null)
return;
User user = user(sender);
if (args.length == 2) {
sender.sendMessage(ChatColor.GREEN + "Listing addons for NPC class " + npcClass.getClassName() + ":");
for (NPCAddon addon : npcClass.getAddons()) {
sender.sendMessage(ChatColor.GRAY + "- " + addon.getName());
}
return;
} else if (args.length == 3) {
sender.sendMessage(ChatColor.RED + "Specify an addon name! For a list of addons, do /addon -l");
return;
}
Document base = Document.parse(npcClass.getData().toJson());
Addon addon = addonRegistry.getAddonByName(args[3]);
if (addon == null) {
sender.sendMessage(ChatColor.RED + "Invalid addon name! For a list of addons, do /addon -l");
} else if (addon.getType() != AddonType.NPC) {
sender.sendMessage(ChatColor.RED + "Invalid addon type! Only NPC Addons can be applied to NPCs.");
} else if (args[2].equalsIgnoreCase("add")) {
npcClass.addAddon((NPCAddon) addon);
sender.sendMessage(ChatColor.GREEN + "Added addon " + addon.getName() + " to NPC class " + npcClass.getClassName() + ".");
AUDIT_LOG.saveEntry(npcClass, user, base, "Added addon " + addon.getName());
} else if (args[2].equalsIgnoreCase("remove")) {
npcClass.removeAddon((NPCAddon) addon);
sender.sendMessage(ChatColor.GREEN + "Removed addon " + addon.getName() + " from NPC class " + npcClass.getClassName() + ".");
AUDIT_LOG.saveEntry(npcClass, user, base, "Removed addon " + addon.getName());
} else {
sender.sendMessage(ChatColor.RED + "Invalid arguments! /npc <ClassName> addon [<add|remove> <AddonName>]");
}
}
use of mc.dragons.core.addon.Addon in project DragonsOnline by UniverseCraft.
the class ItemCommand method manageAddons.
private void manageAddons(CommandSender sender, String[] args) {
ItemClass itemClass = lookupItemClass(sender, args[0]);
if (itemClass == null)
return;
User user = user(sender);
if (args.length == 2) {
sender.sendMessage(ChatColor.GREEN + "Listing addons for item class " + itemClass.getClassName() + ":");
for (ItemAddon addon : itemClass.getAddons()) {
sender.sendMessage(ChatColor.GRAY + "- " + addon.getName());
}
} else if (args.length == 3) {
sender.sendMessage(ChatColor.RED + "Specify an addon name! For a list of addons, do /addon -l");
} else {
Addon addon = addonRegistry.getAddonByName(args[3]);
if (addon == null) {
sender.sendMessage(ChatColor.RED + "Invalid addon name! For a list of addons, do /addon -l");
} else if (!(addon instanceof ItemAddon)) {
sender.sendMessage(ChatColor.RED + "Invalid addon type! Only Item Addons can be applied to items.");
} else if (args[2].equalsIgnoreCase("add")) {
Document base = Document.parse(itemClass.getData().toJson());
itemClass.addAddon((ItemAddon) addon);
sender.sendMessage(ChatColor.GREEN + "Added addon " + addon.getName() + " to item class " + itemClass.getClassName() + ".");
AUDIT_LOG.saveEntry(itemClass, user, base, "Added addon " + addon.getName());
} else if (args[2].equalsIgnoreCase("remove")) {
Document base = Document.parse(itemClass.getData().toJson());
itemClass.removeAddon((ItemAddon) addon);
sender.sendMessage(ChatColor.GREEN + "Removed addon " + addon.getName() + " from item class " + itemClass.getClassName() + ".");
AUDIT_LOG.saveEntry(itemClass, user, base, "Removed addon " + addon.getName());
} else {
sender.sendMessage(ChatColor.RED + "Invalid arguments! /item <ClassName> addon [<add|remove> <AddonName>]");
}
}
}
use of mc.dragons.core.addon.Addon in project DragonsOnline by UniverseCraft.
the class DragonsContentTools method onEnable.
public void onEnable() {
enableDebugLogging();
saveDefaultConfig();
PUSH_FOLDER = getConfig().getString("push-folder", "C:\\DragonsPush\\");
Dragons dragons = getDragonsInstance();
COLoader coLoader = new COLoader(dragons);
dragons.getLightweightLoaderRegistry().register(new AuditLogLoader(dragons.getMongoConfig()));
dragons.getLightweightLoaderRegistry().register(new HologramLoader(dragons.getMongoConfig()));
dragons.getLightweightLoaderRegistry().register(coLoader);
dragons.getUserHookRegistry().registerHook(new ContentUserHook(coLoader));
getCommand("region").setExecutor(new RegionCommand());
getCommand("npc").setExecutor(new NPCCommand());
getCommand("item").setExecutor(new ItemCommand());
getCommand("floor").setExecutor(new FloorCommand());
getCommand("clear").setExecutor(new ClearInventoryCommand());
getCommand("testquest").setExecutor(new TestQuestCommand());
getCommand("quest").setExecutor(new QuestCommand());
getCommand("rename").setExecutor(new RenameCommand());
getCommand("relore").setExecutor(new ReloreCommand());
getCommand("restat").setExecutor(new RestatCommand());
getCommand("resetprofile").setExecutor(new ResetProfileCommand());
getCommand("placeholder").setExecutor(new PlaceholderCommand());
getCommand("fixed").setExecutor(new FixedCommand());
getCommand("objmeta").setExecutor(new ObjectMetadataCommand());
getCommand("deletenpc").setExecutor(new DeleteNPCCommand());
getCommand("hologram").setExecutor(new HologramCommand(this));
getCommand("sign").setExecutor(new SignCommand());
CommandExecutor gamemodeCommandExecutor = new GamemodeCommand();
getCommand("gamemode").setExecutor(gamemodeCommandExecutor);
getCommand("gma").setExecutor(gamemodeCommandExecutor);
getCommand("gmc").setExecutor(gamemodeCommandExecutor);
getCommand("gms").setExecutor(gamemodeCommandExecutor);
getCommand("gotofloor").setExecutor(new GoToFloorCommand());
getCommand("updatestats").setExecutor(new UpdateStatsCommand());
CommandExecutor speedCommand = new SpeedCommand();
getCommand("speed").setExecutor(speedCommand);
getCommand("flyspeed").setExecutor(speedCommand);
getCommand("walkspeed").setExecutor(speedCommand);
CommandExecutor warpCommandsExecutor = new WarpCommands();
getCommand("delwarp").setExecutor(warpCommandsExecutor);
getCommand("setwarp").setExecutor(warpCommandsExecutor);
getCommand("warp").setExecutor(warpCommandsExecutor);
getCommand("warps").setExecutor(warpCommandsExecutor);
CommandExecutor coCommandsExecutor = new CommunityObjectiveCommands(coLoader);
getCommand("createobjective").setExecutor(coCommandsExecutor);
getCommand("listobjectives").setExecutor(coCommandsExecutor);
getCommand("unlockobjective").setExecutor(coCommandsExecutor);
getCommand("lockobjective").setExecutor(coCommandsExecutor);
getCommand("completeobjective").setExecutor(coCommandsExecutor);
getCommand("failobjective").setExecutor(coCommandsExecutor);
getCommand("deleteobjective").setExecutor(coCommandsExecutor);
getCommand("reloadobjectives").setExecutor(coCommandsExecutor);
Addon npcIdentifierAddon = new NPCIdentifierAddon();
dragons.getAddonRegistry().register(npcIdentifierAddon);
npcIdentifierAddon.apply();
Bukkit.getPluginManager().registerEvents(new ContentToolsListeners(), this);
}
Aggregations