diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java index 138f3c16b..536ad0813 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java @@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.mcMMO; import com.google.common.collect.ImmutableList; - import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 68026f00c..d659cb07a 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -19,6 +19,7 @@ import org.bukkit.entity.Player; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Set; public abstract class SkillCommand implements TabExecutor { @@ -131,7 +132,7 @@ public abstract class SkillCommand implements TabExecutor { } } - player.sendMessage(pluginRef.getLocaleManager().getString("Guides.Available", skillName, skillName.toLowerCase())); + player.sendMessage(pluginRef.getLocaleManager().getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH))); } private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/config/SkillConfigFactory.java b/mcmmo-core/src/main/java/com/gmail/nossr50/config/SkillConfigFactory.java index 50eed1303..7f9f07ff0 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/config/SkillConfigFactory.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/config/SkillConfigFactory.java @@ -4,11 +4,13 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.StringUtils; +import java.util.Locale; + public class SkillConfigFactory { protected static SerializedConfigLoader initSkillConfig(mcMMO pluginRef, PrimarySkillType primarySkillType, Class clazz) { return new SerializedConfigLoader(pluginRef, clazz, - primarySkillType.toString().toLowerCase() + ".conf", + primarySkillType.toString().toLowerCase(Locale.ENGLISH) + ".conf", StringUtils.getCapitalized(primarySkillType.toString()), null); } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index 56900e84b..3d4053580 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -144,7 +144,7 @@ public enum SubSkillType { */ public String getPermissionNodeAddress(mcMMO pluginRef) { //TODO: This could be optimized - return "mcmmo.ability." + getParentSkill(pluginRef).toString().toLowerCase() + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH); + return "mcmmo.ability." + getParentSkill(pluginRef).toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH); } /** diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/dumpster/PotionGenerator.java b/mcmmo-core/src/main/java/com/gmail/nossr50/dumpster/PotionGenerator.java index e7107a645..b2540508b 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/dumpster/PotionGenerator.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/dumpster/PotionGenerator.java @@ -253,7 +253,7 @@ // if (target.equals("II")) { // hacks // return target; // } -// return target.substring(0, 1).toUpperCase() + target.substring(1).toLowerCase(); +// return target.substring(0, 1).toUpperCase() + target.substring(1).toLowerCase(Locale.ENGLISH); // } // // private static String getName(PotionEffectType type) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 3923a460b..05bfd3333 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -59,16 +59,9 @@ public class EntityListener implements Listener { } //Prevent entities from giving XP if they target endermite -<<<<<<< HEAD:mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java if (event.getTarget() instanceof Endermite) { - if (event.getEntity().hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) + if (!event.getEntity().hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) event.getEntity().setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue); -======= - if(event.getTarget() instanceof Endermite) - { - if(!event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) - event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); ->>>>>>> 550a3df6169b457fdea552b58861bb42c53420c2:src/main/java/com/gmail/nossr50/listeners/EntityListener.java } } @@ -801,29 +794,6 @@ public class EntityListener implements Listener { } /** -<<<<<<< HEAD:mcmmo-core/src/main/java/com/gmail/nossr50/listeners/EntityListener.java - * Handle EntityExplode events that involve modifying the event. - * - * @param event The event to modify - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onEntityExplodeMonitor(EntityExplodeEvent event) { - /* WORLD BLACKLIST CHECK */ - if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getEntity().getWorld().getName())) - return; - - Entity entity = event.getEntity(); - - if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(MetadataConstants.SAFE_TNT_METAKEY)) { - return; - } - - event.blockList().clear(); - } - - /** -======= ->>>>>>> 550a3df6169b457fdea552b58861bb42c53420c2:src/main/java/com/gmail/nossr50/listeners/EntityListener.java * Handle FoodLevelChange events that involve modifying the event. * * @param event The event to modify diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java b/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java index 75ad07e5d..5a78ebbd3 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java @@ -65,6 +65,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class mcMMO extends JavaPlugin { /* Managers */ @@ -378,9 +379,9 @@ public class mcMMO extends JavaPlugin { * @return the ServerSoftwareType which likely matches the server */ private ServerSoftwareType getServerSoftware() { - if (Bukkit.getVersion().toLowerCase().contains("paper")) + if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("paper")) return ServerSoftwareType.PAPER; - else if (Bukkit.getVersion().toLowerCase().contains("spigot")) + else if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("spigot")) return ServerSoftwareType.SPIGOT; else return ServerSoftwareType.CRAFTBUKKIT; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java index 3577163b7..b156a5972 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java @@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.core.MetadataConstants; import com.gmail.nossr50.mcMMO; - import org.bukkit.entity.LivingEntity; import org.bukkit.scheduler.BukkitRunnable; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/PermissionTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/PermissionTools.java index e7fb54db5..784291b93 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/PermissionTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/PermissionTools.java @@ -18,6 +18,8 @@ import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.SimplePluginManager; +import java.util.Locale; + public final class PermissionTools { private final mcMMO pluginRef; @@ -175,7 +177,7 @@ public final class PermissionTools { } public boolean mctop(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.commands.mctop." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.commands.mctop." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean mmoedit(Permissible permissible) { @@ -195,7 +197,7 @@ public final class PermissionTools { } public boolean skillreset(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean skillresetOthers(Permissible permissible) { @@ -203,11 +205,11 @@ public final class PermissionTools { } public boolean skillresetOthers(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean xplock(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.commands.xplock." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.commands.xplock." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean xprateSet(Permissible permissible) { @@ -257,32 +259,32 @@ public final class PermissionTools { } public boolean lucky(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase(Locale.ENGLISH)); } /* XP PERKS */ public boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean tripleXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean doubleXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean hasCustomXPPerk(Permissible permissible, CustomXPPerk customXPPerk) { @@ -320,11 +322,11 @@ public final class PermissionTools { */ public boolean skillEnabled(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase(Locale.ENGLISH)); } public boolean vanillaXpBoost(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".vanillaxpboost"); + return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".vanillaxpboost"); } public boolean isSubSkillEnabled(Permissible permissible, SubSkillType subSkillType) { @@ -336,7 +338,7 @@ public final class PermissionTools { } public boolean bonusDamage(Permissible permissible, PrimarySkillType skill) { - return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".bonusdamage"); + return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".bonusdamage"); } /* ACROBATICS */ @@ -386,11 +388,11 @@ public final class PermissionTools { } public boolean greenThumbBlock(Permissible permissible, Material material) { - return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.blocks." + material.toString().replace("_", "").toLowerCase()); + return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.blocks." + material.toString().replace("_", "").toLowerCase(Locale.ENGLISH)); } public boolean greenThumbPlant(Permissible permissible, Material material) { - return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.plants." + material.toString().replace("_", "").toLowerCase()); + return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.plants." + material.toString().replace("_", "").toLowerCase(Locale.ENGLISH)); } /* MINING */ @@ -412,11 +414,11 @@ public final class PermissionTools { /* REPAIR */ public boolean repairItemType(Permissible permissible, ItemType repairItemType) { - return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase() + "repair"); + return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase(Locale.ENGLISH) + "repair"); } public boolean repairMaterialType(Permissible permissible, ItemMaterialCategory repairItemMaterialCategory) { - return permissible.hasPermission("mcmmo.ability.repair." + repairItemMaterialCategory.toString().toLowerCase() + "repair"); + return permissible.hasPermission("mcmmo.ability.repair." + repairItemMaterialCategory.toString().toLowerCase(Locale.ENGLISH) + "repair"); } /* SALVAGE */ @@ -429,11 +431,11 @@ public final class PermissionTools { } public boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { - return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase() + "salvage"); + return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase(Locale.ENGLISH) + "salvage"); } public boolean salvageMaterialType(Permissible permissible, ItemMaterialCategory salvageItemMaterialCategory) { - return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemMaterialCategory.toString().toLowerCase() + "salvage"); + return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemMaterialCategory.toString().toLowerCase(Locale.ENGLISH) + "salvage"); } /* SMELTING */ @@ -452,7 +454,7 @@ public final class PermissionTools { /* TAMING */ public boolean callOfTheWild(Permissible permissible, EntityType type) { - return permissible.hasPermission("mcmmo.ability.taming.callofthewild." + type.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.ability.taming.callofthewild." + type.toString().toLowerCase(Locale.ENGLISH)); } /* UNARMED */ @@ -477,7 +479,7 @@ public final class PermissionTools { } public boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { - return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase()); + return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase(Locale.ENGLISH)); } public boolean friendlyFire(Permissible permissible) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index 07259f7a8..00cd70ef1 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -14,6 +14,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; +import java.util.Locale; /** * This class handles many of the JSON components that mcMMO makes and uses @@ -537,7 +538,7 @@ public class TextComponentFactory { TextComponent unlockMessage = new TextComponent(""); unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(pluginRef), pluginRef.getRankTools().getRank(player, subSkillType))); unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType))); - unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType).toString().toLowerCase())); + unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType).toString().toLowerCase(Locale.ENGLISH))); return unlockMessage; } } \ No newline at end of file diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java index e60e09f27..8fc2f31a7 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java @@ -25,6 +25,7 @@ import org.bukkit.command.PluginCommand; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public final class CommandRegistrationManager { private final mcMMO pluginRef; @@ -37,8 +38,8 @@ public final class CommandRegistrationManager { private void registerSkillCommands() { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { - String commandName = primarySkillType.toString().toLowerCase(); - String localizedName = pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType).toLowerCase(); + String commandName = primarySkillType.toString().toLowerCase(Locale.ENGLISH); + String localizedName = pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType).toLowerCase(Locale.ENGLISH); PluginCommand command; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java index 56a27f7ab..1ff315af4 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public final class CommandTools { private final mcMMO pluginRef; @@ -288,7 +289,7 @@ public final class CommandTools { break; } - if (playerName.toLowerCase().contains(partialName.toLowerCase())) { + if (playerName.toLowerCase(Locale.ENGLISH).contains(partialName.toLowerCase(Locale.ENGLISH))) { // Partial match matchedPlayers.add(playerName); }