diff --git a/build.gradle.kts b/build.gradle.kts index e1818f2..9a07ed8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -66,7 +66,7 @@ tasks.compileJava.configure { options.release.set(8) } -version = "2.9.12a" +version = "2.9.13a-SNAPSHOT-01" tasks.named("processResources") { filesMatching("plugin.yml") { diff --git a/src/main/java/main/java/me/dniym/IllegalStack.java b/src/main/java/main/java/me/dniym/IllegalStack.java index 1d51ddf..050a0ca 100644 --- a/src/main/java/main/java/me/dniym/IllegalStack.java +++ b/src/main/java/main/java/me/dniym/IllegalStack.java @@ -1143,6 +1143,8 @@ private void setVersion() { serverVersion = ServerVersion.v1_20_R5; } else if (bukkitVersion.contains("1.21")) { serverVersion = ServerVersion.v1_21_R1; + } else if (bukkitVersion.contains("1.21.1")) { + serverVersion = ServerVersion.v1_21_R2; } else { serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", "")); } diff --git a/src/main/java/main/java/me/dniym/enums/ServerVersion.java b/src/main/java/main/java/me/dniym/enums/ServerVersion.java index fb56ffd..8897c0f 100644 --- a/src/main/java/main/java/me/dniym/enums/ServerVersion.java +++ b/src/main/java/main/java/me/dniym/enums/ServerVersion.java @@ -28,7 +28,8 @@ public enum ServerVersion { v1_20_R3, v1_20_R4, v1_20_R5, - v1_21_R1; + v1_21_R1, + v1_21_R2; public boolean serverVersionEqual(ServerVersion version) { return this.equals(version); diff --git a/src/main/java/main/java/me/dniym/fishing/FishAttempt.java b/src/main/java/main/java/me/dniym/fishing/FishAttempt.java index b34e4b8..e024258 100644 --- a/src/main/java/main/java/me/dniym/fishing/FishAttempt.java +++ b/src/main/java/main/java/me/dniym/fishing/FishAttempt.java @@ -1,5 +1,7 @@ package main.java.me.dniym.fishing; +import main.java.me.dniym.IllegalStack; +import main.java.me.dniym.utils.Scheduler; import org.bukkit.Location; import org.bukkit.entity.FishHook; import org.bukkit.entity.Player; @@ -8,6 +10,7 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; public class FishAttempt { @@ -33,12 +36,17 @@ public static FishAttempt findPlayer(Player p) { } public static FishHook findHook(Player player) { + final AtomicReference fishHook = new AtomicReference<>(); for (FishHook fh : player.getWorld().getEntitiesByClass(FishHook.class)) { - if (fh.getShooter() instanceof Player) { - if (fh.getShooter() == player) { - return fh; + // Get the fishhook entity's scheduler to run a task to check if the fishhook's shooter is the player + Scheduler.runTask(IllegalStack.getPlugin(), () -> { + if (fh.getShooter() instanceof Player) { + if (fh.getShooter() == player) { + fishHook.set(fh); + } } - } + }, fh); + return fishHook.get(); } return null; }