remove unused stuff

This commit is contained in:
destro174 2022-02-19 19:33:50 +01:00
parent bf1c4c38a2
commit 1ccf191596
3 changed files with 0 additions and 90 deletions

View File

@ -72,12 +72,6 @@ class CleanupUnusedClaimTask implements Runnable
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
GriefPrevention.instance.dataStore.deleteClaim(claim, true, true); GriefPrevention.instance.dataStore.deleteClaim(claim, true, true);
//if configured to do so, restore the land to natural
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()) || GriefPrevention.instance.config_claims_survivalAutoNatureRestoration)
{
GriefPrevention.instance.restoreClaim(claim, 0);
}
GriefPrevention.AddLogEntry(" " + claim.getOwnerName() + "'s new player claim expired.", CustomLogEntryTypes.AdminActivity); GriefPrevention.AddLogEntry(" " + claim.getOwnerName() + "'s new player claim expired.", CustomLogEntryTypes.AdminActivity);
} }
} }
@ -121,43 +115,6 @@ class CleanupUnusedClaimTask implements Runnable
GriefPrevention.AddLogEntry(" All of " + claim.getOwnerName() + "'s claims have expired.", CustomLogEntryTypes.AdminActivity); GriefPrevention.AddLogEntry(" All of " + claim.getOwnerName() + "'s claims have expired.", CustomLogEntryTypes.AdminActivity);
GriefPrevention.AddLogEntry("earliestPermissibleLastLogin#getTime: " + earliestPermissibleLastLogin.getTime(), CustomLogEntryTypes.Debug, true); GriefPrevention.AddLogEntry("earliestPermissibleLastLogin#getTime: " + earliestPermissibleLastLogin.getTime(), CustomLogEntryTypes.Debug, true);
GriefPrevention.AddLogEntry("ownerInfo#getLastPlayed: " + ownerInfo.getLastPlayed(), CustomLogEntryTypes.Debug, true); GriefPrevention.AddLogEntry("ownerInfo#getLastPlayed: " + ownerInfo.getLastPlayed(), CustomLogEntryTypes.Debug, true);
for (Claim claim : claims)
{
//if configured to do so, restore the land to natural
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()) || GriefPrevention.instance.config_claims_survivalAutoNatureRestoration)
{
GriefPrevention.instance.restoreClaim(claim, 0);
}
}
}
}
else if (GriefPrevention.instance.config_claims_unusedClaimExpirationDays > 0 && GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()))
{
//avoid scanning large claims and administrative claims
if (claim.isAdminClaim() || claim.getWidth() > 25 || claim.getHeight() > 25) return;
//otherwise scan the claim content
int minInvestment = 400;
long investmentScore = claim.getPlayerInvestmentScore();
if (investmentScore < minInvestment)
{
//if the owner has been gone at least a week, and if he has ONLY the new player claim, it will be removed
Calendar sevenDaysAgo = Calendar.getInstance();
sevenDaysAgo.add(Calendar.DATE, -GriefPrevention.instance.config_claims_unusedClaimExpirationDays);
boolean claimExpired = sevenDaysAgo.getTime().after(new Date(ownerInfo.getLastPlayed()));
if (claimExpired)
{
if (expireEventCanceled())
return;
GriefPrevention.instance.dataStore.deleteClaim(claim, true, true);
GriefPrevention.AddLogEntry("Removed " + claim.getOwnerName() + "'s unused claim @ " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()), CustomLogEntryTypes.AdminActivity);
//restore the claim area to natural state
GriefPrevention.instance.restoreClaim(claim, 0);
}
} }
} }
} }

View File

