use of mc.dragons.core.gameobject.npc.NPCClass 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.gameobject.npc.NPCClass in project DragonsOnline by UniverseCraft.
the class NPCCommand method setImmortal.
private void setImmortal(CommandSender sender, String[] args) {
NPCClass npcClass = lookupNPCClass(sender, args[0]);
Boolean immortal = parseBoolean(sender, args[2]);
if (npcClass == null || immortal == null)
return;
Document base = Document.parse(npcClass.getData().toJson());
npcClass.setImmortal(immortal);
sender.sendMessage(ChatColor.GREEN + "Updated entity immortality successfully.");
AUDIT_LOG.saveEntry(npcClass, user(sender), base, "Set entity immortality to " + immortal);
propagateRevisions(npcClass);
}
use of mc.dragons.core.gameobject.npc.NPCClass in project DragonsOnline by UniverseCraft.
the class NPCCommand method setLevel.
private void setLevel(CommandSender sender, String[] args) {
NPCClass npcClass = lookupNPCClass(sender, args[0]);
Integer level = parseInt(sender, args[2]);
if (npcClass == null || level == null)
return;
Document base = Document.parse(npcClass.getData().toJson());
npcClass.setLevel(level);
sender.sendMessage(ChatColor.GREEN + "Updated entity level successfully.");
AUDIT_LOG.saveEntry(npcClass, user(sender), base, "Set entity level to " + level);
propagateRevisions(npcClass);
}
use of mc.dragons.core.gameobject.npc.NPCClass in project DragonsOnline by UniverseCraft.
the class NPCCommand method setMaxHealth.
private void setMaxHealth(CommandSender sender, String[] args) {
NPCClass npcClass = lookupNPCClass(sender, args[0]);
Double maxHealth = parseDouble(sender, args[2]);
if (npcClass == null || maxHealth == null)
return;
Document base = Document.parse(npcClass.getData().toJson());
npcClass.setMaxHealth(maxHealth);
sender.sendMessage(ChatColor.GREEN + "Updated entity max health successfully.");
AUDIT_LOG.saveEntry(npcClass, user(sender), base, "Set entity max health to " + maxHealth);
propagateRevisions(npcClass);
}
use of mc.dragons.core.gameobject.npc.NPCClass in project DragonsOnline by UniverseCraft.
the class NPCCommand method deleteClass.
private void deleteClass(CommandSender sender, String[] args) {
if (!requirePermission(sender, SystemProfileFlag.GM_DELETE))
return;
if (args.length == 1) {
sender.sendMessage(ChatColor.RED + "Specify a class name to delete! /npc delete <ClassName>");
return;
}
NPCClass npcClass = lookupNPCClass(sender, args[1]);
if (npcClass == null)
return;
gameObjectRegistry.removeFromDatabase(npcClass);
AUDIT_LOG.saveEntry(npcClass, user(sender), "Deleted");
sender.sendMessage(ChatColor.GREEN + "Successfully deleted NPC class.");
}
Aggregations