From 76c3879c1f23f433a7648c7a1741c9c19a818217 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 13 Apr 2016 02:41:40 +1000 Subject: [PATCH 1/5] Fixes #1050 --- Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java | 4 ++-- .../com/plotsquared/bukkit/generator/BukkitPlotGenerator.java | 2 -- .../java/com/intellectualcrafters/plot/commands/Owner.java | 2 +- .../java/com/intellectualcrafters/plot/util/EventUtil.java | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 755475b38..1d056379d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -112,11 +112,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { if (split.length == 3) { this.version[2] = Integer.parseInt(split[2]); } - } catch (NumberFormatException e) { + } catch (Exception e) { e.printStackTrace(); PS.debug(StringMan.getString(Bukkit.getBukkitVersion())); PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\."))); - return new int[]{Integer.MAX_VALUE, 0, 0}; + return new int[]{1,9,2}; } } return this.version; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 540b88766..42b6e68f7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -200,8 +200,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap return this.platformGenerator; } - - @Override public List getDefaultPopulators(World world) { try { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java index 9a5879713..f9ba628a6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java @@ -44,7 +44,7 @@ public class Owner extends SetCommand { if (uuid == null) { if (value.equalsIgnoreCase("none")) { HashSet connected = plot.getConnectedPlots(); - plot.unlink(); + plot.unlinkPlot(false, false); for (Plot current : connected) { current.unclaim(); current.removeSign(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index f14952214..c245667be 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -235,8 +235,7 @@ public abstract class EventUtil { value = (HashSet) flag.getValue(); } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - // TODO: fix the commented dead code - return true; //!(!false || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_DEVICE_INTERACT.s())); + return false; //!(!false || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_DEVICE_INTERACT.s())); } return true; } From 30a2c5d8816d0af6d9cd254b67c21f0aead33744 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 13 Apr 2016 03:35:14 +1000 Subject: [PATCH 2/5] perm requirement for add/trust * --- .../java/com/intellectualcrafters/plot/commands/Add.java | 2 +- .../com/intellectualcrafters/plot/commands/ListCmd.java | 7 ++++++- .../java/com/intellectualcrafters/plot/commands/Trust.java | 2 +- .../com/intellectualcrafters/plot/util/ExpireManager.java | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java index baba1435f..1ccd4d41a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -43,7 +43,7 @@ public class Add extends SubCommand { return true; } UUID uuid; - if (args[0].equalsIgnoreCase("*")) { + if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.add.everyone") || Permissions.hasPermission(plr, "plots.admin.command.add"))) { uuid = DBFunc.everyone; } else { // TODO have a runnable for fetch diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java index 441217d27..6d2d307e3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java @@ -287,7 +287,12 @@ public class ListCmd extends SubCommand { C.COMMAND_SYNTAX.send(plr, "/plot list fuzzy [#]"); return false; } - String term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 2), " "); + String term; + if (MathMan.isInteger(args[args.length - 1])) { + term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 1), " "); + } else { + term = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); + } plots = MainUtil.getPlotsBySearch(term); sort = false; break; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index 390ed1151..0ad231267 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -42,7 +42,7 @@ public class Trust extends SubCommand { return true; } UUID uuid; - if (args[0].equalsIgnoreCase("*")) { + if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.trust.everyone") || Permissions.hasPermission(plr, "plots.admin.command.trust"))) { uuid = DBFunc.everyone; } else { uuid = UUIDHandler.getUUID(args[0], null); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index f281defb2..36a2b4bc9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -18,6 +18,7 @@ import com.intellectualcrafters.plot.object.RunnableVal2; import java.util.HashSet; import java.util.Iterator; +import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -259,7 +260,7 @@ public class ExpireManager { } public boolean isExpired(Plot plot) { - if (!plot.hasOwner() || DBFunc.everyone.equals(plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) { + if (!plot.hasOwner() || Objects.equals(DBFunc.everyone, plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) { return false; } Flag keep = plot.getFlag("keep"); From d34abf4f02082dcf9576af0af66e3bcc444003cb Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 17 Apr 2016 03:11:05 +1000 Subject: [PATCH 3/5] Disable colored chat --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 9db361f56..27d78950f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -603,8 +603,8 @@ public class PlayerEvents extends PlotListener implements Listener { } } } - String full = format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender).replace("%msg%", message); - full = ChatColor.translateAlternateColorCodes('&', full); + String partial = ChatColor.translateAlternateColorCodes('&',format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender)); + String full = partial.replace("%msg%", message); for (Player receiver : recipients) { receiver.sendMessage(full); } From 02d17b363ddcceea42eddd599f74535ee3e9e49d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 17 Apr 2016 03:55:55 +1000 Subject: [PATCH 4/5] Fix plot download/done --- .../com/intellectualcrafters/plot/commands/Download.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java index b1b0bd1bd..63430a100 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -41,8 +41,11 @@ public class Download extends SubCommand { MainUtil.sendMessage(plr, C.PLOT_UNOWNED); return false; } - if ((!plot.isOwner(plr.getUUID()) || (Settings.DOWNLOAD_REQUIRES_DONE && (FlagManager.getPlotFlagRaw(plot, "done") != null))) && !Permissions - .hasPermission(plr, "plots.admin.command.download")) { + if ((Settings.DOWNLOAD_REQUIRES_DONE && (FlagManager.getPlotFlagRaw(plot, "done") == null)) && !Permissions.hasPermission(plr, "plots.admin.command.download")) { + MainUtil.sendMessage(plr, C.DONE_NOT_DONE); + return false; + } + if ((!plot.isOwner(plr.getUUID()))) { MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); return false; } From 1c04b1a0e0ad5f9926cce6387ce5cd3358120630 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 19 Apr 2016 15:32:31 +1000 Subject: [PATCH 5/5] Fixes #1062 --- .../com/plotsquared/bukkit/util/BukkitEconHandler.java | 9 +++++++++ .../com/intellectualcrafters/plot/config/Settings.java | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java index 145c04842..830afe93c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java @@ -75,4 +75,13 @@ public class BukkitEconHandler extends EconHandler { public double getBalance(PlotPlayer player) { return this.econ.getBalance(player.getName()); } + + public void setPermission(String world, String player, String perm, boolean value) { + if (value) { + this.perms.playerAdd(world, player, perm); + } else { + this.perms.playerRemove(world, player, perm); + } + } + } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 87f873cce..909404670 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -167,11 +167,11 @@ public class Settings { /** * SQLite enabled? */ - public static boolean USE_SQLITE = false; + public static boolean USE_SQLITE = true; /** * MySQL Enabled? */ - public static boolean USE_MYSQL = true; /* NOTE: Fixed connector */ + public static boolean USE_MYSQL = false; /* NOTE: Fixed connector */ /** * SQLite Database name */