From d1adf265737c8f518e1945051c8c4065692e3f19 Mon Sep 17 00:00:00 2001 From: RoboMWM Date: Fri, 17 Aug 2018 10:17:56 -0700 Subject: [PATCH] prepend explanation for failed claim and playerdata loads --- .../GriefPrevention/FlatFileDataStore.java | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java b/src/main/java/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java index bdce0c8..3084ad9 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java @@ -18,20 +18,30 @@ package me.ryanhamshire.GriefPrevention; -import java.io.*; -import java.nio.charset.Charset; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Matcher; - -import org.bukkit.*; +import com.google.common.io.Files; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; -import com.google.common.io.Files; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Matcher; //manages data stored in the file system public class FlatFileDataStore extends DataStore @@ -368,6 +378,7 @@ public class FlatFileDataStore extends DataStore { StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); + GriefPrevention.AddLogEntry("Failed to load claim " + files[i].getName() + ". This usually occurs when your server runs out of storage space, causing any file saves to corrupt. Fix or delete the file found in GriefPreventionData/ClaimData/" + files[i].getName(), CustomLogEntryTypes.Debug, false); GriefPrevention.AddLogEntry(files[i].getName() + " " + errors.toString(), CustomLogEntryTypes.Exception); } } @@ -671,6 +682,7 @@ public class FlatFileDataStore extends DataStore { StringWriter errors = new StringWriter(); latestException.printStackTrace(new PrintWriter(errors)); + GriefPrevention.AddLogEntry("Failed to load PlayerData for " + playerID + ". This usually occurs when your server runs out of storage space, causing any file saves to corrupt. Fix or delete the file in GriefPrevetionData/PlayerData/" + playerID, CustomLogEntryTypes.Debug, false); GriefPrevention.AddLogEntry(playerID + " " + errors.toString(), CustomLogEntryTypes.Exception); } }