From 0efb9d62ca15cab36a7717c50eeb00bd51af7c07 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 23 Sep 2014 15:28:26 +1000 Subject: [PATCH] more bug fixes --- PlotSquared/src/com/intellectualcrafters/plot/C.java | 1 + .../src/com/intellectualcrafters/plot/Flag.java | 2 +- .../com/intellectualcrafters/plot/commands/Auto.java | 4 ++-- .../com/intellectualcrafters/plot/commands/Claim.java | 11 +++++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java index be1f7ac9d..37ef64d60 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/C.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java @@ -156,6 +156,7 @@ public enum C { /* Claiming */ + PLOT_NOT_CLAIMED("&cCannot claim plot"), PLOT_IS_CLAIMED("&cThis plot is already claimed"), CLAIMED("&6You successfully claimed the plot"), /* diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Flag.java b/PlotSquared/src/com/intellectualcrafters/plot/Flag.java index f7edd01fc..9558984a9 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/Flag.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/Flag.java @@ -7,7 +7,7 @@ public class Flag { private String key; private String value; public Flag(String key, String value) { - if (!StringUtils.isAlphanumeric(key) || !StringUtils.isAlphanumeric(ChatColor.stripColor(value))) + if (!StringUtils.isAlphanumeric(key) || !StringUtils.isAlphanumeric(ChatColor.stripColor(value).replace(" ", ""))) throw new IllegalArgumentException("Flag must be alphanumerical"); if (key.length()>16) throw new IllegalArgumentException("Key must be <= 16 characters"); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java index cb706fd3b..26800a29a 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java @@ -67,8 +67,8 @@ public class Auto extends SubCommand { id = new PlotId(x,z); if(PlotHelper.getPlot(world, id).owner == null) { Plot plot = PlotHelper.getPlot(world, id); - Claim.claimPlot(plr, plot, true); - br = true; + boolean result = Claim.claimPlot(plr, plot, true); + br = result; } if(z < q && (z - x) < q) { z++; diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java index 6ec532a51..cc3d39dbf 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java @@ -11,6 +11,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; + import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -40,8 +41,13 @@ public class Claim extends SubCommand{ PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED); return false; } - claimPlot(plr, plot, false); - return true; + boolean result = claimPlot(plr, plot, false); + if (!result) { + PlayerFunctions.sendMessage(plr, C.PLOT_NOT_CLAIMED); + return false; + } + return true; + } @@ -61,6 +67,7 @@ public class Claim extends SubCommand{ SchematicHandler.Schematic schematic = handler.getSchematic(world.SCHEMATIC_FILE); handler.paste(player.getLocation(), schematic, plot); } + plot.settings.setFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS); } return event.isCancelled(); }