diff --git a/pom.xml b/pom.xml index 830ed10f8..a9966f278 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 3.2.16 + 3.2.17 PlotSquared jar diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index c3914e8ae..fdbbd2250 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -146,14 +146,12 @@ public class PS { PLATFORM = platform; EconHandler.manager = IMP.getEconomyHandler(); if (getJavaVersion() < 1.7) { - log(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7."); - // Didn't know of any other link :D - log(C.PREFIX.s() + "&cURL: &6https://java.com/en/download/index.jsp"); + log(C.CONSOLE_JAVA_OUTDATED_1_7); IMP.disable(); return; } if (getJavaVersion() < 1.8) { - log(C.PREFIX.s() + "&cIt's really recommended to run Java 1.8, as it increases performance"); + log(C.CONSOLE_JAVA_OUTDATED_1_8); } TASK = IMP.getTaskManager(); if (C.ENABLED.s().length() > 0) { @@ -185,7 +183,7 @@ public class PS { if (Settings.METRICS) { IMP.startMetrics(); } else { - log("&dUsing metrics will allow us to improve the plugin, please consider it :)"); + log(C.CONSOLE_PLEASE_ENABLE_METRICS); } IMP.startMetrics(); if (Settings.CHUNK_PROCESSOR) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 69bca79d2..1eee3d5c9 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -69,8 +69,8 @@ public class Template extends SubCommand { final ZipInputStream zis = new ZipInputStream(new FileInputStream(input)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { - final String name = ze.getName(); - final File newFile = new File((output + File.separator + name.replaceAll("[\\\\|\\|/]", File.separator)).replaceAll("__TEMP_DIR__", world)); + final String name = ze.getName().replace('\\', File.separatorChar).replace('/', File.separatorChar); + final File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world)); new File(newFile.getParent()).mkdirs(); final FileOutputStream fos = new FileOutputStream(newFile); int len; diff --git a/src/main/java/com/intellectualcrafters/plot/config/C.java b/src/main/java/com/intellectualcrafters/plot/config/C.java index 80bd8830a..2f64e35e3 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -90,6 +90,12 @@ public enum C { PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"), PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"), + /* + * Static console + */ + CONSOLE_JAVA_OUTDATED_1_7("&cYour java version is outdated. Please update to at least 1.7.\n&cURL: &6https://java.com/en/download/index.jsp","static.console"), + CONSOLE_JAVA_OUTDATED_1_8("&cIt's really recommended to run Java 1.8, as it increases performance","static.console"), + CONSOLE_PLEASE_ENABLE_METRICS("&dUsing metrics will allow us to improve the plugin, please consider it :)","static.console"), /* * Confirm */ diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index ade54281a..fe993580b 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -661,7 +661,6 @@ public class MainUtil { plot = plot.getBasePlot(false); final PlotWorld plotworld = PS.get().getPlotWorld(plot.world); if (plotworld.DEFAULT_HOME != null) { - final PlotManager manager = PS.get().getPlotManager(plot.world); final int x; final int z; if ((plotworld.DEFAULT_HOME.x == Integer.MAX_VALUE) && (plotworld.DEFAULT_HOME.z == Integer.MAX_VALUE)) { @@ -675,7 +674,7 @@ public class MainUtil { x = bot.getX() + plotworld.DEFAULT_HOME.x; z = bot.getZ() + plotworld.DEFAULT_HOME.z; } - final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PS.get().getPlotWorld(plot.world), plot).getY()); + final int y = getHeighestBlock(plot.world, x, z); return new Location(plot.world, x, y + 1, z); } // Side diff --git a/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/src/main/java/com/plotsquared/bukkit/BukkitMain.java index ae3423714..06324918d 100644 --- a/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -3,6 +3,7 @@ package com.plotsquared.bukkit; import java.io.File; import java.lang.reflect.Method; import java.util.Arrays; +import java.util.List; import java.util.UUID; import org.bukkit.Bukkit; @@ -16,6 +17,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.generator.ChunkGenerator; +import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; @@ -27,6 +29,7 @@ import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.generator.HybridUtils; +import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.SetupObject; @@ -244,8 +247,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { if (!Settings.KILL_ROAD_VEHICLES) { continue; } - final Location loc = entity.getLocation(); - if (MainUtil.isPlotRoad(BukkitUtil.getLocation(loc))) { + com.intellectualcrafters.plot.object.Location loc = BukkitUtil.getLocation(entity.getLocation()); + Plot plot = loc.getPlot(); + if (plot == null) { + if (MainUtil.isPlotAreaAbs(loc)) { + entity.remove(); + } + return; + } + List meta = entity.getMetadata("plot"); + if (meta.size() == 0) { + return; + } + Plot origin = (Plot) meta.get(0).value(); + if (!plot.equals(origin.getBasePlot(false))) { entity.remove(); } break; diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 082b4b8d9..c2a9edaed 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1789,9 +1789,22 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen public void onVehicleCreate(final VehicleCreateEvent event) { final Vehicle entity = event.getVehicle(); final Location loc = BukkitUtil.getLocation(entity); - final Plot plot = MainUtil.getPlot(loc); + if (loc.getPlotWorld() == null) { + return; + } + Plot plot = loc.getPlot(); + if (plot == null) { + if (MainUtil.isPlotArea(loc)) { + entity.remove(); + } + return; + } if (checkEntity(entity, plot)) { entity.remove(); + return; + } + if (Settings.KILL_ROAD_VEHICLES) { + entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot)); } } diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar index d7ee4a0b7..e25d39220 100644 Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