diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java index f3e2b7d80..b04f91076 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java @@ -335,9 +335,8 @@ public class Metrics { else playersOnline = ((Player[])Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; } - catch (NoSuchMethodException ex){} - catch (InvocationTargetException ex){} - catch (IllegalAccessException ex){} + catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex){} + // END server software specific section -- all code below does not use // any code outside of this class / Java // Construct the post data diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 02bbbb5dd..d9b3a50eb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -22,16 +22,12 @@ import com.intellectualcrafters.plot.uuid.PlotUUIDSaver; import com.intellectualcrafters.plot.uuid.UUIDSaver; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; - import me.confuser.barapi.BarAPI; import net.milkbowl.vault.economy.Economy; - import org.bukkit.*; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.entity.Tameable; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; @@ -680,7 +676,7 @@ public class PlotMain extends JavaPlugin { add("plot"); } }); - getCommand("plots").setTabCompleter(command); + //getCommand("plots").setTabCompleter(command); getServer().getPluginManager().registerEvents(new PlayerEvents(), this); PlotPlusListener.startRunnable(this); getServer().getPluginManager().registerEvents(new PlotPlusListener(), this); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java index 4cb57e8ec..138f571a1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java @@ -88,6 +88,7 @@ public abstract class PlotWorld { public boolean SPAWN_BREEDING; public static boolean SPAWN_BREEDING_DEFAULT = false; + public PlotWorld(String worldname) { this.worldname = worldname; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java index 2796ac98a..5d08e1436 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java @@ -36,8 +36,6 @@ public class RUtils { double s = sec % 60; String string = C.TIME_FORMAT.s(); - @SuppressWarnings("unused") - // String s_d = (int) d + " " + (d != 1 ? "days" : "day"); String s_h = (int) h + " " + ((int) h != 1 ? "hours" : "hour"); String s_m = (int) m + " " + ((int) m != 1 ? "minutes" : "minute"); String s_s = (int) s + " " + ((int) s != 1 ? "seconds" : "second"); @@ -68,7 +66,6 @@ public class RUtils { double d = ((l.getYaw() * 4.0F) / 360.0F) + 0.5D; int i = (int) d; int x = d < i ? i - 1 : i; - switch (x) { case 0: return Direction.SOUTH; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 8208c7630..ce4bac0b1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -129,7 +129,8 @@ public class Auto extends SubCommand { boolean claimed = true; while (!br) { PlotId start = getNextPlot(Auto.lastPlot, 1); - + + //FIXME: Wtf is going on here? if (claimed) { if (PlotMain.getPlots(world).get(start) == null || PlotMain.getPlots(world).get(start).owner == null) { Auto.lastPlot = start; @@ -181,7 +182,7 @@ public class Auto extends SubCommand { } } else { - if (id.x==id.y && id.x > 0) { + if (id.x.equals(id.y) && id.x > 0) { return new PlotId(id.x, id.y + step); } if (id.x==absX) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 1db3c1562..c36bf9710 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -8,21 +8,13 @@ package com.intellectualcrafters.plot.commands; +import com.intellectualcrafters.plot.*; +import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; +import com.intellectualcrafters.plot.generator.DefaultPlotWorld; import net.milkbowl.vault.economy.Economy; - import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import com.intellectualcrafters.plot.C; -import com.intellectualcrafters.plot.FlagManager; -import com.intellectualcrafters.plot.PlayerFunctions; -import com.intellectualcrafters.plot.Plot; -import com.intellectualcrafters.plot.PlotHelper; -import com.intellectualcrafters.plot.PlotMain; -import com.intellectualcrafters.plot.PlotWorld; -import com.intellectualcrafters.plot.SchematicHandler; -import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; - /** * @author Citymonstret */ @@ -118,6 +110,12 @@ public class Claim extends SubCommand { if (world.DEFAULT_FLAGS != null && world.DEFAULT_FLAGS.size() > 0) { plot2.settings.setFlags(FlagManager.parseFlags(world.DEFAULT_FLAGS)); } + if (world instanceof DefaultPlotWorld) { + DefaultPlotWorld pW = (DefaultPlotWorld) world; + if(pW.CLAIMED_WALL_BLOCK != pW.WALL_BLOCK) { + PlotMain.getPlotManager(plot.getWorld()).setWall(plot.getWorld(), world, plot.getId(), pW.CLAIMED_WALL_BLOCK); + } + } } return event.isCancelled(); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java index 74dc218ef..608aff23f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java @@ -86,6 +86,10 @@ public enum Command { /** * */ + INTERFACE("interface", "int", new CommandPermission("plots.interface")), + /** + * + */ HOME("home", "h"), /** * diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 43fd0a0f9..1d58eacc4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -64,8 +64,7 @@ public class MainCommand implements CommandExecutor, TabCompleter { StringBuilder builder = new StringBuilder(); builder.append(C.HELP_INFO.s()); for (SubCommand.CommandCategory category : SubCommand.CommandCategory.values()) { - builder.append("\n" - + C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString())); + builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString())); } PlayerFunctions.sendMessage(player, builder.toString()); return true; @@ -82,15 +81,14 @@ public class MainCommand implements CommandExecutor, TabCompleter { StringBuilder builder = new StringBuilder(); builder.append(C.HELP_INFO.s()); for (SubCommand.CommandCategory category : SubCommand.CommandCategory.values()) { - builder.append("\n" - + C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString())); + builder.append("\n").append(C.HELP_INFO_ITEM.s().replaceAll("%category%", category.toString().toLowerCase()).replaceAll("%category_desc%", category.toString())); } PlayerFunctions.sendMessage(player, builder.toString()); return true; } StringBuilder help = new StringBuilder(); for (String string : helpMenu(player, cato)) { - help.append(string + "\n"); + help.append(string).append("\n"); } PlayerFunctions.sendMessage(player, help.toString()); return true; @@ -99,15 +97,13 @@ public class MainCommand implements CommandExecutor, TabCompleter { for (SubCommand command : subCommands) { if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.equalsIgnoreCase(args[0])) { String[] arguments = new String[args.length - 1]; - for (int x = 1; x < args.length; x++) { - arguments[x - 1] = args[x]; - } + System.arraycopy(args, 1, arguments, 0, args.length - 1); if (command.permission.hasPermission(player)) { if (player!=null || !command.isPlayer ) { return command.execute(player, arguments); } else { - PlayerFunctions.sendMessage(player, C.IS_CONSOLE); + PlayerFunctions.sendMessage(null, C.IS_CONSOLE); return false; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java index 1ceacd67f..2cb51e7b2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java @@ -1,22 +1,13 @@ package com.intellectualcrafters.plot.generator; -import java.util.ArrayList; - +import com.intellectualcrafters.plot.*; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import com.intellectualcrafters.plot.PlayerFunctions; -import com.intellectualcrafters.plot.Plot; -import com.intellectualcrafters.plot.PlotBlock; -import com.intellectualcrafters.plot.PlotHelper; -import com.intellectualcrafters.plot.PlotId; -import com.intellectualcrafters.plot.PlotMain; -import com.intellectualcrafters.plot.PlotManager; -import com.intellectualcrafters.plot.PlotWorld; +import java.util.ArrayList; public class DefaultPlotManager extends PlotManager { @@ -233,8 +224,10 @@ public class DefaultPlotManager extends PlotManager { PlotBlock[] plotfloor = dpw.TOP_BLOCK; PlotBlock[] filling = dpw.MAIN_BLOCK; - PlotBlock wall = dpw.WALL_BLOCK; - PlotBlock wall_filling = dpw.WALL_FILLING; + //PlotBlock wall = dpw.WALL_BLOCK; + PlotBlock wall = plot.hasOwner() ? dpw.CLAIMED_WALL_BLOCK : dpw.WALL_BLOCK; + + PlotBlock wall_filling = dpw.WALL_FILLING; Block block = world.getBlockAt(new Location(world, pos1.getBlockX()-1, 1, pos1.getBlockZ())); if (block.getTypeId()!=wall_filling.id || block.getData()!=wall_filling.data) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java index 8e1e21ca7..5b0e90fb6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java @@ -87,6 +87,8 @@ public class DefaultPlotWorld extends PlotWorld { * Default wall block: 44 */ public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0); + public PlotBlock CLAIMED_WALL_BLOCK; + public static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1); /** * Wall filling @@ -144,6 +146,7 @@ public class DefaultPlotWorld extends PlotWorld { new ConfigurationNode("plot.filling", DefaultPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true), new ConfigurationNode("plot.floor", DefaultPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true), new ConfigurationNode("wall.block", DefaultPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true), + new ConfigurationNode("wall.block.claimed", DefaultPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true), new ConfigurationNode("road.width", DefaultPlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true), new ConfigurationNode("road.height", DefaultPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true), new ConfigurationNode("road.enable_stripes", DefaultPlotWorld.ROAD_STRIPES_ENABLED_DEFAULT, "Enable road stripes", Configuration.BOOLEAN, true), @@ -179,6 +182,6 @@ public class DefaultPlotWorld extends PlotWorld { this.ROAD_STRIPES = (PlotBlock) Configuration.BLOCK.parseString(config.getString("road.stripes")); this.WALL_FILLING = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.filling")); this.WALL_HEIGHT = config.getInt("wall.height"); - + this.CLAIMED_WALL_BLOCK = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.block.claimed")); } }