diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6624eb1ee..de6ec31d0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,19 +8,9 @@
-
-
-
-
-
-
-
-
-
-
@@ -44,106 +34,107 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -166,12 +157,9 @@
-
-
-
@@ -186,25 +174,31 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -371,6 +365,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -451,7 +523,7 @@
-
+
@@ -481,6 +553,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -639,7 +825,7 @@
-
+
1411382351159
@@ -737,11 +923,35 @@
1412777725409
1412777725409
-
+
+ 1412778407025
+ 1412778407025
+
+
+ 1412782262178
+ 1412782262178
+
+
+ 1412789519871
+ 1412789519871
+
+
+ 1413044168574
+ 1413044168574
+
+
+ 1413044690771
+ 1413044690771
+
+
+ 1413045024427
+ 1413045024427
+
+
-
+
@@ -765,7 +975,7 @@
-
+
@@ -775,16 +985,16 @@
-
+
-
-
-
+
+
+
-
+
@@ -810,8 +1020,6 @@
-
-
@@ -831,11 +1039,25 @@
-
+
+
+
+
+
+
+
-
+
+
+ file://$PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+ 173
+
+
+
+
+
@@ -843,41 +1065,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -920,20 +1107,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -955,13 +1128,6 @@
-
-
-
-
-
-
-
@@ -983,20 +1149,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1004,21 +1156,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1030,6 +1167,7 @@
+
@@ -1045,6 +1183,7 @@
+
@@ -1052,6 +1191,7 @@
+
@@ -1087,17 +1227,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1132,38 +1261,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1196,23 +1293,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1227,12 +1314,175 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index bb093cb13..390f0be9e 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -681,6 +681,9 @@ public class PlotMain extends JavaPlugin {
PlotHelper.canSetFast = false;
}
+ //Setup version + downloads, will not be updated... maybe setup runnable? TODO Let jesse decide...
+ com.intellectualcrafters.plot.commands.plugin.setup(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 b80ec5bbf..9225d98f1 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/UUIDHandler.java
@@ -1,20 +1,17 @@
package com.intellectualcrafters.plot;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
import com.google.common.base.Charsets;
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 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.UUID;
public class UUIDHandler {
@@ -56,8 +53,16 @@ public class UUIDHandler {
}
long time = System.currentTimeMillis() - start;
- PlotMain.sendConsoleSenderMessage("&cFinished caching of offlineplayers! Took &6" + time + "&cms, &6"
- + length + " &cUUID's were cached" + " and there is now a grand total of &6" + uuidMap.size()
+ int size = uuidMap.size();
+ double ups;
+ if(time == 0l || size == 0) {
+ ups = size;
+ } else {
+ ups = size / time;
+ }
+
+ PlotMain.sendConsoleSenderMessage("&cFinished caching of offlineplayers! Took &6" + time + "&cms (&6" + ups + "&c per millisecond), &6"
+ + length + " &cUUID's were cached" + " and there is now a grand total of &6" + size
+ " &ccached.");
}
});
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java
index 48d995a21..2f152d1e7 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java
@@ -54,10 +54,7 @@ public class Schematic extends SubCommand {
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
break;
}
- if (!PlayerFunctions.isInPlot(plr)) {
- sendMessage(plr, C.NOT_IN_PLOT);
- break;
- }
+
int l1 = schematic.getSchematicDimension().getX();
int l2 = schematic.getSchematicDimension().getZ();
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
index f020b6464..76dd3b79e 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
@@ -8,35 +8,62 @@
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotMain;
-
public class plugin extends SubCommand {
public plugin() {
super("plugin", "plots.use", "Show plugin information", "plugin", "pl", CommandCategory.INFO);
}
- @Override
+ public static String
+ downloads,
+ version;
+
+
+ public static void setup(JavaPlugin plugin) {
+ plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ try {
+ downloads =
+ convertToNumericString(getInfo("https://intellectualsites.com/spigot_api.php?method=downloads&url=http://www.spigotmc.org/resources/plotsquared.1177/"), false);
+ } catch (Exception e) {
+ downloads = "unknown";
+ }
+ }
+ }, 1l);
+ plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ try {
+ version =
+ convertToNumericString(getInfo("https://intellectualsites.com/spigot_api.php?method=version&resource=1177"), true);
+ } catch(Exception e) {
+ //Let's just ignore this, most likely error 500...
+ version = "unknown";
+ }
+ }
+ }, 200l);
+ }
+
+ @Override
public boolean execute(final Player plr, String... args) {
Bukkit.getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PlotMain.class), new Runnable() {
@Override
public void run() {
ArrayList strings = new ArrayList() {
{
- String downloads =
- getInfo("https://intellectualsites.com/spigot_api.php?method=downloads&url=http://www.spigotmc.org/resources/plotsquared.1177/"), version =
- getInfo("https://intellectualsites.com/spigot_api.php?method=version&resource=1177");
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion()));
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
add(String.format("&c>> &6Download at &lhttp://i-s.link/ps"));
@@ -52,26 +79,31 @@ public class plugin extends SubCommand {
return true;
}
+ private static String convertToNumericString(String str, boolean dividers) {
+ StringBuilder builder = new StringBuilder();
+ for(char c : str.toCharArray()) {
+ if(Character.isDigit(c))
+ builder.append(c);
+ else if(dividers && (c == ',' || c == '.' || c == '-' || c == '_'))
+ builder.append(c);
+ }
+ return builder.toString();
+ }
+
/**
* @param link
* @return
*/
- private String getInfo(String link) {
- try {
- URLConnection connection = new URL(link).openConnection();
- connection.addRequestProperty("User-Agent", "Mozilla/4.0");
- BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- String document = "", line;
- while ((line = reader.readLine()) != null) {
- document += (line + "\n");
- }
- reader.close();
- return document;
- }
- catch (Exception e) {
- e.printStackTrace();
- return "";
- }
+ private static String getInfo(String link) throws Exception {
+ URLConnection connection = new URL(link).openConnection();
+ connection.addRequestProperty("User-Agent", "Mozilla/4.0");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String document = "", line;
+ while ((line = reader.readLine()) != null) {
+ document += (line + "\n");
+ }
+ reader.close();
+ return document;
}
}