diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index 039599ccf..a148b1d2d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -5,6 +5,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.PlotGameMode; import com.intellectualcrafters.plot.util.PlotWeather; +import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.bukkit.util.BukkitUtil; import org.bukkit.Effect; @@ -66,7 +67,10 @@ public class BukkitPlayer extends PlotPlayer { @Override public void sendMessage(String message) { - this.player.sendMessage(message); + if (!StringMan.isEqual(this.getMeta("lastMessage"), message)) { + setMeta("lastMessage", message); + this.player.sendMessage(message); + } } @Override diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java index 0de6a0d14..df957892e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSchematicHandler.java @@ -14,6 +14,7 @@ import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import com.plotsquared.bukkit.object.schematic.StateWrapper; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -303,7 +304,7 @@ public class BukkitSchematicHandler extends SchematicHandler { } @Override - public void restoreTile(String world, CompoundTag ct, int x, int y, int z) { - new StateWrapper(ct).restoreTag(world, x, y, z); + public boolean restoreTile(LocalBlockQueue queue, CompoundTag ct, int x, int y, int z) { + return new StateWrapper(ct).restoreTag(queue.getWorld(), x, y, z); } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java index e4da8f87a..3b2ac579f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java @@ -9,6 +9,8 @@ import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.SchematicHandler; +import com.intellectualcrafters.plot.util.block.GlobalBlockQueue; +import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue; import java.util.HashMap; import java.util.Map.Entry; @@ -223,13 +225,17 @@ public class HybridGen extends IndependentPlotGenerator { } rz[i] = v; } + LocalBlockQueue queue = null; for (short x = 0; x < 16; x++) { for (short z = 0; z < 16; z++) { int pair = MathMan.pair(rx[x], rz[z]); HashMap map = hpw.G_SCH_STATE.get(pair); if (map != null) { for (Entry entry : map.entrySet()) { - SchematicHandler.manager.restoreTile(hpw.worldname, entry.getValue(), p1x + x, entry.getKey(), p1z + z); + if (queue == null) { + queue = GlobalBlockQueue.IMP.getNewQueue(hpw.worldname, false); + } + SchematicHandler.manager.restoreTile(queue, entry.getValue(), p1x + x, entry.getKey(), p1z + z); } } } 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 3feedba99..0f06b49fe 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -137,7 +137,7 @@ public abstract class EventUtil { return true; } } - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_BREAK.s())); @@ -149,8 +149,7 @@ public abstract class EventUtil { return true; } if (plot.hasOwner()) { - return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil - .sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s())); + return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s())); } return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); case BREAK_MISC: @@ -161,7 +160,7 @@ public abstract class EventUtil { return true; } if (plot.hasOwner()) { - return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil + return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil .sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_BREAK.s())); } return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); @@ -173,7 +172,7 @@ public abstract class EventUtil { return true; } if (plot.hasOwner()) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_BREAK.s())); @@ -194,7 +193,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil + return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil .sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s())); } return true; @@ -214,7 +213,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_PLACE.s())); @@ -264,7 +263,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_HANGING_INTERACT.s())); @@ -289,7 +288,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_MISC_INTERACT.s())); @@ -314,7 +313,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_VEHICLE_USE.s())); @@ -339,7 +338,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MOB_PLACE.s() + '/' + C.FLAG_PLACE.s())); @@ -366,7 +365,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_PLACE.s() + '/' + C.FLAG_PLACE.s())); @@ -392,7 +391,7 @@ public abstract class EventUtil { value = null; } if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) { - if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) { + if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) { return true; } return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_PLACE.s() + '/' + C.FLAG_PLACE.s())); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index 2f8b460d8..56278eb74 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -334,15 +334,15 @@ public abstract class SchematicHandler { if (!chunks.isEmpty()) { this.run(); } else { - queue.flush(); for (Map.Entry entry : schematic.getTiles().entrySet()) { BlockLoc loc = entry.getKey(); - restoreTile(plot.getArea().worldname, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z); + restoreTile(queue, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z); } if (whenDone != null) { whenDone.value = true; whenDone.run(); } + queue.flush(); } } }); @@ -426,7 +426,7 @@ public abstract class SchematicHandler { return schem; } - public abstract void restoreTile(String world, CompoundTag tag, int x, int y, int z); + public abstract boolean restoreTile(LocalBlockQueue queue, CompoundTag tag, int x, int y, int z); /** * Get a schematic diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/block/GlobalBlockQueue.java b/Core/src/main/java/com/intellectualcrafters/plot/util/block/GlobalBlockQueue.java index 96bf92106..3980335fc 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/block/GlobalBlockQueue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/block/GlobalBlockQueue.java @@ -57,7 +57,11 @@ public class GlobalBlockQueue { } }; - public void GlobalBlockQueueProvider(QueueProvider provider) { + public QueueProvider getProvider() { + return provider; + } + + public void setProvider(QueueProvider provider) { this.provider = provider; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java b/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java index 6a314777c..3044902bc 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java @@ -1,10 +1,12 @@ package com.intellectualcrafters.plot.util.block; +import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PseudoRandom; +import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; @@ -44,6 +46,11 @@ public abstract class LocalBlockQueue { return setBlock(x, y, z, block.id, block.data); } + public boolean setTile(int x, int y, int z, CompoundTag tag) { + SchematicHandler.manager.restoreTile(this, tag, x, y, z); + return true; + } + public abstract PlotBlock getBlock(int x, int y, int z); public abstract boolean setBiome(int x, int z, String biome); diff --git a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index 52d0f1694..33560973e 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.PlotGameMode; import com.intellectualcrafters.plot.util.PlotWeather; +import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.sponge.util.SpongeUtil; import org.spongepowered.api.Sponge; @@ -73,7 +74,10 @@ public class SpongePlayer extends PlotPlayer { @Override public void sendMessage(String message) { - this.player.sendMessage(ChatTypes.CHAT, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(message)); + if (!StringMan.isEqual(this.getMeta("lastMessage"), message)) { + setMeta("lastMessage", message); + this.player.sendMessage(ChatTypes.CHAT, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(message)); + } } @Override