diff --git a/src/com/projectkorra/projectkorra/BendingManager.java b/src/com/projectkorra/projectkorra/BendingManager.java index 5ae22b72..48d35357 100644 --- a/src/com/projectkorra/projectkorra/BendingManager.java +++ b/src/com/projectkorra/projectkorra/BendingManager.java @@ -1,5 +1,13 @@ package com.projectkorra.projectkorra; +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.entity.Player; + import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.chiblocking.combo.ChiCombo; @@ -10,14 +18,6 @@ import com.projectkorra.projectkorra.util.RevertChecker; import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.rpg.RPGMethods; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.UUID; - public class BendingManager implements Runnable { private static BendingManager instance; diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java index 0dd1ddb5..85278e43 100644 --- a/src/com/projectkorra/projectkorra/GeneralMethods.java +++ b/src/com/projectkorra/projectkorra/GeneralMethods.java @@ -190,7 +190,7 @@ public class GeneralMethods { */ public static void bindAbility(Player player, String ability, int slot) { if (MultiAbilityManager.playerAbilities.containsKey(player)) { - player.sendMessage(ChatColor.RED + "You can't edit your binds right now!"); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + "You can't edit your binds right now!"); return; } @@ -203,7 +203,7 @@ public class GeneralMethods { bPlayer.getAbilities().put(slot, ability); if (coreAbil != null) { - player.sendMessage(coreAbil.getElement().getColor() + ConfigManager.languageConfig.get().getString("Commands.Bind.SuccessfullyBound").replace("{ability}", ability).replace("{slot}", String.valueOf(slot))); + player.sendMessage(ConfigManager.getBrandingPrefix() + coreAbil.getElement().getColor() + ConfigManager.languageConfig.get().getString("Commands.Bind.SuccessfullyBound").replace("{ability}", ability).replace("{slot}", String.valueOf(slot))); } saveAbility(bPlayer, slot, ability); } diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index c2f37e9a..3408019b 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -1033,11 +1033,23 @@ public class PKListener implements Listener { } }, 5); - Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() { - public void run() { - player.sendMessage(ChatColor.GOLD + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!"); - } - }, 20 * 5); + if (ConfigManager.languageConfig.get().getBoolean("Chat.Branding.JoinMessage.Enabled")) { + Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() { + public void run() { + ChatColor color = ConfigManager.BRANDING_OPTIONS.get(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase()); + color = color == null ? ChatColor.GOLD : color; + String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder"); + String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.BottomBorder"); + if (!topBorder.isEmpty()) { + player.sendMessage(ChatColor.translateAlternateColorCodes('&', topBorder)); + } + player.sendMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!"); + if (!bottomBorder.isEmpty()) { + player.sendMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder)); + } + } + }, 20 * 4); + } } @EventHandler diff --git a/src/com/projectkorra/projectkorra/ProjectKorra.java b/src/com/projectkorra/projectkorra/ProjectKorra.java index d920a8aa..d76f21af 100644 --- a/src/com/projectkorra/projectkorra/ProjectKorra.java +++ b/src/com/projectkorra/projectkorra/ProjectKorra.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.logging.Logger; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Statistic; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -93,6 +94,24 @@ public class ProjectKorra extends JavaPlugin { getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1); //getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1); getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200); + if (ConfigManager.languageConfig.get().getBoolean("Chat.Branding.AutoAnnouncer.Enabled")) { + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { + @Override + public void run() { + ChatColor color = ConfigManager.BRANDING_OPTIONS.get(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase()); + color = color == null ? ChatColor.GOLD : color; + String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder"); + String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.BottomBorder"); + if (!topBorder.isEmpty()) { + Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', topBorder)); + } + Bukkit.broadcastMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!"); + if (!bottomBorder.isEmpty()) { + Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder)); + } + } + }, (long) (ConfigManager.languageConfig.get().getDouble("Chat.Branding.AutoAnnouncer.Interval") * 60 * 20), (long) (ConfigManager.languageConfig.get().getDouble("Chat.Branding.AutoAnnouncer.Interval") * 60 * 20)); + } TempBlock.startReversion(); for (final Player player : Bukkit.getOnlinePlayers()) { diff --git a/src/com/projectkorra/projectkorra/command/AddCommand.java b/src/com/projectkorra/projectkorra/command/AddCommand.java index e1c86c4a..13d4a1a1 100644 --- a/src/com/projectkorra/projectkorra/command/AddCommand.java +++ b/src/com/projectkorra/projectkorra/command/AddCommand.java @@ -63,7 +63,7 @@ public class AddCommand extends PKCommand { } Player player = Bukkit.getPlayer(args.get(1)); if (player == null) { - sender.sendMessage(ChatColor.RED + playerNotFound); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound); return; } add(sender, player, args.get(0).toLowerCase()); @@ -90,15 +90,15 @@ public class AddCommand extends PKCommand { bPlayer = BendingPlayer.getBendingPlayer(target); } if (bPlayer.isPermaRemoved()) { - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); return; } if (Arrays.asList(Element.getAllElements()).contains(e)) { if (bPlayer.hasElement(e)) { if (!(sender instanceof Player) || !((Player) sender).equals(target)) { - sender.sendMessage(ChatColor.RED + alreadyHasElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); } else { - sender.sendMessage(ChatColor.RED + alreadyHasElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasElement); } return; } @@ -114,17 +114,17 @@ public class AddCommand extends PKCommand { if (!(sender instanceof Player) || !((Player) sender).equals(target)) { if (e != Element.AIR && e != Element.EARTH) { - sender.sendMessage(color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender())); - target.sendMessage(color + addedCFW.replace("{element}", e.getName() + e.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedCFW.replace("{element}", e.getName() + e.getType().getBender())); } else { - sender.sendMessage(color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender())); - target.sendMessage(color + addedAE.replace("{element}", e.getName() + e.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedAE.replace("{element}", e.getName() + e.getType().getBender())); } } else { if (e != Element.AIR && e != Element.EARTH) - target.sendMessage(color + addedCFW.replace("{element}", e.getName() + e.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedCFW.replace("{element}", e.getName() + e.getType().getBender())); else - target.sendMessage(color + addedAE.replace("{element}", e.getName() + e.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedAE.replace("{element}", e.getName() + e.getType().getBender())); } GeneralMethods.saveElements(bPlayer); @@ -135,9 +135,9 @@ public class AddCommand extends PKCommand { SubElement sub = (SubElement) e; if (bPlayer.hasSubElement(sub)) { if (!(sender instanceof Player) || !((Player) sender).equals(target)) { - sender.sendMessage(ChatColor.RED + alreadyHasSubElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasSubElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); } else { - sender.sendMessage(ChatColor.RED + alreadyHasSubElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasSubElement); } return; } @@ -146,15 +146,15 @@ public class AddCommand extends PKCommand { if (!(sender instanceof Player) || !((Player) sender).equals(target)) { if (e != Element.AIR && e != Element.EARTH) - sender.sendMessage(color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); else - sender.sendMessage(color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); } else { if (e != Element.AIR && e != Element.EARTH) - target.sendMessage(color + addedCFW.replace("{element}", sub.getName() + sub.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedCFW.replace("{element}", sub.getName() + sub.getType().getBender())); else - target.sendMessage(color + addedAE.replace("{element}", sub.getName() + sub.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedAE.replace("{element}", sub.getName() + sub.getType().getBender())); } GeneralMethods.saveSubElements(bPlayer); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.ADD)); diff --git a/src/com/projectkorra/projectkorra/command/BindCommand.java b/src/com/projectkorra/projectkorra/command/BindCommand.java index 55c3f5d6..06ca7481 100644 --- a/src/com/projectkorra/projectkorra/command/BindCommand.java +++ b/src/com/projectkorra/projectkorra/command/BindCommand.java @@ -49,7 +49,7 @@ public class BindCommand extends PKCommand { CoreAbility coreAbil = CoreAbility.getAbility(args.get(0)); if (coreAbil == null || coreAbil.isHiddenAbility() || !coreAbil.isEnabled()) { - sender.sendMessage(ChatColor.RED + abilityDoesntExist.replace("{ability}", args.get(0))); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + abilityDoesntExist.replace("{ability}", args.get(0))); return; } @@ -64,7 +64,7 @@ public class BindCommand extends PKCommand { bind(sender, args.get(0), Integer.parseInt(args.get(1))); } catch (NumberFormatException ex) { - sender.sendMessage(ChatColor.RED + wrongNumber); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber); } } } @@ -73,33 +73,33 @@ public class BindCommand extends PKCommand { if (!(sender instanceof Player)) { return; } else if (slot < 1 || slot > 9) { - sender.sendMessage(ChatColor.RED + wrongNumber); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber); return; } BendingPlayer bPlayer = BendingPlayer.getBendingPlayer((Player) sender); CoreAbility coreAbil = CoreAbility.getAbility(ability); if (bPlayer == null) { - sender.sendMessage(ChatColor.RED + loadingInfo); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + loadingInfo); return; } else if (coreAbil == null || !bPlayer.canBind(coreAbil)) { if (coreAbil != null && coreAbil.getElement() != Element.AVATAR && !bPlayer.hasElement(coreAbil.getElement())) { if (coreAbil.getElement() instanceof SubElement) { SubElement sub = (SubElement) coreAbil.getElement(); if (!bPlayer.hasElement(sub.getParentElement())) { - sender.sendMessage(ChatColor.RED + ("AEIOUaeiou".indexOf(sub.getParentElement().getName().charAt(0)) > -1 ? this.noElementAE : this.noElement).replace("{element}", sub.getParentElement().getName() + sub.getParentElement().getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ("AEIOUaeiou".indexOf(sub.getParentElement().getName().charAt(0)) > -1 ? this.noElementAE : this.noElement).replace("{element}", sub.getParentElement().getName() + sub.getParentElement().getType().getBender())); } else { - sender.sendMessage(ChatColor.RED + this.noSubElement.replace("{subelement}", coreAbil.getElement().getName() + coreAbil.getElement().getType().getBending())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noSubElement.replace("{subelement}", coreAbil.getElement().getName() + coreAbil.getElement().getType().getBending())); } } else { - sender.sendMessage(ChatColor.RED + ("AEIOUaeiou".indexOf(coreAbil.getElement().getName().charAt(0)) > -1 ? this.noElementAE : this.noElement).replace("{element}", coreAbil.getElement().getName() + coreAbil.getElement().getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ("AEIOUaeiou".indexOf(coreAbil.getElement().getName().charAt(0)) > -1 ? this.noElementAE : this.noElement).replace("{element}", coreAbil.getElement().getName() + coreAbil.getElement().getType().getBender())); } } else { - sender.sendMessage(ChatColor.RED + super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + super.noPermissionMessage); } return; } else if (!bPlayer.isElementToggled(coreAbil.getElement())) { - sender.sendMessage(ChatColor.RED + toggledElementOff); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggledElementOff); } String name = coreAbil != null ? coreAbil.getName() : null; diff --git a/src/com/projectkorra/projectkorra/command/ChooseCommand.java b/src/com/projectkorra/projectkorra/command/ChooseCommand.java index 74844f7a..67440465 100644 --- a/src/com/projectkorra/projectkorra/command/ChooseCommand.java +++ b/src/com/projectkorra/projectkorra/command/ChooseCommand.java @@ -57,12 +57,12 @@ public class ChooseCommand extends PKCommand { bPlayer = BendingPlayer.getBendingPlayer(sender.getName()); } if (bPlayer.isPermaRemoved()) { - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); return; } if (!bPlayer.getElements().isEmpty() && !sender.hasPermission("bending.command.rechoose")) { - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return; } String element = args.get(0).toLowerCase(); @@ -84,17 +84,17 @@ public class ChooseCommand extends PKCommand { add(sender, (Player) sender, targetElement); return; } else { - sender.sendMessage(ChatColor.RED + invalidElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + invalidElement); return; } } else if (args.size() == 2) { if (!sender.hasPermission("bending.admin.choose")) { - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return; } Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1)); if (target == null || !target.isOnline()) { - sender.sendMessage(ChatColor.RED + playerNotFound); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound); return; } String element = args.get(0).toLowerCase(); @@ -113,7 +113,7 @@ public class ChooseCommand extends PKCommand { add(sender, target, targetElement); return; } else { - sender.sendMessage(ChatColor.RED + invalidElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + invalidElement); } } } @@ -136,9 +136,9 @@ public class ChooseCommand extends PKCommand { bPlayer.addSubElement(sub); ChatColor color = sub != null ? sub.getColor() : ChatColor.WHITE; if (!(sender instanceof Player) || !((Player) sender).equals(target)) { - sender.sendMessage(color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender())); } else { - target.sendMessage(color + chosenCFW.replace("{element}", sub.getName() + sub.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenCFW.replace("{element}", sub.getName() + sub.getType().getBender())); } GeneralMethods.saveSubElements(bPlayer); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE)); @@ -154,14 +154,14 @@ public class ChooseCommand extends PKCommand { ChatColor color = element != null ? element.getColor() : ChatColor.WHITE; if (!(sender instanceof Player) || !((Player) sender).equals(target)) { if (element != Element.AIR && element != Element.EARTH) - sender.sendMessage(color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender())); else - sender.sendMessage(color + chosenOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender())); } else { if (element != Element.AIR && element != Element.EARTH) - target.sendMessage(color + chosenCFW.replace("{element}", element.getName() + element.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenCFW.replace("{element}", element.getName() + element.getType().getBender())); else - target.sendMessage(color + chosenAE.replace("{element}", element.getName() + element.getType().getBender())); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + chosenAE.replace("{element}", element.getName() + element.getType().getBender())); } GeneralMethods.saveElements(bPlayer); GeneralMethods.saveSubElements(bPlayer); diff --git a/src/com/projectkorra/projectkorra/command/ClearCommand.java b/src/com/projectkorra/projectkorra/command/ClearCommand.java index 62659ba4..14e4ed0a 100644 --- a/src/com/projectkorra/projectkorra/command/ClearCommand.java +++ b/src/com/projectkorra/projectkorra/command/ClearCommand.java @@ -39,7 +39,7 @@ public class ClearCommand extends PKCommand { if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 1) || !isPlayer(sender)) { return; } else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) { - sender.sendMessage(ChatColor.RED + cantEditBinds); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + cantEditBinds); return; } @@ -53,23 +53,23 @@ public class ClearCommand extends PKCommand { for (int i = 1; i <= 9; i++) { GeneralMethods.saveAbility(bPlayer, i, null); } - sender.sendMessage(ChatColor.YELLOW + cleared); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + cleared); } else if (args.size() == 1) { try { int slot = Integer.parseInt(args.get(0)); if (slot < 1 || slot > 9) { - sender.sendMessage(ChatColor.RED + wrongNumber); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber); } if (bPlayer.getAbilities().get(slot) != null) { bPlayer.getAbilities().remove(slot); GeneralMethods.saveAbility(bPlayer, slot, null); - sender.sendMessage(ChatColor.YELLOW + clearedSlot.replace("{slot}", String.valueOf(slot))); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + clearedSlot.replace("{slot}", String.valueOf(slot))); } else { - sender.sendMessage(ChatColor.YELLOW + alreadyEmpty); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + alreadyEmpty); } } catch (NumberFormatException e) { - sender.sendMessage(ChatColor.RED + wrongNumber); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber); } } } diff --git a/src/com/projectkorra/projectkorra/command/CopyCommand.java b/src/com/projectkorra/projectkorra/command/CopyCommand.java index 259e0ee9..347b1b59 100644 --- a/src/com/projectkorra/projectkorra/command/CopyCommand.java +++ b/src/com/projectkorra/projectkorra/command/CopyCommand.java @@ -43,18 +43,18 @@ public class CopyCommand extends PKCommand { Player orig = Bukkit.getPlayer(args.get(0)); if (orig == null || !orig.isOnline()) { - sender.sendMessage(ChatColor.RED + playerNotFound); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound); return; } boolean boundAll = assignAbilities(sender, orig, (Player) sender, true); - sender.sendMessage(ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); if (!boundAll) { - sender.sendMessage(ChatColor.RED + failedToBindAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + failedToBindAll); } } else if (args.size() == 2) { if (!hasPermission(sender, "assign")) { - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return; } @@ -62,15 +62,15 @@ public class CopyCommand extends PKCommand { Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1)); if ((orig == null || !orig.isOnline()) || (target == null || !target.isOnline())) { - sender.sendMessage(ChatColor.RED + playerNotFound); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound); return; } boolean boundAll = assignAbilities(sender, orig, target, false); - sender.sendMessage(ChatColor.GREEN + copiedOther.replace("{target1}", ChatColor.YELLOW + target.getName() + ChatColor.GREEN).replace("{target2}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); - target.sendMessage(ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + copiedOther.replace("{target1}", ChatColor.YELLOW + target.getName() + ChatColor.GREEN).replace("{target2}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); + target.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN)); if (!boundAll) { - sender.sendMessage(ChatColor.RED + failedToBindAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + failedToBindAll); } } } @@ -91,9 +91,9 @@ public class CopyCommand extends PKCommand { } if (orig.isPermaRemoved()) { if (self) { - player.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); } else { - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); } return false; } diff --git a/src/com/projectkorra/projectkorra/command/DisplayCommand.java b/src/com/projectkorra/projectkorra/command/DisplayCommand.java index b04ac415..d7007d3d 100644 --- a/src/com/projectkorra/projectkorra/command/DisplayCommand.java +++ b/src/com/projectkorra/projectkorra/command/DisplayCommand.java @@ -83,7 +83,7 @@ public class DisplayCommand extends PKCommand { ArrayList combos = ComboManager.getCombosForElement(element); if (combos.isEmpty()) { - sender.sendMessage(color + noCombosAvailable.replace("{element}", element.getName())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + noCombosAvailable.replace("{element}", element.getName())); return; } for (String comboMove : combos) { @@ -105,7 +105,7 @@ public class DisplayCommand extends PKCommand { Set passives = PassiveManager.getPassivesForElement(element); if (passives.isEmpty()) { - sender.sendMessage(color + noPassivesAvailable.replace("{element}", element.getName())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + noPassivesAvailable.replace("{element}", element.getName())); return; } for (String passiveAbil : passives) { @@ -152,7 +152,7 @@ public class DisplayCommand extends PKCommand { if (args.size() == 0) { //bending display if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED + playersOnly); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playersOnly); return; } displayBinds(sender); diff --git a/src/com/projectkorra/projectkorra/command/ImportCommand.java b/src/com/projectkorra/projectkorra/command/ImportCommand.java index 6c434151..410f83a4 100644 --- a/src/com/projectkorra/projectkorra/command/ImportCommand.java +++ b/src/com/projectkorra/projectkorra/command/ImportCommand.java @@ -53,11 +53,11 @@ public class ImportCommand extends PKCommand { if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 0)) { return; } else if (!GeneralMethods.isImportEnabled()) { - sender.sendMessage(ChatColor.RED + this.disabled); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.disabled); return; } - sender.sendMessage(ChatColor.GREEN + this.preparingData); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.preparingData); File bendingPlayersFile = new File(".", "converted.yml"); FileConfiguration bendingPlayers = YamlConfiguration.loadConfiguration(bendingPlayersFile); diff --git a/src/com/projectkorra/projectkorra/command/InvincibleCommand.java b/src/com/projectkorra/projectkorra/command/InvincibleCommand.java index c6df5988..1c7df2d4 100644 --- a/src/com/projectkorra/projectkorra/command/InvincibleCommand.java +++ b/src/com/projectkorra/projectkorra/command/InvincibleCommand.java @@ -25,10 +25,10 @@ public class InvincibleCommand extends PKCommand { if (!Commands.invincible.contains(sender.getName())) { Commands.invincible.add(sender.getName()); - sender.sendMessage(ChatColor.GREEN + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOn")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOn")); } else { Commands.invincible.remove(sender.getName()); - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOff")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOff")); } } diff --git a/src/com/projectkorra/projectkorra/command/PKCommand.java b/src/com/projectkorra/projectkorra/command/PKCommand.java index 76dd60a4..ecb2b927 100644 --- a/src/com/projectkorra/projectkorra/command/PKCommand.java +++ b/src/com/projectkorra/projectkorra/command/PKCommand.java @@ -112,7 +112,7 @@ public abstract class PKCommand implements SubCommand { if (sender.hasPermission("bending.command." + name + "." + extra)) { return true; } else { - sender.sendMessage(this.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + this.noPermissionMessage); return false; } } @@ -147,7 +147,7 @@ public abstract class PKCommand implements SubCommand { if (sender instanceof Player) { return true; } else { - sender.sendMessage(this.mustBePlayerMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + this.mustBePlayerMessage); return false; } } diff --git a/src/com/projectkorra/projectkorra/command/PermaremoveCommand.java b/src/com/projectkorra/projectkorra/command/PermaremoveCommand.java index af2a7677..9ff25d8d 100644 --- a/src/com/projectkorra/projectkorra/command/PermaremoveCommand.java +++ b/src/com/projectkorra/projectkorra/command/PermaremoveCommand.java @@ -56,7 +56,7 @@ public class PermaremoveCommand extends PKCommand { private void permaremove(CommandSender sender, String target) { Player player = Bukkit.getPlayer(target); if (player == null) { - sender.sendMessage(ChatColor.RED + this.playerIsOffline); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.playerIsOffline); return; } @@ -69,18 +69,18 @@ public class PermaremoveCommand extends PKCommand { if (bPlayer.isPermaRemoved()) { bPlayer.setPermaRemoved(false); GeneralMethods.savePermaRemoved(bPlayer); - player.sendMessage(ChatColor.GREEN + this.restored); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.restored); if (!(sender instanceof Player) || !sender.getName().equalsIgnoreCase(target)) - sender.sendMessage(ChatColor.GREEN + this.restoredConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.restoredConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.GREEN)); } else { bPlayer.getElements().clear(); GeneralMethods.saveElements(bPlayer); bPlayer.setPermaRemoved(true); GeneralMethods.savePermaRemoved(bPlayer); GeneralMethods.removeUnusableAbilities(player.getName()); - player.sendMessage(ChatColor.RED + this.removed); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.removed); if (!(sender instanceof Player) || !sender.getName().equalsIgnoreCase(target)) - sender.sendMessage(ChatColor.RED + this.removedConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.RED)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.removedConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.RED)); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.PERMAREMOVE)); } } @@ -94,7 +94,7 @@ public class PermaremoveCommand extends PKCommand { @Override public boolean hasPermission(CommandSender sender) { if (!sender.hasPermission("bending.admin.permaremove")) { - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return false; } return true; diff --git a/src/com/projectkorra/projectkorra/command/PresetCommand.java b/src/com/projectkorra/projectkorra/command/PresetCommand.java index dd4155dd..27d235a7 100644 --- a/src/com/projectkorra/projectkorra/command/PresetCommand.java +++ b/src/com/projectkorra/projectkorra/command/PresetCommand.java @@ -66,7 +66,7 @@ public class PresetCommand extends PKCommand { if (!isPlayer(sender) || !correctLength(sender, args.size(), 1, 3)) { return; } else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) { - sender.sendMessage(this.cantEditBinds); + sender.sendMessage(ConfigManager.getBrandingPrefix() + this.cantEditBinds); return; } @@ -85,7 +85,7 @@ public class PresetCommand extends PKCommand { List presetNames = new ArrayList(); if (presets == null || presets.isEmpty()) { - sender.sendMessage(ChatColor.RED + this.noPresets); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresets); return; } @@ -104,7 +104,7 @@ public class PresetCommand extends PKCommand { String name = args.get(1); if (Arrays.asList(deletealiases).contains(args.get(0)) && hasPermission(sender, "delete")) { //bending preset delete name if (!Preset.presetExists(player, name)) { - sender.sendMessage(ChatColor.RED + this.noPresetName); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName); return; } @@ -121,23 +121,23 @@ public class PresetCommand extends PKCommand { } else if (Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) { boundAll = Preset.bindExternalPreset(player, name); } else if (!Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) { - sender.sendMessage(ChatColor.RED + this.noPresetNameExternal); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetNameExternal); return; } else if (bPlayer.isPermaRemoved()) { - player.sendMessage(ChatColor.RED + this.bendingRemoved); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemoved); return; } else { - sender.sendMessage(ChatColor.RED + this.noPresetName); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName); return; } sender.sendMessage(ChatColor.GREEN + bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN)); if (!boundAll) { - sender.sendMessage(ChatColor.RED + this.failedToBindAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.failedToBindAll); } } else if (hasPermission(sender, "bind.external.assign") && Preset.externalPresetExists(name)) { if (!Preset.externalPresetExists(name)) { - sender.sendMessage(ChatColor.RED + this.noPresetNameExternal); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetNameExternal); return; } @@ -150,23 +150,23 @@ public class PresetCommand extends PKCommand { bPlayer2 = BendingPlayer.getBendingPlayer(player2); } if (bPlayer2.isPermaRemoved()) { - player.sendMessage(ChatColor.RED + this.bendingRemovedOther); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemovedOther); return; } boolean boundAll = Preset.bindExternalPreset(player2, name); - sender.sendMessage(ChatColor.GREEN + this.boundOtherConfirm.replace("{target}", ChatColor.YELLOW + player2.getName() + ChatColor.GREEN).replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN + ChatColor.YELLOW)); - player2.sendMessage(ChatColor.GREEN + this.bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.boundOtherConfirm.replace("{target}", ChatColor.YELLOW + player2.getName() + ChatColor.GREEN).replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN + ChatColor.YELLOW)); + player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN)); if (!boundAll) { - player2.sendMessage(ChatColor.RED + this.failedToBindAll); + player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.failedToBindAll); } return; } else { - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); } } else if (hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) { if (!Preset.presetExists(player, name)) { - sender.sendMessage(ChatColor.RED + this.noPresetName); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName); return; } @@ -179,30 +179,30 @@ public class PresetCommand extends PKCommand { bPlayer2 = BendingPlayer.getBendingPlayer(player2); } if (bPlayer2.isPermaRemoved()) { - player.sendMessage(ChatColor.RED + this.bendingRemovedOther); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemovedOther); return; } Preset preset = Preset.getPreset(player, name); boolean boundAll = Preset.bindPreset(player2, preset); - sender.sendMessage(ChatColor.GREEN + this.boundOtherConfirm.replace("{target}", ChatColor.YELLOW + player2.getName() + ChatColor.GREEN).replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN + ChatColor.YELLOW)); - player2.sendMessage(ChatColor.GREEN + this.succesfullyCopied.replace("{target}", ChatColor.YELLOW + player.getName() + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.boundOtherConfirm.replace("{target}", ChatColor.YELLOW + player2.getName() + ChatColor.GREEN).replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN + ChatColor.YELLOW)); + player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.succesfullyCopied.replace("{target}", ChatColor.YELLOW + player.getName() + ChatColor.GREEN)); if (!boundAll) { - player2.sendMessage(ChatColor.RED + this.failedToBindAll); + player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.failedToBindAll); } return; } else { - sender.sendMessage(ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); } } } else if (Arrays.asList(createaliases).contains(args.get(0)) && hasPermission(sender, "create")) { //bending preset create name int limit = GeneralMethods.getMaxPresets(player); if (Preset.presets.get(player) != null && Preset.presets.get(player).size() >= limit) { - sender.sendMessage(ChatColor.RED + this.reachedMax); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.reachedMax); return; } else if (Preset.presetExists(player, name)) { - sender.sendMessage(ChatColor.RED + this.alreadyExists); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.alreadyExists); return; } @@ -213,7 +213,7 @@ public class PresetCommand extends PKCommand { Preset preset = new Preset(player.getUniqueId(), name, abilities); preset.save(player); - sender.sendMessage(ChatColor.GREEN + this.createdNewPreset.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.createdNewPreset.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN)); } else { help(sender, false); } diff --git a/src/com/projectkorra/projectkorra/command/RemoveCommand.java b/src/com/projectkorra/projectkorra/command/RemoveCommand.java index d0907940..acd6c2d4 100644 --- a/src/com/projectkorra/projectkorra/command/RemoveCommand.java +++ b/src/com/projectkorra/projectkorra/command/RemoveCommand.java @@ -61,10 +61,10 @@ public class RemoveCommand extends PKCommand { senderBPlayer.getSubElements().remove(e); GeneralMethods.saveSubElements(senderBPlayer); GeneralMethods.removeUnusableAbilities(sender.getName()); - sender.sendMessage(e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE)); } else - sender.sendMessage(ChatColor.RED + wrongElementSelf); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElementSelf); return; } else if (e instanceof Element) { if (senderBPlayer.hasElement(e)) { @@ -75,22 +75,22 @@ public class RemoveCommand extends PKCommand { GeneralMethods.saveElements(senderBPlayer); GeneralMethods.removeUnusableAbilities(sender.getName()); - sender.sendMessage(e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending())); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE)); return; } else - sender.sendMessage(ChatColor.RED + wrongElementSelf); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElementSelf); { return; } } } else - sender.sendMessage(ChatColor.RED + invalidElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + invalidElement); { return; } } - sender.sendMessage(ChatColor.RED + playerOffline); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerOffline); return; } else { help(sender, false); @@ -107,7 +107,7 @@ public class RemoveCommand extends PKCommand { Element e = Element.fromString(args.get(1)); if (e != null) { if (!bPlayer.hasElement(e)) { - sender.sendMessage(ChatColor.DARK_RED + wrongElementTarget.replace("{target}", player.getName())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.DARK_RED + wrongElementTarget.replace("{target}", player.getName())); return; } if (e instanceof SubElement) { @@ -119,8 +119,8 @@ public class RemoveCommand extends PKCommand { } GeneralMethods.removeUnusableAbilities(player.getName()); - player.sendMessage(e.getColor() + this.succesfullyRemovedElementTarget.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); - sender.sendMessage(e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending()).replace("{target}", ChatColor.DARK_AQUA + player.getName() + e.getColor())); + player.sendMessage(ConfigManager.getBrandingPrefix() + e.getColor() + this.succesfullyRemovedElementTarget.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending()).replace("{target}", ChatColor.DARK_AQUA + player.getName() + e.getColor())); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE)); return; } @@ -133,8 +133,8 @@ public class RemoveCommand extends PKCommand { if (GeneralMethods.hasRPG()) RPGMethods.revokeAvatar(bPlayer.getUUID()); if (!player.getName().equalsIgnoreCase(sender.getName())) - sender.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW)); - player.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTarget.replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + ChatColor.YELLOW)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW)); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + this.succesfullyRemovedAllElementsTarget.replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + ChatColor.YELLOW)); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.REMOVE)); } } @@ -150,7 +150,7 @@ public class RemoveCommand extends PKCommand { if (sender.hasPermission("bending.admin." + getName())) { return true; } - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return false; } diff --git a/src/com/projectkorra/projectkorra/command/ToggleCommand.java b/src/com/projectkorra/projectkorra/command/ToggleCommand.java index b9d27a84..8100b6bc 100644 --- a/src/com/projectkorra/projectkorra/command/ToggleCommand.java +++ b/src/com/projectkorra/projectkorra/command/ToggleCommand.java @@ -60,7 +60,7 @@ public class ToggleCommand extends PKCommand { return; } if (Commands.isToggledForAll) { - sender.sendMessage(ChatColor.RED + toggledOffForAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggledOffForAll); return; } BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName()); @@ -69,10 +69,10 @@ public class ToggleCommand extends PKCommand { bPlayer = BendingPlayer.getBendingPlayer(sender.getName()); } if (bPlayer.isToggled()) { - sender.sendMessage(ChatColor.RED + toggleOffSelf); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggleOffSelf); bPlayer.toggleBending(); } else { - sender.sendMessage(ChatColor.GREEN + toggleOnSelf); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnSelf); bPlayer.toggleBending(); } } else if (args.size() == 1) { @@ -80,21 +80,21 @@ public class ToggleCommand extends PKCommand { if (Commands.isToggledForAll) { // Bending is toggled off for all players. Commands.isToggledForAll = false; for (Player player : Bukkit.getOnlinePlayers()) { - player.sendMessage(ChatColor.GREEN + toggleOnAll); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnAll); } if (!(sender instanceof Player)) - sender.sendMessage(ChatColor.GREEN + toggleOnAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnAll); } else { Commands.isToggledForAll = true; for (Player player : Bukkit.getOnlinePlayers()) { - player.sendMessage(ChatColor.RED + toggleOffAll); + player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggleOffAll); } if (!(sender instanceof Player)) - sender.sendMessage(ChatColor.RED + toggleOffAll); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggleOffAll); } } else if (sender instanceof Player && args.size() == 1 && Element.fromString(args.get(0)) != null) { if (!BendingPlayer.getBendingPlayer(sender.getName()).hasElement(Element.fromString(args.get(0)))) { - sender.sendMessage(ChatColor.RED + wrongElement); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElement); return; } Element e = Element.fromString(args.get(0)); @@ -103,9 +103,9 @@ public class ToggleCommand extends PKCommand { bPlayer.toggleElement(e); if (bPlayer.isElementToggled(e)) { - sender.sendMessage(color + toggledOnSingleElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + toggledOnSingleElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); } else { - sender.sendMessage(color + toggledOffSingleElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + toggledOffSingleElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); } } } else if (sender instanceof Player && args.size() == 2 && Element.fromString(args.get(0)) != null) { @@ -113,11 +113,11 @@ public class ToggleCommand extends PKCommand { if (!hasAdminPermission(sender)) return; if (target == null) { - sender.sendMessage(ChatColor.RED + notFound); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + notFound); return; } if (!BendingPlayer.getBendingPlayer(target.getName()).hasElement(Element.fromString(args.get(0)))) { - sender.sendMessage(ChatColor.RED + wrongElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElementOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + ChatColor.RED)); return; } Element e = Element.fromString(args.get(0)); @@ -125,11 +125,11 @@ public class ToggleCommand extends PKCommand { ChatColor color = e != null ? e.getColor() : null; if (bPlayer.isElementToggled(e)) { - sender.sendMessage(color + this.toggledOffOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); - target.sendMessage(color + this.toggledOffOtherElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")).replace("{sender}", ChatColor.DARK_AQUA + sender.getName())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + this.toggledOffOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + this.toggledOffOtherElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")).replace("{sender}", ChatColor.DARK_AQUA + sender.getName())); } else { - sender.sendMessage(color + this.toggledOnOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); - target.sendMessage(color + this.toggledOnOtherElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")).replace("{sender}", ChatColor.DARK_AQUA + sender.getName())); + sender.sendMessage(ConfigManager.getBrandingPrefix() + color + this.toggledOnOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : ""))); + target.sendMessage(ConfigManager.getBrandingPrefix() + color + this.toggledOnOtherElement.replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")).replace("{sender}", ChatColor.DARK_AQUA + sender.getName())); } bPlayer.toggleElement(e); } else { @@ -139,7 +139,7 @@ public class ToggleCommand extends PKCommand { public boolean hasAdminPermission(CommandSender sender) { if (!sender.hasPermission("bending.admin.toggle")) { - sender.sendMessage(super.noPermissionMessage); + sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage); return false; } return true; diff --git a/src/com/projectkorra/projectkorra/command/WhoCommand.java b/src/com/projectkorra/projectkorra/command/WhoCommand.java index 52178159..db10bcfe 100644 --- a/src/com/projectkorra/projectkorra/command/WhoCommand.java +++ b/src/com/projectkorra/projectkorra/command/WhoCommand.java @@ -121,7 +121,7 @@ public class WhoCommand extends PKCommand { players.add(result); } if (players.isEmpty()) { - sender.sendMessage(ChatColor.RED + noPlayersOnline); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + noPlayersOnline); } else { for (String s : getPage(players, ChatColor.GOLD + "Players:", page, true)) { sender.sendMessage(s); @@ -141,11 +141,11 @@ public class WhoCommand extends PKCommand { @SuppressWarnings("deprecation") final OfflinePlayer player = Bukkit.getOfflinePlayer(playerName); if (player == null || !player.hasPlayedBefore() && !player.isOnline()) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + "Player not found!"); return; } if (!player.isOnline() && !BendingPlayer.getPlayers().containsKey(player.getUniqueId())) { - sender.sendMessage(ChatColor.GRAY + playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY).replace("{target}", ChatColor.WHITE + player.getName() + ChatColor.GRAY)); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GRAY + playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY).replace("{target}", ChatColor.WHITE + player.getName() + ChatColor.GRAY)); } Player player_ = (Player) (player.isOnline() ? player : null); @@ -160,7 +160,7 @@ public class WhoCommand extends PKCommand { final long delay = 200L; while (!BendingPlayer.getPlayers().containsKey(player.getUniqueId())) { if (count > 5 * (1000 / delay)) { //After 5 seconds of waiting, tell the user the database is busy and to try again in a few seconds. - sender.sendMessage(ChatColor.DARK_RED + databaseOverload); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.DARK_RED + databaseOverload); break; } count++; @@ -169,7 +169,7 @@ public class WhoCommand extends PKCommand { } catch (InterruptedException e) { e.printStackTrace(); - sender.sendMessage(ChatColor.DARK_RED + databaseOverload); + sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.DARK_RED + databaseOverload); break; } } diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 3edad32a..555624a9 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -1,12 +1,17 @@ package com.projectkorra.projectkorra.configuration; +import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import java.io.File; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; public class ConfigManager { + public static final Map BRANDING_OPTIONS = new HashMap<>(); + public static Config presetConfig; public static Config defaultConfig; public static Config languageConfig; @@ -18,6 +23,14 @@ public class ConfigManager { configCheck(ConfigType.DEFAULT); configCheck(ConfigType.LANGUAGE); configCheck(ConfigType.PRESETS); + + BRANDING_OPTIONS.put("GOLD", ChatColor.GOLD); + BRANDING_OPTIONS.put("AQUA", ChatColor.AQUA); + BRANDING_OPTIONS.put("YELLOW", ChatColor.YELLOW); + BRANDING_OPTIONS.put("RED", ChatColor.RED); + BRANDING_OPTIONS.put("GREEN", ChatColor.GREEN); + BRANDING_OPTIONS.put("PINK", ChatColor.LIGHT_PURPLE); + BRANDING_OPTIONS.put("PURPLE", ChatColor.DARK_PURPLE); } public static void configCheck(ConfigType type) { @@ -59,6 +72,14 @@ public class ConfigManager { config.addDefault("Chat.Colors.Fire", "RED"); config.addDefault("Chat.Colors.FireSub", "DARK_RED"); config.addDefault("Chat.Colors.Chi", "GOLD"); + config.addDefault("Chat.Branding.JoinMessage.Enabled", true); + config.addDefault("Chat.Branding.AutoAnnouncer.Enabled", true); + config.addDefault("Chat.Branding.AutoAnnouncer.Interval", 30); + config.addDefault("Chat.Branding.Color", "GOLD"); + config.addDefault("Chat.Branding.Borders.TopBorder", ""); + config.addDefault("Chat.Branding.Borders.BottomBorder", ""); + config.addDefault("Chat.Branding.ChatPrefix.Prefix", ""); + config.addDefault("Chat.Branding.ChatPrefix.Suffix", " "); config.addDefault("Chat.Prefixes.Air", "[Air]"); config.addDefault("Chat.Prefixes.Earth", "[Earth]"); @@ -1291,4 +1312,10 @@ public class ConfigManager { public static FileConfiguration getConfig() { return ConfigManager.defaultConfig.get(); } + + public static String getBrandingPrefix() { + ChatColor color = BRANDING_OPTIONS.get(languageConfig.get().getString("Chat.Branding.Color").toUpperCase()); + color = color == null ? ChatColor.GOLD : color; + return ChatColor.translateAlternateColorCodes('&', languageConfig.get().getString("Chat.Branding.ChatPrefix.Prefix")) + color + "ProjectKorra" + ChatColor.translateAlternateColorCodes('&', languageConfig.get().getString("Chat.Branding.ChatPrefix.Suffix")); + } }