From 606a92f1efff1b86f2026e2bed377c9ff1f80e9a Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:48:01 +0200 Subject: [PATCH 1/9] Fix /party teleport NPE (#4885) --- .../com/gmail/nossr50/commands/party/PartyCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java index f3523445c..752552747 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java @@ -200,15 +200,19 @@ public class PartyCommand implements TabExecutor { if (matches.size() == 0) { Player player = (Player) sender; + final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); //Not Loaded - if(UserManager.getPlayer(player) == null) + if(mcMMOPlayer == null) { sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); return ImmutableList.of(); } - Party party = UserManager.getPlayer(player).getParty(); + if (mcMMOPlayer.getParty() == null) + return ImmutableList.of(); + + final Party party = mcMMOPlayer.getParty(); playerNames = party.getOnlinePlayerNames(player); return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size())); From 69ef484b8621ac7f90afe79d8679f7b53e6f7c92 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:48:53 +0200 Subject: [PATCH 2/9] Fix dots not being replaced when renaming party (#4882) --- .../com/gmail/nossr50/commands/party/PartyRenameCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java index 2ab6f0621..29e35cd4a 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java @@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor { Party playerParty = mcMMOPlayer.getParty(); String oldPartyName = playerParty.getName(); - String newPartyName = args[1]; + String newPartyName = args[1].replace(".", ""); // This is to prevent party leaders from spamming other players with the rename message if (oldPartyName.equalsIgnoreCase(newPartyName)) { From 9b0632d63c4ddaace1c99a45229737f57fcfbe19 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:49:35 +0200 Subject: [PATCH 3/9] Make party loading more resilient (#4881) --- .../com/gmail/nossr50/party/PartyManager.java | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index 16965629f..c723dbd50 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -28,6 +28,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; import java.util.UUID; +import java.util.logging.Level; public final class PartyManager { private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml"; @@ -609,34 +610,38 @@ public final class PartyManager { ArrayList hasAlly = new ArrayList<>(); for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) { - Party party = new Party(partyName); + try { + Party party = new Party(partyName); - String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]"); - party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1])); - party.setPassword(partiesFile.getString(partyName + ".Password")); - party.setLocked(partiesFile.getBoolean(partyName + ".Locked")); - party.setLevel(partiesFile.getInt(partyName + ".Level")); - party.setXp(partiesFile.getInt(partyName + ".Xp")); + String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]"); + party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1])); + party.setPassword(partiesFile.getString(partyName + ".Password")); + party.setLocked(partiesFile.getBoolean(partyName + ".Locked")); + party.setLevel(partiesFile.getInt(partyName + ".Level")); + party.setXp(partiesFile.getInt(partyName + ".Xp")); - if (partiesFile.getString(partyName + ".Ally") != null) { - hasAlly.add(party); + if (partiesFile.getString(partyName + ".Ally") != null) { + hasAlly.add(party); + } + + party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE"))); + party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE"))); + + for (ItemShareType itemShareType : ItemShareType.values()) { + party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true)); + } + + LinkedHashMap members = party.getMembers(); + + for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) { + String[] memberSplit = memberEntry.split("[|]"); + members.put(UUID.fromString(memberSplit[0]), memberSplit[1]); + } + + parties.add(party); + } catch (Exception e) { + mcMMO.p.getLogger().log(Level.WARNING, "An exception occurred while loading a party with name '" + partyName + "'. Skipped loading party.", e); } - - party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE"))); - party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE"))); - - for (ItemShareType itemShareType : ItemShareType.values()) { - party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true)); - } - - LinkedHashMap members = party.getMembers(); - - for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) { - String[] memberSplit = memberEntry.split("[|]"); - members.put(UUID.fromString(memberSplit[0]), memberSplit[1]); - } - - parties.add(party); } mcMMO.p.debug("Loaded (" + parties.size() + ") Parties..."); From 4553310bb93091642c426448305388a873ea0921 Mon Sep 17 00:00:00 2001 From: Smudge <68658429+smuddgge@users.noreply.github.com> Date: Tue, 4 Apr 2023 01:52:00 +0100 Subject: [PATCH 4/9] Fixed fishing exploiting compatibility (#4859) * Fixed fishing exploiting compatibility * Moved same target to class variable --- .../nossr50/listeners/PlayerListener.java | 3 ++ .../skills/fishing/FishingManager.java | 40 ++++++++++--------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index fb906ad1d..3a3900dd4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -450,6 +450,9 @@ public class PlayerListener implements Listener { case CAUGHT_FISH: if(caught instanceof Item) { if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) { + + fishingManager.processExploiting(event.getHook().getLocation().toVector()); + if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) { player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange())); event.setExpToDrop(0); diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index a0f4f014a..d4d147325 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -51,6 +51,7 @@ public class FishingManager extends SkillManager { private long lastWarnedExhaust = 0L; private FishHook fishHookReference; private BoundingBox lastFishingBoundingBox; + private boolean sameTarget; private Item fishingCatch; private Location hookLocation; private int fishCaughtCounter = 1; @@ -125,6 +126,25 @@ public class FishingManager extends SkillManager { return hasFished; } + public void processExploiting(Vector centerOfCastVector) { + BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector); + this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox); + + if (this.sameTarget) { + fishCaughtCounter++; + } + else { + fishCaughtCounter = 1; + } + + //If the new bounding box does not intersect with the old one, then update our bounding box reference + if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox; + + if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) { + getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange())); + } + } + public boolean isExploitingFishing(Vector centerOfCastVector) { /*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100); @@ -133,25 +153,7 @@ public class FishingManager extends SkillManager { return false; }*/ - BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector); - - boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox); - - if(sameTarget) - fishCaughtCounter++; - else - fishCaughtCounter = 1; - - if(fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) - { - getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange())); - } - - //If the new bounding box does not intersect with the old one, then update our bounding box reference - if(!sameTarget) - lastFishingBoundingBox = newCastBoundingBox; - - return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit(); + return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit(); } public static BoundingBox makeBoundingBox(Vector centerOfCastVector) { From ac68c4ebe683a5a93f45fc7109bddafd4b7b2fcc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 7 Apr 2023 17:00:01 -0700 Subject: [PATCH 5/9] 2.1.219 --- Changelog.txt | 4 ++++ pom.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 620ce8497..28f1d79ba 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Version 2.1.219 + Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge) Fixed wiki url being incorrect in commands + Party loading is more resilient (Thanks Wariorrrr) + Fixed periods not being replaced whe nrenaming party (Thanks Wariorrrr) + Fixed Party Teleport NPE (Thanks Wariorrrr) Added support for various new things from Minecraft 1.20 Fixed double drop issue with Beetroots Added 'Camel' to taming experience in experience.yml diff --git a/pom.xml b/pom.xml index 4377c2962..81e05aa76 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.219-SNAPSHOT + 2.1.219 mcMMO https://github.com/mcMMO-Dev/mcMMO From 0ab93586fdce8399299488ff6d8d262e86521a52 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 11 Apr 2023 15:39:01 -0700 Subject: [PATCH 6/9] Config files will update automatically again --- Changelog.txt | 4 + pom.xml | 2 +- .../com/gmail/nossr50/api/ExperienceAPI.java | 4 +- .../com/gmail/nossr50/chat/ChatManager.java | 8 +- .../chat/author/AbstractPlayerAuthor.java | 2 +- .../com/gmail/nossr50/chat/author/Author.java | 4 +- .../nossr50/chat/mailer/AdminChatMailer.java | 4 +- .../nossr50/chat/mailer/PartyChatMailer.java | 4 +- .../gmail/nossr50/config/AdvancedConfig.java | 9 +- .../gmail/nossr50/config/BukkitConfig.java | 185 +++++++----------- .../com/gmail/nossr50/config/ChatConfig.java | 2 +- .../nossr50/config/CoreSkillsConfig.java | 4 +- .../config/experience/ExperienceConfig.java | 6 - .../config/skills/repair/RepairConfig.java | 2 +- .../treasure/FishingTreasureConfig.java | 2 +- .../config/treasure/TreasureConfig.java | 2 +- .../nossr50/datatypes/player/McMMOPlayer.java | 6 +- .../datatypes/skills/interfaces/Toolable.java | 2 +- .../skills/subskills/AbstractSubSkill.java | 2 +- .../skills/subskills/interfaces/SubSkill.java | 2 +- .../nossr50/metadata/MobMetadataService.java | 4 +- .../nossr50/skills/taming/TamingManager.java | 2 +- .../java/com/gmail/nossr50/util/Misc.java | 2 +- .../util/compat/CompatibilityLayer.java | 2 +- .../util/experience/ExperienceBarWrapper.java | 5 +- .../util/platform/MajorMinorPatchVersion.java | 2 +- .../util/platform/MinecraftGameVersion.java | 2 +- .../gmail/nossr50/util/skills/RankUtils.java | 8 +- src/main/resources/chat.yml | 6 +- src/main/resources/config.yml | 19 +- src/main/resources/experience.yml | 2 +- .../resources/locale/locale_cs_CZ.properties | 2 +- .../resources/locale/locale_cy.properties | 2 +- .../resources/locale/locale_da.properties | 2 +- .../resources/locale/locale_en_US.properties | 10 +- .../resources/locale/locale_es.properties | 2 +- .../resources/locale/locale_fi.properties | 2 +- .../resources/locale/locale_it.properties | 2 +- .../resources/locale/locale_ko.properties | 2 +- .../resources/locale/locale_nl.properties | 2 +- .../resources/locale/locale_sv.properties | 2 +- .../resources/locale/locale_th_TH.properties | 2 +- src/main/resources/mods/armor.default.yml | 2 +- src/main/resources/mods/tools.default.yml | 4 +- src/main/resources/plugin.yml | 4 +- 45 files changed, 154 insertions(+), 196 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 28f1d79ba..574eea05b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,7 @@ +Version 2.1.220 + Config files update automatically again + Default configs are now copied to plugins/mcMMO/defaults for easy reference, these configs will always match the default values of the config in the JAR + Version 2.1.219 Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge) Fixed wiki url being incorrect in commands diff --git a/pom.xml b/pom.xml index 81e05aa76..fb39a2584 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.219 + 2.1.220-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index 7fb2ed7ee..f18cd18ca 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -41,7 +41,7 @@ public final class ExperienceAPI { /** * Start the task that gives combat XP. - * Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP + * Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP * * @param mcMMOPlayer The attacking player * @param target The defending entity @@ -56,7 +56,7 @@ public final class ExperienceAPI { /** * Start the task that gives combat XP. - * Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP + * Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP * * @param mcMMOPlayer The attacking player * @param target The defending entity diff --git a/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/src/main/java/com/gmail/nossr50/chat/ChatManager.java index a0a1e6f30..658f4dd16 100644 --- a/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -43,7 +43,7 @@ public class ChatManager { * * @param mmoPlayer target player * @param rawMessage the raw message from the player as it was typed - * @param isAsync whether or not this is getting processed via async + * @param isAsync whether this is getting processed via async */ public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) { processPlayerMessage(mmoPlayer, mmoPlayer.getChatChannel(), rawMessage, isAsync); @@ -69,7 +69,7 @@ public class ChatManager { * @param mmoPlayer target player * @param chatChannel target chat channel * @param rawMessage raw chat message as it was typed - * @param isAsync whether or not this is getting processed via async + * @param isAsync whether this is getting processed via async */ private void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) { switch (chatChannel) { @@ -155,7 +155,7 @@ public class ChatManager { } /** - * Whether or not the player is allowed to send a message to the chat channel they are targeting + * Whether the player is allowed to send a message to the chat channel they are targeting * @param mmoPlayer target player * @return true if the player can send messages to that chat channel */ @@ -197,7 +197,7 @@ public class ChatManager { } /** - * Whether or not a specific chat channel is enabled + * Whether a specific chat channel is enabled * ChatChannels are enabled/disabled via user config * * If chat is disabled, this always returns false diff --git a/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java b/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java index e2bb7c7e0..eb606af6d 100644 --- a/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java +++ b/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java @@ -73,7 +73,7 @@ public abstract class AbstractPlayerAuthor implements Author { * Sanitized names are associated with a {@link ChatChannel} as different chat channels have different chat name settings * * @param chatChannel target chat channel - * @param useDisplayName whether or not to use this authors display name + * @param useDisplayName whether to use this authors display name */ private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) { if(useDisplayName) { diff --git a/src/main/java/com/gmail/nossr50/chat/author/Author.java b/src/main/java/com/gmail/nossr50/chat/author/Author.java index 6f45a21b7..c7c35b7e2 100644 --- a/src/main/java/com/gmail/nossr50/chat/author/Author.java +++ b/src/main/java/com/gmail/nossr50/chat/author/Author.java @@ -17,14 +17,14 @@ public interface Author extends Identity { @NotNull String getAuthoredName(@NotNull ChatChannel chatChannel); /** - * Whether or not this author is a {@link org.bukkit.command.ConsoleCommandSender} + * Whether this author is a {@link org.bukkit.command.ConsoleCommandSender} * * @return true if this author is the console */ boolean isConsole(); /** - * Whether or not this author is a {@link org.bukkit.entity.Player} + * Whether this author is a {@link org.bukkit.entity.Player} * @return true if this author is a player */ boolean isPlayer(); diff --git a/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java b/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java index de922e56a..f798f5d47 100644 --- a/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java +++ b/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java @@ -73,8 +73,8 @@ public class AdminChatMailer extends AbstractChatMailer { * * @param author the author * @param rawString the raw message as the author typed it before any styling - * @param isAsync whether or not this is being processed asynchronously - * @param canColor whether or not the author can use colors in chat + * @param isAsync whether this is being processed asynchronously + * @param canColor whether the author can use colors in chat */ public void processChatMessage(@NotNull Author author, @NotNull String rawString, boolean isAsync, boolean canColor) { AdminChatMessage chatMessage = new AdminChatMessage(pluginRef, author, constructAudience(), rawString, addStyle(author, rawString, canColor)); diff --git a/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java b/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java index 6158ad826..ad8d8992d 100644 --- a/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java +++ b/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java @@ -27,8 +27,8 @@ public class PartyChatMailer extends AbstractChatMailer { * * @param author the author * @param rawString the raw message as the author typed it before any styling - * @param isAsync whether or not this is being processed asynchronously - * @param canColor whether or not the author can use colors in chat + * @param isAsync whether this is being processed asynchronously + * @param canColor whether the author can use colors in chat */ public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) { PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party); diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 25425a0a3..04cca138a 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -17,11 +17,6 @@ public class AdvancedConfig extends BukkitConfig { validate(); } - @Override - public void initDefaults() { - config.addDefault("Skills.General.StartingLevel", 0); - } - @Override protected boolean validateKeys() { // Validate all the settings! @@ -427,7 +422,7 @@ public class AdvancedConfig extends BukkitConfig { /** * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level. - * It returns a different value depending on whether or not the server is in retro mode + * It returns a different value depending on whether the server is in retro mode * * @return the level at which abilities stop increasing in length */ @@ -440,7 +435,7 @@ public class AdvancedConfig extends BukkitConfig { /** * This returns the frequency at which abilities will increase in length - * It returns a different value depending on whether or not the server is in retro mode + * It returns a different value depending on whether the server is in retro mode * * @return the number of levels required per ability length increase */ diff --git a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java index e1bd830cd..fff40e5e4 100644 --- a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java +++ b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java @@ -7,53 +7,112 @@ import org.jetbrains.annotations.NotNull; import java.io.*; import java.util.HashSet; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.Set; public abstract class BukkitConfig { - public static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:"; - public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2"; - public static final char COMMENT_PREFIX = '#'; + boolean copyDefaults = true; protected final String fileName; protected final File configFile; + protected YamlConfiguration defaultYamlConfig; protected YamlConfiguration config; - protected @NotNull - final File dataFolder; + protected @NotNull final File dataFolder; public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) { mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); this.fileName = fileName; this.dataFolder = dataFolder; configFile = new File(dataFolder, fileName); - // purgeComments(true); + this.defaultYamlConfig = copyDefaultConfig(); + this.config = initConfig(); + updateFile(); + mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); + } + + public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) { + mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); + this.copyDefaults = copyDefaults; + this.fileName = fileName; + this.dataFolder = dataFolder; + configFile = new File(dataFolder, fileName); + this.defaultYamlConfig = copyDefaultConfig(); this.config = initConfig(); - initDefaults(); updateFile(); mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); } - @Deprecated public BukkitConfig(@NotNull String fileName) { this(fileName, mcMMO.p.getDataFolder()); } - - /** - * Initialize default values for the config - */ - public void initDefaults() {} + public BukkitConfig(@NotNull String fileName, boolean copyDefaults) { + this(fileName, mcMMO.p.getDataFolder(), copyDefaults); + } /** * Update the file on the disk by copying out any new and missing defaults */ public void updateFile() { try { + if(copyDefaults) { + copyMissingDefaultsFromResource(); + } config.save(configFile); } catch (IOException e) { e.printStackTrace(); } } - private YamlConfiguration initConfig() { + /** + * Copies missing keys and values from the internal resource config within the JAR + */ + private void copyMissingDefaultsFromResource() { + boolean updated = false; + for (String key : defaultYamlConfig.getKeys(true)) { + if (!config.contains(key)) { + config.set(key, defaultYamlConfig.get(key)); + updated = true; + } + } + + if (updated) { + updateFile(); + } + } + + /** + * Copies the config from the JAR to defaults/ + */ + YamlConfiguration copyDefaultConfig() { + mcMMO.p.getLogger().info("[config] Copying default config to disk: " + fileName + " to defaults/" + fileName); + try(InputStream inputStream = mcMMO.p.getResource(fileName)) { + if(inputStream == null) { + mcMMO.p.getLogger().severe("[config] Unable to copy default config: " + fileName); + return null; + } + + //Save default file into defaults/ + File defaultsFolder = new File(dataFolder, "defaults"); + if (!defaultsFolder.exists()) { + defaultsFolder.mkdir(); + } + File defaultFile = new File(defaultsFolder, fileName); + Path path = defaultFile.toPath(); + Files.copy(inputStream, path, java.nio.file.StandardCopyOption.REPLACE_EXISTING); + + // Load file into YAML config + YamlConfiguration defaultYamlConfig = new YamlConfiguration(); + defaultYamlConfig.load(defaultFile); + return defaultYamlConfig; + } catch (IOException | InvalidConfigurationException e) { + e.printStackTrace(); + } + return null; + } + + YamlConfiguration initConfig() { if (!configFile.exists()) { mcMMO.p.getLogger().info("[config] User config file not found, copying a default config to disk: " + fileName); mcMMO.p.saveResource(fileName, false); @@ -106,8 +165,8 @@ public abstract class BukkitConfig { } public void backup() { - mcMMO.p.getLogger().severe("You are using an old version of the " + fileName + " file."); - mcMMO.p.getLogger().severe("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version."); + mcMMO.p.getLogger().info("You are using an old version of the " + fileName + " file."); + mcMMO.p.getLogger().info("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version."); configFile.renameTo(new File(configFile.getPath() + ".old")); @@ -123,98 +182,4 @@ public abstract class BukkitConfig { public File getFile() { return configFile; } - -// /** -// * Somewhere between December 2021-January 2022 Spigot updated their -// * SnakeYAML dependency/API and due to our own crappy legacy code -// * this introduced a very problematic bug where comments got duplicated -// *

-// * This method hotfixes the problem by just deleting any existing comments -// * it's ugly, but it gets the job done -// * -// * @param silentFail when true mcMMO will report errors during the patch process or debug information -// * the option to have it fail silently is because mcMMO wants to check files before they are parsed as a file with a zillion comments will fail to even load -// */ -// private void purgeComments(boolean silentFail) { -// if(!configFile.exists()) -// return; -// -// int dupedLines = 0, lineCount = 0, lineCountAfter = 0; -// try (FileReader fileReader = new FileReader(configFile); -// BufferedReader bufferedReader = new BufferedReader(fileReader)) { -// StringBuilder stringBuilder = new StringBuilder(); -// String line; -// Set seenBefore = new HashSet<>(); -// -// stringBuilder.append(CURRENT_CONFIG_PATCH_VER).append(System.lineSeparator()); -// boolean noPatchNeeded = false; -// -// // While not at the end of the file -// while ((line = bufferedReader.readLine()) != null) { -// lineCount++; -// -// if(line.startsWith(CURRENT_CONFIG_PATCH_VER)) { -// noPatchNeeded = true; -// break; -// } -// -// //Older version, don't append this line -// if(line.startsWith(CONFIG_PATCH_PREFIX)) -// continue; -// -// if (isFirstCharAsciiCharacter(line, COMMENT_PREFIX)) { -// if(seenBefore.contains(line)) -// dupedLines++; -// else -// seenBefore.add(line); -// -// continue; //Delete the line by not appending it -// } -// -// stringBuilder -// .append(line) //Convert existing files into two-spaced format -// .append(System.lineSeparator()); -// lineCountAfter++; -// } -// -// if(noPatchNeeded) -// return; -// -// if(lineCount == 0 && !silentFail) { -// mcMMO.p.getLogger().info("[config patcher] Config line count: " + lineCount); -// throw new InvalidConfigurationException("[config patcher] Patching of config file resulted in an empty file, this will not be saved. Contact the mcMMO devs!"); -// } -// -// if(dupedLines > 0 && !silentFail) { -// mcMMO.p.getLogger().info("[config patcher] Found "+dupedLines+" duplicate comments in config file: " + configFile.getName()); -// mcMMO.p.getLogger().info("[config patcher] Purging the duplicate comments... (Nothing is broken, this is just info used for debugging)"); -// mcMMO.p.getLogger().info("[config patcher] Line count before: "+lineCount); -// mcMMO.p.getLogger().info("[config patcher] Line count after: "+lineCountAfter); -// } -// -// // Write out the *patched* file -// // AKA the file without any comments -// try (FileWriter fileWriter = new FileWriter(configFile)) { -// fileWriter.write(stringBuilder.toString()); -// } -// } catch (IOException | InvalidConfigurationException ex) { -// mcMMO.p.getLogger().severe("Failed to patch config file: " + configFile.getName()); -// ex.printStackTrace(); -// } -// } - - private boolean isFirstCharAsciiCharacter(String line, char character) { - if(line == null || line.isEmpty()) { - return true; - } - - for(Character c : line.toCharArray()) { - if(c.equals(' ')) - continue; - - return c.equals(character); - } - - return false; - } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/ChatConfig.java b/src/main/java/com/gmail/nossr50/config/ChatConfig.java index bbda1b69c..0e33d74d1 100644 --- a/src/main/java/com/gmail/nossr50/config/ChatConfig.java +++ b/src/main/java/com/gmail/nossr50/config/ChatConfig.java @@ -40,7 +40,7 @@ public class ChatConfig extends BukkitConfig { } /** - * Whether or not to use display names for players in target {@link ChatChannel} + * Whether to use display names for players in target {@link ChatChannel} * * @param chatChannel target chat channel * diff --git a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java index f92990ad6..d172e4551 100644 --- a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java @@ -35,7 +35,7 @@ public class CoreSkillsConfig extends BukkitConfig { */ /** - * Whether or not a skill is enabled + * Whether a skill is enabled * Defaults true * * @param abstractSubSkill SubSkill definition to check @@ -47,7 +47,7 @@ public class CoreSkillsConfig extends BukkitConfig { } /** - * Whether or not this primary skill is enabled + * Whether this primary skill is enabled * * @param primarySkillType target primary skill * diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 75686cfcd..929fdcefe 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -25,12 +25,6 @@ public class ExperienceConfig extends BukkitConfig { validate(); } - @Override - public void initDefaults() { - config.addDefault("ExploitFix.Combat.XPCeiling.Enabled", true); - config.addDefault("ExploitFix.Combat.XPCeiling.Damage_Limit", 100); - } - public static ExperienceConfig getInstance() { if (instance == null) { instance = new ExperienceConfig(); diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java index 604a18e9c..14dafd766 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java @@ -18,7 +18,7 @@ public class RepairConfig extends BukkitConfig { private List repairables; public RepairConfig(String fileName) { - super(fileName); + super(fileName, false); notSupported = new HashSet<>(); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java index 1a9dd41c5..4239d8803 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java @@ -28,7 +28,7 @@ public class FishingTreasureConfig extends BukkitConfig { public @NotNull HashMap> shakeMap = new HashMap<>(); private FishingTreasureConfig() { - super(FILENAME); + super(FILENAME, false); loadKeys(); validate(); } diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 1827188dd..7ebf53ae7 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -35,7 +35,7 @@ public class TreasureConfig extends BukkitConfig { public HashMap> hylianMap = new HashMap<>(); private TreasureConfig() { - super(FILENAME); + super(FILENAME, false); loadKeys(); validate(); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 83463ebb4..a22dd3491 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -577,7 +577,7 @@ public class McMMOPlayer implements Identified { } /** - * Whether or not a player is level capped + * Whether a player is level capped * If they are at the power level cap, this will return true, otherwise it checks their skill level * @param primarySkillType * @return @@ -590,7 +590,7 @@ public class McMMOPlayer implements Identified { } /** - * Whether or not a player is power level capped + * Whether a player is power level capped * Compares their power level total to the current set limit * @return true if they have reached the power level cap */ @@ -912,7 +912,7 @@ public class McMMOPlayer implements Identified { return; } - //These values change depending on whether or not the server is in retro mode + //These values change depending on whether the server is in retro mode int abilityLengthVar = mcMMO.p.getAdvancedConfig().getAbilityLength(); int abilityLengthCap = mcMMO.p.getAdvancedConfig().getAbilityLengthCap(); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/interfaces/Toolable.java b/src/main/java/com/gmail/nossr50/datatypes/skills/interfaces/Toolable.java index 7b817bea1..e3a448eb0 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/interfaces/Toolable.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/interfaces/Toolable.java @@ -6,7 +6,7 @@ import java.util.Collection; public interface Toolable { /** - * Whether or not this Skill requires a tool + * Whether this Skill requires a tool * Not all skills will require a tool * @return true if tool is required */ diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/AbstractSubSkill.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/AbstractSubSkill.java index 2e7c9a1f5..109ece783 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/AbstractSubSkill.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/AbstractSubSkill.java @@ -35,7 +35,7 @@ public abstract class AbstractSubSkill implements SubSkill, Interaction, Rank, S } /** - * Whether or not this subskill is enabled + * Whether this subskill is enabled * * @return true if enabled */ diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java index 1ca73bbdf..33d0e9874 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java @@ -64,7 +64,7 @@ public interface SubSkill extends Skill { void addStats(TextComponent.Builder componentBuilder, Player player); /** - * Whether or not this subskill is enabled + * Whether this subskill is enabled * @return true if enabled */ boolean isEnabled(); diff --git a/src/main/java/com/gmail/nossr50/metadata/MobMetadataService.java b/src/main/java/com/gmail/nossr50/metadata/MobMetadataService.java index c0ff78c0c..e78b056c9 100644 --- a/src/main/java/com/gmail/nossr50/metadata/MobMetadataService.java +++ b/src/main/java/com/gmail/nossr50/metadata/MobMetadataService.java @@ -56,7 +56,7 @@ public class MobMetadataService { } /** - * Whether or not a target {@link LivingEntity} has a specific mcMMO mob flags + * Whether a target {@link LivingEntity} has a specific mcMMO mob flags * * @param flag the type of mob flag to check for * @param livingEntity the living entity to check for metadata @@ -76,7 +76,7 @@ public class MobMetadataService { } /** - * Whether or not a target {@link LivingEntity} has any mcMMO mob flags + * Whether a target {@link LivingEntity} has any mcMMO mob flags * * @param livingEntity the living entity to check for metadata * diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 7d4ad8849..fa618bc33 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -476,7 +476,7 @@ public class TamingManager extends SkillManager { } /** - * Whether or not the itemstack is used for COTW + * Whether the itemstack is used for COTW * @param itemStack target ItemStack * @return true if it is used for any COTW */ diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 03821dccd..0e713a2e4 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -303,7 +303,7 @@ public final class Misc { } /** - * Whether or not a player is the party leader of a party + * Whether a player is the party leader of a party * * @param mmoPlayer target player * @return true if the player is the party leader diff --git a/src/main/java/com/gmail/nossr50/util/compat/CompatibilityLayer.java b/src/main/java/com/gmail/nossr50/util/compat/CompatibilityLayer.java index 51b240338..5abbaa818 100644 --- a/src/main/java/com/gmail/nossr50/util/compat/CompatibilityLayer.java +++ b/src/main/java/com/gmail/nossr50/util/compat/CompatibilityLayer.java @@ -5,7 +5,7 @@ package com.gmail.nossr50.util.compat; */ public interface CompatibilityLayer { /** - * Whether or not this CompatibilityLayer successfully initialized and in theory should be functional + * Whether this CompatibilityLayer successfully initialized and in theory should be functional * @return true if this CompatibilityLayer is functional */ default boolean noErrorsOnInitialize() { return true; }; diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java index 5ae2032c6..185026ed9 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java @@ -151,7 +151,10 @@ public class ExperienceBarWrapper { private void createBossBar() { - bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(title, ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType), ExperienceConfig.getInstance().getExperienceBarStyle(primarySkillType)); + bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar( + title, + ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType), + ExperienceConfig.getInstance().getExperienceBarStyle(primarySkillType)); bossBar.addPlayer(mcMMOPlayer.getPlayer()); } } diff --git a/src/main/java/com/gmail/nossr50/util/platform/MajorMinorPatchVersion.java b/src/main/java/com/gmail/nossr50/util/platform/MajorMinorPatchVersion.java index b933786f6..47f41a82e 100644 --- a/src/main/java/com/gmail/nossr50/util/platform/MajorMinorPatchVersion.java +++ b/src/main/java/com/gmail/nossr50/util/platform/MajorMinorPatchVersion.java @@ -84,7 +84,7 @@ public abstract class MajorMinorPatchVersion implements Versioned { } /** - * Whether or not this version of Minecraft is a patch + * Whether this version of Minecraft is a patch * a patch version value above 0 will indicate that this is a patch * @return true if this version is a patch */ diff --git a/src/main/java/com/gmail/nossr50/util/platform/MinecraftGameVersion.java b/src/main/java/com/gmail/nossr50/util/platform/MinecraftGameVersion.java index ead974825..387d831d1 100644 --- a/src/main/java/com/gmail/nossr50/util/platform/MinecraftGameVersion.java +++ b/src/main/java/com/gmail/nossr50/util/platform/MinecraftGameVersion.java @@ -28,7 +28,7 @@ public class MinecraftGameVersion extends MajorMinorPatchVersion { } /** - * Returns whether or not the Minecraft version is at least equal to or higher than a target version + * Returns whether the Minecraft version is at least equal to or higher than a target version * @param majorVerNumber target major version number - for example 1.16.5 , the 1 is the major version * @param minorVerNumber target minor version number - for example 1.16.5, the 16 is the minor version * @param patchVerNumber target patch version number - for example 1.16.5, the 5 is the patch version number diff --git a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java index c36821cc7..e53ec67d4 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java @@ -104,7 +104,7 @@ public class RankUtils { } /** - * Returns whether or not the player has unlocked the first rank in target subskill + * Returns whether the player has unlocked the first rank in target subskill * @param player the player * @param subSkillType the target subskill * @return true if the player has at least one rank in the skill @@ -118,7 +118,7 @@ public class RankUtils { } /** - * Returns whether or not the player has unlocked the first rank in target subskill + * Returns whether the player has unlocked the first rank in target subskill * @param player the player * @param abstractSubSkill the target subskill * @return true if the player has at least one rank in the skill @@ -132,7 +132,7 @@ public class RankUtils { } /** - * Returns whether or not the player has reached the specified rank in target subskill + * Returns whether the player has reached the specified rank in target subskill * @param rank the target rank * @param player the player * @param subSkillType the target subskill @@ -144,7 +144,7 @@ public class RankUtils { } /** - * Returns whether or not the player has reached the specified rank in target subskill + * Returns whether the player has reached the specified rank in target subskill * @param rank the target rank * @param player the player * @param abstractSubSkill the target subskill diff --git a/src/main/resources/chat.yml b/src/main/resources/chat.yml index 6fa5ecf88..34f812a07 100644 --- a/src/main/resources/chat.yml +++ b/src/main/resources/chat.yml @@ -6,15 +6,15 @@ Chat: Party: # Enable or disable party chat Enable: true - # Whether or not to use the current display name of a player + # Whether to use the current display name of a player Use_Display_Names: true Spies: - # Whether or not players with the chat spy permission join the server with chat spying toggled on + # Whether players with the chat spy permission join the server with chat spying toggled on Automatically_Enable_Spying: false Admin: # Enable or disable admin chat Enable: true - # Whether or not to use the current display name of a player + # Whether to use the current display name of a player Use_Display_Names: true # CUSTOMIZATION INFORMATION # If you want to customize the look and feel of chat channels, that is handled through localization which is configurable diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b9eae9772..789729cc6 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -10,9 +10,9 @@ General: # When players reach certain level milestones messages will be broadcast Level_Up_Chat_Broadcasts: - # Whether or not level up broadcasts are enabled + # Whether level up broadcasts are enabled Enabled: true - # Whether or not you want power level milestones to be broadcast + # Whether you want power level milestones to be broadcast Broadcast_Powerlevels: Enabled: true # How often to broadcast, you can change this to 1 to always broadcast a level up event, a setting of 100 will limit it to every 100 levels (for example level 100, level 200, etc) @@ -20,9 +20,9 @@ General: Broadcast_Targets: # Send the message to the console as well Send_To_Console: true - # Whether or not to only send chat messages to party members + # Whether to only send chat messages to party members Only_Party_Members: false - # Whether or not players who recieve a level up broadcast have to be on the same world as the one who leveled up + # Whether players who receive a level up broadcast have to be on the same world as the one who leveled up Only_Same_World: false # Distance restrictions Distance_Restrictions: @@ -34,9 +34,9 @@ General: Broadcast_Targets: # Send the message to the console as well Send_To_Console: true - # Whether or not to only send chat messages to party members + # Whether to only send chat messages to party members Only_Party_Members: false - # Whether or not players who recieve a level up broadcast have to be on the same world as the one who leveled up + # Whether players who recieve a level up broadcast have to be on the same world as the one who leveled up Only_Same_World: false # Distance restrictions Distance_Restrictions: @@ -44,7 +44,7 @@ General: # When using Restrict_Distance the blow setting configures the range of the broadcast Restricted_Radius: 100 # Turning this on will scale mcMMO around 1-1000 with default scaling factor - # Everything in your config related to skill level requirements, skill level bonuses, etc will be multiplied by 10 when this mode is on + # Everything in your config related to skill level requirements, skill level bonuses, etc. will be multiplied by 10 when this mode is on # This change is purely cosmetic, it retains the old feel of mcMMO where you could level up thousands of times RetroMode: Enabled: true @@ -59,9 +59,6 @@ General: Save_Interval: 10 # Allow mcMMO to report on basic anonymous usage Stats_Tracking: true - # Allow mcMMO to check if a new version is available - Update_Check: true - Prefer_Beta: false Power_Level_Cap: 0 # Should mcMMO truncate levels if you lower your max level cap for a skillname TruncateSkills: true @@ -147,7 +144,7 @@ Scoreboard: LevelUp_Time: 5 Mob_Healthbar: - # Enabled: Whether or not the feature is enabled at all + # Enabled: Whether the feature is enabled at all # Display_Type: Per player Default display for mob health bars - HEARTS, BAR, or DISABLED Enabled: true Display_Type: HEARTS diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 88a3150dd..6f60eff27 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -41,7 +41,7 @@ ExploitFix: SnowGolemExcavation: true # This include NPCs from stuff like Citizens, this is not a setting for Vanilla Minecraft Villagers (Which can be considered NPCs) # mcMMO normally doesn't process attacks against an Entity if it is an NPC from another plugin - # Of course, mcMMO doesn't know for sure whether or not something is an NPC, it checks a few known things, see our source code to see how + # Of course, mcMMO doesn't know for sure whether something is an NPC, it checks a few known things, see our source code to see how PreventPluginNPCInteraction: true Fishing_ExploitFix_Options: MoveRange: 3 diff --git a/src/main/resources/locale/locale_cs_CZ.properties b/src/main/resources/locale/locale_cs_CZ.properties index 4080f60bc..c74ce2d7e 100644 --- a/src/main/resources/locale/locale_cs_CZ.properties +++ b/src/main/resources/locale/locale_cs_CZ.properties @@ -646,4 +646,4 @@ Scoreboard.Misc.RemainingXP=Zbývající XP Scoreboard.Misc.Overall=Celkově Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_cy.properties b/src/main/resources/locale/locale_cy.properties index 254a078d3..4689705a9 100644 --- a/src/main/resources/locale/locale_cy.properties +++ b/src/main/resources/locale/locale_cy.properties @@ -467,4 +467,4 @@ Skills.AbilityGateRequirementFail= Smelting.SubSkill.UnderstandingTheArt.Name= Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_da.properties b/src/main/resources/locale/locale_da.properties index 6207fe433..d14a1cf0c 100644 --- a/src/main/resources/locale/locale_da.properties +++ b/src/main/resources/locale/locale_da.properties @@ -466,4 +466,4 @@ MOTD.Version=&6[mcMMO] Kører version &3{0} MOTD.Website=&6[mcMMO] &a{0}&e - mcMMO Hjemmeside Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 992ea77a3..27c45d0d9 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -172,7 +172,7 @@ Archery.SubSkill.ArrowRetrieval.Name=Arrow Retrieval Archery.SubSkill.ArrowRetrieval.Description=Chance to retrieve arrows from corpses Archery.SubSkill.ArrowRetrieval.Stat=Arrow Recovery Chance Archery.SubSkill.ArcheryLimitBreak.Name=Archery Limit Break -Archery.SubSkill.ArcheryLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether or not it will boost damage in PVE. +Archery.SubSkill.ArcheryLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE. Archery.SubSkill.ArcheryLimitBreak.Stat=Limit Break Max DMG Archery.Listener=Archery: Archery.SkillName=ARCHERY @@ -200,7 +200,7 @@ Axes.SubSkill.CriticalStrikes.Stat=Critical Strike Chance Axes.SubSkill.AxeMastery.Name=Axe Mastery Axes.SubSkill.AxeMastery.Description=Adds bonus DMG Axes.SubSkill.AxesLimitBreak.Name=Axes Limit Break -Axes.SubSkill.AxesLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether or not it will boost damage in PVE. +Axes.SubSkill.AxesLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE. Axes.SubSkill.AxesLimitBreak.Stat=Limit Break Max DMG Axes.SubSkill.ArmorImpact.Name=Armor Impact Axes.SubSkill.ArmorImpact.Description=Strike with enough force to shatter armor @@ -426,7 +426,7 @@ Swords.SubSkill.Stab.Name=Stab Swords.SubSkill.Stab.Description=Adds bonus damage to your attacks. Swords.SubSkill.Stab.Stat=Stab Damage Swords.SubSkill.SwordsLimitBreak.Name=Swords Limit Break -Swords.SubSkill.SwordsLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether or not it will boost damage in PVE. +Swords.SubSkill.SwordsLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE. Swords.SubSkill.SwordsLimitBreak.Stat=Limit Break Max DMG Swords.SubSkill.Rupture.Stat=Rupture Chance Swords.SubSkill.Rupture.Stat.Extra=[[DARK_AQUA]]Rupture Duration: &e{0}s&a vs Players, &e{1}s&a vs Mobs. @@ -508,7 +508,7 @@ Unarmed.SubSkill.Disarm.Name=Disarm Unarmed.SubSkill.Disarm.Description=Drops the foes item held in hand Unarmed.SubSkill.Disarm.Stat=Disarm Chance Unarmed.SubSkill.UnarmedLimitBreak.Name=Unarmed Limit Break -Unarmed.SubSkill.UnarmedLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether or not it will boost damage in PVE. +Unarmed.SubSkill.UnarmedLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE. Unarmed.SubSkill.UnarmedLimitBreak.Stat=Limit Break Max DMG Unarmed.SubSkill.SteelArmStyle.Name=Steel Arm Style Unarmed.SubSkill.SteelArmStyle.Description=Hardens your arm over time @@ -1128,7 +1128,7 @@ LevelCap.PowerLevel=&6(&amcMMO&6) &eYou have reached the power level cap of &c{0 LevelCap.Skill=&6(&amcMMO&6) &eYou have reached the level cap of &c{0}&e for &6{1}&e. You will cease to level in this skill from this point on. Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. Compatibility.Layer.Unsupported=&6Compatibility for &a{0}&6 is not supported by this version of Minecraft. Compatibility.Layer.PartialSupport=&6Compatibility for &a{0}&6 is not fully supported by this version of Minecraft, but mcMMO is running a secondary system to emulate some of the missing features. Commands.XPBar.DisableAll=&6 All mcMMO XP bars are now disabled, use /mmoxpbar reset to restore default settings. diff --git a/src/main/resources/locale/locale_es.properties b/src/main/resources/locale/locale_es.properties index 331f4c271..1a97cd0fa 100644 --- a/src/main/resources/locale/locale_es.properties +++ b/src/main/resources/locale/locale_es.properties @@ -674,4 +674,4 @@ Scoreboard.Misc.RemainingXP=XP restante Scoreboard.Misc.Overall=Total Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_fi.properties b/src/main/resources/locale/locale_fi.properties index fc5039a01..75570f4aa 100644 --- a/src/main/resources/locale/locale_fi.properties +++ b/src/main/resources/locale/locale_fi.properties @@ -199,4 +199,4 @@ Stats.Header.Misc=&6-=SEKALAISET TAIDOT=- Stats.Own.Stats=&a[mcMMO] Tilastot Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_it.properties b/src/main/resources/locale/locale_it.properties index c1d7408af..250245ed3 100644 --- a/src/main/resources/locale/locale_it.properties +++ b/src/main/resources/locale/locale_it.properties @@ -1139,4 +1139,4 @@ LevelCap.PowerLevel=&6(&amcMMO&6) &eHai raggiunto il livello massimo di potenza LevelCap.Skill=&6(&amcMMO&6) &eHai raggiunto il livello massimo di &c{0}&e per &6{1}&e. Da questo punto in poi cesserai di salire di livello in questa abilità. Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_ko.properties b/src/main/resources/locale/locale_ko.properties index aa37dac39..488fb8e82 100644 --- a/src/main/resources/locale/locale_ko.properties +++ b/src/main/resources/locale/locale_ko.properties @@ -990,7 +990,7 @@ Profile.Loading.Failure=mcMMO는 여전히 당신의 데이터를 읽을 수 없 Profile.Loading.AdminFailureNotice=&4[A]&c mcMMO는 &e{0}&c 플레이어 데이터 읽기가 불가능합니다. &d당신의 데이터베이스 설치를 검사해주세요. Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. #OVERHAULs Overhaul.Levelup=&l{0} &r(이)가 레벨 &r&a&l{2}&r&f 로 성장 했습니다. diff --git a/src/main/resources/locale/locale_nl.properties b/src/main/resources/locale/locale_nl.properties index 165fdc7f6..5fbae168e 100644 --- a/src/main/resources/locale/locale_nl.properties +++ b/src/main/resources/locale/locale_nl.properties @@ -430,4 +430,4 @@ Scoreboard.Misc.RemainingXP=Resterende XP Scoreboard.Misc.Overall=Globaal Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_sv.properties b/src/main/resources/locale/locale_sv.properties index 6c4ae3717..edebda814 100644 --- a/src/main/resources/locale/locale_sv.properties +++ b/src/main/resources/locale/locale_sv.properties @@ -151,4 +151,4 @@ Stats.Header.Misc=&6-=Varierande Färdogheter=- Stats.Own.Stats=&a[mcMMO] Stats Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/locale/locale_th_TH.properties b/src/main/resources/locale/locale_th_TH.properties index 4faa11011..74debe67d 100644 --- a/src/main/resources/locale/locale_th_TH.properties +++ b/src/main/resources/locale/locale_th_TH.properties @@ -634,4 +634,4 @@ UpdateChecker.Outdated=You are using an outdated version of mcMMO! UpdateChecker.NewAvailable=There is a new version available on BukkitDev. Commands.XPBar.Usage=Proper usage is /mmoxpbar Commands.Description.mmoxpbar=Player settings for mcMMO XP bars -Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional. +Commands.Description.mmocompat=Information about mcMMO and whether its in compatibility mode or fully functional. diff --git a/src/main/resources/mods/armor.default.yml b/src/main/resources/mods/armor.default.yml index 14604141d..e02ee9ba4 100644 --- a/src/main/resources/mods/armor.default.yml +++ b/src/main/resources/mods/armor.default.yml @@ -8,7 +8,7 @@ # The bare minimum of an Armor piece is that it has a Repair_Material # # -# Repairable: Whether or not the item is repairable +# Repairable: Whether the item is repairable ## This defaults to true # # Repair_Material: This is the material name of the item used to repair this armor. diff --git a/src/main/resources/mods/tools.default.yml b/src/main/resources/mods/tools.default.yml index fe1d15507..361ff4630 100644 --- a/src/main/resources/mods/tools.default.yml +++ b/src/main/resources/mods/tools.default.yml @@ -18,10 +18,10 @@ ## Valid values range from 1 to 4 ## This defaults to 1 # -# Ability_Enabled: Whether or not abilities are enabled with this tool +# Ability_Enabled: Whether abilities are enabled with this tool ## This defaults to true # -# Repairable: Whether or not the item is repairable +# Repairable: Whether the item is repairable ## This defaults to true # # Repair_Material: This is the material name of the item used to repair this tool. diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 23915d427..1708fe719 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -26,7 +26,7 @@ commands: aliases: xpbarsettings description: Change XP bar settings mmocompat: - description: Information about the server and whether or not its considered fully compatible or running in compatibility mode + description: Information about the server and whether its considered fully compatible or running in compatibility mode mmodebug: aliases: [mcmmodebugmode] description: Toggles a debug mode which will print useful information to chat @@ -54,7 +54,7 @@ commands: description: Add mcMMO levels to a user permission: mcmmo.commands.addlevels mcability: - description: Toggle whether or not abilities get readied on right click + description: Toggle whether abilities get readied on right click permission: mcmmo.commands.mcability mcrefresh: description: Refresh all cooldowns for mcMMO From 978ee4a9a310ce5d5f08ce561bc22ae2077a59ec Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 11 Apr 2023 15:49:37 -0700 Subject: [PATCH 7/9] Optimize the imports --- src/main/java/com/gmail/nossr50/config/BukkitConfig.java | 5 ++--- src/main/java/com/gmail/nossr50/listeners/BlockListener.java | 1 - .../java/com/gmail/nossr50/listeners/InventoryListener.java | 1 - src/main/java/com/gmail/nossr50/listeners/WorldListener.java | 3 --- src/main/java/com/gmail/nossr50/mcMMO.java | 1 - .../gmail/nossr50/runnables/skills/AwardCombatXpTask.java | 1 - .../java/com/gmail/nossr50/skills/mining/MiningManager.java | 1 - src/main/java/com/gmail/nossr50/util/EventUtils.java | 2 -- src/main/java/com/gmail/nossr50/util/ItemUtils.java | 1 - 9 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java index fff40e5e4..4a0f02e69 100644 --- a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java +++ b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java @@ -5,13 +5,12 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.NotNull; -import java.io.*; -import java.util.HashSet; +import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; -import java.util.Set; public abstract class BukkitConfig { boolean copyDefaults = true; diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index d931d6ca9..4e36e5e5c 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -38,7 +38,6 @@ import org.bukkit.event.block.*; import org.bukkit.inventory.ItemStack; import java.util.HashSet; -import java.util.Locale; public class BlockListener implements Listener { private final mcMMO plugin; diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index 2ac87e12a..6be0eb357 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -16,7 +16,6 @@ import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index 5dbcb3ab3..d8553f80e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -1,9 +1,7 @@ package com.gmail.nossr50.listeners; import com.gmail.nossr50.config.WorldBlacklist; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.player.UserManager; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.block.BlockState; @@ -13,7 +11,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.WorldUnloadEvent; -import org.bukkit.scheduler.BukkitRunnable; public class WorldListener implements Listener { private final mcMMO plugin; diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 9fafa309d..78b5b937b 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -68,7 +68,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java index e9aea8f2a..02e01ed1e 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.runnables.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 1e2dacc88..f2e4e617f 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.skills.mining; import com.gmail.nossr50.api.ItemSpawnReason; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.interactions.NotificationType; diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index c92b1f10d..3420f9f1a 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -44,8 +44,6 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerAnimationEvent; -import org.bukkit.event.player.PlayerAnimationType; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index ed763fdf3..4787e0159 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -import java.util.Locale; public final class ItemUtils { /** From 640f4b0a9bb8f1e96dd21d7d9ed266b06ae51315 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 17 Apr 2023 12:07:41 -0700 Subject: [PATCH 8/9] Fix mcMMO attempting to copy out custom repair/salvage configs --- ...java => AutoUpdateLegacyConfigLoader.java} | 10 +++---- .../gmail/nossr50/config/BukkitConfig.java | 28 ++++++++----------- ...figLoader.java => LegacyConfigLoader.java} | 11 ++++---- .../config/mods/ArmorConfigManager.java | 2 +- .../config/mods/BlockConfigManager.java | 2 +- ...nfig.java => CustomArmorLegacyConfig.java} | 6 ++-- ...nfig.java => CustomBlockLegacyConfig.java} | 6 ++-- ...fig.java => CustomEntityLegacyConfig.java} | 6 ++-- ...onfig.java => CustomToolLegacyConfig.java} | 6 ++-- .../config/mods/EntityConfigManager.java | 2 +- .../config/mods/ToolConfigManager.java | 2 +- .../config/skills/alchemy/PotionConfig.java | 4 +-- .../config/skills/repair/RepairConfig.java | 4 +-- .../skills/repair/RepairConfigManager.java | 4 +-- .../config/skills/salvage/SalvageConfig.java | 4 +-- .../skills/salvage/SalvageConfigManager.java | 4 +-- .../com/gmail/nossr50/util/ModManager.java | 16 +++++------ 17 files changed, 57 insertions(+), 60 deletions(-) rename src/main/java/com/gmail/nossr50/config/{AutoUpdateConfigLoader.java => AutoUpdateLegacyConfigLoader.java} (88%) rename src/main/java/com/gmail/nossr50/config/{ConfigLoader.java => LegacyConfigLoader.java} (89%) rename src/main/java/com/gmail/nossr50/config/mods/{CustomArmorConfig.java => CustomArmorLegacyConfig.java} (95%) rename src/main/java/com/gmail/nossr50/config/mods/{CustomBlockConfig.java => CustomBlockLegacyConfig.java} (94%) rename src/main/java/com/gmail/nossr50/config/mods/{CustomEntityConfig.java => CustomEntityLegacyConfig.java} (93%) rename src/main/java/com/gmail/nossr50/config/mods/{CustomToolConfig.java => CustomToolLegacyConfig.java} (95%) diff --git a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java b/src/main/java/com/gmail/nossr50/config/AutoUpdateLegacyConfigLoader.java similarity index 88% rename from src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java rename to src/main/java/com/gmail/nossr50/config/AutoUpdateLegacyConfigLoader.java index 710534e36..b021a7bac 100644 --- a/src/main/java/com/gmail/nossr50/config/AutoUpdateConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/AutoUpdateLegacyConfigLoader.java @@ -10,22 +10,22 @@ import java.io.IOException; import java.util.HashSet; import java.util.Set; -public abstract class AutoUpdateConfigLoader extends ConfigLoader { - public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) { +public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader { + public AutoUpdateLegacyConfigLoader(String relativePath, String fileName, File dataFolder) { super(relativePath, fileName, dataFolder); } - public AutoUpdateConfigLoader(String fileName, File dataFolder) { + public AutoUpdateLegacyConfigLoader(String fileName, File dataFolder) { super(fileName, dataFolder); } @Deprecated - public AutoUpdateConfigLoader(String relativePath, String fileName) { + public AutoUpdateLegacyConfigLoader(String relativePath, String fileName) { super(relativePath, fileName); } @Deprecated - public AutoUpdateConfigLoader(String fileName) { + public AutoUpdateLegacyConfigLoader(String fileName) { super(fileName); } diff --git a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java index 4a0f02e69..35c598e36 100644 --- a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java +++ b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java @@ -19,17 +19,7 @@ public abstract class BukkitConfig { protected YamlConfiguration defaultYamlConfig; protected YamlConfiguration config; protected @NotNull final File dataFolder; - - public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) { - mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); - this.fileName = fileName; - this.dataFolder = dataFolder; - configFile = new File(dataFolder, fileName); - this.defaultYamlConfig = copyDefaultConfig(); - this.config = initConfig(); - updateFile(); - mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); - } + private boolean savedDefaults = false; public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) { mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); @@ -37,12 +27,16 @@ public abstract class BukkitConfig { this.fileName = fileName; this.dataFolder = dataFolder; configFile = new File(dataFolder, fileName); - this.defaultYamlConfig = copyDefaultConfig(); + this.defaultYamlConfig = saveDefaultConfigToDisk(); this.config = initConfig(); updateFile(); mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); } + public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) { + this(fileName, dataFolder, true); + } + public BukkitConfig(@NotNull String fileName) { this(fileName, mcMMO.p.getDataFolder()); } @@ -55,10 +49,12 @@ public abstract class BukkitConfig { */ public void updateFile() { try { - if(copyDefaults) { - copyMissingDefaultsFromResource(); - } config.save(configFile); + + if(copyDefaults && !savedDefaults) { + copyMissingDefaultsFromResource(); + savedDefaults = true; + } } catch (IOException e) { e.printStackTrace(); } @@ -84,7 +80,7 @@ public abstract class BukkitConfig { /** * Copies the config from the JAR to defaults/ */ - YamlConfiguration copyDefaultConfig() { + YamlConfiguration saveDefaultConfigToDisk() { mcMMO.p.getLogger().info("[config] Copying default config to disk: " + fileName + " to defaults/" + fileName); try(InputStream inputStream = mcMMO.p.getResource(fileName)) { if(inputStream == null) { diff --git a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java b/src/main/java/com/gmail/nossr50/config/LegacyConfigLoader.java similarity index 89% rename from src/main/java/com/gmail/nossr50/config/ConfigLoader.java rename to src/main/java/com/gmail/nossr50/config/LegacyConfigLoader.java index 972bd697e..ebd82c237 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/LegacyConfigLoader.java @@ -7,20 +7,21 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.List; -public abstract class ConfigLoader { +@Deprecated +public abstract class LegacyConfigLoader { protected final File configFile; protected final @NotNull File dataFolder; protected String fileName; protected YamlConfiguration config; - public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) { + public LegacyConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) { this.fileName = fileName; this.dataFolder = dataFolder; configFile = new File(dataFolder, relativePath + File.separator + fileName); loadFile(); } - public ConfigLoader(String fileName, @NotNull File dataFolder) { + public LegacyConfigLoader(String fileName, @NotNull File dataFolder) { this.fileName = fileName; this.dataFolder = dataFolder; configFile = new File(dataFolder, fileName); @@ -28,7 +29,7 @@ public abstract class ConfigLoader { } @Deprecated - public ConfigLoader(String relativePath, String fileName) { + public LegacyConfigLoader(String relativePath, String fileName) { this.fileName = fileName; configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName); this.dataFolder = mcMMO.p.getDataFolder(); @@ -36,7 +37,7 @@ public abstract class ConfigLoader { } @Deprecated - public ConfigLoader(String fileName) { + public LegacyConfigLoader(String fileName) { this.fileName = fileName; configFile = new File(mcMMO.p.getDataFolder(), fileName); this.dataFolder = mcMMO.p.getDataFolder(); diff --git a/src/main/java/com/gmail/nossr50/config/mods/ArmorConfigManager.java b/src/main/java/com/gmail/nossr50/config/mods/ArmorConfigManager.java index 95f979e59..66d220d9a 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/ArmorConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/mods/ArmorConfigManager.java @@ -29,7 +29,7 @@ public class ArmorConfigManager { continue; } - modManager.registerCustomArmor(new CustomArmorConfig(fileName)); + modManager.registerCustomArmor(new CustomArmorLegacyConfig(fileName)); } } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/BlockConfigManager.java b/src/main/java/com/gmail/nossr50/config/mods/BlockConfigManager.java index 2b3c397ff..c6df0a1a0 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/BlockConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/mods/BlockConfigManager.java @@ -29,7 +29,7 @@ public class BlockConfigManager { continue; } - modManager.registerCustomBlocks(new CustomBlockConfig(fileName)); + modManager.registerCustomBlocks(new CustomBlockLegacyConfig(fileName)); } } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorLegacyConfig.java similarity index 95% rename from src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java rename to src/main/java/com/gmail/nossr50/config/mods/CustomArmorLegacyConfig.java index 0d456b588..1369d3026 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorLegacyConfig.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.config.mods; -import com.gmail.nossr50.config.ConfigLoader; +import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.mcMMO; @@ -13,7 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -public class CustomArmorConfig extends ConfigLoader { +public class CustomArmorLegacyConfig extends LegacyConfigLoader { public List customBoots = new ArrayList<>(); public List customChestplates = new ArrayList<>(); public List customHelmets = new ArrayList<>(); @@ -21,7 +21,7 @@ public class CustomArmorConfig extends ConfigLoader { public List repairables = new ArrayList<>(); private boolean needsUpdate = false; - protected CustomArmorConfig(String fileName) { + protected CustomArmorLegacyConfig(String fileName) { super("mods", fileName); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomBlockLegacyConfig.java similarity index 94% rename from src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java rename to src/main/java/com/gmail/nossr50/config/mods/CustomBlockLegacyConfig.java index 3d96ba7f9..4be1ef44a 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomBlockConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomBlockLegacyConfig.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.config.mods; -import com.gmail.nossr50.config.ConfigLoader; +import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.datatypes.mods.CustomBlock; import com.gmail.nossr50.mcMMO; import org.bukkit.Material; @@ -11,7 +11,7 @@ import java.util.HashMap; import java.util.List; import java.util.Set; -public class CustomBlockConfig extends ConfigLoader { +public class CustomBlockLegacyConfig extends LegacyConfigLoader { public List customExcavationBlocks = new ArrayList<>(); public List customHerbalismBlocks = new ArrayList<>(); public List customMiningBlocks = new ArrayList<>(); @@ -22,7 +22,7 @@ public class CustomBlockConfig extends ConfigLoader { public HashMap customBlockMap = new HashMap<>(); private boolean needsUpdate = false; - protected CustomBlockConfig(String fileName) { + protected CustomBlockLegacyConfig(String fileName) { super("mods", fileName); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomEntityLegacyConfig.java similarity index 93% rename from src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java rename to src/main/java/com/gmail/nossr50/config/mods/CustomEntityLegacyConfig.java index 27cfb1fd9..37244835c 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomEntityConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomEntityLegacyConfig.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.config.mods; -import com.gmail.nossr50.config.ConfigLoader; +import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.datatypes.mods.CustomEntity; import com.gmail.nossr50.mcMMO; import org.apache.commons.lang.ClassUtils; @@ -9,11 +9,11 @@ import org.bukkit.inventory.ItemStack; import java.util.HashMap; -public class CustomEntityConfig extends ConfigLoader { +public class CustomEntityLegacyConfig extends LegacyConfigLoader { public HashMap customEntityClassMap = new HashMap<>(); public HashMap customEntityTypeMap = new HashMap<>(); - protected CustomEntityConfig(String fileName) { + protected CustomEntityLegacyConfig(String fileName) { super("mods", fileName); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomToolLegacyConfig.java similarity index 95% rename from src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java rename to src/main/java/com/gmail/nossr50/config/mods/CustomToolLegacyConfig.java index 4ec07e220..ab6630cc7 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomToolLegacyConfig.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.config.mods; -import com.gmail.nossr50.config.ConfigLoader; +import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.datatypes.mods.CustomTool; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.datatypes.skills.MaterialType; @@ -15,7 +15,7 @@ import java.util.HashMap; import java.util.List; import java.util.Set; -public class CustomToolConfig extends ConfigLoader { +public class CustomToolLegacyConfig extends LegacyConfigLoader { public List customAxes = new ArrayList<>(); public List customBows = new ArrayList<>(); public List customHoes = new ArrayList<>(); @@ -26,7 +26,7 @@ public class CustomToolConfig extends ConfigLoader { public List repairables = new ArrayList<>(); private boolean needsUpdate = false; - protected CustomToolConfig(String fileName) { + protected CustomToolLegacyConfig(String fileName) { super("mods", fileName); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/mods/EntityConfigManager.java b/src/main/java/com/gmail/nossr50/config/mods/EntityConfigManager.java index 1ccedadea..85977bc67 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/EntityConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/mods/EntityConfigManager.java @@ -29,7 +29,7 @@ public class EntityConfigManager { continue; } - modManager.registerCustomEntities(new CustomEntityConfig(fileName)); + modManager.registerCustomEntities(new CustomEntityLegacyConfig(fileName)); } } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/ToolConfigManager.java b/src/main/java/com/gmail/nossr50/config/mods/ToolConfigManager.java index 0a4873056..9b0ac1b87 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/ToolConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/mods/ToolConfigManager.java @@ -29,7 +29,7 @@ public class ToolConfigManager { continue; } - modManager.registerCustomTools(new CustomToolConfig(fileName)); + modManager.registerCustomTools(new CustomToolLegacyConfig(fileName)); } } } diff --git a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java index fae1b3eb8..e8dd1a41c 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.config.skills.alchemy; -import com.gmail.nossr50.config.ConfigLoader; +import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; import com.gmail.nossr50.mcMMO; import org.bukkit.ChatColor; @@ -15,7 +15,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class PotionConfig extends ConfigLoader { +public class PotionConfig extends LegacyConfigLoader { private static PotionConfig instance; private final List concoctionsIngredientsTierOne = new ArrayList<>(); diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java index 14dafd766..85e8c9431 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java @@ -17,8 +17,8 @@ public class RepairConfig extends BukkitConfig { private final HashSet notSupported; private List repairables; - public RepairConfig(String fileName) { - super(fileName, false); + public RepairConfig(String fileName, boolean copyDefaults) { + super(fileName, copyDefaults); notSupported = new HashSet<>(); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfigManager.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfigManager.java index 28ba2a746..1a54906a7 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfigManager.java @@ -16,7 +16,7 @@ public class RepairConfigManager { Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml"); File dataFolder = plugin.getDataFolder(); - RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML); + RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML, true); repairables.addAll(mainRepairConfig.getLoadedRepairables()); for (String fileName : dataFolder.list()) { @@ -33,7 +33,7 @@ public class RepairConfigManager { continue; } - RepairConfig rConfig = new RepairConfig(fileName); + RepairConfig rConfig = new RepairConfig(fileName, false); repairables.addAll(rConfig.getLoadedRepairables()); } } diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index c8700274d..0900cebcc 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -20,8 +20,8 @@ public class SalvageConfig extends BukkitConfig { private final HashSet notSupported; private Set salvageables; - public SalvageConfig(String fileName) { - super(fileName); + public SalvageConfig(String fileName, boolean copyDefaults) { + super(fileName, copyDefaults); notSupported = new HashSet<>(); loadKeys(); } diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfigManager.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfigManager.java index 1e6617034..77348e8d3 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfigManager.java @@ -17,7 +17,7 @@ public class SalvageConfigManager { Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml"); File dataFolder = plugin.getDataFolder(); - SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML); + SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML, true); salvageables.addAll(mainSalvageConfig.getLoadedSalvageables()); for (String fileName : dataFolder.list()) { @@ -34,7 +34,7 @@ public class SalvageConfigManager { continue; } - SalvageConfig salvageConfig = new SalvageConfig(fileName); + SalvageConfig salvageConfig = new SalvageConfig(fileName, false); salvageables.addAll(salvageConfig.getLoadedSalvageables()); } } diff --git a/src/main/java/com/gmail/nossr50/util/ModManager.java b/src/main/java/com/gmail/nossr50/util/ModManager.java index 62646466a..4ec27d192 100644 --- a/src/main/java/com/gmail/nossr50/util/ModManager.java +++ b/src/main/java/com/gmail/nossr50/util/ModManager.java @@ -1,9 +1,9 @@ package com.gmail.nossr50.util; -import com.gmail.nossr50.config.mods.CustomArmorConfig; -import com.gmail.nossr50.config.mods.CustomBlockConfig; -import com.gmail.nossr50.config.mods.CustomEntityConfig; -import com.gmail.nossr50.config.mods.CustomToolConfig; +import com.gmail.nossr50.config.mods.CustomArmorLegacyConfig; +import com.gmail.nossr50.config.mods.CustomBlockLegacyConfig; +import com.gmail.nossr50.config.mods.CustomEntityLegacyConfig; +import com.gmail.nossr50.config.mods.CustomToolLegacyConfig; import com.gmail.nossr50.datatypes.mods.CustomBlock; import com.gmail.nossr50.datatypes.mods.CustomEntity; import com.gmail.nossr50.datatypes.mods.CustomTool; @@ -52,7 +52,7 @@ public class ModManager { private final List customSwords = new ArrayList<>(); private final HashMap customToolMap = new HashMap<>(); - public void registerCustomArmor(CustomArmorConfig config) { + public void registerCustomArmor(CustomArmorLegacyConfig config) { customBoots.addAll(config.customBoots); customChestplates.addAll(config.customChestplates); customHelmets.addAll(config.customHelmets); @@ -60,7 +60,7 @@ public class ModManager { repairables.addAll(config.repairables); } - public void registerCustomBlocks(CustomBlockConfig config) { + public void registerCustomBlocks(CustomBlockLegacyConfig config) { customExcavationBlocks.addAll(config.customExcavationBlocks); customHerbalismBlocks.addAll(config.customHerbalismBlocks); customMiningBlocks.addAll(config.customMiningBlocks); @@ -71,12 +71,12 @@ public class ModManager { customBlockMap.putAll(config.customBlockMap); } - public void registerCustomEntities(CustomEntityConfig config) { + public void registerCustomEntities(CustomEntityLegacyConfig config) { customEntityClassMap.putAll(config.customEntityClassMap); customEntityTypeMap.putAll(config.customEntityTypeMap); } - public void registerCustomTools(CustomToolConfig config) { + public void registerCustomTools(CustomToolLegacyConfig config) { customAxes.addAll(config.customAxes); customBows.addAll(config.customBows); customHoes.addAll(config.customHoes); From f40f68bdf06a8cc3d4a15eb93545ffddb13cbb18 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 17 Apr 2023 12:07:59 -0700 Subject: [PATCH 9/9] Fix RankConfig not using the new updating config system --- src/main/java/com/gmail/nossr50/config/RankConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/RankConfig.java b/src/main/java/com/gmail/nossr50/config/RankConfig.java index 003b27a4d..6b125c204 100644 --- a/src/main/java/com/gmail/nossr50/config/RankConfig.java +++ b/src/main/java/com/gmail/nossr50/config/RankConfig.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -public class RankConfig extends AutoUpdateConfigLoader { +public class RankConfig extends BukkitConfig { private static RankConfig instance; public RankConfig() { @@ -66,7 +66,7 @@ public class RankConfig extends AutoUpdateConfigLoader { */ public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) { String key = getRankAddressKey(subSkillType, rank, retroMode); - return config.getInt(key, getInternalConfig().getInt(key)); + return config.getInt(key, defaultYamlConfig.getInt(key)); } /** @@ -128,7 +128,7 @@ public class RankConfig extends AutoUpdateConfigLoader { private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) { String key = getRankAddressKey(subSkillType, rank, retroMode); - int defaultValue = getInternalConfig().getInt(key); + int defaultValue = defaultYamlConfig.getInt(key); config.set(key, defaultValue); mcMMO.p.getLogger().info(key + " SET -> " + defaultValue); }