9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-27 10:49:08 +00:00

Add CANCEL entry prevent option

This commit is contained in:
SamB440
2021-05-07 20:07:02 +01:00
parent 822a67ab8e
commit 8a34492df8

View File

@@ -7,7 +7,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
public enum PreventType {
TELEPORT,
PUSH;
PUSH,
CANCEL;
public void prevent(PlayerMoveEvent event) {
if (event.getTo() == null) return;
@@ -19,6 +20,9 @@ public enum PreventType {
case PUSH:
player.setVelocity(event.getTo().toVector().subtract(event.getFrom().toVector()).multiply(-3));
break;
case CANCEL:
event.setCancelled(true);
break;
}
player.spawnParticle(Particle.BARRIER, event.getTo().getBlock().getLocation().add(0.5, 0.5, 0.5), 1);
}