mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-18 13:21:46 +01:00
Do not allow teleport inside of regions with the chorus-fruit-teleport deny flag set
This commit is contained in:
parent
5c9ba2e22e
commit
e38d98da00
@ -380,11 +380,15 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
}
|
||||
try {
|
||||
if (event.getCause() == TeleportCause.CHORUS_FRUIT) {
|
||||
if (!plugin.getGlobalRegionManager().hasBypass(localPlayer, world)
|
||||
&& !(setFrom.allows(DefaultFlag.CHORUS_TELEPORT, localPlayer))) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You're not allowed to teleport from here.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
if (!plugin.getGlobalRegionManager().hasBypass(localPlayer, world)) {
|
||||
boolean allowFrom = setFrom.allows(DefaultFlag.CHORUS_TELEPORT, localPlayer);
|
||||
boolean allowTo = set.allows(DefaultFlag.CHORUS_TELEPORT, localPlayer);
|
||||
if (!allowFrom || !allowTo) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You're not allowed to teleport " +
|
||||
(!allowFrom ? "from here." : "there."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NoSuchFieldError ignored) {}
|
||||
|
Loading…
Reference in New Issue
Block a user