add more debug messages for claim expiration checks.

This commit is contained in:
RoboMWM 2020-03-16 21:23:05 -07:00
parent e0a0be7bef
commit c19e3b7ea4
2 changed files with 18 additions and 7 deletions

View File

@ -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();

View File

@ -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();
}
}