Add negative value check when accruing claim blocks

to prevent plugins from doing nasties
This commit is contained in:
RoboMWM 2016-11-20 17:40:26 -08:00
parent 11d6d3cf13
commit 514b0e5949
2 changed files with 3 additions and 3 deletions

View File

@ -85,8 +85,9 @@ class DeliverClaimBlocksTask implements Runnable
GriefPrevention.AddLogEntry(player.getName() + " claim block delivery was canceled by another plugin.", CustomLogEntryTypes.Debug, true);
return;
}
playerData.accrueBlocks(event.getBlocksToAccrue());
accrualRate = event.getBlocksToAccrue();
if(accrualRate < 0) accrualRate = 0;
playerData.accrueBlocks(accrualRate);
GriefPrevention.AddLogEntry("Delivering " + event.getBlocksToAccrue() + " blocks to " + player.getName(), CustomLogEntryTypes.Debug, true);
//intentionally NOT saving data here to reduce overall secondary storage access frequency

View File

@ -29,7 +29,6 @@ public class AccrueClaimBlocksEvent extends Event
public AccrueClaimBlocksEvent(Player player, int blocksToAccrue)
{
this.player = player;
if(blocksToAccrue < 0) blocksToAccrue = 1;
this.blocksToAccrue = blocksToAccrue / 6;
}