private String formatDeathMessage(String deathMessage, Player p) { String playerKit = cm.getKillMessageNoKit(); if (kits.getKitByPlayer(p) != null) playerKit = kits.getKitByPlayer(p).getName(); String killMessage = cm.getKillMessageFormatPlayerKit(); if (killMessage.contains("%Player%") || killMessage.contains("%Kit%")) { playerKit = killMessage.replace("%Player%", p.getName()).replace("%Kit%", playerKit); } else { playerKit = String.format(killMessage, p.getName(), playerKit); } return deathMessage.replace(p.getName(), playerKit); }
@Override public void enable() { CommandBook.inst().createDefaultConfiguration("kits.txt"); // Setup kits kits = new FlatFileKitsManager(new File(CommandBook.inst().getDataFolder(), "kits.txt")); kits.load(); CommandBook.server() .getScheduler() .scheduleAsyncRepeatingTask( CommandBook.inst(), new GarbageCollector(this), GarbageCollector.CHECK_FREQUENCY, GarbageCollector.CHECK_FREQUENCY); registerCommands(Commands.class); }
@Override public void reload() { super.reload(); kits.load(); }