From c19e3b7ea40f78587c1f5bd8e44022fbc72159ed Mon Sep 17 00:00:00 2001 From: RoboMWM Date: Mon, 16 Mar 2020 21:23:05 -0700 Subject: [PATCH] add more debug messages for claim expiration checks. --- .../CleanupUnusedClaimPreTask.java | 16 ++++++++++++---- .../GriefPrevention/FindUnusedClaimsTask.java | 9 ++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/CleanupUnusedClaimPreTask.java b/src/main/java/me/ryanhamshire/GriefPrevention/CleanupUnusedClaimPreTask.java index f5e9d7a..27d9360 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/CleanupUnusedClaimPreTask.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/CleanupUnusedClaimPreTask.java @@ -41,13 +41,21 @@ class CleanupUnusedClaimPreTask implements Runnable //get the data PlayerData ownerData = GriefPrevention.instance.dataStore.getPlayerDataFromStorage(ownerID); OfflinePlayer ownerInfo = Bukkit.getServer().getOfflinePlayer(ownerID); + + GriefPrevention.AddLogEntry("Looking for expired claims. Checking data for " + ownerID.toString(), CustomLogEntryTypes.Debug, true); //expiration code uses last logout timestamp to decide whether to expire claims //don't expire claims for online players - if(ownerInfo.isOnline()) return; - if(ownerInfo.getLastPlayed() <= 0) return; - - GriefPrevention.AddLogEntry("Looking for expired claims. Checking data for " + ownerID.toString(), CustomLogEntryTypes.Debug, true); + if(ownerInfo.isOnline()) + { + GriefPrevention.AddLogEntry("Player is online. Ignoring.", CustomLogEntryTypes.Debug, true); + return; + } + if(ownerInfo.getLastPlayed() <= 0) + { + GriefPrevention.AddLogEntry("Player is new or not in the server's cached userdata. Ignoring. getLastPlayed = " + ownerInfo.getLastPlayed(), CustomLogEntryTypes.Debug, true); + return; + } //skip claims belonging to exempted players based on block totals in config int bonusBlocks = ownerData.getBonusClaimBlocks(); diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/FindUnusedClaimsTask.java b/src/main/java/me/ryanhamshire/GriefPrevention/FindUnusedClaimsTask.java index bcb4773..66fa539 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/FindUnusedClaimsTask.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/FindUnusedClaimsTask.java @@ -25,8 +25,6 @@ import java.util.Objects; import java.util.UUID; import java.util.stream.Collectors; -import org.bukkit.Bukkit; - //FEATURE: automatically remove claims owned by inactive players which: //...aren't protecting much OR //...are a free new player claim (and the player has no other claims) OR @@ -56,7 +54,7 @@ class FindUnusedClaimsTask implements Runnable return; } - Bukkit.getScheduler().runTaskAsynchronously(GriefPrevention.instance, new CleanupUnusedClaimPreTask(claimOwnerIterator.next())); + GriefPrevention.instance.getServer().getScheduler().runTaskAsynchronously(GriefPrevention.instance, new CleanupUnusedClaimPreTask(claimOwnerIterator.next())); } public void refreshUUIDs() { @@ -69,6 +67,11 @@ class FindUnusedClaimsTask implements Runnable Collections.shuffle(claimOwnerUUIDs); } + GriefPrevention.AddLogEntry("The following UUIDs own a claim and will be checked for inactivity in the following order:", CustomLogEntryTypes.Debug, true); + + for (UUID uuid : claimOwnerUUIDs) + GriefPrevention.AddLogEntry(uuid.toString(), CustomLogEntryTypes.Debug, true); + claimOwnerIterator = claimOwnerUUIDs.iterator(); } }