Skip to content

Commit 9a47480

Browse files
committed
should fix #14 & #15
1 parent f62ac99 commit 9a47480

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group = "cz.qery"
2-
version = "5.0"
2+
version = "5.1"
33

44
kotlin {
55
jvmToolchain(21)

src/main/java/cz/qery/toolkit/helper/Vanish.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.bukkit.GameMode;
88
import org.bukkit.entity.Creature;
99
import org.bukkit.entity.Entity;
10+
import org.bukkit.entity.LivingEntity;
1011
import org.bukkit.entity.Player;
1112
import org.bukkit.metadata.FixedMetadataValue;
1213

@@ -71,9 +72,16 @@ public static void Hide(Player p, boolean init) {
7172
}
7273
p.setSleepingIgnored(true);
7374
p.setAllowFlight(true);
75+
7476
for (Entity e : p.getWorld().getEntities()) {
75-
if (e instanceof Creature && ((Creature) e).getTarget() != null && ((Creature) e).getTarget().getUniqueId().compareTo(p.getUniqueId()) == 0) {
76-
((Creature) e).setTarget(null);
77+
if (e instanceof Creature creature) {
78+
creature.getScheduler().run(plugin, (task) -> {
79+
if (!creature.isValid()) return;
80+
LivingEntity target = creature.getTarget();
81+
if (target != null && target.getUniqueId().equals(p.getUniqueId())) {
82+
creature.setTarget(null);
83+
}
84+
}, null);
7785
}
7886
}
7987

src/main/resources/plugin.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: Set of useful tools
88
website: github.com/czQery/ToolKit
99

1010
softdepend:
11-
- ple3xmap
12-
- apollo-bukkit
13-
- apollo-folia
11+
- Pl3xMap
12+
- Apollo-Folia
13+
- Apollo-Bukkit
1414

1515
commands:
1616
toolkit:

0 commit comments

Comments
 (0)