@ -1359,12 +1359,6 @@ public abstract class DataStore
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
this.deleteClaim(claim, releasePets); this.deleteClaim(claim, releasePets);
//if in a creative mode world, delete the claim
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()))
{
GriefPrevention.instance.restoreClaim(claim, 0);
}
} }
} }
@ -1517,14 +1511,6 @@ public abstract class DataStore
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SubdivisionVideo2, 201L, DataStore.SUBDIVISION_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SubdivisionVideo2, 201L, DataStore.SUBDIVISION_VIDEO_URL);
} }
//if in a creative mode world and shrinking an existing claim, restore any unclaimed area
if (smaller && GriefPrevention.instance.creativeRulesApply(oldClaim.getLesserBoundaryCorner()))
{
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.UnclaimCleanupWarning);
GriefPrevention.instance.restoreClaim(oldClaim, 20L * 60 * 2); //2 minutes
GriefPrevention.AddLogEntry(player.getName() + " shrank a claim @ " + GriefPrevention.getfriendlyLocationString(playerData.claimResizing.getLesserBoundaryCorner()));
}
//clean up //clean up
playerData.claimResizing = null; playerData.claimResizing = null;
playerData.lastShovelLocation = null; playerData.lastShovelLocation = null;

View File

@ -2037,12 +2037,6 @@ public class GriefPrevention extends JavaPlugin
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
this.dataStore.deleteClaim(claim, true, true); this.dataStore.deleteClaim(claim, true, true);
//if in a creative mode world, /restorenature the claim
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()) || GriefPrevention.instance.config_claims_survivalAutoNatureRestoration)
{
GriefPrevention.instance.restoreClaim(claim, 0);
}
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DeleteSuccess); GriefPrevention.sendMessage(player, TextMode.Success, Messages.DeleteSuccess);
GriefPrevention.AddLogEntry(player.getName() + " deleted " + claim.getOwnerName() + "'s claim at " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()), CustomLogEntryTypes.AdminActivity); GriefPrevention.AddLogEntry(player.getName() + " deleted " + claim.getOwnerName() + "'s claim at " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()), CustomLogEntryTypes.AdminActivity);
@ -3017,14 +3011,6 @@ public class GriefPrevention extends JavaPlugin
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
this.dataStore.deleteClaim(claim, true, false); this.dataStore.deleteClaim(claim, true, false);
//if in a creative mode world, restore the claim area
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()))
{
GriefPrevention.AddLogEntry(player.getName() + " abandoned a claim @ " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()));
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.UnclaimCleanupWarning);
GriefPrevention.instance.restoreClaim(claim, 20L * 60 * 2);
}
//adjust claim blocks when abandoning a top level claim //adjust claim blocks when abandoning a top level claim
if (this.config_claims_abandonReturnRatio != 1.0D && claim.parent == null && claim.ownerID.equals(playerData.playerID)) if (this.config_claims_abandonReturnRatio != 1.0D && claim.parent == null && claim.ownerID.equals(playerData.playerID))
{ {
@ -3629,25 +3615,6 @@ public class GriefPrevention extends JavaPlugin
} }
} }
//restores nature in multiple chunks, as described by a claim instance
//this restores all chunks which have ANY number of claim blocks from this claim in them
//if the claim is still active (in the data store), then the claimed blocks will not be changed (only the area bordering the claim)
public void restoreClaim(Claim claim, long delayInTicks)
{
//admin claims aren't automatically cleaned up when deleted or abandoned
if (claim.isAdminClaim()) return;
//it's too expensive to do this for huge claims
if (claim.getArea() > 10000) return;
ArrayList<Chunk> chunks = claim.getChunks();
for (Chunk chunk : chunks)
{
this.restoreChunk(chunk, this.getSeaLevel(chunk.getWorld()) - 15, false, delayInTicks, null);
}
}
public void restoreChunk(Chunk chunk, int miny, boolean aggressiveMode, long delayInTicks, Player playerReceivingVisualization) public void restoreChunk(Chunk chunk, int miny, boolean aggressiveMode, long delayInTicks, Player playerReceivingVisualization)
{ {
//build a snapshot of this chunk, including 1 block boundary outside of the chunk all the way around //build a snapshot of this chunk, including 1 block boundary outside of the chunk all the way around