From 35fbeb8ff17b1d934cfced8595b58210f4b70021 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Fri, 1 Mar 2024 09:42:29 -0500 Subject: [PATCH] Refactor commands directory, add compatibility classes for older versions. --- pom.xml | 2 +- .../lokka30/phantomworlds/PhantomWorlds.java | 34 +++++++--- .../comatibility/VersionCompatibility.java | 61 +++++++++++++++++ .../impl/OneSeventeenCompatibility.java | 67 +++++++++++++++++++ .../impl/OneTwentyCompatibility.java | 29 ++++++++ .../PWCommand.java | 40 +++++------ .../handler/PWInvalidUsageHandler.java | 2 +- .../params/AliasWorldParameter.java | 2 +- .../params/GamemodeParameter.java | 2 +- .../params/PortalParameter.java | 2 +- .../params/PotionEffectParameter.java | 11 +-- .../params/SettingParameter.java | 4 +- .../params/WorldFolderParameter.java | 4 +- .../sub/BackupCommand.java | 2 +- .../sub/CompatibilityCommand.java | 2 +- .../sub/CreateCommand.java | 2 +- .../sub/DebugCommand.java | 2 +- .../sub/DeleteCommand.java | 2 +- .../sub/ImportCommand.java | 2 +- .../sub/InfoCommand.java | 2 +- .../sub/ListCommand.java | 2 +- .../sub/LoadCommand.java | 4 +- .../sub/ReloadCommand.java | 2 +- .../sub/SetSpawnCommand.java | 2 +- .../sub/SpawnCommand.java | 2 +- .../sub/TeleportCommand.java | 2 +- .../sub/UnloadCommand.java | 2 +- .../sub/set/SetEffectsCommand.java | 2 +- .../sub/set/SetGamemodeCommand.java | 2 +- .../sub/set/SetPortalCommand.java | 2 +- .../sub/set/SetWhitelistCommand.java | 2 +- .../utils/WorldFolder.java | 2 +- .../player/PlayerChangeWorldListener.java | 2 +- .../phantomworlds/managers/WorldManager.java | 8 --- .../me/lokka30/phantomworlds/misc/Utils.java | 7 ++ .../phantomworlds/world/PhantomWorld.java | 32 --------- src/main/resources/plugin.yml | 2 +- src/main/resources/settings.yml | 2 +- 38 files changed, 248 insertions(+), 105 deletions(-) create mode 100644 src/main/java/me/lokka30/phantomworlds/comatibility/VersionCompatibility.java create mode 100644 src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneSeventeenCompatibility.java create mode 100644 src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneTwentyCompatibility.java rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/PWCommand.java (85%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/handler/PWInvalidUsageHandler.java (96%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/AliasWorldParameter.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/GamemodeParameter.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/PortalParameter.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/PotionEffectParameter.java (87%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/SettingParameter.java (93%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/params/WorldFolderParameter.java (95%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/BackupCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/CompatibilityCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/CreateCommand.java (99%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/DebugCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/DeleteCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/ImportCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/InfoCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/ListCommand.java (99%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/LoadCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/ReloadCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/SetSpawnCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/SpawnCommand.java (96%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/TeleportCommand.java (96%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/UnloadCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/set/SetEffectsCommand.java (98%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/set/SetGamemodeCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/set/SetPortalCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/sub/set/SetWhitelistCommand.java (97%) rename src/main/java/me/lokka30/phantomworlds/{commandsredux => commands}/utils/WorldFolder.java (94%) diff --git a/pom.xml b/pom.xml index dd8296e..4ccd486 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.lokka30 PhantomWorlds - 2.0.7 + 2.0.8 PhantomWorlds The Robust World Manager for Minecraft Servers diff --git a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java index 03ec77a..4375916 100644 --- a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java +++ b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java @@ -6,14 +6,17 @@ import me.lokka30.microlib.files.YamlConfigFile; import me.lokka30.microlib.maths.QuickTimer; import me.lokka30.microlib.other.UpdateChecker; -import me.lokka30.phantomworlds.commandsredux.PWCommand; -import me.lokka30.phantomworlds.commandsredux.params.AliasWorldParameter; -import me.lokka30.phantomworlds.commandsredux.params.GamemodeParameter; -import me.lokka30.phantomworlds.commandsredux.params.PortalParameter; -import me.lokka30.phantomworlds.commandsredux.params.PotionEffectParameter; -import me.lokka30.phantomworlds.commandsredux.params.SettingParameter; -import me.lokka30.phantomworlds.commandsredux.params.WorldFolderParameter; -import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder; +import me.lokka30.phantomworlds.comatibility.VersionCompatibility; +import me.lokka30.phantomworlds.comatibility.impl.OneSeventeenCompatibility; +import me.lokka30.phantomworlds.comatibility.impl.OneTwentyCompatibility; +import me.lokka30.phantomworlds.commands.PWCommand; +import me.lokka30.phantomworlds.commands.params.AliasWorldParameter; +import me.lokka30.phantomworlds.commands.params.GamemodeParameter; +import me.lokka30.phantomworlds.commands.params.PortalParameter; +import me.lokka30.phantomworlds.commands.params.PotionEffectParameter; +import me.lokka30.phantomworlds.commands.params.SettingParameter; +import me.lokka30.phantomworlds.commands.params.WorldFolderParameter; +import me.lokka30.phantomworlds.commands.utils.WorldFolder; import me.lokka30.phantomworlds.listeners.player.PlayerChangeWorldListener; import me.lokka30.phantomworlds.listeners.player.PlayerDeathListener; import me.lokka30.phantomworlds.listeners.player.PlayerJoinListener; @@ -24,8 +27,10 @@ import me.lokka30.phantomworlds.managers.WorldManager; import me.lokka30.phantomworlds.misc.CompatibilityChecker; import me.lokka30.phantomworlds.misc.UpdateCheckerResult; +import me.lokka30.phantomworlds.misc.Utils; import me.lokka30.phantomworlds.scheduler.BackupScheduler; import org.bstats.bukkit.Metrics; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.PortalType; import org.bukkit.World; @@ -63,6 +68,8 @@ public class PhantomWorlds extends JavaPlugin { private static PhantomWorlds instance; + private static VersionCompatibility compatibility; + protected LiteCommands command; private BukkitTask backupService = null; @@ -125,6 +132,13 @@ public void onEnable() { createTabs.addAll(generateCreateSuggestions()); QuickTimer timer = new QuickTimer(TimeUnit.MILLISECONDS); + + final String bukkitVersion = Bukkit.getServer().getBukkitVersion(); + if(Utils.isOneSeventeen(bukkitVersion)) { + compatibility = new OneSeventeenCompatibility(); + } else { + compatibility = new OneTwentyCompatibility(); + } checkCompatibility(); loadFiles(); @@ -312,6 +326,10 @@ public static WorldManager worldManager() { return instance.worldManager; } + public static VersionCompatibility compatibility() { + return compatibility; + } + private ArrayList generateCreateSuggestions() { final ArrayList suggestions = new ArrayList<>(); diff --git a/src/main/java/me/lokka30/phantomworlds/comatibility/VersionCompatibility.java b/src/main/java/me/lokka30/phantomworlds/comatibility/VersionCompatibility.java new file mode 100644 index 0000000..966c340 --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/comatibility/VersionCompatibility.java @@ -0,0 +1,61 @@ +package me.lokka30.phantomworlds.comatibility; +/* + * Phantom Worlds + * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import org.bukkit.NamespacedKey; +import org.bukkit.potion.PotionEffectType; + +import java.util.ArrayList; +import java.util.List; + +/** + * VersionCompatibility + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public interface VersionCompatibility { + + /** + * Used to return a list of potion effects suggestions for our /pw set effects command. + * @return The list containing the potion effects that exist. + */ + default List potionEffectSuggestions() { + + final List effects = new ArrayList<>(); + + for(PotionEffectType value : PotionEffectType.values()) { + + if(value == null) { //for some reason there is a null value here + continue; + } + effects.add(value.getKey() + ",duration,amplifier"); + effects.add(value.getKey() + ",-1,1"); + } + return effects; + } + + /** + * Used to find an {@link PotionEffectType effect type} based on a string. + * @param effectType The effect type. + * @return The effect type if found, otherwise null + */ + default PotionEffectType findType(final String effectType) { + return PotionEffectType.getByKey(NamespacedKey.fromString(effectType)); + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneSeventeenCompatibility.java b/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneSeventeenCompatibility.java new file mode 100644 index 0000000..70ea519 --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneSeventeenCompatibility.java @@ -0,0 +1,67 @@ +package me.lokka30.phantomworlds.comatibility.impl; +/* + * Phantom Worlds + * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import me.lokka30.phantomworlds.comatibility.VersionCompatibility; +import org.bukkit.potion.PotionEffectType; + +import java.util.ArrayList; +import java.util.List; + +/** + * OneSixteenCompatibility + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class OneSeventeenCompatibility implements VersionCompatibility { + + /** + * Used to return a list of potion effects suggestions for our /pw set effects command. + * + * @return The list containing the potion effects that exist. + */ + @Override + public List potionEffectSuggestions() { + + final List effects = new ArrayList<>(); + + for(PotionEffectType value : PotionEffectType.values()) { + + if(value == null) { //for some reason there is a null value here + continue; + } + + effects.add(value.getName() + ",duration,amplifier"); + effects.add(value.getName() + ",-1,1"); + } + return effects; + } + + /** + * Used to find an {@link PotionEffectType effect type} based on a string. + * + * @param effectType The effect type. + * + * @return The effect type if found, otherwise null + */ + @Override + public PotionEffectType findType(String effectType) { + return PotionEffectType.getByName(effectType); + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneTwentyCompatibility.java b/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneTwentyCompatibility.java new file mode 100644 index 0000000..4e8da88 --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/comatibility/impl/OneTwentyCompatibility.java @@ -0,0 +1,29 @@ +package me.lokka30.phantomworlds.comatibility.impl; +/* + * Phantom Worlds + * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import me.lokka30.phantomworlds.comatibility.VersionCompatibility; + +/** + * OneTwentyCompatibility + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class OneTwentyCompatibility implements VersionCompatibility { +} diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/PWCommand.java similarity index 85% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/PWCommand.java index 9ee0143..433fa54 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/PWCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux; +package me.lokka30.phantomworlds.commands; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar @@ -24,25 +24,25 @@ import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.optional.OptionalArg; import dev.rollczi.litecommands.annotations.permission.Permission; -import me.lokka30.phantomworlds.commandsredux.sub.BackupCommand; -import me.lokka30.phantomworlds.commandsredux.sub.CompatibilityCommand; -import me.lokka30.phantomworlds.commandsredux.sub.CreateCommand; -import me.lokka30.phantomworlds.commandsredux.sub.DebugCommand; -import me.lokka30.phantomworlds.commandsredux.sub.DeleteCommand; -import me.lokka30.phantomworlds.commandsredux.sub.ImportCommand; -import me.lokka30.phantomworlds.commandsredux.sub.InfoCommand; -import me.lokka30.phantomworlds.commandsredux.sub.ListCommand; -import me.lokka30.phantomworlds.commandsredux.sub.LoadCommand; -import me.lokka30.phantomworlds.commandsredux.sub.ReloadCommand; -import me.lokka30.phantomworlds.commandsredux.sub.SetSpawnCommand; -import me.lokka30.phantomworlds.commandsredux.sub.SpawnCommand; -import me.lokka30.phantomworlds.commandsredux.sub.TeleportCommand; -import me.lokka30.phantomworlds.commandsredux.sub.UnloadCommand; -import me.lokka30.phantomworlds.commandsredux.sub.set.SetEffectsCommand; -import me.lokka30.phantomworlds.commandsredux.sub.set.SetGamemodeCommand; -import me.lokka30.phantomworlds.commandsredux.sub.set.SetPortalCommand; -import me.lokka30.phantomworlds.commandsredux.sub.set.SetWhitelistCommand; -import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder; +import me.lokka30.phantomworlds.commands.sub.BackupCommand; +import me.lokka30.phantomworlds.commands.sub.CompatibilityCommand; +import me.lokka30.phantomworlds.commands.sub.CreateCommand; +import me.lokka30.phantomworlds.commands.sub.DebugCommand; +import me.lokka30.phantomworlds.commands.sub.DeleteCommand; +import me.lokka30.phantomworlds.commands.sub.ImportCommand; +import me.lokka30.phantomworlds.commands.sub.InfoCommand; +import me.lokka30.phantomworlds.commands.sub.ListCommand; +import me.lokka30.phantomworlds.commands.sub.LoadCommand; +import me.lokka30.phantomworlds.commands.sub.ReloadCommand; +import me.lokka30.phantomworlds.commands.sub.SetSpawnCommand; +import me.lokka30.phantomworlds.commands.sub.SpawnCommand; +import me.lokka30.phantomworlds.commands.sub.TeleportCommand; +import me.lokka30.phantomworlds.commands.sub.UnloadCommand; +import me.lokka30.phantomworlds.commands.sub.set.SetEffectsCommand; +import me.lokka30.phantomworlds.commands.sub.set.SetGamemodeCommand; +import me.lokka30.phantomworlds.commands.sub.set.SetPortalCommand; +import me.lokka30.phantomworlds.commands.sub.set.SetWhitelistCommand; +import me.lokka30.phantomworlds.commands.utils.WorldFolder; import org.bukkit.GameMode; import org.bukkit.PortalType; import org.bukkit.World; diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java b/src/main/java/me/lokka30/phantomworlds/commands/handler/PWInvalidUsageHandler.java similarity index 96% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java rename to src/main/java/me/lokka30/phantomworlds/commands/handler/PWInvalidUsageHandler.java index 355acbe..3e73285 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/handler/PWInvalidUsageHandler.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.handler; +package me.lokka30.phantomworlds.commands.handler; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/AliasWorldParameter.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/AliasWorldParameter.java index 9525884..657bbb7 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/AliasWorldParameter.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/GamemodeParameter.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/GamemodeParameter.java index aebcedc..8921fd1 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/GamemodeParameter.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/PortalParameter.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/PortalParameter.java index 5b702ac..f275d7f 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/PortalParameter.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/PotionEffectParameter.java similarity index 87% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/PotionEffectParameter.java index aaf284d..b1dd3e8 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/PotionEffectParameter.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar @@ -23,6 +23,7 @@ import dev.rollczi.litecommands.invocation.Invocation; import dev.rollczi.litecommands.suggestion.SuggestionContext; import dev.rollczi.litecommands.suggestion.SuggestionResult; +import me.lokka30.phantomworlds.PhantomWorlds; import org.bukkit.command.CommandSender; import org.bukkit.potion.PotionEffectType; @@ -40,10 +41,10 @@ public class PotionEffectParameter extends ArgumentResolver POTION_EFFECTS = new ArrayList<>(); static { - for(PotionEffectType value : PotionEffectType.values()) { - POTION_EFFECTS.add(value.getKey() + ",duration,amplifier"); - POTION_EFFECTS.add(value.getKey() + ",-1,1"); - } + + System.out.println("Null Check: " + (PhantomWorlds.compatibility() == null)); + + POTION_EFFECTS.addAll(PhantomWorlds.compatibility().potionEffectSuggestions()); } @Override diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/SettingParameter.java similarity index 93% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/SettingParameter.java index 491d9f9..a1b9923 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/SettingParameter.java @@ -1,7 +1,7 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds - * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java b/src/main/java/me/lokka30/phantomworlds/commands/params/WorldFolderParameter.java similarity index 95% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java rename to src/main/java/me/lokka30/phantomworlds/commands/params/WorldFolderParameter.java index 4136a1e..db36120 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/params/WorldFolderParameter.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.params; +package me.lokka30.phantomworlds.commands.params; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar @@ -23,7 +23,7 @@ import dev.rollczi.litecommands.invocation.Invocation; import dev.rollczi.litecommands.suggestion.SuggestionContext; import dev.rollczi.litecommands.suggestion.SuggestionResult; -import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder; +import me.lokka30.phantomworlds.commands.utils.WorldFolder; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/BackupCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/BackupCommand.java index 0d2f3a1..99f0dc7 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/BackupCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/CompatibilityCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/CompatibilityCommand.java index a32b3bc..6094501 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/CompatibilityCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/CreateCommand.java similarity index 99% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/CreateCommand.java index f67b5a0..b5df828 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/CreateCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/DebugCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/DebugCommand.java index 3c97ad9..acf7083 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/DebugCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/DeleteCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/DeleteCommand.java index 9312650..4d18d88 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/DeleteCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/ImportCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/ImportCommand.java index 27d55cd..712549b 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/ImportCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/InfoCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/InfoCommand.java index 1e7258d..d6584c1 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/InfoCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/ListCommand.java similarity index 99% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/ListCommand.java index f35839a..ebf1b36 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/ListCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/LoadCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/LoadCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/LoadCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/LoadCommand.java index 442d977..74994eb 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/LoadCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/LoadCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar @@ -19,7 +19,7 @@ import me.lokka30.microlib.messaging.MultiMessage; import me.lokka30.phantomworlds.PhantomWorlds; -import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder; +import me.lokka30.phantomworlds.commands.utils.WorldFolder; import me.lokka30.phantomworlds.misc.WorldLoadResponse; import org.bukkit.command.CommandSender; diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/ReloadCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/ReloadCommand.java index 9f4fbbb..350211e 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/ReloadCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/SetSpawnCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/SetSpawnCommand.java index 5a13fd9..af9789a 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/SetSpawnCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/SpawnCommand.java similarity index 96% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/SpawnCommand.java index 115bc57..7a44614 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/SpawnCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/TeleportCommand.java similarity index 96% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/TeleportCommand.java index 2fbb8e7..477b725 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/TeleportCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/UnloadCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/UnloadCommand.java index a1addf5..993ab61 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/UnloadCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub; +package me.lokka30.phantomworlds.commands.sub; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetEffectsCommand.java similarity index 98% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetEffectsCommand.java index d2d3cd8..df685fc 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetEffectsCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub.set; +package me.lokka30.phantomworlds.commands.sub.set; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetGamemodeCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetGamemodeCommand.java index fc99cb7..eb436bb 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetGamemodeCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub.set; +package me.lokka30.phantomworlds.commands.sub.set; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetPortalCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetPortalCommand.java index 6dc0ef0..45cc0c2 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetPortalCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub.set; +package me.lokka30.phantomworlds.commands.sub.set; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetWhitelistCommand.java similarity index 97% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java rename to src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetWhitelistCommand.java index 4db93d5..e5070b5 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/sub/set/SetWhitelistCommand.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.sub.set; +package me.lokka30.phantomworlds.commands.sub.set; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java b/src/main/java/me/lokka30/phantomworlds/commands/utils/WorldFolder.java similarity index 94% rename from src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java rename to src/main/java/me/lokka30/phantomworlds/commands/utils/WorldFolder.java index 476584d..d9b4fff 100644 --- a/src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/utils/WorldFolder.java @@ -1,4 +1,4 @@ -package me.lokka30.phantomworlds.commandsredux.utils; +package me.lokka30.phantomworlds.commands.utils; /* * Phantom Worlds * Copyright (C) 2023 - 2024 Daniel "creatorfromhell" Vidmar diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java index 8a18c69..f7bbbda 100644 --- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java +++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java @@ -81,7 +81,7 @@ public void onChangeWorld(PlayerChangedWorldEvent event) { final int duration = PhantomWorlds.instance().data.getConfig().getInt(cfgPath + ".effects." + effName + ".duration", -1); final int amplifier = PhantomWorlds.instance().data.getConfig().getInt(cfgPath + ".effects." + effName + ".amplifier", 1); - final PotionEffectType type = PotionEffectType.getByKey(NamespacedKey.fromString(effName)); + final PotionEffectType type = PhantomWorlds.compatibility().findType(effName); if(type != null) { final PotionEffect effect = new PotionEffect(type, duration, amplifier); event.getPlayer().addPotionEffect(effect); diff --git a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java index 4572f1a..f78dc8d 100644 --- a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java +++ b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java @@ -18,7 +18,6 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; import static me.lokka30.phantomworlds.misc.Utils.zipFolder; @@ -154,13 +153,6 @@ public PhantomWorld getPhantomWorldFromData(final String name) { PhantomWorlds.instance().data.getConfig().getString(cfgPath + "gameMode", "SURVIVAL") ) ); - - if(PhantomWorlds.instance().data.getConfig().contains(cfgPath + "rules") && - PhantomWorlds.instance().data.getConfig().isConfigurationSection(cfgPath + "rules")) { - for(final String rule : PhantomWorlds.instance().data.getConfig().getConfigurationSection(cfgPath + "rules").getKeys(false)) { - world.getGamerules().put(rule, PhantomWorlds.instance().data.getConfig().getString(cfgPath + "rules." + rule)); - } - } return world; } diff --git a/src/main/java/me/lokka30/phantomworlds/misc/Utils.java b/src/main/java/me/lokka30/phantomworlds/misc/Utils.java index b565360..4564385 100644 --- a/src/main/java/me/lokka30/phantomworlds/misc/Utils.java +++ b/src/main/java/me/lokka30/phantomworlds/misc/Utils.java @@ -415,4 +415,11 @@ public static String defaultWorld() { return "world"; } } + + public static boolean isOneSeventeen(final String version) { + return version.contains("1.17") || version.contains("1.7") || version.contains("1.8") || + version.contains("1.9") || version.contains("1.10") || version.contains("1.11") || + version.contains("1.12") || version.contains("1.13") || version.contains("1.14") || + version.contains("1.15") || version.contains("1.16"); + } } \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java b/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java index 2221412..6e3bb20 100644 --- a/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java +++ b/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java @@ -20,7 +20,6 @@ import me.lokka30.phantomworlds.PhantomWorlds; import org.bukkit.Difficulty; import org.bukkit.GameMode; -import org.bukkit.GameRule; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.WorldType; @@ -28,8 +27,6 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; /** * PhantomWorld object to make it easier to work with PW-managed worlds. @@ -39,8 +36,6 @@ */ public class PhantomWorld { - private final Map gamerules = new HashMap<>(); - private final String name; private final World.Environment environment; private final boolean generateStructures; @@ -126,25 +121,6 @@ public void create() { world.setKeepSpawnInMemory(keepSpawnInMemory); world.setPVP(allowPvP); world.setDifficulty(difficulty); - - for(Map.Entry entry : gamerules.entrySet()) { - final GameRule rule = GameRule.getByName(entry.getKey()); - if(rule == null) continue; - - if(rule.getType() == Boolean.class) { - try { - world.setGameRule((GameRule)rule, Boolean.valueOf(entry.getValue())); - } catch(Exception ignore) { - PhantomWorlds.logger().warning("Error setting gamerule: " + entry.getKey() + " for world: " + name + "! Invalid boolean value!"); - } - } else if(rule.getType() == Integer.class) { - try { - world.setGameRule((GameRule)rule, Integer.valueOf(entry.getValue())); - } catch(Exception ignore) { - PhantomWorlds.logger().warning("Error setting gamerule: " + entry.getKey() + " for world: " + name + "! Invalid integer value!"); - } - } - } } public void save() { @@ -171,14 +147,6 @@ public void save() { } } - public void loadGameRules() { - - } - - public Map getGamerules() { - return gamerules; - } - public String name() { return name; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 1d946f4..5bf69b5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,7 +5,7 @@ # / / | `.__/| / | \__/ `._.' / ' / |,' \,' `._.' / /\__ `___,' \___.' name: 'PhantomWorlds' -version: '2.07' +version: '2.08' description: 'The Robust World Manager for Minecraft Servers' authors: [ 'creatorfromhell', 'lokka30' ] website: 'https://github.com/lokka30/PhantomWorlds' diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index 0b59b2f..4b4c510 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -24,7 +24,7 @@ spawning: delete-archive: true #Should worlds be automatically backed up to the backup folder? -backup-scheduler: true +backup-scheduler: false #The time, in seconds, to back up every PhantomWorlds-managed world. backup-delay: 600