diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 394e37f9b..3e461857d 100644 --- a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -332,7 +332,7 @@ public class SQLManager implements AbstractDB { stmt.setString((i * 6) + 4, DBFunc.everyone.toString()); } stmt.setString((i * 6) + 5, plot.world); - stmt.setTimestamp((i * 6) + 6, new Timestamp(System.currentTimeMillis())); + stmt.setString((i * 6) + 6, System.currentTimeMillis() + ""); } @Override diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java index f46fba209..121ac1fc2 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.object; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map.Entry; import java.util.UUID; @@ -146,6 +147,14 @@ public class Plot { this.temp = false; } + /** + * Get the players currently inside this plot + * @return + */ + public List getPlayersInPlot() { + return MainUtil.getPlayersInPlot(this); + } + /** * Check if the plot has a set owner * diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 0781d8a08..501958302 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -106,7 +106,7 @@ public class MainUtil { public static List getPlayersInPlot(Plot plot) { ArrayList players = new ArrayList<>(); for (PlotPlayer pp : UUIDHandler.getPlayers().values()) { - if (plot.equals(MainUtil.getPlot(pp.getLocation()))) { + if (plot.equals(pp.getCurrentPlot())) { players.add(pp); } } diff --git a/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java b/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java index 2dd5a032c..3b210f7ab 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java @@ -17,7 +17,10 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.StaticStrings; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.StringMan; +import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.bukkit.util.BukkitUtil; /** @@ -27,7 +30,7 @@ import com.plotsquared.bukkit.util.BukkitUtil; */ public class ChatListener implements Listener { - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.LOWEST) public void onChat(final AsyncPlayerChatEvent event) { final Player player = event.getPlayer(); final String world = player.getWorld().getName(); @@ -44,20 +47,21 @@ public class ChatListener implements Listener { if (plot == null) { return; } + event.setCancelled(true); final String message = event.getMessage(); - String format = C.PLOT_CHAT_FORMAT.s(); final String sender = event.getPlayer().getDisplayName(); final PlotId id = plot.id; - final Set recipients = event.getRecipients(); - recipients.clear(); - for (final Player p : Bukkit.getOnlinePlayers()) { - if (p.hasPermission("plots.admin.command.chat") || plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(p)))) { - recipients.add(p); + String toSend = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender, "%msg%", message); + PS.debug("FORMAT: " + event.getFormat()); + PS.debug("MESSAGE: " + event.getMessage()); + for (PlotPlayer recipient : UUIDHandler.getPlayers().values()) { + if (plot.equals(recipient.getCurrentPlot())) { + recipient.sendMessage(toSend); + } + else if (recipient.hasPermission(StaticStrings.PERMISSION_COMMANDS_CHAT)) { + recipient.sendMessage(toSend); } } - format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message.replaceAll("([%]{1})", "%%")); - format = ChatColor.translateAlternateColorCodes('&', format); - event.setFormat(format); } } diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java index 7d981c5f2..b61c6cd9c 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java @@ -57,6 +57,7 @@ import com.intellectualcrafters.plot.object.PlotLoc; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.RegionWrapper; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.MainUtil; @@ -194,112 +195,61 @@ public class BukkitChunkManager extends ChunkManager { */ @Override public boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone) { - TaskManager.index.incrementAndGet(); final int relX = newPos.getX() - pos1.getX(); final int relZ = newPos.getZ() - pos1.getZ(); + + final int relCX = relX >> 4; + final int relCZ = relZ >> 4; final RegionWrapper region = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); final World oldWorld = Bukkit.getWorld(pos1.getWorld()); final World newWorld = Bukkit.getWorld(newPos.getWorld()); - - final Chunk c1 = newWorld.getChunkAt(pos1.getX() >> 4, pos1.getZ() >> 4); - final Chunk c2 = newWorld.getChunkAt(pos2.getX() >> 4, pos2.getZ() >> 4); - - final int sx = pos1.getX(); - final int sz = pos1.getZ(); - final int ex = pos2.getX(); - final int ez = pos2.getZ(); - - final int c1x = c1.getX(); - final int c1z = c1.getZ(); - final int c2x = c2.getX(); - final int c2z = c2.getZ(); - final ArrayList chunks = new ArrayList<>(); - final ArrayList toGenerate = new ArrayList<>(); - // Load chunks - for (int x = c1x; x <= c2x; x++) { - for (int z = c1z; z <= c2z; z++) { - final Chunk chunk = newWorld.getChunkAt(x, z); - toGenerate.add(chunk); - } - } - final Plugin plugin = BukkitMain.THIS; - final Integer currentIndex = TaskManager.index.get(); - final int loadTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { + + initMaps(); + + ChunkManager.chunkTask(pos1, pos2, new RunnableVal() { @Override public void run() { - final long start = System.currentTimeMillis(); - while ((System.currentTimeMillis() - start) < 25) { - if (toGenerate.size() == 0) { - Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); - TaskManager.tasks.remove(currentIndex); - TaskManager.runTask(new Runnable() { - @Override - public void run() { - TaskManager.index.incrementAndGet(); - // Copy entities - initMaps(); - for (int x = c1x; x <= c2x; x++) { - for (int z = c1z; z <= c2z; z++) { - final Chunk chunk = oldWorld.getChunkAt(x, z); - chunks.add(chunk); - chunk.load(false); - } - } - // Copy blocks - final AtomicInteger mx = new AtomicInteger(sx); - final Integer currentIndex = TaskManager.index.get(); - final int maxY = oldWorld.getMaxHeight(); - final Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { - @Override - public void run() { - final long start = System.currentTimeMillis(); - while ((System.currentTimeMillis() - start) < 25) { - final int xv = mx.intValue(); - for (int z = sz; z <= ez; z++) { - saveBlocks(oldWorld, maxY, xv, z); - for (int y = 1; y <= maxY; y++) { - final Block block = oldWorld.getBlockAt(xv, y, z); - final int id = block.getTypeId(); - final byte data = block.getData(); - BukkitSetBlockManager.setBlockManager.set(newWorld, xv + relX, y, z + relZ, id, data); - } - } - mx.incrementAndGet(); - if (xv == ex) { // done! - for (int x = c1x; x <= c2x; x++) { - for (int z = c1z; z <= c2z; z++) { - final Chunk chunk = oldWorld.getChunkAt(x, z); - chunks.add(chunk); - chunk.load(false); - saveEntitiesIn(chunk, region); - } - } - restoreBlocks(newWorld, relX, relZ); - restoreEntities(newWorld, relX, relZ); - BukkitSetBlockManager.setBlockManager.update(chunks); - TaskManager.runTask(whenDone); - Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); - TaskManager.tasks.remove(currentIndex); - return; - } - } - } - }, 1, 1); - TaskManager.tasks.put(currentIndex, task); - } - }); - return; + int bx = value[2]; + int bz = value[3]; + + int tx = value[4]; + int tz = value[5]; + // Load chunks + ChunkLoc loc1 = new ChunkLoc(value[0], value[1]); + ChunkLoc loc2 = new ChunkLoc(loc1.x + relCX, loc1.z + relCZ); + Chunk c1 = oldWorld.getChunkAt(loc1.x, loc1.z); + Chunk c2 = oldWorld.getChunkAt(loc2.x, loc2.z); + c1.load(true); + c2.load(true); + chunks.add(c2); + // entities + saveEntitiesIn(c1, region); + // copy chunk + for (int x = bx; x <= tx; x++) { + for (int z = bz; z <= tz; z++) { + saveBlocks(oldWorld, 255, x, z); + for (int y = 1; y < 256; y++) { + final Block block = oldWorld.getBlockAt(x, y, z); + final int id = block.getTypeId(); + final byte data = block.getData(); + BukkitSetBlockManager.setBlockManager.set(newWorld, x + relX, y, z + relZ, id, data); + } } - final Chunk chunk = toGenerate.get(0); - toGenerate.remove(0); - chunk.load(true); - chunks.add(chunk); } + // restore chunk + restoreBlocks(newWorld, relX, relZ); + restoreEntities(newWorld, relX, relZ); + BukkitSetBlockManager.setBlockManager.update(chunks); } - }, 1l, 1l); - TaskManager.tasks.put(currentIndex, loadTask); + }, new Runnable() { + @Override + public void run() { + // TODO whenDone + TaskManager.runTask(whenDone); + } + }, 5); return true; } @@ -549,7 +499,7 @@ public class BukkitChunkManager extends ChunkManager { try { entity.spawn(world, x_offset, z_offset); } catch (final Exception e) { - PS.debug("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id)); + PS.debug("Failed to restore entity (e): " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id)); e.printStackTrace(); } } @@ -568,7 +518,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : signContents.keySet()) { @@ -601,7 +551,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : dropperContents.keySet()) { @@ -615,7 +565,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : beaconContents.keySet()) { @@ -629,7 +579,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : jukeDisc.keySet()) { @@ -643,7 +593,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate jukebox: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : skullData.keySet()) { @@ -666,7 +616,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore skull: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate skull: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : hopperContents.keySet()) { @@ -680,7 +630,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : noteBlockContents.keySet()) { @@ -694,7 +644,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : brewTime.keySet()) { @@ -707,7 +657,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : spawnerData.keySet()) { @@ -721,7 +671,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : cmdData.keySet()) { @@ -735,7 +685,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore command block: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to restore command block: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to restore command block (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : brewingStandContents.keySet()) { @@ -749,7 +699,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : furnaceTime.keySet()) { @@ -764,7 +714,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : furnaceContents.keySet()) { @@ -778,7 +728,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } for (final BlockLoc loc : bannerBase.keySet()) { @@ -798,7 +748,7 @@ public class BukkitChunkManager extends ChunkManager { PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } catch (final Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); + PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (loc.x + x_offset) + "," + (loc.y) + "," + (loc.z + z_offset)); } } } diff --git a/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java b/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java index cca9e507d..a1a17ad39 100644 --- a/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -56,9 +56,9 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { @Override public void run() { PS.debug(C.PREFIX.s() + "&6Starting player data caching for: " + world); - final HashBiMap toAdd = HashBiMap.create(new HashMap()); - toAdd.put(new StringWrapper("*"), DBFunc.everyone); if (Settings.TWIN_MODE_UUID) { + final HashBiMap toAdd = HashBiMap.create(new HashMap()); + toAdd.put(new StringWrapper("*"), DBFunc.everyone); HashSet all = UUIDHandler.getAllUUIDS(); PS.debug("&aFast mode UUID caching enabled!"); final File playerdataFolder = new File(container, world + File.separator + "playerdata"); @@ -99,6 +99,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { PS.debug("Failed to cache: " + all.size() + " uuids - slowly processing all files"); } } + final HashBiMap toAdd = HashBiMap.create(new HashMap()); + toAdd.put(new StringWrapper("*"), DBFunc.everyone); final HashSet worlds = new HashSet<>(); worlds.add(world); worlds.add("world"); diff --git a/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/src/main/java/com/plotsquared/sponge/listener/MainListener.java index 8bc537adf..ef57b6847 100644 --- a/src/main/java/com/plotsquared/sponge/listener/MainListener.java +++ b/src/main/java/com/plotsquared/sponge/listener/MainListener.java @@ -218,14 +218,16 @@ public class MainListener { String sender = player.getName(); PlotId id = plot.id; String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender); - String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender); + Text forcedMessage = event.getMessage(); +// String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender); for (PlotPlayer user : UUIDHandler.getPlayers().values()) { String toSend; if (plot.equals(MainUtil.getPlot(user.getLocation()))) { toSend = newMessage; } else if (Permissions.hasPermission(user, PERMISSION_COMMANDS_CHAT)) { - toSend = forcedMessage; + ((SpongePlayer) user).player.sendMessage(forcedMessage); + continue; } else { continue;