mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
Fix sulk sensors detecting vanished players (#5262)
This commit is contained in:
parent
11e6d3ca7b
commit
e7c56b32a4
@ -121,6 +121,15 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isGameEventEvent() {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.block.BlockReceiveGameEvent");
|
||||
return true;
|
||||
} catch (final ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerEvents() {
|
||||
ess.getServer().getPluginManager().registerEvents(this, ess);
|
||||
|
||||
@ -128,6 +137,10 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
||||
ess.getServer().getPluginManager().registerEvents(new ArrowPickupListener(), ess);
|
||||
}
|
||||
|
||||
if (isGameEventEvent()) {
|
||||
ess.getServer().getPluginManager().registerEvents(new SculkListener1_17(), ess);
|
||||
}
|
||||
|
||||
if (isEntityPickupEvent()) {
|
||||
ess.getServer().getPluginManager().registerEvents(new PickupListener1_12(), ess);
|
||||
} else {
|
||||
@ -1001,6 +1014,15 @@ public class EssentialsPlayerListener implements Listener, FakeAccessor {
|
||||
}
|
||||
}
|
||||
|
||||
private final class SculkListener1_17 implements Listener {
|
||||
@EventHandler
|
||||
public void onGameEvent(final org.bukkit.event.block.BlockReceiveGameEvent event) {
|
||||
if (event.getEntity() instanceof Player && ess.getUser((Player) event.getEntity()).isVanished()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class CommandSendFilter implements CommandSendListenerProvider.Filter {
|
||||
@Override
|
||||
public Predicate<String> apply(Player player) {
|
||||
|
Loading…
Reference in New Issue
Block a user