Only warn once when placing tnt
This commit is contained in:
parent
173bd794fe
commit
9a70c2218b
File diff suppressed because it is too large
Load Diff
|
|
@ -1,338 +1,341 @@
|
||||||
/*
|
/*
|
||||||
GriefPrevention Server Plugin for Minecraft
|
GriefPrevention Server Plugin for Minecraft
|
||||||
Copyright (C) 2011 Ryan Hamshire
|
Copyright (C) 2011 Ryan Hamshire
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
//holds all of GriefPrevention's player-tied data
|
//holds all of GriefPrevention's player-tied data
|
||||||
public class PlayerData
|
public class PlayerData
|
||||||
{
|
{
|
||||||
//the player's ID
|
//the player's ID
|
||||||
public UUID playerID;
|
public UUID playerID;
|
||||||
|
|
||||||
//the player's claims
|
//the player's claims
|
||||||
private Vector<Claim> claims = null;
|
private Vector<Claim> claims = null;
|
||||||
|
|
||||||
//how many claim blocks the player has earned via play time
|
//how many claim blocks the player has earned via play time
|
||||||
private Integer accruedClaimBlocks = null;
|
private Integer accruedClaimBlocks = null;
|
||||||
|
|
||||||
//temporary holding area to avoid opening data files too early
|
//temporary holding area to avoid opening data files too early
|
||||||
private int newlyAccruedClaimBlocks = 0;
|
private int newlyAccruedClaimBlocks = 0;
|
||||||
|
|
||||||
//where this player was the last time we checked on him for earning claim blocks
|
//where this player was the last time we checked on him for earning claim blocks
|
||||||
public Location lastAfkCheckLocation = null;
|
public Location lastAfkCheckLocation = null;
|
||||||
|
|
||||||
//how many claim blocks the player has been gifted by admins, or purchased via economy integration
|
//how many claim blocks the player has been gifted by admins, or purchased via economy integration
|
||||||
private Integer bonusClaimBlocks = null;
|
private Integer bonusClaimBlocks = null;
|
||||||
|
|
||||||
//what "mode" the shovel is in determines what it will do when it's used
|
//what "mode" the shovel is in determines what it will do when it's used
|
||||||
public ShovelMode shovelMode = ShovelMode.Basic;
|
public ShovelMode shovelMode = ShovelMode.Basic;
|
||||||
|
|
||||||
//radius for restore nature fill mode
|
//radius for restore nature fill mode
|
||||||
int fillRadius = 0;
|
int fillRadius = 0;
|
||||||
|
|
||||||
//last place the player used the shovel, useful in creating and resizing claims,
|
//last place the player used the shovel, useful in creating and resizing claims,
|
||||||
//because the player must use the shovel twice in those instances
|
//because the player must use the shovel twice in those instances
|
||||||
public Location lastShovelLocation = null;
|
public Location lastShovelLocation = null;
|
||||||
|
|
||||||
//the claim this player is currently resizing
|
//the claim this player is currently resizing
|
||||||
public Claim claimResizing = null;
|
public Claim claimResizing = null;
|
||||||
|
|
||||||
//the claim this player is currently subdividing
|
//the claim this player is currently subdividing
|
||||||
public Claim claimSubdividing = null;
|
public Claim claimSubdividing = null;
|
||||||
|
|
||||||
//whether or not the player has a pending /trapped rescue
|
//whether or not the player has a pending /trapped rescue
|
||||||
public boolean pendingTrapped = false;
|
public boolean pendingTrapped = false;
|
||||||
|
|
||||||
//whether this player was recently warned about building outside land claims
|
//whether this player was recently warned about building outside land claims
|
||||||
boolean warnedAboutBuildingOutsideClaims = false;
|
boolean warnedAboutBuildingOutsideClaims = false;
|
||||||
|
|
||||||
//whether the player was kicked (set and used during logout)
|
//whether this player was recently warned about placing tnt
|
||||||
boolean wasKicked = false;
|
boolean warnedAboutPlacingTnt = false;
|
||||||
|
|
||||||
//visualization
|
//whether the player was kicked (set and used during logout)
|
||||||
public Visualization currentVisualization = null;
|
boolean wasKicked = false;
|
||||||
|
|
||||||
//anti-camping pvp protection
|
//visualization
|
||||||
public boolean pvpImmune = false;
|
public Visualization currentVisualization = null;
|
||||||
public long lastSpawn = 0;
|
|
||||||
|
//anti-camping pvp protection
|
||||||
//ignore claims mode
|
public boolean pvpImmune = false;
|
||||||
public boolean ignoreClaims = false;
|
public long lastSpawn = 0;
|
||||||
|
|
||||||
//the last claim this player was in, that we know of
|
//ignore claims mode
|
||||||
public Claim lastClaim = null;
|
public boolean ignoreClaims = false;
|
||||||
|
|
||||||
//pvp
|
//the last claim this player was in, that we know of
|
||||||
public long lastPvpTimestamp = 0;
|
public Claim lastClaim = null;
|
||||||
public String lastPvpPlayer = "";
|
|
||||||
|
//pvp
|
||||||
//safety confirmation for deleting multi-subdivision claims
|
public long lastPvpTimestamp = 0;
|
||||||
public boolean warnedAboutMajorDeletion = false;
|
public String lastPvpPlayer = "";
|
||||||
|
|
||||||
public InetAddress ipAddress;
|
//safety confirmation for deleting multi-subdivision claims
|
||||||
|
public boolean warnedAboutMajorDeletion = false;
|
||||||
//for addons to set per-player claim limits. Any negative value will use config's value
|
|
||||||
private int AccruedClaimBlocksLimit = -1;
|
public InetAddress ipAddress;
|
||||||
|
|
||||||
//whether or not this player has received a message about unlocking death drops since his last death
|
//for addons to set per-player claim limits. Any negative value will use config's value
|
||||||
boolean receivedDropUnlockAdvertisement = false;
|
private int AccruedClaimBlocksLimit = -1;
|
||||||
|
|
||||||
//whether or not this player's dropped items (on death) are unlocked for other players to pick up
|
//whether or not this player has received a message about unlocking death drops since his last death
|
||||||
boolean dropsAreUnlocked = false;
|
boolean receivedDropUnlockAdvertisement = false;
|
||||||
|
|
||||||
//message to send to player after he respawns
|
//whether or not this player's dropped items (on death) are unlocked for other players to pick up
|
||||||
String messageOnRespawn = null;
|
boolean dropsAreUnlocked = false;
|
||||||
|
|
||||||
//player which a pet will be given to when it's right-clicked
|
//message to send to player after he respawns
|
||||||
OfflinePlayer petGiveawayRecipient = null;
|
String messageOnRespawn = null;
|
||||||
|
|
||||||
//timestamp for last "you're building outside your land claims" message
|
//player which a pet will be given to when it's right-clicked
|
||||||
Long buildWarningTimestamp = null;
|
OfflinePlayer petGiveawayRecipient = null;
|
||||||
|
|
||||||
//spot where a player can't talk, used to mute new players until they've moved a little
|
//timestamp for last "you're building outside your land claims" message
|
||||||
//this is an anti-bot strategy.
|
Long buildWarningTimestamp = null;
|
||||||
Location noChatLocation = null;
|
|
||||||
|
//spot where a player can't talk, used to mute new players until they've moved a little
|
||||||
//ignore list
|
//this is an anti-bot strategy.
|
||||||
//true means invisible (admin-forced ignore), false means player-created ignore
|
Location noChatLocation = null;
|
||||||
public ConcurrentHashMap<UUID, Boolean> ignoredPlayers = new ConcurrentHashMap<>();
|
|
||||||
public boolean ignoreListChanged = false;
|
//ignore list
|
||||||
|
//true means invisible (admin-forced ignore), false means player-created ignore
|
||||||
//profanity warning, once per play session
|
public ConcurrentHashMap<UUID, Boolean> ignoredPlayers = new ConcurrentHashMap<>();
|
||||||
boolean profanityWarned = false;
|
public boolean ignoreListChanged = false;
|
||||||
|
|
||||||
//whether or not this player is "in" pvp combat
|
//profanity warning, once per play session
|
||||||
public boolean inPvpCombat()
|
boolean profanityWarned = false;
|
||||||
{
|
|
||||||
if (this.lastPvpTimestamp == 0) return false;
|
//whether or not this player is "in" pvp combat
|
||||||
|
public boolean inPvpCombat()
|
||||||
long now = Calendar.getInstance().getTimeInMillis();
|
{
|
||||||
|
if (this.lastPvpTimestamp == 0) return false;
|
||||||
long elapsed = now - this.lastPvpTimestamp;
|
|
||||||
|
long now = Calendar.getInstance().getTimeInMillis();
|
||||||
if (elapsed > GriefPrevention.instance.config_pvp_combatTimeoutSeconds * 1000) //X seconds
|
|
||||||
{
|
long elapsed = now - this.lastPvpTimestamp;
|
||||||
this.lastPvpTimestamp = 0;
|
|
||||||
return false;
|
if (elapsed > GriefPrevention.instance.config_pvp_combatTimeoutSeconds * 1000) //X seconds
|
||||||
}
|
{
|
||||||
|
this.lastPvpTimestamp = 0;
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//the number of claim blocks a player has available for claiming land
|
return true;
|
||||||
public int getRemainingClaimBlocks()
|
}
|
||||||
{
|
|
||||||
int remainingBlocks = this.getAccruedClaimBlocks() + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
//the number of claim blocks a player has available for claiming land
|
||||||
for (int i = 0; i < this.getClaims().size(); i++)
|
public int getRemainingClaimBlocks()
|
||||||
{
|
{
|
||||||
Claim claim = this.getClaims().get(i);
|
int remainingBlocks = this.getAccruedClaimBlocks() + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
||||||
remainingBlocks -= claim.getArea();
|
for (int i = 0; i < this.getClaims().size(); i++)
|
||||||
}
|
{
|
||||||
|
Claim claim = this.getClaims().get(i);
|
||||||
return remainingBlocks;
|
remainingBlocks -= claim.getArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't load data from secondary storage until it's needed
|
return remainingBlocks;
|
||||||
public synchronized int getAccruedClaimBlocks()
|
}
|
||||||
{
|
|
||||||
if (this.accruedClaimBlocks == null) this.loadDataFromSecondaryStorage();
|
//don't load data from secondary storage until it's needed
|
||||||
|
public synchronized int getAccruedClaimBlocks()
|
||||||
//update claim blocks with any he has accrued during his current play session
|
{
|
||||||
if (this.newlyAccruedClaimBlocks > 0)
|
if (this.accruedClaimBlocks == null) this.loadDataFromSecondaryStorage();
|
||||||
{
|
|
||||||
int accruedLimit = this.getAccruedClaimBlocksLimit();
|
//update claim blocks with any he has accrued during his current play session
|
||||||
|
if (this.newlyAccruedClaimBlocks > 0)
|
||||||
//if over the limit before adding blocks, leave it as-is, because the limit may have changed AFTER he accrued the blocks
|
{
|
||||||
if (this.accruedClaimBlocks < accruedLimit)
|
int accruedLimit = this.getAccruedClaimBlocksLimit();
|
||||||
{
|
|
||||||
//move any in the holding area
|
//if over the limit before adding blocks, leave it as-is, because the limit may have changed AFTER he accrued the blocks
|
||||||
int newTotal = this.accruedClaimBlocks + this.newlyAccruedClaimBlocks;
|
if (this.accruedClaimBlocks < accruedLimit)
|
||||||
|
{
|
||||||
//respect limits
|
//move any in the holding area
|
||||||
this.accruedClaimBlocks = Math.min(newTotal, accruedLimit);
|
int newTotal = this.accruedClaimBlocks + this.newlyAccruedClaimBlocks;
|
||||||
}
|
|
||||||
|
//respect limits
|
||||||
this.newlyAccruedClaimBlocks = 0;
|
this.accruedClaimBlocks = Math.min(newTotal, accruedLimit);
|
||||||
return this.accruedClaimBlocks;
|
}
|
||||||
}
|
|
||||||
|
this.newlyAccruedClaimBlocks = 0;
|
||||||
return accruedClaimBlocks;
|
return this.accruedClaimBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccruedClaimBlocks(Integer accruedClaimBlocks)
|
return accruedClaimBlocks;
|
||||||
{
|
}
|
||||||
this.accruedClaimBlocks = accruedClaimBlocks;
|
|
||||||
this.newlyAccruedClaimBlocks = 0;
|
public void setAccruedClaimBlocks(Integer accruedClaimBlocks)
|
||||||
}
|
{
|
||||||
|
this.accruedClaimBlocks = accruedClaimBlocks;
|
||||||
public int getBonusClaimBlocks()
|
this.newlyAccruedClaimBlocks = 0;
|
||||||
{
|
}
|
||||||
if (this.bonusClaimBlocks == null) this.loadDataFromSecondaryStorage();
|
|
||||||
return bonusClaimBlocks;
|
public int getBonusClaimBlocks()
|
||||||
}
|
{
|
||||||
|
if (this.bonusClaimBlocks == null) this.loadDataFromSecondaryStorage();
|
||||||
public void setBonusClaimBlocks(Integer bonusClaimBlocks)
|
return bonusClaimBlocks;
|
||||||
{
|
}
|
||||||
this.bonusClaimBlocks = bonusClaimBlocks;
|
|
||||||
}
|
public void setBonusClaimBlocks(Integer bonusClaimBlocks)
|
||||||
|
{
|
||||||
private void loadDataFromSecondaryStorage()
|
this.bonusClaimBlocks = bonusClaimBlocks;
|
||||||
{
|
}
|
||||||
//reach out to secondary storage to get any data there
|
|
||||||
PlayerData storageData = GriefPrevention.instance.dataStore.getPlayerDataFromStorage(this.playerID);
|
private void loadDataFromSecondaryStorage()
|
||||||
|
{
|
||||||
if (this.accruedClaimBlocks == null)
|
//reach out to secondary storage to get any data there
|
||||||
{
|
PlayerData storageData = GriefPrevention.instance.dataStore.getPlayerDataFromStorage(this.playerID);
|
||||||
if (storageData.accruedClaimBlocks != null)
|
|
||||||
{
|
if (this.accruedClaimBlocks == null)
|
||||||
this.accruedClaimBlocks = storageData.accruedClaimBlocks;
|
{
|
||||||
|
if (storageData.accruedClaimBlocks != null)
|
||||||
//ensure at least minimum accrued are accrued (in case of settings changes to increase initial amount)
|
{
|
||||||
if (GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && (this.accruedClaimBlocks < GriefPrevention.instance.config_claims_initialBlocks))
|
this.accruedClaimBlocks = storageData.accruedClaimBlocks;
|
||||||
{
|
|
||||||
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
|
//ensure at least minimum accrued are accrued (in case of settings changes to increase initial amount)
|
||||||
}
|
if (GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && (this.accruedClaimBlocks < GriefPrevention.instance.config_claims_initialBlocks))
|
||||||
|
{
|
||||||
}
|
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
|
||||||
if (this.bonusClaimBlocks == null)
|
}
|
||||||
{
|
}
|
||||||
if (storageData.bonusClaimBlocks != null)
|
|
||||||
{
|
if (this.bonusClaimBlocks == null)
|
||||||
this.bonusClaimBlocks = storageData.bonusClaimBlocks;
|
{
|
||||||
}
|
if (storageData.bonusClaimBlocks != null)
|
||||||
else
|
{
|
||||||
{
|
this.bonusClaimBlocks = storageData.bonusClaimBlocks;
|
||||||
this.bonusClaimBlocks = 0;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
this.bonusClaimBlocks = 0;
|
||||||
|
}
|
||||||
public Vector<Claim> getClaims()
|
}
|
||||||
{
|
}
|
||||||
if (this.claims == null)
|
|
||||||
{
|
public Vector<Claim> getClaims()
|
||||||
this.claims = new Vector<>();
|
{
|
||||||
|
if (this.claims == null)
|
||||||
//find all the claims belonging to this player and note them for future reference
|
{
|
||||||
DataStore dataStore = GriefPrevention.instance.dataStore;
|
this.claims = new Vector<>();
|
||||||
int totalClaimsArea = 0;
|
|
||||||
for (int i = 0; i < dataStore.claims.size(); i++)
|
//find all the claims belonging to this player and note them for future reference
|
||||||
{
|
DataStore dataStore = GriefPrevention.instance.dataStore;
|
||||||
Claim claim = dataStore.claims.get(i);
|
int totalClaimsArea = 0;
|
||||||
if (!claim.inDataStore)
|
for (int i = 0; i < dataStore.claims.size(); i++)
|
||||||
{
|
{
|
||||||
dataStore.claims.remove(i--);
|
Claim claim = dataStore.claims.get(i);
|
||||||
continue;
|
if (!claim.inDataStore)
|
||||||
}
|
{
|
||||||
if (playerID.equals(claim.ownerID))
|
dataStore.claims.remove(i--);
|
||||||
{
|
continue;
|
||||||
this.claims.add(claim);
|
}
|
||||||
totalClaimsArea += claim.getArea();
|
if (playerID.equals(claim.ownerID))
|
||||||
}
|
{
|
||||||
}
|
this.claims.add(claim);
|
||||||
|
totalClaimsArea += claim.getArea();
|
||||||
//ensure player has claim blocks for his claims, and at least the minimum accrued
|
}
|
||||||
this.loadDataFromSecondaryStorage();
|
}
|
||||||
|
|
||||||
//if total claimed area is more than total blocks available
|
//ensure player has claim blocks for his claims, and at least the minimum accrued
|
||||||
int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
this.loadDataFromSecondaryStorage();
|
||||||
if (GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && totalBlocks < totalClaimsArea)
|
|
||||||
{
|
//if total claimed area is more than total blocks available
|
||||||
OfflinePlayer player = GriefPrevention.instance.getServer().getOfflinePlayer(this.playerID);
|
int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
||||||
GriefPrevention.AddLogEntry(player.getName() + " has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug, true);
|
if (GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && totalBlocks < totalClaimsArea)
|
||||||
GriefPrevention.AddLogEntry(player.getName() + " Accrued blocks: " + this.getAccruedClaimBlocks() + " Bonus blocks: " + this.getBonusClaimBlocks(), CustomLogEntryTypes.Debug, true);
|
{
|
||||||
GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug, true);
|
OfflinePlayer player = GriefPrevention.instance.getServer().getOfflinePlayer(this.playerID);
|
||||||
for (Claim claim : this.claims)
|
GriefPrevention.AddLogEntry(player.getName() + " has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug, true);
|
||||||
{
|
GriefPrevention.AddLogEntry(player.getName() + " Accrued blocks: " + this.getAccruedClaimBlocks() + " Bonus blocks: " + this.getBonusClaimBlocks(), CustomLogEntryTypes.Debug, true);
|
||||||
if (!claim.inDataStore) continue;
|
GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug, true);
|
||||||
GriefPrevention.AddLogEntry(
|
for (Claim claim : this.claims)
|
||||||
GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " // "
|
{
|
||||||
+ GriefPrevention.getfriendlyLocationString(claim.getGreaterBoundaryCorner()) + " = "
|
if (!claim.inDataStore) continue;
|
||||||
+ claim.getArea()
|
GriefPrevention.AddLogEntry(
|
||||||
, CustomLogEntryTypes.Debug, true);
|
GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " // "
|
||||||
}
|
+ GriefPrevention.getfriendlyLocationString(claim.getGreaterBoundaryCorner()) + " = "
|
||||||
|
+ claim.getArea()
|
||||||
//try to fix it by adding to accrued blocks
|
, CustomLogEntryTypes.Debug, true);
|
||||||
this.accruedClaimBlocks = totalClaimsArea; //Set accrued blocks to equal total claims
|
}
|
||||||
int accruedLimit = this.getAccruedClaimBlocksLimit();
|
|
||||||
this.accruedClaimBlocks = Math.min(accruedLimit, this.accruedClaimBlocks); //set accrued blocks to maximum limit, if it's smaller
|
//try to fix it by adding to accrued blocks
|
||||||
GriefPrevention.AddLogEntry("New accrued blocks: " + this.accruedClaimBlocks, CustomLogEntryTypes.Debug, true);
|
this.accruedClaimBlocks = totalClaimsArea; //Set accrued blocks to equal total claims
|
||||||
|
int accruedLimit = this.getAccruedClaimBlocksLimit();
|
||||||
//Recalculate total blocks (accrued + bonus + permission group bonus)
|
this.accruedClaimBlocks = Math.min(accruedLimit, this.accruedClaimBlocks); //set accrued blocks to maximum limit, if it's smaller
|
||||||
totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
GriefPrevention.AddLogEntry("New accrued blocks: " + this.accruedClaimBlocks, CustomLogEntryTypes.Debug, true);
|
||||||
GriefPrevention.AddLogEntry("New total blocks: " + totalBlocks, CustomLogEntryTypes.Debug, true);
|
|
||||||
|
//Recalculate total blocks (accrued + bonus + permission group bonus)
|
||||||
//if that didn't fix it, then make up the difference with bonus blocks
|
totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
||||||
if (totalBlocks < totalClaimsArea)
|
GriefPrevention.AddLogEntry("New total blocks: " + totalBlocks, CustomLogEntryTypes.Debug, true);
|
||||||
{
|
|
||||||
int bonusBlocksToAdd = totalClaimsArea - totalBlocks;
|
//if that didn't fix it, then make up the difference with bonus blocks
|
||||||
this.bonusClaimBlocks += bonusBlocksToAdd;
|
if (totalBlocks < totalClaimsArea)
|
||||||
GriefPrevention.AddLogEntry("Accrued blocks weren't enough. Adding " + bonusBlocksToAdd + " bonus blocks.", CustomLogEntryTypes.Debug, true);
|
{
|
||||||
}
|
int bonusBlocksToAdd = totalClaimsArea - totalBlocks;
|
||||||
GriefPrevention.AddLogEntry(player.getName() + " Accrued blocks: " + this.getAccruedClaimBlocks() + " Bonus blocks: " + this.getBonusClaimBlocks() + " Group Bonus Blocks: " + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID), CustomLogEntryTypes.Debug, true);
|
this.bonusClaimBlocks += bonusBlocksToAdd;
|
||||||
//Recalculate total blocks (accrued + bonus + permission group bonus)
|
GriefPrevention.AddLogEntry("Accrued blocks weren't enough. Adding " + bonusBlocksToAdd + " bonus blocks.", CustomLogEntryTypes.Debug, true);
|
||||||
totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
}
|
||||||
GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug, true);
|
GriefPrevention.AddLogEntry(player.getName() + " Accrued blocks: " + this.getAccruedClaimBlocks() + " Bonus blocks: " + this.getBonusClaimBlocks() + " Group Bonus Blocks: " + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID), CustomLogEntryTypes.Debug, true);
|
||||||
GriefPrevention.AddLogEntry("Remaining claim blocks to use: " + this.getRemainingClaimBlocks() + " (should be 0)", CustomLogEntryTypes.Debug, true);
|
//Recalculate total blocks (accrued + bonus + permission group bonus)
|
||||||
}
|
totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
|
||||||
}
|
GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug, true);
|
||||||
|
GriefPrevention.AddLogEntry("Remaining claim blocks to use: " + this.getRemainingClaimBlocks() + " (should be 0)", CustomLogEntryTypes.Debug, true);
|
||||||
for (int i = 0; i < this.claims.size(); i++)
|
}
|
||||||
{
|
}
|
||||||
if (!claims.get(i).inDataStore)
|
|
||||||
{
|
for (int i = 0; i < this.claims.size(); i++)
|
||||||
claims.remove(i--);
|
{
|
||||||
}
|
if (!claims.get(i).inDataStore)
|
||||||
}
|
{
|
||||||
|
claims.remove(i--);
|
||||||
return claims;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Limit can be changed by addons
|
return claims;
|
||||||
public int getAccruedClaimBlocksLimit()
|
}
|
||||||
{
|
|
||||||
if (this.AccruedClaimBlocksLimit < 0)
|
//Limit can be changed by addons
|
||||||
return GriefPrevention.instance.config_claims_maxAccruedBlocks_default;
|
public int getAccruedClaimBlocksLimit()
|
||||||
return this.AccruedClaimBlocksLimit;
|
{
|
||||||
}
|
if (this.AccruedClaimBlocksLimit < 0)
|
||||||
|
return GriefPrevention.instance.config_claims_maxAccruedBlocks_default;
|
||||||
public void setAccruedClaimBlocksLimit(int limit)
|
return this.AccruedClaimBlocksLimit;
|
||||||
{
|
}
|
||||||
this.AccruedClaimBlocksLimit = limit;
|
|
||||||
}
|
public void setAccruedClaimBlocksLimit(int limit)
|
||||||
|
{
|
||||||
public void accrueBlocks(int howMany)
|
this.AccruedClaimBlocksLimit = limit;
|
||||||
{
|
}
|
||||||
this.newlyAccruedClaimBlocks += howMany;
|
|
||||||
}
|
public void accrueBlocks(int howMany)
|
||||||
|
{
|
||||||
|
this.newlyAccruedClaimBlocks += howMany;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user