Skip to content

Commit

Permalink
Prepare for 2.0.0, drop 1.16, 1.17 support
Browse files Browse the repository at this point in the history
Prepare for Version 2.0.0
  • Loading branch information
sarhatabaot authored Dec 7, 2024
2 parents 2eb8cf2 + 144bd38 commit 618c7fe
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 264 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion even-more-fish-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("com.oheers.evenmorefish.java-conventions")
}

version = 1.7
version = 2.0

dependencies {
compileOnly(libs.spigot.api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> values);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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;
}

}
4 changes: 2 additions & 2 deletions even-more-fish-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down Expand Up @@ -126,7 +126,7 @@ bukkit {
"GriefPrevention"
)
loadBefore = listOf("AntiAC")
apiVersion = "1.16"
apiVersion = "1.18"

commands {
register("evenmorefish") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class EvenMoreFish extends JavaPlugin implements EMFPlugin {
private final Random random = new Random();

private Permission permission = null;
private Map<Integer, Set<String>> fish = new HashMap<>();
private ItemStack customNBTRod;
private boolean checkingEatEvent;
private boolean checkingIntEvent;
Expand Down Expand Up @@ -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<Rarity, List<Fish>> getFishCollection() {
return FishManager.getInstance().getRarityMap();
}

@Override
public void onEnable() {

Expand Down Expand Up @@ -523,8 +514,6 @@ public void reload(@Nullable CommandSender sender) {

terminateGUIS();

fish.clear();

reloadConfig();
saveDefaultConfig();

Expand Down Expand Up @@ -589,10 +578,6 @@ public Permission getPermission() {
return permission;
}

public Map<Integer, Set<String>> getFish() {
return fish;
}

public ItemStack getCustomNBTRod() {
return customNBTRod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 618c7fe

Please sign in to comment.