mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-27 17:44:47 +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,17 +53,25 @@ 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(true);
|
event.setKeepInventory(keepInventory);
|
||||||
event.getDrops().clear();
|
|
||||||
|
if (keepInventory)
|
||||||
|
{
|
||||||
|
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(true);
|
event.setKeepLevel(keepExp);
|
||||||
event.setDroppedExp(0);
|
|
||||||
|
if (keepExp)
|
||||||
|
{
|
||||||
|
event.setDroppedExp(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue