use of net.citizensnpcs.api.exception.NPCLoadException in project CitizensAPI by CitizensDev.
the class Owner method load.
@Override
public void load(DataKey key) throws NPCLoadException {
if (key.keyExists("owner")) {
owner = key.getString("owner");
if (key.keyExists("uuid") && !key.getString("uuid").isEmpty()) {
uuid = UUID.fromString(key.getString("uuid"));
}
} else {
try {
owner = key.getString("");
uuid = null;
} catch (Exception ex) {
owner = SERVER;
uuid = null;
throw new NPCLoadException("Invalid owner.");
}
}
}
use of net.citizensnpcs.api.exception.NPCLoadException in project Citizens2 by CitizensDev.
the class AdminCommands method reload.
@Command(aliases = { "citizens" }, usage = "reload", desc = "Reload Citizens", modifiers = { "reload" }, min = 1, max = 1, permission = "citizens.admin")
public void reload(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Messaging.sendTr(sender, Messages.CITIZENS_RELOADING);
try {
plugin.reload();
Messaging.sendTr(sender, Messages.CITIZENS_RELOADED);
} catch (NPCLoadException ex) {
ex.printStackTrace();
throw new CommandException(Messages.CITIZENS_RELOAD_ERROR);
}
}
Aggregations