diff --git a/README.md b/README.md index 616a733f1..036c9eb4c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ plugin for your server. --- -Supported Versions: 1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.6, 1.21.1, 1.21.3 (Experimental, Dev Builds) +Supported Versions: 1.18.2, 1.19.4, 1.20.6, 1.21.1, 1.21.3 (Experimental, Dev Builds) If you encounter any issues with the plugin, please do the following before reporting the problem: - Create a Spigot or Paper test server using one of the supported versions. diff --git a/even-more-fish-api/build.gradle.kts b/even-more-fish-api/build.gradle.kts index 20c025b83..4a23f4cb8 100644 --- a/even-more-fish-api/build.gradle.kts +++ b/even-more-fish-api/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("com.oheers.evenmorefish.java-conventions") } -version = 1.7 +version = 2.0 dependencies { compileOnly(libs.spigot.api) diff --git a/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/EMFRequirementsLoadEvent.java b/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/EMFRequirementsLoadEvent.java index 66c081759..613eb217b 100644 --- a/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/EMFRequirementsLoadEvent.java +++ b/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/EMFRequirementsLoadEvent.java @@ -9,7 +9,7 @@ */ public class EMFRequirementsLoadEvent extends Event { - private static HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList(); public static HandlerList getHandlerList() { return handlers; diff --git a/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/RequirementType.java b/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/RequirementType.java index 9096c40d9..739e0c6ec 100644 --- a/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/RequirementType.java +++ b/even-more-fish-api/src/main/java/com/oheers/fish/api/requirement/RequirementType.java @@ -13,8 +13,8 @@ public interface RequirementType { /** * Checks if a player meets this requirement. - * @param player The player to check - * @param value The value to check + * @param context The context to check + * @param values The values to check this context against */ boolean checkRequirement(@NotNull RequirementContext context, @NotNull List values); diff --git a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardEvent.java b/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardEvent.java deleted file mode 100644 index a4d9c6913..000000000 --- a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.oheers.fish.api.reward; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -/** - * @deprecated Use a custom {@link RewardType} instead. - */ -@Deprecated -public class EMFRewardEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - Reward reward; - Player player; - Vector fishVelocity; - Location hookLocation; - - public EMFRewardEvent(Reward reward, Player player, Vector fishVelocity, Location hookLocation) { - this.reward = reward; - this.player = player; - this.fishVelocity = fishVelocity; - this.hookLocation = hookLocation; - } - - public static HandlerList getHandlerList() { - return handlers; - } - - @Override - public @NotNull HandlerList getHandlers() { - return handlers; - } - - /** - * @return A list of Reward objects that will be run on the player. - */ - public Reward getReward() { - return this.reward; - } - - /** - * @return The player that each Reward object will be run on - */ - public Player getPlayer() { - return this.player; - } - - /** - * @return The vector velocity of the fish. - */ - public Vector getVelocity() { - return fishVelocity; - } - - /** - * @return The location of the hook of the fishing rod. - */ - public Location getHookLocation() { - return hookLocation; - } -} \ No newline at end of file diff --git a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardsLoadEvent.java b/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardsLoadEvent.java index cc0632f33..f15609780 100644 --- a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardsLoadEvent.java +++ b/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/EMFRewardsLoadEvent.java @@ -9,7 +9,7 @@ */ public class EMFRewardsLoadEvent extends Event { - private static HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList(); public static HandlerList getHandlerList() { return handlers; diff --git a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/Reward.java b/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/Reward.java index d01d3d59f..d57c7522a 100644 --- a/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/Reward.java +++ b/even-more-fish-api/src/main/java/com/oheers/fish/api/reward/Reward.java @@ -1,18 +1,18 @@ package com.oheers.fish.api.reward; import com.oheers.fish.api.plugin.EMFPlugin; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; public class Reward { - private @NotNull String key; - private @NotNull String value; + private final @NotNull String key; + private final @NotNull String value; private RewardType rewardType = null; private Vector fishVelocity; @@ -43,19 +43,20 @@ public RewardType getRewardType() { public @NotNull String getValue() { return this.value; } // Ignore deprecation warnings, we need to keep the old event for outdated addons. - @SuppressWarnings("deprecation") public void rewardPlayer(@NotNull Player player, Location hookLocation) { if (getRewardType() == null) { - EMFPlugin.getLogger().warning("No reward type found for key: " + getKey() + ". Falling back to the deprecated event-based rewards."); - EMFRewardEvent event = new EMFRewardEvent(this, player, fishVelocity, hookLocation); - Bukkit.getPluginManager().callEvent(event); + EMFPlugin.getLogger().warning("No reward type found for key: " + getKey()); return; } getRewardType().doReward(player, getKey(), getValue(), hookLocation); } - public void setFishVelocity(Vector fishVelocity) { + public void setFishVelocity(@Nullable Vector fishVelocity) { this.fishVelocity = fishVelocity; } + public @Nullable Vector getFishVelocity() { + return this.fishVelocity; + } + } diff --git a/even-more-fish-plugin/build.gradle.kts b/even-more-fish-plugin/build.gradle.kts index 080992951..0aa960ac0 100644 --- a/even-more-fish-plugin/build.gradle.kts +++ b/even-more-fish-plugin/build.gradle.kts @@ -13,7 +13,7 @@ plugins { } group = "com.oheers.evenmorefish" -version = "1.7.4" +version = "2.0.0" description = "A fishing extension bringing an exciting new experience to fishing." @@ -126,7 +126,7 @@ bukkit { "GriefPrevention" ) loadBefore = listOf("AntiAC") - apiVersion = "1.16" + apiVersion = "1.18" commands { register("evenmorefish") { diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/EvenMoreFish.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/EvenMoreFish.java index 2d757e65f..bea5bb35c 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/EvenMoreFish.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/EvenMoreFish.java @@ -76,7 +76,6 @@ public class EvenMoreFish extends JavaPlugin implements EMFPlugin { private final Random random = new Random(); private Permission permission = null; - private Map> fish = new HashMap<>(); private ItemStack customNBTRod; private boolean checkingEatEvent; private boolean checkingIntEvent; @@ -120,14 +119,6 @@ public AddonManager getAddonManager() { return addonManager; } - /** - * @deprecated Use {@link FishManager#getRarityMap()} instead. This method will be removed in EMF 1.8 - */ - @Deprecated(forRemoval = true) - public Map> getFishCollection() { - return FishManager.getInstance().getRarityMap(); - } - @Override public void onEnable() { @@ -523,8 +514,6 @@ public void reload(@Nullable CommandSender sender) { terminateGUIS(); - fish.clear(); - reloadConfig(); saveDefaultConfig(); @@ -589,10 +578,6 @@ public Permission getPermission() { return permission; } - public Map> getFish() { - return fish; - } - public ItemStack getCustomNBTRod() { return customNBTRod; } diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/PlaceholderReceiver.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/PlaceholderReceiver.java index 24fb297f3..e45ba3a55 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/PlaceholderReceiver.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/PlaceholderReceiver.java @@ -265,27 +265,26 @@ public String onPlaceholderRequest(Player player, @NotNull String identifier) { return null; } } - - if (identifier.equals("competition_time_left")) { - return Competition.getNextCompetitionMessage().getRawMessage(); - } - - if (identifier.equals("competition_active")) { - return Boolean.toString(Competition.isActive()); - } - if (identifier.equals("custom_fishing_boolean")) { - return Boolean.toString(plugin.isCustomFishing(player)); - } - - if (identifier.equals("custom_fishing_status")) { - if (plugin.isCustomFishing(player)) { - return new Message(ConfigMessage.CUSTOM_FISHING_ENABLED).getRawMessage(); - } else { - return new Message(ConfigMessage.CUSTOM_FISHING_DISABLED).getRawMessage(); + switch (identifier) { + case "competition_time_left" -> { + return Competition.getNextCompetitionMessage().getRawMessage(); + } + case "competition_active" -> { + return Boolean.toString(Competition.isActive()); + } + case "custom_fishing_boolean" -> { + return Boolean.toString(plugin.isCustomFishing(player)); + } + case "custom_fishing_status" -> { + if (plugin.isCustomFishing(player)) { + return new Message(ConfigMessage.CUSTOM_FISHING_ENABLED).getRawMessage(); + } else { + return new Message(ConfigMessage.CUSTOM_FISHING_DISABLED).getRawMessage(); + } } } - + // We return null if an invalid placeholder (f.e. %someplugin_placeholder3%) // was provided return null; diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/Message.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/Message.java index 09a1e3e54..f8e8b2824 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/Message.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/Message.java @@ -288,7 +288,7 @@ public void setRarityColour(@NotNull final String colour) { /** * The player's name to replace the {player} variable. * - * @param playerName The name of the player. + * @param player The player. */ public void setPlayer(@NotNull final OfflinePlayer player) { relevantPlayer = player; diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/OldMessage.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/OldMessage.java deleted file mode 100644 index 937613816..000000000 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/config/messages/OldMessage.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.oheers.fish.config.messages; - -import com.oheers.fish.EvenMoreFish; -import com.oheers.fish.FishUtils; -import me.clip.placeholderapi.PlaceholderAPI; -import org.bukkit.entity.Player; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * @deprecated Use {@link Message} instead. This class will be removed in EMF 1.8 - */ -@Deprecated -public class OldMessage { - - // msg is the string got from the messages.yml file - - String msg; - Player receiver; - - // the list of variables loaded - List> variableMap = new ArrayList<>(); - - public OldMessage() { - - } - - public OldMessage setMSG(String msg) { - this.msg = msg; - return this; - } - - public OldMessage setReceiver(Player receiver) { - this.receiver = receiver; - return this; - } - - public OldMessage setPlayer(String player) { - variableMap.add(new AbstractMap.SimpleEntry<>("{player}", player)); - return this; - } - - public OldMessage setLength(String length) { - variableMap.add(new AbstractMap.SimpleEntry<>("{length}", length)); - return this; - } - - public OldMessage setRarity(String rarity) { - variableMap.add(new AbstractMap.SimpleEntry<>("{rarity}", rarity)); - return this; - } - - public OldMessage setPosition(String position) { - variableMap.add(new AbstractMap.SimpleEntry<>("{position}", position)); - return this; - } - - public OldMessage setAmount(String amount) { - variableMap.add(new AbstractMap.SimpleEntry<>("{amount}", amount)); - return this; - } - - public OldMessage setEffect(String effect) { - variableMap.add(new AbstractMap.SimpleEntry<>("{effect}", effect)); - return this; - } - - public OldMessage setAmplifier(String amplifier) { - variableMap.add(new AbstractMap.SimpleEntry<>("{amplifier}", amplifier)); - return this; - } - - public OldMessage setTime(String time) { - variableMap.add(new AbstractMap.SimpleEntry<>("{time}", time)); - return this; - } - - public OldMessage setItem(String item) { - variableMap.add(new AbstractMap.SimpleEntry<>("{item}", item)); - return this; - } - - public OldMessage setName(String name) { - variableMap.add(new AbstractMap.SimpleEntry<>("{name}", name)); - return this; - } - - public OldMessage setBait(String bait) { - variableMap.add(new AbstractMap.SimpleEntry<>("{bait}", bait)); - return this; - } - - public OldMessage setCurrBaits(String currBaits) { - variableMap.add(new AbstractMap.SimpleEntry<>("{current_baits}", currBaits)); - return this; - } - - public OldMessage setMaxBaits(String maxBaits) { - variableMap.add(new AbstractMap.SimpleEntry<>("{max_baits}", maxBaits)); - return this; - } - - public OldMessage setBaitTheme(String theme) { - variableMap.add(new AbstractMap.SimpleEntry<>("{bait_theme}", theme)); - return this; - } - - public String toString() { - - if (EvenMoreFish.getInstance().isUsingPAPI()) { - if (receiver != null) { - msg = PlaceholderAPI.setPlaceholders(receiver, msg); - } - } - - for (Map.Entry replacement : variableMap) { - msg = msg.replace(replacement.getKey(), replacement.getValue()); - } - - return FishUtils.translateColorCodes(msg); - - } -} \ No newline at end of file diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Fish.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Fish.java index ee093bee5..cb3ebe3f4 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Fish.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Fish.java @@ -106,7 +106,7 @@ public Fish(@NotNull Rarity rarity, @Nullable Section section) throws InvalidFis * If possible, prefer {@link Fish#Fish(Rarity, Section)} instead. */ public Fish(@NotNull Rarity rarity, @NotNull String name) throws InvalidFishException { - // Manually obtain the section when this deprecated constructor is used. + // Manually obtain the section for this. this(rarity, FishFile.getInstance().getConfig().getSection("fish." + rarity.getValue() + "." + name)); } diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/FishManager.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/FishManager.java index f1be5939f..b40e6c3f7 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/FishManager.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/FishManager.java @@ -23,7 +23,7 @@ public class FishManager { private static FishManager instance; - private Map> rarityMap; + private final Map> rarityMap; private boolean loaded = false; private FishManager() { diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Rarity.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Rarity.java index 06e3edb92..2555fa9e2 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Rarity.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/fishing/items/Rarity.java @@ -45,20 +45,6 @@ public Rarity(@NotNull Section section) { handleRequirements(section); } - /** - * Constructs a rarity with the provided values. - * @deprecated Use {@link Rarity#Rarity(Section)} instead. This constructor will be removed for EMF 1.8. - */ - @Deprecated(forRemoval = true) - public Rarity(String value, String colour, double weight, boolean announce, boolean useConfigCasing, String loreOverride) { - this.value = value; - this.colour = colour; - this.weight = weight; - this.announce = announce; - this.loreOverride = loreOverride; - this.useConfigCasing = useConfigCasing; - } - private void handleRequirements(@NotNull Section raritySection) { Section requirementSection = raritySection.getSection("requirements"); requirement = new Requirement(); diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/gui/guis/SellGUI.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/gui/guis/SellGUI.java index aab05260c..e4eb9ddef 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/gui/guis/SellGUI.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/gui/guis/SellGUI.java @@ -30,10 +30,8 @@ public class SellGUI implements EMFGUI { private final Player player; private final Inventory fishInventory; private MyScheduledTask task; - private final SellState sellState; public SellGUI(@NotNull Player player, @NotNull SellState sellState, @Nullable Inventory fishInventory) { - this.sellState = sellState; this.player = player; Section section; if (sellState == SellState.NORMAL) { diff --git a/even-more-fish-plugin/src/main/java/com/oheers/fish/utils/ItemFactory.java b/even-more-fish-plugin/src/main/java/com/oheers/fish/utils/ItemFactory.java index 93edbb928..2bbdc2c95 100644 --- a/even-more-fish-plugin/src/main/java/com/oheers/fish/utils/ItemFactory.java +++ b/even-more-fish-plugin/src/main/java/com/oheers/fish/utils/ItemFactory.java @@ -529,7 +529,7 @@ public void applyDamage() { } } - product.setItemMeta((ItemMeta) nonDamaged); + product.setItemMeta(nonDamaged); } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9c24508ad..79dc3708b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,7 @@ include(":even-more-fish-plugin") dependencyResolutionManagement { versionCatalogs { create("libs") { - library("spigot-api", "org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT") + library("spigot-api", "org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") library("vault-api", "com.github.MilkBowl:VaultAPI:1.7.1") library("placeholder-api", "me.clip:placeholderapi:2.11.6") library("bstats", "org.bstats:bstats-bukkit:3.0.2") diff --git a/wiki/Home.md b/wiki/Home.md index ade10447d..0386bf5b0 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -16,7 +16,7 @@ This is a feature-rich plugin providing a new experience to fishing on Minecraft ### Downloading -The latest version of the plugin will always be available at the [official SpigotMC page](https://www.spigotmc.org/resources/evenmorefish-%E2%96%AA-extensive-fishing-plugin-%E2%96%AA.91310/updates). To run it on your server, insert the .jar file into your server's `plugin` folder and **restart** the server completely. +The latest version of the plugin will always be available at the official [SpigotMC page](https://www.spigotmc.org/resources/evenmorefish-%E2%96%AA-extensive-fishing-plugin-%E2%96%AA.91310/updates) or [Modrinth page](https://modrinth.com/plugin/evenmorefish). To run it on your server, insert the .jar file into your server's `plugin` folder and **restart** the server completely. ### Development Builds Untested, bleeding edge builds are available at [Jenkins](https://ci.codemc.io/job/Oheers/job/EvenMoreFish/) @@ -25,7 +25,7 @@ Untested, bleeding edge builds are available at [Jenkins](https://ci.codemc.io/j This is for more advanced users, though it comes with the added benefit of a more up-to-date version of the plugin. Please note that self-compiled versions of the plugin may only partially work, or not work atall. In most cases, support won't be offered to versions that haven't been fully released but bug reports would be massively appreciated. -To get the files needed to compile, run `git clone https://github.com/Oheers/EvenMoreFish.git` on your computer, which provides you with the source code for the plugin. Go into the newly created directory and run `./gradlew build` and locate the `even-more-fish-plugin/build/libs` folder where you will see a .jar file called `even-more-fish-{version}.jar`. +To get the files needed to compile, run `git clone https://github.com/Oheers/EvenMoreFish.git` on your computer, which provides you with the source code for the plugin. Go into the newly created directory and run `./gradlew build` and locate the `even-more-fish-plugin/build/libs` folder where you will see a .jar file called `even-more-fish-{version}-{compile-timestamp}.jar`. ### Configuring -Once installed, you will most likely want to make changes to how the plugin runs: to do this, you will need to configure the plugin using its config files. For an in-depth guide on how to do this, go to wiki.notsetup.yet \ No newline at end of file +Once installed, you will most likely want to make changes to how the plugin runs: to do this, you will need to configure the plugin using its config files. There are guides for most of these files in this wiki. \ No newline at end of file