Added in compatibility with newest beta build's data format by skipping
any lines with UUIDs in them.
This commit is contained in:
parent
4f5d668b15
commit
23f8272a70
|
|
@ -23,6 +23,8 @@ import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
|
||||||
|
|
@ -32,6 +34,8 @@ public class FlatFileDataStore extends DataStore
|
||||||
private final static String playerDataFolderPath = dataLayerFolderPath + File.separator + "PlayerData";
|
private final static String playerDataFolderPath = dataLayerFolderPath + File.separator + "PlayerData";
|
||||||
private final static String claimDataFolderPath = dataLayerFolderPath + File.separator + "ClaimData";
|
private final static String claimDataFolderPath = dataLayerFolderPath + File.separator + "ClaimData";
|
||||||
private final static String nextClaimIdFilePath = claimDataFolderPath + File.separator + "_nextClaimID";
|
private final static String nextClaimIdFilePath = claimDataFolderPath + File.separator + "_nextClaimID";
|
||||||
|
|
||||||
|
private final static Pattern uuidpattern = Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}");
|
||||||
|
|
||||||
static boolean hasData()
|
static boolean hasData()
|
||||||
{
|
{
|
||||||
|
|
@ -155,6 +159,12 @@ public class FlatFileDataStore extends DataStore
|
||||||
|
|
||||||
while(line != null)
|
while(line != null)
|
||||||
{
|
{
|
||||||
|
//Let's skip the UUID lines from previous versions
|
||||||
|
Matcher match = uuidpattern.matcher(line.trim());
|
||||||
|
if(match.find()) {
|
||||||
|
inStream.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
//first line is lesser boundary corner location
|
//first line is lesser boundary corner location
|
||||||
Location lesserBoundaryCorner = this.locationFromString(line);
|
Location lesserBoundaryCorner = this.locationFromString(line);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -689,6 +689,16 @@ public class GriefPrevention extends JavaPlugin
|
||||||
//this is the preferred method, as it's simpler than the database scenario
|
//this is the preferred method, as it's simpler than the database scenario
|
||||||
if(this.dataStore == null)
|
if(this.dataStore == null)
|
||||||
{
|
{
|
||||||
|
File oldclaimdata = new File(getDataFolder(), "ClaimData");
|
||||||
|
if(oldclaimdata.exists()) {
|
||||||
|
if(!FlatFileDataStore.hasData()) {
|
||||||
|
File claimdata = new File("plugins" + File.separator + "GriefPreventionData" + File.separator + "ClaimData");
|
||||||
|
oldclaimdata.renameTo(claimdata);
|
||||||
|
File oldplayerdata = new File(getDataFolder(), "PlayerData");
|
||||||
|
File playerdata = new File("plugins" + File.separator + "GriefPreventionData" + File.separator + "PlayerData");
|
||||||
|
oldplayerdata.renameTo(playerdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.dataStore = new FlatFileDataStore();
|
this.dataStore = new FlatFileDataStore();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user