From fb277920767c6a609669afde011aa4c45d22e144 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 26 Apr 2015 17:47:45 +1000 Subject: [PATCH] Fixed bed in nethe --- PlotSquared/pom.xml | 2 +- .../plot/commands/Set.java | 2 +- .../intellectualcrafters/plot/config/C.java | 2 +- .../plot/database/SQLManager.java | 19 ++++----- .../plot/listeners/PlayerEvents.java | 9 +++-- .../plot/listeners/PlayerEvents_1_8.java | 39 +++++++++++++++++++ .../plot/listeners/PlotListener.java | 6 +-- 7 files changed, 55 insertions(+), 24 deletions(-) diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 43772e4e5..19b1543f9 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -81,7 +81,7 @@ org.bukkit bukkit - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT com.sk89q diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 10e19d329..3f1bb0b4a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -293,7 +293,7 @@ public class Set extends SubCommand { private String getBiomeList(final String[] biomes) { final StringBuilder builder = new StringBuilder(); - builder.append(MainUtil.colorise('&', C.NOT_VALID_BLOCK_LIST_HEADER.s())); + builder.append(MainUtil.colorise('&', C.NEED_BIOME.s())); for (final String b : biomes) { builder.append(getString(b)); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index 7458b41d2..3ac10f838 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -286,7 +286,7 @@ public enum C { /* * Biome */ - NEED_BIOME("$2You have got to specify a biome"), + NEED_BIOME("$2You need to specify a valid biome."), BIOME_SET_TO("$2Plot biome set to $2"), /* * Teleport / Entry diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index e019c6e25..dd041ef22 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -97,19 +97,14 @@ public class SQLManager implements AbstractDB { TaskManager.runTaskRepeat(new Runnable() { @Override public void run() { - TaskManager.runTaskAsync(new Runnable() { - @Override - public void run() { - try { - System.out.print("CONNECTIN"); - SQLManager.this.connection = PlotSquared.getMySQL().forceConnection(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - }); + try { + SQLManager.this.connection = PlotSquared.getMySQL().forceConnection(); + } + catch (Exception e) { + e.printStackTrace(); + } } - }, 1); + }, 11000); } updateTables(); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index 636e9e072..4e4cae1fb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -49,6 +49,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; @@ -284,7 +285,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi MainUtil.teleportPlayer(pp, pp.getLocation(), plot); MainUtil.sendMessage(pp, C.TELEPORTED_TO_ROAD); } - plotEntry(player, plot); + plotEntry(pp, plot); } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @@ -323,8 +324,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } Plot plot = MainUtil.getPlot(t); if (plot != null) { + final PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot.denied.size() > 0) { - final PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot.isDenied(pp.getUUID())) { if (!Permissions.hasPermission(pp, "plots.admin.entry.denied")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied"); @@ -334,7 +335,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } if (!plot.equals(MainUtil.getPlot(f))) { - plotEntry(player, plot); + plotEntry(pp, plot); } } else if (MainUtil.leftPlot(f, t)) { @@ -1004,7 +1005,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } else { if (MainUtil.enteredPlot(f, t)) { - plotEntry(player, plot); + plotEntry(pp, plot); } } } else { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java index 7e15843ad..df491fda0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java @@ -1,16 +1,20 @@ package com.intellectualcrafters.plot.listeners; +import java.util.Iterator; import java.util.UUID; +import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -19,6 +23,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class PlayerEvents_1_8 extends PlotListener implements Listener { + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onInteract(final PlayerInteractAtEntityEvent e) { Entity entity = e.getRightClicked(); @@ -59,4 +64,38 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener { } } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onBigBoom(final BlockExplodeEvent event) { + Block block = event.getBlock(); + Location loc = BukkitUtil.getLocation(block.getLocation()); + final String world = loc.getWorld(); + if (!PlotSquared.isPlotWorld(world)) { + return; + } + final Plot plot = MainUtil.getPlot(loc); + if ((plot != null) && plot.hasOwner()) { + if (FlagManager.isPlotFlagTrue(plot, "explosion")) { + final Iterator iter = event.blockList().iterator(); + while (iter.hasNext()) { + final Block b = iter.next(); + if (!plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(b.getLocation())))) { + iter.remove(); + } + } + return; + } + } + if (MainUtil.isPlotArea(loc)) { + event.setCancelled(true); + } else { + final Iterator iter = event.blockList().iterator(); + while (iter.hasNext()) { + iter.next(); + if (MainUtil.isPlotArea(loc)) { + iter.remove(); + } + } + } + } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index 5235690fa..5a43683ae 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -86,11 +86,7 @@ public class PlotListener extends APlotListener { } } - public void plotEntry(final PlotPlayer player, final Plot plot) { - plotEntry(((BukkitPlayer) player).player, plot); - } - - public void plotEntry(final Player pp, final Plot plot) { + public void plotEntry(final PlotPlayer pp, final Plot plot) { Player player = ((BukkitPlayer) pp).player; if (plot.hasOwner()) { final Flag gamemodeFlag = FlagManager.getPlotFlag(plot, "gamemode");