mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-27 01:34:13 +00:00
Fix edge case with glide flag
This commit is contained in:
parent
7cd74edb2e
commit
d9f15956cd
1 changed files with 25 additions and 6 deletions
|
@ -31,15 +31,34 @@ public class EntityListenerOnePointNine implements Listener
|
|||
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
|
||||
|
||||
ForcedState state = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.GLIDE);
|
||||
if (state != ForcedState.ALLOW)
|
||||
switch(state)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
player.setGliding(state == ForcedState.FORCE);
|
||||
|
||||
if (state == ForcedState.DENY)
|
||||
case ALLOW:
|
||||
break;
|
||||
case DENY:
|
||||
{
|
||||
if (!event.isGliding())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
//Prevent the player from being allowed to glide by spamming space
|
||||
player.teleport(player.getLocation());
|
||||
|
||||
break;
|
||||
}
|
||||
case FORCE:
|
||||
{
|
||||
if (event.isGliding())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue