mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Changes to branding (#721)
* Changes to branding * Fixed java 8 crap * whoops missed some cause im an idiot
This commit is contained in:
parent
697db0236d
commit
e8df4895b9
19 changed files with 197 additions and 139 deletions
|
@ -1,5 +1,13 @@
|
||||||
package com.projectkorra.projectkorra;
|
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.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.chiblocking.combo.ChiCombo;
|
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.projectkorra.util.TempPotionEffect;
|
||||||
import com.projectkorra.rpg.RPGMethods;
|
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 {
|
public class BendingManager implements Runnable {
|
||||||
|
|
||||||
private static BendingManager instance;
|
private static BendingManager instance;
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class GeneralMethods {
|
||||||
*/
|
*/
|
||||||
public static void bindAbility(Player player, String ability, int slot) {
|
public static void bindAbility(Player player, String ability, int slot) {
|
||||||
if (MultiAbilityManager.playerAbilities.containsKey(player)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ public class GeneralMethods {
|
||||||
bPlayer.getAbilities().put(slot, ability);
|
bPlayer.getAbilities().put(slot, ability);
|
||||||
|
|
||||||
if (coreAbil != null) {
|
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);
|
saveAbility(bPlayer, slot, ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1033,11 +1033,23 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}, 5);
|
}, 5);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
|
if (ConfigManager.languageConfig.get().getBoolean("Chat.Branding.JoinMessage.Enabled")) {
|
||||||
public void run() {
|
Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
|
||||||
player.sendMessage(ChatColor.GOLD + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!");
|
public void run() {
|
||||||
}
|
ChatColor color = ConfigManager.BRANDING_OPTIONS.get(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase());
|
||||||
}, 20 * 5);
|
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
|
@EventHandler
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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 ChiblockingManager(this), 0, 1);
|
||||||
//getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1);
|
//getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1);
|
||||||
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
|
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();
|
TempBlock.startReversion();
|
||||||
|
|
||||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class AddCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getPlayer(args.get(1));
|
Player player = Bukkit.getPlayer(args.get(1));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
sender.sendMessage(ChatColor.RED + playerNotFound);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
add(sender, player, args.get(0).toLowerCase());
|
add(sender, player, args.get(0).toLowerCase());
|
||||||
|
@ -90,15 +90,15 @@ public class AddCommand extends PKCommand {
|
||||||
bPlayer = BendingPlayer.getBendingPlayer(target);
|
bPlayer = BendingPlayer.getBendingPlayer(target);
|
||||||
}
|
}
|
||||||
if (bPlayer.isPermaRemoved()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (Arrays.asList(Element.getAllElements()).contains(e)) {
|
if (Arrays.asList(Element.getAllElements()).contains(e)) {
|
||||||
if (bPlayer.hasElement(e)) {
|
if (bPlayer.hasElement(e)) {
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + alreadyHasElement);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasElement);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -114,17 +114,17 @@ public class AddCommand extends PKCommand {
|
||||||
|
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
if (e != Element.AIR && e != Element.EARTH) {
|
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()));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + 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()));
|
target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedCFW.replace("{element}", e.getName() + e.getType().getBender()));
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).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(color + addedAE.replace("{element}", e.getName() + e.getType().getBender()));
|
target.sendMessage(ConfigManager.getBrandingPrefix() + color + addedAE.replace("{element}", e.getName() + e.getType().getBender()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e != Element.AIR && e != Element.EARTH)
|
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
|
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);
|
GeneralMethods.saveElements(bPlayer);
|
||||||
|
@ -135,9 +135,9 @@ public class AddCommand extends PKCommand {
|
||||||
SubElement sub = (SubElement) e;
|
SubElement sub = (SubElement) e;
|
||||||
if (bPlayer.hasSubElement(sub)) {
|
if (bPlayer.hasSubElement(sub)) {
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + alreadyHasSubElement);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + alreadyHasSubElement);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -146,15 +146,15 @@ public class AddCommand extends PKCommand {
|
||||||
|
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
if (e != Element.AIR && e != Element.EARTH)
|
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
|
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 {
|
} else {
|
||||||
if (e != Element.AIR && e != Element.EARTH)
|
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
|
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);
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.ADD));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.ADD));
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class BindCommand extends PKCommand {
|
||||||
|
|
||||||
CoreAbility coreAbil = CoreAbility.getAbility(args.get(0));
|
CoreAbility coreAbil = CoreAbility.getAbility(args.get(0));
|
||||||
if (coreAbil == null || coreAbil.isHiddenAbility() || !coreAbil.isEnabled()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class BindCommand extends PKCommand {
|
||||||
bind(sender, args.get(0), Integer.parseInt(args.get(1)));
|
bind(sender, args.get(0), Integer.parseInt(args.get(1)));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex) {
|
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)) {
|
if (!(sender instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
} else if (slot < 1 || slot > 9) {
|
} else if (slot < 1 || slot > 9) {
|
||||||
sender.sendMessage(ChatColor.RED + wrongNumber);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer((Player) sender);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer((Player) sender);
|
||||||
CoreAbility coreAbil = CoreAbility.getAbility(ability);
|
CoreAbility coreAbil = CoreAbility.getAbility(ability);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
sender.sendMessage(ChatColor.RED + loadingInfo);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + loadingInfo);
|
||||||
return;
|
return;
|
||||||
} else if (coreAbil == null || !bPlayer.canBind(coreAbil)) {
|
} else if (coreAbil == null || !bPlayer.canBind(coreAbil)) {
|
||||||
if (coreAbil != null && coreAbil.getElement() != Element.AVATAR && !bPlayer.hasElement(coreAbil.getElement())) {
|
if (coreAbil != null && coreAbil.getElement() != Element.AVATAR && !bPlayer.hasElement(coreAbil.getElement())) {
|
||||||
if (coreAbil.getElement() instanceof SubElement) {
|
if (coreAbil.getElement() instanceof SubElement) {
|
||||||
SubElement sub = (SubElement) coreAbil.getElement();
|
SubElement sub = (SubElement) coreAbil.getElement();
|
||||||
if (!bPlayer.hasElement(sub.getParentElement())) {
|
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 {
|
} 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 {
|
} 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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + super.noPermissionMessage);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (!bPlayer.isElementToggled(coreAbil.getElement())) {
|
} 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;
|
String name = coreAbil != null ? coreAbil.getName() : null;
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class ChooseCommand extends PKCommand {
|
||||||
bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
||||||
}
|
}
|
||||||
if (bPlayer.isPermaRemoved()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bPlayer.getElements().isEmpty() && !sender.hasPermission("bending.command.rechoose")) {
|
if (!bPlayer.getElements().isEmpty() && !sender.hasPermission("bending.command.rechoose")) {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String element = args.get(0).toLowerCase();
|
String element = args.get(0).toLowerCase();
|
||||||
|
@ -84,17 +84,17 @@ public class ChooseCommand extends PKCommand {
|
||||||
add(sender, (Player) sender, targetElement);
|
add(sender, (Player) sender, targetElement);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + invalidElement);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + invalidElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (args.size() == 2) {
|
} else if (args.size() == 2) {
|
||||||
if (!sender.hasPermission("bending.admin.choose")) {
|
if (!sender.hasPermission("bending.admin.choose")) {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1));
|
Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1));
|
||||||
if (target == null || !target.isOnline()) {
|
if (target == null || !target.isOnline()) {
|
||||||
sender.sendMessage(ChatColor.RED + playerNotFound);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String element = args.get(0).toLowerCase();
|
String element = args.get(0).toLowerCase();
|
||||||
|
@ -113,7 +113,7 @@ public class ChooseCommand extends PKCommand {
|
||||||
add(sender, target, targetElement);
|
add(sender, target, targetElement);
|
||||||
return;
|
return;
|
||||||
} else {
|
} 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);
|
bPlayer.addSubElement(sub);
|
||||||
ChatColor color = sub != null ? sub.getColor() : ChatColor.WHITE;
|
ChatColor color = sub != null ? sub.getColor() : ChatColor.WHITE;
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
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 {
|
} 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);
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
|
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;
|
ChatColor color = element != null ? element.getColor() : ChatColor.WHITE;
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
if (element != Element.AIR && element != Element.EARTH)
|
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
|
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 {
|
} else {
|
||||||
if (element != Element.AIR && element != Element.EARTH)
|
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
|
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.saveElements(bPlayer);
|
||||||
GeneralMethods.saveSubElements(bPlayer);
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ClearCommand extends PKCommand {
|
||||||
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 1) || !isPlayer(sender)) {
|
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 1) || !isPlayer(sender)) {
|
||||||
return;
|
return;
|
||||||
} else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) {
|
} else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) {
|
||||||
sender.sendMessage(ChatColor.RED + cantEditBinds);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + cantEditBinds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,23 +53,23 @@ public class ClearCommand extends PKCommand {
|
||||||
for (int i = 1; i <= 9; i++) {
|
for (int i = 1; i <= 9; i++) {
|
||||||
GeneralMethods.saveAbility(bPlayer, i, null);
|
GeneralMethods.saveAbility(bPlayer, i, null);
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.YELLOW + cleared);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + cleared);
|
||||||
} else if (args.size() == 1) {
|
} else if (args.size() == 1) {
|
||||||
try {
|
try {
|
||||||
int slot = Integer.parseInt(args.get(0));
|
int slot = Integer.parseInt(args.get(0));
|
||||||
if (slot < 1 || slot > 9) {
|
if (slot < 1 || slot > 9) {
|
||||||
sender.sendMessage(ChatColor.RED + wrongNumber);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber);
|
||||||
}
|
}
|
||||||
if (bPlayer.getAbilities().get(slot) != null) {
|
if (bPlayer.getAbilities().get(slot) != null) {
|
||||||
bPlayer.getAbilities().remove(slot);
|
bPlayer.getAbilities().remove(slot);
|
||||||
GeneralMethods.saveAbility(bPlayer, slot, null);
|
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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.YELLOW + alreadyEmpty);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.YELLOW + alreadyEmpty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e) {
|
catch (NumberFormatException e) {
|
||||||
sender.sendMessage(ChatColor.RED + wrongNumber);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,18 +43,18 @@ public class CopyCommand extends PKCommand {
|
||||||
Player orig = Bukkit.getPlayer(args.get(0));
|
Player orig = Bukkit.getPlayer(args.get(0));
|
||||||
|
|
||||||
if (orig == null || !orig.isOnline()) {
|
if (orig == null || !orig.isOnline()) {
|
||||||
sender.sendMessage(ChatColor.RED + playerNotFound);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean boundAll = assignAbilities(sender, orig, (Player) sender, true);
|
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) {
|
if (!boundAll) {
|
||||||
sender.sendMessage(ChatColor.RED + failedToBindAll);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + failedToBindAll);
|
||||||
}
|
}
|
||||||
} else if (args.size() == 2) {
|
} else if (args.size() == 2) {
|
||||||
if (!hasPermission(sender, "assign")) {
|
if (!hasPermission(sender, "assign")) {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,15 +62,15 @@ public class CopyCommand extends PKCommand {
|
||||||
Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1));
|
Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1));
|
||||||
|
|
||||||
if ((orig == null || !orig.isOnline()) || (target == null || !target.isOnline())) {
|
if ((orig == null || !orig.isOnline()) || (target == null || !target.isOnline())) {
|
||||||
sender.sendMessage(ChatColor.RED + playerNotFound);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerNotFound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean boundAll = assignAbilities(sender, orig, target, false);
|
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));
|
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(ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN));
|
target.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + copied.replace("{target}", ChatColor.YELLOW + orig.getName() + ChatColor.GREEN));
|
||||||
if (!boundAll) {
|
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 (orig.isPermaRemoved()) {
|
||||||
if (self) {
|
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 {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
ArrayList<String> combos = ComboManager.getCombosForElement(element);
|
ArrayList<String> combos = ComboManager.getCombosForElement(element);
|
||||||
|
|
||||||
if (combos.isEmpty()) {
|
if (combos.isEmpty()) {
|
||||||
sender.sendMessage(color + noCombosAvailable.replace("{element}", element.getName()));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + color + noCombosAvailable.replace("{element}", element.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String comboMove : combos) {
|
for (String comboMove : combos) {
|
||||||
|
@ -105,7 +105,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
Set<String> passives = PassiveManager.getPassivesForElement(element);
|
Set<String> passives = PassiveManager.getPassivesForElement(element);
|
||||||
|
|
||||||
if (passives.isEmpty()) {
|
if (passives.isEmpty()) {
|
||||||
sender.sendMessage(color + noPassivesAvailable.replace("{element}", element.getName()));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + color + noPassivesAvailable.replace("{element}", element.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String passiveAbil : passives) {
|
for (String passiveAbil : passives) {
|
||||||
|
@ -152,7 +152,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
if (args.size() == 0) {
|
if (args.size() == 0) {
|
||||||
//bending display
|
//bending display
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + playersOnly);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playersOnly);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
displayBinds(sender);
|
displayBinds(sender);
|
||||||
|
|
|
@ -53,11 +53,11 @@ public class ImportCommand extends PKCommand {
|
||||||
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 0)) {
|
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 0)) {
|
||||||
return;
|
return;
|
||||||
} else if (!GeneralMethods.isImportEnabled()) {
|
} else if (!GeneralMethods.isImportEnabled()) {
|
||||||
sender.sendMessage(ChatColor.RED + this.disabled);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.disabled);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + this.preparingData);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.preparingData);
|
||||||
File bendingPlayersFile = new File(".", "converted.yml");
|
File bendingPlayersFile = new File(".", "converted.yml");
|
||||||
FileConfiguration bendingPlayers = YamlConfiguration.loadConfiguration(bendingPlayersFile);
|
FileConfiguration bendingPlayers = YamlConfiguration.loadConfiguration(bendingPlayersFile);
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ public class InvincibleCommand extends PKCommand {
|
||||||
|
|
||||||
if (!Commands.invincible.contains(sender.getName())) {
|
if (!Commands.invincible.contains(sender.getName())) {
|
||||||
Commands.invincible.add(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 {
|
} else {
|
||||||
Commands.invincible.remove(sender.getName());
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public abstract class PKCommand implements SubCommand {
|
||||||
if (sender.hasPermission("bending.command." + name + "." + extra)) {
|
if (sender.hasPermission("bending.command." + name + "." + extra)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(this.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + this.noPermissionMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public abstract class PKCommand implements SubCommand {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(this.mustBePlayerMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + this.mustBePlayerMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class PermaremoveCommand extends PKCommand {
|
||||||
private void permaremove(CommandSender sender, String target) {
|
private void permaremove(CommandSender sender, String target) {
|
||||||
Player player = Bukkit.getPlayer(target);
|
Player player = Bukkit.getPlayer(target);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
sender.sendMessage(ChatColor.RED + this.playerIsOffline);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.playerIsOffline);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,18 +69,18 @@ public class PermaremoveCommand extends PKCommand {
|
||||||
if (bPlayer.isPermaRemoved()) {
|
if (bPlayer.isPermaRemoved()) {
|
||||||
bPlayer.setPermaRemoved(false);
|
bPlayer.setPermaRemoved(false);
|
||||||
GeneralMethods.savePermaRemoved(bPlayer);
|
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))
|
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 {
|
} else {
|
||||||
bPlayer.getElements().clear();
|
bPlayer.getElements().clear();
|
||||||
GeneralMethods.saveElements(bPlayer);
|
GeneralMethods.saveElements(bPlayer);
|
||||||
bPlayer.setPermaRemoved(true);
|
bPlayer.setPermaRemoved(true);
|
||||||
GeneralMethods.savePermaRemoved(bPlayer);
|
GeneralMethods.savePermaRemoved(bPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
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))
|
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));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.PERMAREMOVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class PermaremoveCommand extends PKCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(CommandSender sender) {
|
public boolean hasPermission(CommandSender sender) {
|
||||||
if (!sender.hasPermission("bending.admin.permaremove")) {
|
if (!sender.hasPermission("bending.admin.permaremove")) {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class PresetCommand extends PKCommand {
|
||||||
if (!isPlayer(sender) || !correctLength(sender, args.size(), 1, 3)) {
|
if (!isPlayer(sender) || !correctLength(sender, args.size(), 1, 3)) {
|
||||||
return;
|
return;
|
||||||
} else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) {
|
} else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) {
|
||||||
sender.sendMessage(this.cantEditBinds);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + this.cantEditBinds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class PresetCommand extends PKCommand {
|
||||||
List<String> presetNames = new ArrayList<String>();
|
List<String> presetNames = new ArrayList<String>();
|
||||||
|
|
||||||
if (presets == null || presets.isEmpty()) {
|
if (presets == null || presets.isEmpty()) {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresets);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresets);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class PresetCommand extends PKCommand {
|
||||||
String name = args.get(1);
|
String name = args.get(1);
|
||||||
if (Arrays.asList(deletealiases).contains(args.get(0)) && hasPermission(sender, "delete")) { //bending preset delete name
|
if (Arrays.asList(deletealiases).contains(args.get(0)) && hasPermission(sender, "delete")) { //bending preset delete name
|
||||||
if (!Preset.presetExists(player, name)) {
|
if (!Preset.presetExists(player, name)) {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresetName);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,23 +121,23 @@ public class PresetCommand extends PKCommand {
|
||||||
} else if (Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) {
|
} else if (Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) {
|
||||||
boundAll = Preset.bindExternalPreset(player, name);
|
boundAll = Preset.bindExternalPreset(player, name);
|
||||||
} else if (!Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) {
|
} else if (!Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresetNameExternal);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetNameExternal);
|
||||||
return;
|
return;
|
||||||
} else if (bPlayer.isPermaRemoved()) {
|
} else if (bPlayer.isPermaRemoved()) {
|
||||||
player.sendMessage(ChatColor.RED + this.bendingRemoved);
|
player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemoved);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresetName);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN));
|
sender.sendMessage(ChatColor.GREEN + bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN));
|
||||||
if (!boundAll) {
|
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)) {
|
} else if (hasPermission(sender, "bind.external.assign") && Preset.externalPresetExists(name)) {
|
||||||
if (!Preset.externalPresetExists(name)) {
|
if (!Preset.externalPresetExists(name)) {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresetNameExternal);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetNameExternal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,23 +150,23 @@ public class PresetCommand extends PKCommand {
|
||||||
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
|
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
|
||||||
}
|
}
|
||||||
if (bPlayer2.isPermaRemoved()) {
|
if (bPlayer2.isPermaRemoved()) {
|
||||||
player.sendMessage(ChatColor.RED + this.bendingRemovedOther);
|
player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemovedOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean boundAll = Preset.bindExternalPreset(player2, name);
|
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));
|
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(ChatColor.GREEN + this.bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN));
|
player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.bound.replace("{name}", ChatColor.YELLOW + name + ChatColor.GREEN));
|
||||||
if (!boundAll) {
|
if (!boundAll) {
|
||||||
player2.sendMessage(ChatColor.RED + this.failedToBindAll);
|
player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.failedToBindAll);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} 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)) {
|
} else if (hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) {
|
||||||
if (!Preset.presetExists(player, name)) {
|
if (!Preset.presetExists(player, name)) {
|
||||||
sender.sendMessage(ChatColor.RED + this.noPresetName);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.noPresetName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,30 +179,30 @@ public class PresetCommand extends PKCommand {
|
||||||
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
|
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
|
||||||
}
|
}
|
||||||
if (bPlayer2.isPermaRemoved()) {
|
if (bPlayer2.isPermaRemoved()) {
|
||||||
player.sendMessage(ChatColor.RED + this.bendingRemovedOther);
|
player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.bendingRemovedOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Preset preset = Preset.getPreset(player, name);
|
Preset preset = Preset.getPreset(player, name);
|
||||||
boolean boundAll = Preset.bindPreset(player2, preset);
|
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));
|
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(ChatColor.GREEN + this.succesfullyCopied.replace("{target}", ChatColor.YELLOW + player.getName() + ChatColor.GREEN));
|
player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + this.succesfullyCopied.replace("{target}", ChatColor.YELLOW + player.getName() + ChatColor.GREEN));
|
||||||
if (!boundAll) {
|
if (!boundAll) {
|
||||||
player2.sendMessage(ChatColor.RED + this.failedToBindAll);
|
player2.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.failedToBindAll);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} 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
|
} else if (Arrays.asList(createaliases).contains(args.get(0)) && hasPermission(sender, "create")) { //bending preset create name
|
||||||
int limit = GeneralMethods.getMaxPresets(player);
|
int limit = GeneralMethods.getMaxPresets(player);
|
||||||
|
|
||||||
if (Preset.presets.get(player) != null && Preset.presets.get(player).size() >= limit) {
|
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;
|
return;
|
||||||
} else if (Preset.presetExists(player, name)) {
|
} else if (Preset.presetExists(player, name)) {
|
||||||
sender.sendMessage(ChatColor.RED + this.alreadyExists);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + this.alreadyExists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ public class PresetCommand extends PKCommand {
|
||||||
|
|
||||||
Preset preset = new Preset(player.getUniqueId(), name, abilities);
|
Preset preset = new Preset(player.getUniqueId(), name, abilities);
|
||||||
preset.save(player);
|
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 {
|
} else {
|
||||||
help(sender, false);
|
help(sender, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ public class RemoveCommand extends PKCommand {
|
||||||
senderBPlayer.getSubElements().remove(e);
|
senderBPlayer.getSubElements().remove(e);
|
||||||
GeneralMethods.saveSubElements(senderBPlayer);
|
GeneralMethods.saveSubElements(senderBPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
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));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE));
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + wrongElementSelf);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElementSelf);
|
||||||
return;
|
return;
|
||||||
} else if (e instanceof Element) {
|
} else if (e instanceof Element) {
|
||||||
if (senderBPlayer.hasElement(e)) {
|
if (senderBPlayer.hasElement(e)) {
|
||||||
|
@ -75,22 +75,22 @@ public class RemoveCommand extends PKCommand {
|
||||||
GeneralMethods.saveElements(senderBPlayer);
|
GeneralMethods.saveElements(senderBPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
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));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + wrongElementSelf);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElementSelf);
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(ChatColor.RED + invalidElement);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + invalidElement);
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.RED + playerOffline);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + playerOffline);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
help(sender, false);
|
help(sender, false);
|
||||||
|
@ -107,7 +107,7 @@ public class RemoveCommand extends PKCommand {
|
||||||
Element e = Element.fromString(args.get(1));
|
Element e = Element.fromString(args.get(1));
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
if (!bPlayer.hasElement(e)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (e instanceof SubElement) {
|
if (e instanceof SubElement) {
|
||||||
|
@ -119,8 +119,8 @@ public class RemoveCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
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()));
|
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(e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending()).replace("{target}", ChatColor.DARK_AQUA + player.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));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,8 @@ public class RemoveCommand extends PKCommand {
|
||||||
if (GeneralMethods.hasRPG())
|
if (GeneralMethods.hasRPG())
|
||||||
RPGMethods.revokeAvatar(bPlayer.getUUID());
|
RPGMethods.revokeAvatar(bPlayer.getUUID());
|
||||||
if (!player.getName().equalsIgnoreCase(sender.getName()))
|
if (!player.getName().equalsIgnoreCase(sender.getName()))
|
||||||
sender.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + 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));
|
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));
|
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())) {
|
if (sender.hasPermission("bending.admin." + getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ToggleCommand extends PKCommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Commands.isToggledForAll) {
|
if (Commands.isToggledForAll) {
|
||||||
sender.sendMessage(ChatColor.RED + toggledOffForAll);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggledOffForAll);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
||||||
|
@ -69,10 +69,10 @@ public class ToggleCommand extends PKCommand {
|
||||||
bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
|
||||||
}
|
}
|
||||||
if (bPlayer.isToggled()) {
|
if (bPlayer.isToggled()) {
|
||||||
sender.sendMessage(ChatColor.RED + toggleOffSelf);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggleOffSelf);
|
||||||
bPlayer.toggleBending();
|
bPlayer.toggleBending();
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.GREEN + toggleOnSelf);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnSelf);
|
||||||
bPlayer.toggleBending();
|
bPlayer.toggleBending();
|
||||||
}
|
}
|
||||||
} else if (args.size() == 1) {
|
} else if (args.size() == 1) {
|
||||||
|
@ -80,21 +80,21 @@ public class ToggleCommand extends PKCommand {
|
||||||
if (Commands.isToggledForAll) { // Bending is toggled off for all players.
|
if (Commands.isToggledForAll) { // Bending is toggled off for all players.
|
||||||
Commands.isToggledForAll = false;
|
Commands.isToggledForAll = false;
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.sendMessage(ChatColor.GREEN + toggleOnAll);
|
player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnAll);
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
sender.sendMessage(ChatColor.GREEN + toggleOnAll);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.GREEN + toggleOnAll);
|
||||||
} else {
|
} else {
|
||||||
Commands.isToggledForAll = true;
|
Commands.isToggledForAll = true;
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.sendMessage(ChatColor.RED + toggleOffAll);
|
player.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + toggleOffAll);
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player))
|
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) {
|
} 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)))) {
|
if (!BendingPlayer.getBendingPlayer(sender.getName()).hasElement(Element.fromString(args.get(0)))) {
|
||||||
sender.sendMessage(ChatColor.RED + wrongElement);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + wrongElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Element e = Element.fromString(args.get(0));
|
Element e = Element.fromString(args.get(0));
|
||||||
|
@ -103,9 +103,9 @@ public class ToggleCommand extends PKCommand {
|
||||||
bPlayer.toggleElement(e);
|
bPlayer.toggleElement(e);
|
||||||
|
|
||||||
if (bPlayer.isElementToggled(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 {
|
} 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) {
|
} 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))
|
if (!hasAdminPermission(sender))
|
||||||
return;
|
return;
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
sender.sendMessage(ChatColor.RED + notFound);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + notFound);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!BendingPlayer.getBendingPlayer(target.getName()).hasElement(Element.fromString(args.get(0)))) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
Element e = Element.fromString(args.get(0));
|
Element e = Element.fromString(args.get(0));
|
||||||
|
@ -125,11 +125,11 @@ public class ToggleCommand extends PKCommand {
|
||||||
ChatColor color = e != null ? e.getColor() : null;
|
ChatColor color = e != null ? e.getColor() : null;
|
||||||
|
|
||||||
if (bPlayer.isElementToggled(e)) {
|
if (bPlayer.isElementToggled(e)) {
|
||||||
sender.sendMessage(color + this.toggledOffOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + 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()));
|
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 {
|
} else {
|
||||||
sender.sendMessage(color + this.toggledOnOtherElementConfirm.replace("{target}", target.getName()).replace("{element}", e.getName() + (e.getType() != null ? e.getType().getBending() : "")));
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + 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()));
|
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);
|
bPlayer.toggleElement(e);
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,7 +139,7 @@ public class ToggleCommand extends PKCommand {
|
||||||
|
|
||||||
public boolean hasAdminPermission(CommandSender sender) {
|
public boolean hasAdminPermission(CommandSender sender) {
|
||||||
if (!sender.hasPermission("bending.admin.toggle")) {
|
if (!sender.hasPermission("bending.admin.toggle")) {
|
||||||
sender.sendMessage(super.noPermissionMessage);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + super.noPermissionMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class WhoCommand extends PKCommand {
|
||||||
players.add(result);
|
players.add(result);
|
||||||
}
|
}
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
sender.sendMessage(ChatColor.RED + noPlayersOnline);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + noPlayersOnline);
|
||||||
} else {
|
} else {
|
||||||
for (String s : getPage(players, ChatColor.GOLD + "Players:", page, true)) {
|
for (String s : getPage(players, ChatColor.GOLD + "Players:", page, true)) {
|
||||||
sender.sendMessage(s);
|
sender.sendMessage(s);
|
||||||
|
@ -141,11 +141,11 @@ public class WhoCommand extends PKCommand {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
final OfflinePlayer player = Bukkit.getOfflinePlayer(playerName);
|
final OfflinePlayer player = Bukkit.getOfflinePlayer(playerName);
|
||||||
if (player == null || !player.hasPlayedBefore() && !player.isOnline()) {
|
if (player == null || !player.hasPlayedBefore() && !player.isOnline()) {
|
||||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.RED + "Player not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!player.isOnline() && !BendingPlayer.getPlayers().containsKey(player.getUniqueId())) {
|
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);
|
Player player_ = (Player) (player.isOnline() ? player : null);
|
||||||
|
@ -160,7 +160,7 @@ public class WhoCommand extends PKCommand {
|
||||||
final long delay = 200L;
|
final long delay = 200L;
|
||||||
while (!BendingPlayer.getPlayers().containsKey(player.getUniqueId())) {
|
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.
|
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;
|
break;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
@ -169,7 +169,7 @@ public class WhoCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sender.sendMessage(ChatColor.DARK_RED + databaseOverload);
|
sender.sendMessage(ConfigManager.getBrandingPrefix() + ChatColor.DARK_RED + databaseOverload);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
package com.projectkorra.projectkorra.configuration;
|
package com.projectkorra.projectkorra.configuration;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
|
|
||||||
|
public static final Map<String, ChatColor> BRANDING_OPTIONS = new HashMap<>();
|
||||||
|
|
||||||
public static Config presetConfig;
|
public static Config presetConfig;
|
||||||
public static Config defaultConfig;
|
public static Config defaultConfig;
|
||||||
public static Config languageConfig;
|
public static Config languageConfig;
|
||||||
|
@ -18,6 +23,14 @@ public class ConfigManager {
|
||||||
configCheck(ConfigType.DEFAULT);
|
configCheck(ConfigType.DEFAULT);
|
||||||
configCheck(ConfigType.LANGUAGE);
|
configCheck(ConfigType.LANGUAGE);
|
||||||
configCheck(ConfigType.PRESETS);
|
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) {
|
public static void configCheck(ConfigType type) {
|
||||||
|
@ -59,6 +72,14 @@ public class ConfigManager {
|
||||||
config.addDefault("Chat.Colors.Fire", "RED");
|
config.addDefault("Chat.Colors.Fire", "RED");
|
||||||
config.addDefault("Chat.Colors.FireSub", "DARK_RED");
|
config.addDefault("Chat.Colors.FireSub", "DARK_RED");
|
||||||
config.addDefault("Chat.Colors.Chi", "GOLD");
|
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.Air", "[Air]");
|
||||||
config.addDefault("Chat.Prefixes.Earth", "[Earth]");
|
config.addDefault("Chat.Prefixes.Earth", "[Earth]");
|
||||||
|
@ -1291,4 +1312,10 @@ public class ConfigManager {
|
||||||
public static FileConfiguration getConfig() {
|
public static FileConfiguration getConfig() {
|
||||||
return ConfigManager.defaultConfig.get();
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue