Missed a few merges

This commit is contained in:
nossr50 2020-01-27 18:40:46 -08:00
parent 4b6e2c35b2
commit 3eb160a794
12 changed files with 42 additions and 65 deletions

View File

@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;

View File

@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set; import java.util.Set;
public abstract class SkillCommand implements TabExecutor { 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) { private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {

View File

@ -4,11 +4,13 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import java.util.Locale;
public class SkillConfigFactory { public class SkillConfigFactory {
protected static SerializedConfigLoader initSkillConfig(mcMMO pluginRef, PrimarySkillType primarySkillType, Class<?> clazz) { protected static SerializedConfigLoader initSkillConfig(mcMMO pluginRef, PrimarySkillType primarySkillType, Class<?> clazz) {
return new SerializedConfigLoader(pluginRef, clazz, return new SerializedConfigLoader(pluginRef, clazz,
primarySkillType.toString().toLowerCase() + ".conf", primarySkillType.toString().toLowerCase(Locale.ENGLISH) + ".conf",
StringUtils.getCapitalized(primarySkillType.toString()), StringUtils.getCapitalized(primarySkillType.toString()),
null); null);
} }

View File

@ -144,7 +144,7 @@ public enum SubSkillType {
*/ */
public String getPermissionNodeAddress(mcMMO pluginRef) { public String getPermissionNodeAddress(mcMMO pluginRef) {
//TODO: This could be optimized //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);
} }
/** /**

View File

@ -253,7 +253,7 @@
// if (target.equals("II")) { // hacks // if (target.equals("II")) { // hacks
// return target; // 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) { // private static String getName(PotionEffectType type) {

View File

@ -59,16 +59,9 @@ public class EntityListener implements Listener {
} }
//Prevent entities from giving XP if they target endermite //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.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); 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. * Handle FoodLevelChange events that involve modifying the event.
* *
* @param event The event to modify * @param event The event to modify

View File

@ -65,6 +65,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public class mcMMO extends JavaPlugin { public class mcMMO extends JavaPlugin {
/* Managers */ /* Managers */
@ -378,9 +379,9 @@ public class mcMMO extends JavaPlugin {
* @return the ServerSoftwareType which likely matches the server * @return the ServerSoftwareType which likely matches the server
*/ */
private ServerSoftwareType getServerSoftware() { private ServerSoftwareType getServerSoftware() {
if (Bukkit.getVersion().toLowerCase().contains("paper")) if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("paper"))
return ServerSoftwareType.PAPER; return ServerSoftwareType.PAPER;
else if (Bukkit.getVersion().toLowerCase().contains("spigot")) else if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("spigot"))
return ServerSoftwareType.SPIGOT; return ServerSoftwareType.SPIGOT;
else else
return ServerSoftwareType.CRAFTBUKKIT; return ServerSoftwareType.CRAFTBUKKIT;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables;
import com.gmail.nossr50.core.MetadataConstants; import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;

View File

@ -18,6 +18,8 @@ import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.SimplePluginManager; import org.bukkit.plugin.SimplePluginManager;
import java.util.Locale;
public final class PermissionTools { public final class PermissionTools {
private final mcMMO pluginRef; private final mcMMO pluginRef;
@ -175,7 +177,7 @@ public final class PermissionTools {
} }
public boolean mctop(Permissible permissible, PrimarySkillType skill) { 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) { public boolean mmoedit(Permissible permissible) {
@ -195,7 +197,7 @@ public final class PermissionTools {
} }
public boolean skillreset(Permissible permissible, PrimarySkillType skill) { 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) { public boolean skillresetOthers(Permissible permissible) {
@ -203,11 +205,11 @@ public final class PermissionTools {
} }
public boolean skillresetOthers(Permissible permissible, PrimarySkillType skill) { 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) { 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) { public boolean xprateSet(Permissible permissible) {
@ -257,32 +259,32 @@ public final class PermissionTools {
} }
public boolean lucky(Permissible permissible, PrimarySkillType skill) { 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 */ /* XP PERKS */
public boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { 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) { 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) { 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) { 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) { 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) { 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) { public boolean hasCustomXPPerk(Permissible permissible, CustomXPPerk customXPPerk) {
@ -320,11 +322,11 @@ public final class PermissionTools {
*/ */
public boolean skillEnabled(Permissible permissible, PrimarySkillType skill) { 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) { 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) { public boolean isSubSkillEnabled(Permissible permissible, SubSkillType subSkillType) {
@ -336,7 +338,7 @@ public final class PermissionTools {
} }
public boolean bonusDamage(Permissible permissible, PrimarySkillType skill) { 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 */ /* ACROBATICS */
@ -386,11 +388,11 @@ public final class PermissionTools {
} }
public boolean greenThumbBlock(Permissible permissible, Material material) { 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) { 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 */ /* MINING */
@ -412,11 +414,11 @@ public final class PermissionTools {
/* REPAIR */ /* REPAIR */
public boolean repairItemType(Permissible permissible, ItemType repairItemType) { 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) { 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 */ /* SALVAGE */
@ -429,11 +431,11 @@ public final class PermissionTools {
} }
public boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { 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) { 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 */ /* SMELTING */
@ -452,7 +454,7 @@ public final class PermissionTools {
/* TAMING */ /* TAMING */
public boolean callOfTheWild(Permissible permissible, EntityType type) { 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 */ /* UNARMED */
@ -477,7 +479,7 @@ public final class PermissionTools {
} }
public boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { 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) { public boolean friendlyFire(Permissible permissible) {

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
* This class handles many of the JSON components that mcMMO makes and uses * This class handles many of the JSON components that mcMMO makes and uses
@ -537,7 +538,7 @@ public class TextComponentFactory {
TextComponent unlockMessage = new TextComponent(""); TextComponent unlockMessage = new TextComponent("");
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(pluginRef), pluginRef.getRankTools().getRank(player, subSkillType))); 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.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; return unlockMessage;
} }
} }

View File

@ -25,6 +25,7 @@ import org.bukkit.command.PluginCommand;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public final class CommandRegistrationManager { public final class CommandRegistrationManager {
private final mcMMO pluginRef; private final mcMMO pluginRef;
@ -37,8 +38,8 @@ public final class CommandRegistrationManager {
private void registerSkillCommands() { private void registerSkillCommands() {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
String commandName = primarySkillType.toString().toLowerCase(); String commandName = primarySkillType.toString().toLowerCase(Locale.ENGLISH);
String localizedName = pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType).toLowerCase(); String localizedName = pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType).toLowerCase(Locale.ENGLISH);
PluginCommand command; PluginCommand command;

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public final class CommandTools { public final class CommandTools {
private final mcMMO pluginRef; private final mcMMO pluginRef;
@ -288,7 +289,7 @@ public final class CommandTools {
break; break;
} }
if (playerName.toLowerCase().contains(partialName.toLowerCase())) { if (playerName.toLowerCase(Locale.ENGLISH).contains(partialName.toLowerCase(Locale.ENGLISH))) {
// Partial match // Partial match
matchedPlayers.add(playerName); matchedPlayers.add(playerName);
} }