mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Further address locale issues (Targets #4083)
This commit is contained in:
parent
33f4ac14b5
commit
0ffcff53b3
@ -1,3 +1,6 @@
|
||||
Version 2.1.114
|
||||
Fix some more locale usages, should aim to further prevent issues with oddball locales
|
||||
|
||||
Version 2.1.113
|
||||
Activating Berserk on a soft block (glass, snow, dirts) will break that material right away instead of only breaking subsequent blocks hit by the player
|
||||
Berserk will now break glass and glass pane blocks
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class McImportCommand implements CommandExecutor {
|
||||
int fileAmount;
|
||||
@ -129,7 +130,7 @@ public class McImportCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
FileWriter out = null;
|
||||
String type = modConfigType.name().toLowerCase();
|
||||
String type = modConfigType.name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
for (String modName : materialNames.keySet()) {
|
||||
File outputFile = new File(outputFilePath, modName + "." + type + ".yml");
|
||||
|
@ -30,6 +30,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 {
|
||||
@ -134,7 +135,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase()));
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
|
||||
|
@ -347,7 +347,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage) {
|
||||
List<PlayerStat> stats = new ArrayList<PlayerStat>();
|
||||
|
||||
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
|
||||
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase(Locale.ENGLISH);
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
@ -391,7 +391,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
try {
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
String skillName = primarySkillType.name().toLowerCase();
|
||||
String skillName = primarySkillType.name().toLowerCase(Locale.ENGLISH);
|
||||
// Get count of all users with higher skill level than player
|
||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
||||
@ -911,7 +911,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
int cap = Config.getInstance().getLevelCap(skill);
|
||||
if (cap != Integer.MAX_VALUE) {
|
||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase() + "` = " + cap + " WHERE `" + skill.name().toLowerCase() + "` > " + cap);
|
||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase(Locale.ENGLISH) + "` = " + cap + " WHERE `" + skill.name().toLowerCase(Locale.ENGLISH) + "` > " + cap);
|
||||
statement.executeUpdate();
|
||||
tryClose(statement);
|
||||
}
|
||||
@ -951,7 +951,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
break;
|
||||
}
|
||||
if (connection == null) {
|
||||
throw new RuntimeException("getConnection() for " + identifier.name().toLowerCase() + " pool timed out. Increase max connections settings.");
|
||||
throw new RuntimeException("getConnection() for " + identifier.name().toLowerCase(Locale.ENGLISH) + " pool timed out. Increase max connections settings.");
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
@ -1262,7 +1262,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
|
||||
|
||||
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
String skill_name = skill.name().toLowerCase();
|
||||
String skill_name = skill.name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
try {
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_" + skill_name + "` (`" + skill_name + "`) USING BTREE");
|
||||
|
@ -3,6 +3,8 @@ package com.gmail.nossr50.datatypes.skills;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum SubSkillType {
|
||||
/* !! Warning -- Do not let subskills share a name with any existing PrimarySkillType as it will clash with the static import !! */
|
||||
|
||||
@ -157,7 +159,7 @@ public enum SubSkillType {
|
||||
public String getPermissionNodeAddress()
|
||||
{
|
||||
//TODO: This could be optimized
|
||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase() + "." + getConfigName(toString()).toLowerCase();
|
||||
return "mcmmo.ability." + getParentSkill().toString().toLowerCase(Locale.ENGLISH) + "." + getConfigName(toString()).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,8 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Roll extends AcrobaticsSubSkill {
|
||||
|
||||
|
||||
@ -100,7 +102,7 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
*/
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return ("mcmmo.ability."+getPrimaryKeyName()+"."+getConfigKeyName()).toLowerCase();
|
||||
return ("mcmmo.ability."+getPrimaryKeyName()+"."+getConfigKeyName()).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.Event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class InteractionManager {
|
||||
private static HashMap<InteractType, ArrayList<Interaction>> interactRegister;
|
||||
@ -47,7 +48,7 @@ public class InteractionManager {
|
||||
//Register skill
|
||||
arrayRef.add(abstractSubSkill);
|
||||
|
||||
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase();
|
||||
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
//Register in name map
|
||||
if(subSkillNameMap.get(lowerCaseName) == null)
|
||||
@ -64,7 +65,7 @@ public class InteractionManager {
|
||||
*/
|
||||
public static AbstractSubSkill getAbstractByName(String name)
|
||||
{
|
||||
return subSkillNameMap.get(name.toLowerCase());
|
||||
return subSkillNameMap.get(name.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,8 @@ import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
@ -909,12 +911,12 @@ public class PlayerListener implements Listener {
|
||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||
String message = event.getMessage();
|
||||
String command = message.substring(1).split(" ")[0];
|
||||
String lowerCaseCommand = command.toLowerCase();
|
||||
String lowerCaseCommand = command.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
// Do these ACTUALLY have to be lower case to work properly?
|
||||
for (PrimarySkillType skill : PrimarySkillType.values()) {
|
||||
String skillName = skill.toString().toLowerCase();
|
||||
String localizedName = skill.getName().toLowerCase();
|
||||
String skillName = skill.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (lowerCaseCommand.equals(localizedName)) {
|
||||
event.setMessage(message.replace(command, skillName));
|
||||
|
@ -62,6 +62,7 @@ import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
/* Managers */
|
||||
@ -286,9 +287,9 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
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;
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.util;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Stores hash tables for item and block names
|
||||
@ -503,6 +504,6 @@ public class MaterialMapStore {
|
||||
|
||||
private void addToHashSet(String string, HashSet<String> stringHashSet)
|
||||
{
|
||||
stringHashSet.add(string.toLowerCase());
|
||||
stringHashSet.add(string.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@ -225,7 +226,7 @@ public final class Misc {
|
||||
String[] materialSplit = materialName.split("_");
|
||||
|
||||
if (materialSplit.length > 1) {
|
||||
return materialSplit[0].toLowerCase();
|
||||
return materialSplit[0].toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
return "UnknownMods";
|
||||
|
@ -16,6 +16,8 @@ import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public final class Permissions {
|
||||
private Permissions() {}
|
||||
|
||||
@ -79,17 +81,17 @@ public final class Permissions {
|
||||
public static boolean mcrefresh(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.mcrefresh")); }
|
||||
public static boolean mcrefreshOthers(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.mcrefresh.others")); }
|
||||
|
||||
public static boolean mctop(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.mctop." + skill.toString().toLowerCase()); }
|
||||
public static boolean mctop(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.mctop." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
public static boolean mmoedit(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoedit"); }
|
||||
public static boolean mmoeditOthers(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoedit.others"); }
|
||||
|
||||
public static boolean skillreset(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.skillreset"); }
|
||||
public static boolean skillreset(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase()); }
|
||||
public static boolean skillreset(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean skillresetOthers(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.skillreset.others"); }
|
||||
public static boolean skillresetOthers(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase()); }
|
||||
public static boolean skillresetOthers(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
public static boolean xplock(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.xplock." + skill.toString().toLowerCase()); }
|
||||
public static boolean xplock(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.commands.xplock." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
public static boolean xprateSet(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.xprate.set"); }
|
||||
public static boolean xprateReset(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.xprate.reset"); }
|
||||
@ -111,16 +113,16 @@ public final class Permissions {
|
||||
public static boolean hasRepairEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.repairenchant"); }
|
||||
public static boolean hasSalvageEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.salvageenchant"); }
|
||||
|
||||
public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase()); }
|
||||
public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
/* XP PERKS */
|
||||
public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase()); }
|
||||
public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase()); }
|
||||
public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase()); }
|
||||
public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase()); }
|
||||
public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase()); }
|
||||
public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase()); }
|
||||
public static boolean customXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase()); }
|
||||
public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean customXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
/* ACTIVATION PERKS */
|
||||
public static boolean twelveSecondActivationBoost(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.activationtime.twelveseconds"); }
|
||||
@ -136,11 +138,11 @@ public final class Permissions {
|
||||
* SKILLS
|
||||
*/
|
||||
|
||||
public static boolean skillEnabled(Permissible permissible, PrimarySkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase()); }
|
||||
public static boolean vanillaXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".vanillaxpboost"); }
|
||||
public static boolean skillEnabled(Permissible permissible, PrimarySkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean vanillaXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".vanillaxpboost"); }
|
||||
public static boolean isSubSkillEnabled(Permissible permissible, SubSkillType subSkillType) { return permissible.hasPermission(subSkillType.getPermissionNodeAddress()); }
|
||||
public static boolean isSubSkillEnabled(Permissible permissible, AbstractSubSkill abstractSubSkill) { return permissible.hasPermission(abstractSubSkill.getPermissionNode()); }
|
||||
public static boolean bonusDamage(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".bonusdamage"); }
|
||||
public static boolean bonusDamage(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".bonusdamage"); }
|
||||
|
||||
/* ACROBATICS */
|
||||
public static boolean dodge(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.acrobatics.dodge"); }
|
||||
@ -163,8 +165,8 @@ public final class Permissions {
|
||||
|
||||
/* HERBALISM */
|
||||
public static boolean greenTerra(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.herbalism.greenterra"); }
|
||||
public static boolean greenThumbBlock(Permissible permissible, Material material) { return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.blocks." + material.toString().replace("_", "").toLowerCase()); }
|
||||
public static boolean greenThumbPlant(Permissible permissible, Material material) { return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.plants." + material.toString().replace("_", "").toLowerCase()); }
|
||||
public static boolean greenThumbBlock(Permissible permissible, Material material) { return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.blocks." + material.toString().replace("_", "").toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean greenThumbPlant(Permissible permissible, Material material) { return permissible.hasPermission("mcmmo.ability.herbalism.greenthumb.plants." + material.toString().replace("_", "").toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
/* MINING */
|
||||
public static boolean biggerBombs(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.mining.blastmining.biggerbombs"); }
|
||||
@ -173,15 +175,15 @@ public final class Permissions {
|
||||
public static boolean superBreaker(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.mining.superbreaker"); }
|
||||
|
||||
/* REPAIR */
|
||||
public static boolean repairItemType(Permissible permissible, ItemType repairItemType) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase() + "repair"); }
|
||||
public static boolean repairMaterialType(Permissible permissible, MaterialType repairMaterialType) { return permissible.hasPermission("mcmmo.ability.repair." + repairMaterialType.toString().toLowerCase() + "repair"); }
|
||||
public static boolean repairItemType(Permissible permissible, ItemType repairItemType) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase(Locale.ENGLISH) + "repair"); }
|
||||
public static boolean repairMaterialType(Permissible permissible, MaterialType repairMaterialType) { return permissible.hasPermission("mcmmo.ability.repair." + repairMaterialType.toString().toLowerCase(Locale.ENGLISH) + "repair"); }
|
||||
|
||||
/* SALVAGE */
|
||||
public static boolean advancedSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.advancedsalvage"); }
|
||||
public static boolean arcaneSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.arcanesalvage"); }
|
||||
|
||||
public static boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase() + "salvage"); }
|
||||
public static boolean salvageMaterialType(Permissible permissible, MaterialType salvageMaterialType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageMaterialType.toString().toLowerCase() + "salvage"); }
|
||||
public static boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase(Locale.ENGLISH) + "salvage"); }
|
||||
public static boolean salvageMaterialType(Permissible permissible, MaterialType salvageMaterialType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageMaterialType.toString().toLowerCase(Locale.ENGLISH) + "salvage"); }
|
||||
|
||||
/* SMELTING */
|
||||
public static boolean fluxMining(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fluxmining"); }
|
||||
@ -191,7 +193,7 @@ public final class Permissions {
|
||||
public static boolean serratedStrikes(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.swords.serratedstrikes"); }
|
||||
|
||||
/* TAMING */
|
||||
public static boolean callOfTheWild(Permissible permissible, EntityType type) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild." + type.toString().toLowerCase()); }
|
||||
public static boolean callOfTheWild(Permissible permissible, EntityType type) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild." + type.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
/* UNARMED */
|
||||
public static boolean berserk(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.unarmed.berserk"); }
|
||||
@ -204,7 +206,7 @@ public final class Permissions {
|
||||
*/
|
||||
public static boolean partySizeBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.partylimit" ); }
|
||||
public static boolean party(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.party"); }
|
||||
public static boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase()); }
|
||||
public static boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean friendlyFire(Permissible permissible) { return permissible.hasPermission("mcmmo.party.friendlyfire"); }
|
||||
|
||||
/* TELEPORT */
|
||||
|
@ -7,6 +7,8 @@ import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class StringUtils {
|
||||
|
||||
/**
|
||||
@ -17,7 +19,7 @@ public class StringUtils {
|
||||
* @return the capitalized string
|
||||
*/
|
||||
public static String getCapitalized(String target) {
|
||||
return target.substring(0, 1).toUpperCase() + target.substring(1).toLowerCase();
|
||||
return target.substring(0, 1).toUpperCase() + target.substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public static String getPrettyItemString(Material material) {
|
||||
|
@ -17,6 +17,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
|
||||
@ -545,7 +546,7 @@ public class TextComponentFactory {
|
||||
TextComponent unlockMessage = new TextComponent("");
|
||||
unlockMessage.setText(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
||||
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
|
||||
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/"+subSkillType.getParentSkill().toString().toLowerCase()));
|
||||
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
|
||||
return unlockMessage;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.command.PluginCommand;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public final class CommandRegistrationManager {
|
||||
private CommandRegistrationManager() {};
|
||||
@ -36,8 +37,8 @@ public final class CommandRegistrationManager {
|
||||
|
||||
private static void registerSkillCommands() {
|
||||
for (PrimarySkillType skill : PrimarySkillType.values()) {
|
||||
String commandName = skill.toString().toLowerCase();
|
||||
String localizedName = skill.getName().toLowerCase();
|
||||
String commandName = skill.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
PluginCommand command;
|
||||
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public final class CommandUtils {
|
||||
public static final List<String> TRUE_FALSE_OPTIONS = ImmutableList.of("on", "off", "true", "false", "enabled", "disabled");
|
||||
@ -302,7 +303,7 @@ public final class CommandUtils {
|
||||
break;
|
||||
}
|
||||
|
||||
if (playerName.toLowerCase().contains(partialName.toLowerCase())) {
|
||||
if (playerName.toLowerCase(Locale.ENGLISH).contains(partialName.toLowerCase(Locale.ENGLISH))) {
|
||||
// Partial match
|
||||
matchedPlayers.add(playerName);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class ScoreboardWrapper {
|
||||
revertTask = new ScoreboardChangeTask().runTaskLater(mcMMO.p, ticks);
|
||||
|
||||
// TODO is there any way to do the time that looks acceptable?
|
||||
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F));
|
||||
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F));
|
||||
|
||||
if(UserManager.getPlayer(playerName) == null)
|
||||
return;
|
||||
|
@ -245,7 +245,7 @@ public class PotionConfigGenerator {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user