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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user