diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index 0eae2af7b..549b7241f 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -8,42 +8,7 @@
package com.intellectualcrafters.plot;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.UUID;
-
-import me.confuser.barapi.BarAPI;
-import net.milkbowl.vault.economy.Economy;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.World;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Tameable;
-import org.bukkit.generator.ChunkGenerator;
-import org.bukkit.plugin.RegisteredServiceProvider;
-import org.bukkit.plugin.java.JavaPlugin;
-
import ca.mera.CameraAPI;
-
import com.intellectualcrafters.plot.Logger.LogLevel;
import com.intellectualcrafters.plot.Settings.Web;
import com.intellectualcrafters.plot.commands.Camera;
@@ -60,14 +25,39 @@ import com.intellectualcrafters.plot.generator.WorldGenerator;
import com.intellectualcrafters.plot.listeners.PlayerEvents;
import com.intellectualcrafters.plot.listeners.WorldEditListener;
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
+import com.intellectualcrafters.plot.uuid.PlotUUIDSaver;
+import com.intellectualcrafters.plot.uuid.UUIDSaver;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+import me.confuser.barapi.BarAPI;
+import net.milkbowl.vault.economy.Economy;
+import org.bukkit.*;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Tameable;
+import org.bukkit.generator.ChunkGenerator;
+import org.bukkit.plugin.RegisteredServiceProvider;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.*;
+import java.util.Map.Entry;
/**
* @awesome @author Citymonstret, Empire92 PlotMain class.
*/
public class PlotMain extends JavaPlugin {
+ private static UUIDSaver uuidSaver;
+
/**
* settings.properties
*/
@@ -162,7 +152,7 @@ public class PlotMain extends JavaPlugin {
* - checks for '*' nodes
*
* @param player
- * @param perm
+ * @param perms
* @return
*/
public static boolean hasPermissions(Player player, String[] perms) {
@@ -193,6 +183,14 @@ public class PlotMain extends JavaPlugin {
return true;
}
+ public static void setUUIDSaver(UUIDSaver saver) {
+ uuidSaver = saver;
+ }
+
+ public static UUIDSaver getUUIDSaver() {
+ return uuidSaver;
+ }
+
/**
* Check a player for a permission
* - Op has all permissions
@@ -684,6 +682,7 @@ public class PlotMain extends JavaPlugin {
//Setup version + downloads, will not be updated... maybe setup runnable? TODO Let jesse decide...
com.intellectualcrafters.plot.commands.plugin.setup(this);
+ setUUIDSaver(new PlotUUIDSaver());
UUIDHandler.startFetch(this);
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
index 1b8066966..ce4c5f7ec 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
@@ -5,6 +5,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.uuid.NameFetcher;
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
+import com.intellectualcrafters.plot.uuid.UUIDSaver;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@@ -223,4 +224,12 @@ public class UUIDHandler {
add(name, uuid);
return uuid;
}
+
+
+ /* Save UUIDS */
+ public static void handleSaving() {
+ UUIDSaver saver = PlotMain.getUUIDSaver();
+ // Should it save per UUIDSet or all of them? TODO: Let Jesse decide xD
+ saver.globalSave(getUuidMap());
+ }
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java b/PlotSquared/src/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
new file mode 100644
index 000000000..086eddc87
--- /dev/null
+++ b/PlotSquared/src/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
@@ -0,0 +1,27 @@
+package com.intellectualcrafters.plot.uuid;
+
+import com.google.common.collect.BiMap;
+
+import java.util.UUID;
+
+/**
+ * Created by Citymonstret on 2014-10-13.
+ */
+public class PlotUUIDSaver extends UUIDSaver {
+
+ public void globalSave(BiMap map) {
+
+ }
+
+ public void save(UUIDSet set) {
+
+ }
+
+ public UUIDSet get(String name) {
+ return null;
+ }
+
+ public UUIDSet get(UUID uuid) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSaver.java b/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSaver.java
new file mode 100644
index 000000000..7e494d34f
--- /dev/null
+++ b/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSaver.java
@@ -0,0 +1,15 @@
+package com.intellectualcrafters.plot.uuid;
+
+import com.google.common.collect.BiMap;
+
+import java.util.UUID;
+
+/**
+ * Created by Citymonstret on 2014-10-13.
+ */
+public abstract class UUIDSaver {
+ public abstract void globalSave(BiMap map);
+ public abstract void save(UUIDSet set);
+ public abstract UUIDSet get(String name);
+ public abstract UUIDSet get(UUID uuid);
+}
\ No newline at end of file
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSet.java b/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSet.java
new file mode 100644
index 000000000..703b96441
--- /dev/null
+++ b/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDSet.java
@@ -0,0 +1,29 @@
+package com.intellectualcrafters.plot.uuid;
+
+import java.util.UUID;
+
+/**
+ * Created by Citymonstret on 2014-10-13.
+ */
+public class UUIDSet {
+ private String name;
+ private UUID uuid;
+
+ public UUIDSet(String name, UUID uuid) {
+ this.name = name;
+ this.uuid = uuid;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public UUID getUUID() {
+ return uuid;
+ }
+}
\ No newline at end of file