diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a077bf067..6624eb1ee 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -13,9 +13,14 @@
-
-
+
+
+
+
+
+
+
@@ -38,38 +43,113 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -92,7 +172,6 @@
-
@@ -104,19 +183,28 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -157,6 +245,8 @@
+
+
@@ -335,8 +425,6 @@
-
-
@@ -550,7 +638,8 @@
-
+
+
1411382351159
@@ -636,11 +725,23 @@
1412599888665
1412599888665
-
+
+ 1412745106846
+ 1412745106846
+
+
+ 1412777166979
+ 1412777166979
+
+
+ 1412777725409
+ 1412777725409
+
+
-
+
@@ -664,7 +765,7 @@
-
+
@@ -678,18 +779,18 @@
+
-
+
-
@@ -727,7 +828,10 @@
-
+
+
+
+
@@ -739,63 +843,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -803,13 +850,6 @@
-
-
-
-
-
-
-
@@ -936,13 +976,6 @@
-
-
-
-
-
-
-
@@ -978,14 +1011,6 @@
-
-
-
-
-
-
-
-
@@ -994,22 +1019,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1017,19 +1026,10 @@
-
-
-
-
-
-
-
-
-
@@ -1045,31 +1045,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1077,7 +1052,6 @@
-
@@ -1097,24 +1071,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java
index 94b085059..7c7609b37 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/C.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java
@@ -25,7 +25,7 @@ public enum C {
/*
* Economy Stuff
*/
- CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), REMOVED_BALANCE("&6%s &chas been taken from your balance"),
+ CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), ADDED_BALANCE("&6%s &chas been added to your balance"), REMOVED_BALANCE("&6%s &chas been taken from your balance"),
/*
* Setup Stuff
*/
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java b/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java
index 7988a5d1e..33714f513 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java
@@ -7,7 +7,38 @@ import org.bukkit.ChatColor;
*/
public class ConsoleColors {
- public static final String ANSI_RESET = "\u001B[0m";
+ static enum ConsoleColor {
+ RESET ("\u001B[0m"),
+ BLACK ("\u001B[30m"),
+ RED ("\u001B[31m"),
+ GREEN ("\u001B[32m"),
+ YELLOW ("\u001B[33m"),
+ BLUE ("\u001B[34m"),
+ PURPLE ("\u001B[35m"),
+ CYAN ("\u001B[36m"),
+ WHITE ("\u001B[37m"),
+ BOLD ("\033[1m"),
+ UNDERLINE ("\033[0m"),
+ ITALIC ("\033[3m");
+
+ private String win;
+ private String lin;
+
+ ConsoleColor(String lin) {
+ this.lin = lin;
+ this.win = win;
+ }
+
+ public String getWin() {
+ return win;
+ }
+
+ public String getLin(){
+ return lin;
+ }
+ }
+
+ /* public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
@@ -18,49 +49,53 @@ public class ConsoleColors {
public static final String ANSI_WHITE = "\u001B[37m";
public static final String ANSI_BOLD = "\033[1m";
public static final String ANSI_UNDERLINE = "\033[0m";
- public static final String ANSI_ITALIC = "\033[3m]";
+ public static final String ANSI_ITALIC = "\033[3m]";*/
public static String fromString(String input) {
input = input.replaceAll("&0", fromChatColor(ChatColor.BLACK)).replaceAll("&1", fromChatColor(ChatColor.DARK_BLUE)).replaceAll("&2", fromChatColor(ChatColor.DARK_GREEN)).replaceAll("&3", fromChatColor(ChatColor.DARK_AQUA)).replaceAll("&4", fromChatColor(ChatColor.DARK_RED)).replaceAll("&5", fromChatColor(ChatColor.DARK_PURPLE)).replaceAll("&6", fromChatColor(ChatColor.GOLD)).replaceAll("&7", fromChatColor(ChatColor.GRAY)).replaceAll("&8", fromChatColor(ChatColor.DARK_GRAY)).replaceAll("&9", fromChatColor(ChatColor.BLUE)).replaceAll("&a", fromChatColor(ChatColor.GREEN)).replaceAll("&b", fromChatColor(ChatColor.AQUA)).replaceAll("&c", fromChatColor(ChatColor.RED)).replaceAll("&d", fromChatColor(ChatColor.LIGHT_PURPLE)).replaceAll("&e", fromChatColor(ChatColor.YELLOW)).replaceAll("&f", fromChatColor(ChatColor.WHITE)).replaceAll("&k", fromChatColor(ChatColor.MAGIC)).replaceAll("&l", fromChatColor(ChatColor.BOLD)).replaceAll("&m", fromChatColor(ChatColor.STRIKETHROUGH))
.replaceAll("&n", fromChatColor(ChatColor.UNDERLINE)).replaceAll("&o", fromChatColor(ChatColor.ITALIC)).replaceAll("&r", fromChatColor(ChatColor.RESET));
- return input + ANSI_RESET;
+ return input + ConsoleColor.RESET.toString();
}
public static String fromChatColor(ChatColor color) {
+ return chatColor(color).getLin();
+ }
+
+ public static ConsoleColor chatColor(ChatColor color) {
switch (color) {
case RESET:
- return ANSI_RESET;
+ return ConsoleColor.RESET;
case GRAY:
case DARK_GRAY:
- return ANSI_WHITE;
+ return ConsoleColor.WHITE;
case BLACK:
- return ANSI_BLACK;
+ return ConsoleColor.BLACK;
case DARK_RED:
case RED:
- return ANSI_RED;
+ return ConsoleColor.RED;
case GOLD:
case YELLOW:
- return ANSI_YELLOW;
+ return ConsoleColor.YELLOW;
case DARK_GREEN:
case GREEN:
- return ANSI_GREEN;
+ return ConsoleColor.GREEN;
case AQUA:
case DARK_AQUA:
- return ANSI_CYAN;
+ return ConsoleColor.CYAN;
case LIGHT_PURPLE:
case DARK_PURPLE:
- return ANSI_PURPLE;
+ return ConsoleColor.PURPLE;
case BLUE:
case DARK_BLUE:
- return ANSI_BLUE;
+ return ConsoleColor.BLUE;
case UNDERLINE:
- return ANSI_UNDERLINE;
+ return ConsoleColor.UNDERLINE;
case ITALIC:
- return ANSI_ITALIC;
+ return ConsoleColor.ITALIC;
case BOLD:
- return ANSI_BOLD;
+ return ConsoleColor.BOLD;
default:
- return "";
+ return ConsoleColor.RESET;
}
}
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
index db95db2d4..c034afcd1 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
@@ -9,19 +9,9 @@
package com.intellectualcrafters.plot;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.World;
+import com.intellectualcrafters.plot.database.DBFunc;
+import net.milkbowl.vault.economy.Economy;
+import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@@ -29,7 +19,8 @@ import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.io.File;
+import java.util.*;
/**
* plot functions
@@ -48,7 +39,7 @@ public class PlotHelper {
/**
* direction 0 = north, 1 = south, etc:
*
- * @param plot
+ * @param id
* @param direction
* @return
*/
@@ -66,6 +57,23 @@ public class PlotHelper {
return id;
}
+ public static boolean mergePlots(Player plr, World world, ArrayList plotIds) {
+ PlotWorld plotworld = PlotMain.getWorldSettings(world);
+ if(PlotMain.useEconomy && plotworld.USE_ECONOMY) {
+ double cost = plotIds.size() * plotworld.MERGE_PRICE;
+ if (cost > 0d) {
+ Economy economy = PlotMain.economy;
+ if (economy.getBalance(plr) < cost) {
+ PlayerFunctions.sendMessage(plr, C.CANNOT_AFFORD_MERGE, "" + cost);
+ return false;
+ }
+ economy.withdrawPlayer(plr, cost);
+ PlayerFunctions.sendMessage(plr, C.REMOVED_BALANCE, cost + "");
+ }
+ }
+ return mergePlots(world, plotIds);
+ }
+
/**
* Completely merges a set of plots
* (There are no checks to make sure you supply the correct
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index f4a301929..86815c262 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -490,8 +490,8 @@ public class PlotMain extends JavaPlugin {
}
/**
- * TODO: Implement better system The whole point of this system is to
- * recycle old plots So why not just allow users to claim old plots, and try
+ * TODO: Implement better system
+ * The whole point of this system is to recycle old plots So why not just allow users to claim old plots, and try
* to hide the fact that the are owned. Reduce amount of expired plots: - On
* /plot auto - allow claiming of old plot, clear it so the user doesn't
* know - On /plot info, - show that the plot is expired and allowed to be
@@ -752,8 +752,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/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
index af600eec3..2fa30c2b7 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
@@ -1,14 +1,10 @@
package com.intellectualcrafters.plot;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.bukkit.block.Biome;
import org.bukkit.configuration.ConfigurationSection;
-
-import com.sk89q.worldedit.util.YAMLConfiguration;
-
public abstract class PlotWorld {
public boolean AUTO_MERGE;
@@ -110,4 +106,4 @@ public abstract class PlotWorld {
* @return ConfigurationNode[]
*/
public abstract ConfigurationNode[] getSettingNodes();
-}
+}
\ No newline at end of file
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/Auto.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
index ab55f1426..7943ae1ec 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
@@ -70,6 +70,7 @@ public class Auto extends SubCommand {
PlotWorld pWorld = PlotMain.getWorldSettings(world);
if(PlotMain.useEconomy && pWorld.USE_ECONOMY) {
double cost = pWorld.PLOT_PRICE;
+ cost = (size_x * size_z) * cost;
if (cost > 0d) {
Economy economy = PlotMain.economy;
if (economy.getBalance(plr) < cost) {
@@ -119,16 +120,16 @@ public class Auto extends SubCommand {
PlotId start = new PlotId(x, z);
PlotId end = new PlotId((x + size_x) - 1, (z + size_z) - 1);
if (isUnowned(world, start, end)) {
- // TODO claim event
- // Claim.claimPlot calls that event...
for (int i = start.x; i <= end.x; i++) {
for (int j = start.y; j <= end.y; j++) {
Plot plot = PlotHelper.getPlot(world, new PlotId(i, j));
- boolean teleport = ((i == end.x) && (j == end.y)) ? true : false;
+ boolean teleport = ((i == end.x) && (j == end.y));
Claim.claimPlot(plr, plot, teleport);
}
}
- PlotHelper.mergePlots(world, PlayerFunctions.getPlotSelectionIds(world, start, end));
+ if(!PlotHelper.mergePlots(plr, world, PlayerFunctions.getPlotSelectionIds(world, start, end))) {
+ return false;
+ }
br = true;
}
if ((z < q) && ((z - x) < q)) {
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java
index 685a14596..888e9dac9 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java
@@ -9,14 +9,10 @@
package com.intellectualcrafters.plot.commands;
-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.PlotMain;
+import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.database.DBFunc;
+import net.milkbowl.vault.economy.Economy;
+import org.bukkit.entity.Player;
/**
* Created by Citymonstret on 2014-08-01.
@@ -42,6 +38,15 @@ public class Delete extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
+ PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld());
+ if(PlotMain.useEconomy && pWorld.USE_ECONOMY) {
+ double c = pWorld.SELL_PRICE;
+ if(c > 0d) {
+ Economy economy = PlotMain.economy;
+ economy.depositPlayer(plr, c);
+ sendMessage(plr, C.ADDED_BALANCE, c + "");
+ }
+ }
boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true);
if (result) {
PlotHelper.removeSign(plr, plot);
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/MainCommand.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java
index ce9d70571..a4b2920dd 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java
@@ -9,18 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.Arrays;
-
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.PlotMain;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotMain;
+import java.util.ArrayList;
+import java.util.Arrays;
/**
* PlotMain command class
@@ -123,7 +122,7 @@ public class MainCommand implements CommandExecutor {
if (cmd.permission.hasPermission(player) && (cmd.category == category)) {
String s = t(C.HELP_PAGE.s());
s = s.replaceAll("%alias%", cmd.alias);
- s = s.replaceAll("%usage%", "/plot " + cmd.usage);
+ s = s.replaceAll("%usage%", cmd.usage.contains("plot") ? cmd.usage : "/plot " + cmd.usage);
s = s.replaceAll("%cmd%", cmd.cmd);
s = s.replaceAll("%desc%", cmd.description);
help.add(s);
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
index 63b231e28..2fb53e1eb 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Merge.java
@@ -9,24 +9,15 @@
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.events.PlotMergeEvent;
import net.milkbowl.vault.economy.Economy;
-
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.SetBlockFast;
-import com.intellectualcrafters.plot.events.PlotMergeEvent;
+import java.util.ArrayList;
/**
*
@@ -127,6 +118,7 @@ public class Merge extends SubCommand {
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
if (PlotMain.useEconomy && plotWorld.USE_ECONOMY) {
double cost = plotWorld.MERGE_PRICE;
+ cost = plots.size() * cost;
if (cost > 0d) {
Economy economy = PlotMain.economy;
if (economy.getBalance(plr) < cost) {
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) {
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
index 7a58d17dd..00ca7ff68 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
@@ -9,13 +9,17 @@
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.Settings;
+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;
public class plugin extends SubCommand {
@@ -24,18 +28,50 @@ public class plugin extends SubCommand {
}
@Override
- public boolean execute(Player plr, String... args) {
- ArrayList strings = new ArrayList() {
- {
- add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion()));
- add(String.format("&c>> &6Made by Citymonstret and brandonrelph"));
- add(String.format("&c>> &6Download at %s", Settings.URL));
+ 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"));
+ add(String.format("&c>> &cNewest Version (Spigot): %s", version));
+ add(String.format("&c>> &cTotal Downloads (Spigot): %s", downloads));
+ }
+ };
+ for (String s : strings) {
+ PlayerFunctions.sendMessage(plr, s);
+ }
}
- };
- for (String s : strings) {
- PlayerFunctions.sendMessage(plr, s);
- }
+ });
return true;
}
+ /**
+ *
+ * @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 "";
+ }
+ }
+
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
index f2c1c243f..e94c69f5b 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
@@ -1,17 +1,10 @@
package com.intellectualcrafters.plot.generator;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.commons.lang.StringUtils;
-import org.bukkit.Material;
-import org.bukkit.block.Biome;
import org.bukkit.configuration.ConfigurationSection;
-import com.intellectualcrafters.plot.Configuration.*;
import com.intellectualcrafters.plot.Configuration;
import com.intellectualcrafters.plot.ConfigurationNode;
-import com.intellectualcrafters.plot.Flag;
import com.intellectualcrafters.plot.PlotBlock;
import com.intellectualcrafters.plot.PlotWorld;
diff --git a/PlotSquared/src/plugin.yml b/PlotSquared/src/plugin.yml
index c4ba2f754..671cdba1b 100644
--- a/PlotSquared/src/plugin.yml
+++ b/PlotSquared/src/plugin.yml
@@ -4,7 +4,7 @@ version: 2.0.5
load: STARTUP
description: >
Easy, yet powerful Plot World generation and management.
-authors: [Citymonstret, brandonrelph]
+authors: [Citymonstret, Empire92]
softdepend: [WorldEdit, BarAPI, PlotMe, CameraAPI]
database: false
commands: