From bbf92bfa38a27be8b343d3d14b4304db6a89f67c Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 9 Feb 2015 15:20:05 +1100 Subject: [PATCH] fixes title spam --- .../plot/commands/DebugClear.java | 12 ++++++++-- .../plot/titles/DefaultTitleManager.java | 24 +++++++++---------- .../plot/titles/HackTitleManager.java | 23 +++++++++--------- .../plot/util/PlotHelper.java | 3 ++- 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 3f7b7dd57..d470df358 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -22,6 +22,8 @@ package com.intellectualcrafters.plot.commands; import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotMain; @@ -59,7 +61,10 @@ public class DebugClear extends SubCommand { if (plot == null) { PlotMain.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); } else { - ChunkManager.clearPlotExperimental(Bukkit.getWorld(world), plot, false); + World bukkitWorld = Bukkit.getWorld(world); + Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id); + Location pos2 = PlotHelper.getPlotTopLoc(bukkitWorld, plot.id); + ChunkManager.regenerateRegion(pos1, pos2); PlotMain.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared."); PlotMain.sendConsoleSenderMessage("&aDone!"); } @@ -80,7 +85,10 @@ public class DebugClear extends SubCommand { return sendMessage(plr, C.NO_PLOT_PERMS); } assert plot != null; - ChunkManager.clearPlotExperimental(plr.getWorld(), plot, false); + World bukkitWorld = plr.getWorld(); + Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id); + Location pos2 = PlotHelper.getPlotTopLoc(bukkitWorld, plot.id); + ChunkManager.regenerateRegion(pos1, pos2); PlayerFunctions.sendMessage(plr, "&aDone!"); // sign diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java index 3d69cd0e1..a21d16259 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java @@ -44,8 +44,9 @@ public class DefaultTitleManager { * * @param title * Title + * @throws ClassNotFoundException */ - public DefaultTitleManager(String title) { + public DefaultTitleManager(String title) throws ClassNotFoundException { this.title = title; loadClasses(); } @@ -57,8 +58,9 @@ public class DefaultTitleManager { * Title text * @param subtitle * Subtitle text + * @throws ClassNotFoundException */ - public DefaultTitleManager(String title, String subtitle) { + public DefaultTitleManager(String title, String subtitle) throws ClassNotFoundException { this.title = title; this.subtitle = subtitle; loadClasses(); @@ -69,8 +71,9 @@ public class DefaultTitleManager { * * @param title * Title + * @throws ClassNotFoundException */ - public DefaultTitleManager(DefaultTitleManager title) { + public DefaultTitleManager(DefaultTitleManager title) throws ClassNotFoundException { // Copy title this.title = title.title; this.subtitle = title.subtitle; @@ -96,8 +99,9 @@ public class DefaultTitleManager { * Stay on screen time * @param fadeOutTime * Fade out time + * @throws ClassNotFoundException */ - public DefaultTitleManager(String title, String subtitle, int fadeInTime, int stayTime, int fadeOutTime) { + public DefaultTitleManager(String title, String subtitle, int fadeInTime, int stayTime, int fadeOutTime) throws ClassNotFoundException { this.title = title; this.subtitle = subtitle; this.fadeInTime = fadeInTime; @@ -108,8 +112,9 @@ public class DefaultTitleManager { /** * Load spigot and NMS classes + * @throws ClassNotFoundException */ - private void loadClasses() { + private void loadClasses() throws ClassNotFoundException { packetTitle = getNMSClass("PacketPlayOutTitle"); packetActions = getNMSClass("EnumTitleAction"); chatBaseComponent = getNMSClass("IChatBaseComponent"); @@ -363,15 +368,10 @@ public class DefaultTitleManager { return version; } - private Class getNMSClass(String className) { + private Class getNMSClass(String className) throws ClassNotFoundException { String fullName = "net.minecraft.server." + getVersion() + className; Class clazz = null; - try { - clazz = Class.forName(fullName); - } - catch (Exception e) { - e.printStackTrace(); - } + clazz = Class.forName(fullName); return clazz; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java index a5ce7042b..7c9c5dfa7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java @@ -41,8 +41,9 @@ public class HackTitleManager { * * @param title * Title + * @throws ClassNotFoundException */ - public HackTitleManager(String title) { + public HackTitleManager(String title) throws ClassNotFoundException { this.title = title; loadClasses(); } @@ -54,8 +55,9 @@ public class HackTitleManager { * Title text * @param subtitle * Subtitle text + * @throws ClassNotFoundException */ - public HackTitleManager(String title, String subtitle) { + public HackTitleManager(String title, String subtitle) throws ClassNotFoundException { this.title = title; this.subtitle = subtitle; loadClasses(); @@ -66,8 +68,9 @@ public class HackTitleManager { * * @param title * Title + * @throws ClassNotFoundException */ - public HackTitleManager(HackTitleManager title) { + public HackTitleManager(HackTitleManager title) throws ClassNotFoundException { // Copy title this.title = title.title; this.subtitle = title.subtitle; @@ -93,9 +96,10 @@ public class HackTitleManager { * Stay on screen time * @param fadeOutTime * Fade out time + * @throws ClassNotFoundException */ public HackTitleManager(String title, String subtitle, int fadeInTime, int stayTime, - int fadeOutTime) { + int fadeOutTime) throws ClassNotFoundException { this.title = title; this.subtitle = subtitle; this.fadeInTime = fadeInTime; @@ -106,8 +110,9 @@ public class HackTitleManager { /** * Load spigot and NMS classes + * @throws ClassNotFoundException */ - private void loadClasses() { + private void loadClasses() throws ClassNotFoundException { packetTitle = getClass("org.spigotmc.ProtocolInjector$PacketTitle"); packetActions = getClass("org.spigotmc.ProtocolInjector$PacketTitle$Action"); nmsChatSerializer = getNMSClass("ChatSerializer"); @@ -439,14 +444,10 @@ public class HackTitleManager { return version; } - private Class getNMSClass(String className) { + private Class getNMSClass(String className) throws ClassNotFoundException { String fullName = "net.minecraft.server." + getVersion() + className; Class clazz = null; - try { - clazz = Class.forName(fullName); - } catch (Exception e) { - e.printStackTrace(); - } + clazz = Class.forName(fullName); return clazz; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java index 871fdb66f..1c4455dc8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java @@ -765,7 +765,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; PlotWorld plotworld = PlotMain.getWorldSettings(world); if (plotworld.TERRAIN != 0) { - ChunkManager.clearPlotExperimental(world, plot, isDelete); + final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id); + ChunkManager.regenerateRegion(pos1, pos2); return; }