mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-27 03:27:39 +01:00
Add "chorus-fruit-teleport" flag to prevent teleporting with chorus fruits.
Fixes WORLDGUARD-3645.
This commit is contained in:
parent
38dcdff0b6
commit
a8591e536a
@ -53,6 +53,7 @@
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
@ -367,6 +368,16 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
} catch (NoSuchElementException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ public final class DefaultFlag {
|
||||
public static final StateFlag ENTRY = new StateFlag("entry", true, RegionGroup.NON_MEMBERS);
|
||||
public static final StateFlag EXIT = new StateFlag("exit", true, RegionGroup.NON_MEMBERS);
|
||||
public static final StateFlag ENDERPEARL = new StateFlag("enderpearl", true);
|
||||
public static final StateFlag CHORUS_TELEPORT = new StateFlag("chorus-fruit-teleport", true);
|
||||
public static final StateFlag ENTITY_PAINTING_DESTROY = new StateFlag("entity-painting-destroy", true);
|
||||
public static final StateFlag ENTITY_ITEM_FRAME_DESTROY = new StateFlag("entity-item-frame-destroy", true);
|
||||
public static final StateFlag FALL_DAMAGE = new StateFlag("fall-damage", true);
|
||||
@ -146,7 +147,7 @@ public final class DefaultFlag {
|
||||
CREEPER_EXPLOSION, OTHER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
||||
DENY_MESSAGE, ENTRY_DENY_MESSAGE, EXIT_DENY_MESSAGE, EXIT_OVERRIDE, EXIT_VIA_TELEPORT,
|
||||
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
||||
EXIT, ENTRY, LIGHTNING, ENTITY_PAINTING_DESTROY, ENDERPEARL,
|
||||
EXIT, ENTRY, LIGHTNING, ENTITY_PAINTING_DESTROY, ENDERPEARL, CHORUS_TELEPORT,
|
||||
ENTITY_ITEM_FRAME_DESTROY, FALL_DAMAGE, ITEM_PICKUP, ITEM_DROP, /*MAX_PLAYERS, MAX_PLAYERS_MESSAGE,*/
|
||||
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
||||
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
|
||||
|
Loading…
Reference in New Issue
Block a user