Fixed keep-inventory & keep-exp has no effect is set to false

This commit is contained in:
isokissa3 2019-03-13 01:00:31 +02:00
parent c4b229e137
commit c2a0b0fd32

View file

@ -53,17 +53,25 @@ public class PlayerListener implements Listener
ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
Boolean keepInventory = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_INVENTORY);
if (Boolean.TRUE.equals(keepInventory))
if (keepInventory != null)
{
event.setKeepInventory(true);
event.getDrops().clear();
event.setKeepInventory(keepInventory);
if (keepInventory)
{
event.getDrops().clear();
}
}
Boolean keepExp = WorldGuardUtils.queryValue(player, player.getWorld(), regions.getRegions(), Flags.KEEP_EXP);
if (Boolean.TRUE.equals(keepExp))
if (keepExp != null)
{
event.setKeepLevel(true);
event.setDroppedExp(0);
event.setKeepLevel(keepExp);
if (keepExp)
{
event.setDroppedExp(0);
}
}
}