diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8a4fd94f5..6624eb1ee 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -13,10 +13,14 @@
-
-
-
-
+
+
+
+
+
+
+
+
@@ -40,41 +44,66 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -83,34 +112,39 @@
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -152,12 +186,9 @@
-
-
-
@@ -166,6 +197,14 @@
+
+
+
+
+
+
+
+
@@ -600,7 +639,7 @@
-
+
1411382351159
@@ -694,11 +733,15 @@
1412777166979
1412777166979
-
+
+ 1412777725409
+ 1412777725409
+
+
-
+
@@ -722,7 +765,7 @@
-
+
@@ -741,7 +784,7 @@
-
+
@@ -787,7 +830,8 @@
-
+
+
@@ -799,41 +843,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1002,14 +1011,6 @@
-
-
-
-
-
-
-
-
@@ -1018,20 +1019,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1061,22 +1048,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1137,14 +1108,6 @@
-
-
-
-
-
-
-
-
@@ -1171,12 +1134,105 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index 94761771f..937b3145f 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -728,8 +728,8 @@ public class PlotMain extends JavaPlugin {
PlotHelper.canSetFast = false;
}
-
-// UUIDHandler.startFetch(this);
+ //TODO Test...
+ UUIDHandler.startFetch(this);
}
/**
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
index e11ab4819..ac6fe88b6 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
@@ -1,11 +1,14 @@
package com.intellectualcrafters.plot;
import com.google.common.base.Charsets;
+import com.intellectualcrafters.plot.uuid.NameFetcher;
+import com.intellectualcrafters.plot.uuid.UUIDFetcher;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
+import java.util.Arrays;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -71,7 +74,13 @@ public class UUIDHandler {
return uuid;
}
if(Bukkit.getOnlineMode()) {
- /* TODO: Add mojang API support */
+ try {
+ UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
+ uuid = fetcher.call().get(name);
+ add(name, uuid);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
} else {
return getUuidOfflineMode(name);
}
@@ -108,7 +117,19 @@ public class UUIDHandler {
if ((name = getNameOfflinePlayer(uuid)) != null) {
return name;
}
- return null;
+ if (Bukkit.getOnlineMode()) {
+ try {
+ NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
+ name = fetcher.call().get(uuid);
+ add(name, uuid);
+ return name;
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ return "unknown";
+ }
+ return "";
}
/**
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java
index ba4607432..fcb8e55e0 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java
@@ -9,17 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-08-03.
@@ -72,7 +72,7 @@ public class Denied extends SubCommand {
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
return true;
}
- if (!hasBeenOnServer(args[1])) {
+ /*if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
@@ -85,7 +85,8 @@ public class Denied extends SubCommand {
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.addDenied(uuid);
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
@@ -110,7 +111,7 @@ public class Denied extends SubCommand {
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
return true;
}
- if (!hasBeenOnServer(args[1])) {
+ /*if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
@@ -127,7 +128,8 @@ public class Denied extends SubCommand {
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeDenied(uuid);
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java
index ada76c272..38a70d2f0 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java
@@ -9,17 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class Helpers extends SubCommand {
@@ -69,7 +69,7 @@ public class Helpers extends SubCommand {
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
return true;
}
- if (!hasBeenOnServer(args[1])) {
+ /*if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
@@ -82,7 +82,8 @@ public class Helpers extends SubCommand {
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.addHelper(uuid);
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
@@ -100,7 +101,7 @@ public class Helpers extends SubCommand {
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
return true;
}
- if (!hasBeenOnServer(args[1])) {
+ /*if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
@@ -117,7 +118,8 @@ public class Helpers extends SubCommand {
if (!plot.helpers.contains(uuid)) {
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeHelper(uuid);
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java
index 2c1cc2509..009aafdd5 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java
@@ -9,22 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.ArrayList;
+import java.util.UUID;
/**
*
@@ -125,11 +120,13 @@ public class Info extends SubCommand {
if (uuid.equals(DBFunc.everyone) || uuid.toString().equalsIgnoreCase(DBFunc.everyone.toString())) {
return "everyone";
}
+ /*
OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid);
if (plr.getName() == null) {
return "unknown";
}
- return plr.getName();
+ return plr.getName();*/
+ return UUIDHandler.getName(uuid);
}
private Biome getBiomeAt(Plot plot) {
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java
index 8c941f2e3..8856ad539 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java
@@ -9,17 +9,11 @@
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class SetOwner extends SubCommand {
@@ -28,9 +22,14 @@ public class SetOwner extends SubCommand {
super("setowner", "plots.admin", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS);
}
+ /*
private UUID getUUID(String string) {
OfflinePlayer player = Bukkit.getOfflinePlayer(string);
return ((player != null) && player.hasPlayedBefore()) ? player.getUniqueId() : null;
+ }*/
+
+ private UUID getUUID(String string) {
+ return UUIDHandler.getUUID(string);
}
@Override
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Trusted.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Trusted.java
index 754f903f5..2271683c9 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Trusted.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Trusted.java
@@ -9,17 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class Trusted extends SubCommand {
@@ -69,7 +69,7 @@ public class Trusted extends SubCommand {
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
return true;
}
- if (!hasBeenOnServer(args[1])) {
+ /*if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
}
@@ -82,7 +82,8 @@ public class Trusted extends SubCommand {
if (uuid == null) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.addTrusted(uuid);
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
@@ -100,6 +101,7 @@ public class Trusted extends SubCommand {
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
return true;
}
+ /*
if (!hasBeenOnServer(args[1])) {
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
return true;
@@ -117,7 +119,8 @@ public class Trusted extends SubCommand {
if (!plot.trusted.contains(uuid)) {
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
return true;
- }
+ }*/
+ UUID uuid = UUIDHandler.getUUID(args[1]);
plot.removeTrusted(uuid);
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java
index 566a133ed..b91c90154 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java
@@ -9,18 +9,12 @@
package com.intellectualcrafters.plot.commands;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
+import com.intellectualcrafters.plot.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
+import java.util.HashMap;
+import java.util.UUID;
/**
*
@@ -97,11 +91,12 @@ public class list extends SubCommand {
if (id == null) {
return "none";
}
- String name = Bukkit.getOfflinePlayer(id).getName();
+ /*String name = Bukkit.getOfflinePlayer(id).getName();
if (name == null) {
return "none";
}
- return name;
+ return name;*/
+ return UUIDHandler.getName(id);
}
private String getArgumentList(String[] strings) {