mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-28 10:04:50 +00:00
Fixed keep-inventory & keep-exp has no effect is set to false
This commit is contained in:
parent
c4b229e137
commit
c2a0b0fd32
1 changed files with 14 additions and 6 deletions
|
@ -53,19 +53,27 @@ public class PlayerListener implements Listener
|
||||||
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
|
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
|
||||||
|
|
||||||
Boolean keepInventory = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_INVENTORY);
|
Boolean keepInventory = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_INVENTORY);
|
||||||
if (Boolean.TRUE.equals(keepInventory))
|
if (keepInventory != null)
|
||||||
|
{
|
||||||
|
event.setKeepInventory(keepInventory);
|
||||||
|
|
||||||
|
if (keepInventory)
|
||||||
{
|
{
|
||||||
event.setKeepInventory(true);
|
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Boolean keepExp = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_EXP);
|
Boolean keepExp = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_EXP);
|
||||||
if (Boolean.TRUE.equals(keepExp))
|
if (keepExp != null)
|
||||||
|
{
|
||||||
|
event.setKeepLevel(keepExp);
|
||||||
|
|
||||||
|
if (keepExp)
|
||||||
{
|
{
|
||||||
event.setKeepLevel(true);
|
|
||||||
event.setDroppedExp(0);
|
event.setDroppedExp(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event)
|
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event)
|
||||||
|
|
Loading…
Reference in a new issue