Small DB changes
This commit is contained in:
parent
307d9210dd
commit
5fe9d05e1b
@ -1,5 +1,6 @@
|
||||
package com.massivecraft.massivecore.store;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||
@ -148,15 +149,20 @@ public class DriverFlatfile extends DriverAbstract
|
||||
return loadFile(file);
|
||||
}
|
||||
|
||||
public Entry<JsonObject, Long> loadFile(File file)
|
||||
public static Entry<JsonObject, Long> loadFile(File file)
|
||||
{
|
||||
long mtime = file.lastModified();
|
||||
JsonObject raw = loadFileJson(file);
|
||||
JsonObject raw = loadFileJsonObject(file);
|
||||
|
||||
return new SimpleEntry<>(raw, mtime);
|
||||
}
|
||||
|
||||
public JsonObject loadFileJson(File file)
|
||||
public static JsonObject loadFileJsonObject(File file)
|
||||
{
|
||||
return loadFileJson(file).getAsJsonObject();
|
||||
}
|
||||
|
||||
public static JsonElement loadFileJson(File file)
|
||||
{
|
||||
String content = DiscUtil.readCatch(file);
|
||||
if (content == null) return null;
|
||||
@ -164,7 +170,7 @@ public class DriverFlatfile extends DriverAbstract
|
||||
content = content.trim();
|
||||
if (content.length() == 0) return null;
|
||||
|
||||
return new JsonParser().parse(content).getAsJsonObject();
|
||||
return new JsonParser().parse(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,8 +63,6 @@ public class IdData implements Identified, Named
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (!(obj instanceof IdData)) return false;
|
||||
IdData other = (IdData) obj;
|
||||
if (id == null)
|
||||
|
@ -265,6 +265,11 @@ public class IdUtil implements Listener, Runnable
|
||||
update(id, name, System.currentTimeMillis(), presence);
|
||||
}
|
||||
|
||||
public static void update(IdData data)
|
||||
{
|
||||
update(data.getId(), data.getName(), data.getMillis(), null);
|
||||
}
|
||||
|
||||
public static void update(final String id, final String name, final long millis, SenderPresence presence)
|
||||
{
|
||||
// First Null Check
|
||||
|
Loading…
Reference in New Issue
Block a user