fixes title spam

This commit is contained in:
boy0001 2015-02-09 15:20:05 +11:00
parent 202ad43214
commit bbf92bfa38
4 changed files with 36 additions and 26 deletions

View File

@ -22,6 +22,8 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotMain;
@ -59,7 +61,10 @@ public class DebugClear extends SubCommand {
if (plot == null) { if (plot == null) {
PlotMain.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); PlotMain.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world);
} else { } 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("Plot " + plot.getId().toString() + " cleared.");
PlotMain.sendConsoleSenderMessage("&aDone!"); PlotMain.sendConsoleSenderMessage("&aDone!");
} }
@ -80,7 +85,10 @@ public class DebugClear extends SubCommand {
return sendMessage(plr, C.NO_PLOT_PERMS); return sendMessage(plr, C.NO_PLOT_PERMS);
} }
assert plot != null; 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!"); PlayerFunctions.sendMessage(plr, "&aDone!");
// sign // sign

View File

@ -44,8 +44,9 @@ public class DefaultTitleManager {
* *
* @param title * @param title
* Title * Title
* @throws ClassNotFoundException
*/ */
public DefaultTitleManager(String title) { public DefaultTitleManager(String title) throws ClassNotFoundException {
this.title = title; this.title = title;
loadClasses(); loadClasses();
} }
@ -57,8 +58,9 @@ public class DefaultTitleManager {
* Title text * Title text
* @param subtitle * @param subtitle
* Subtitle text * Subtitle text
* @throws ClassNotFoundException
*/ */
public DefaultTitleManager(String title, String subtitle) { public DefaultTitleManager(String title, String subtitle) throws ClassNotFoundException {
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
loadClasses(); loadClasses();
@ -69,8 +71,9 @@ public class DefaultTitleManager {
* *
* @param title * @param title
* Title * Title
* @throws ClassNotFoundException
*/ */
public DefaultTitleManager(DefaultTitleManager title) { public DefaultTitleManager(DefaultTitleManager title) throws ClassNotFoundException {
// Copy title // Copy title
this.title = title.title; this.title = title.title;
this.subtitle = title.subtitle; this.subtitle = title.subtitle;
@ -96,8 +99,9 @@ public class DefaultTitleManager {
* Stay on screen time * Stay on screen time
* @param fadeOutTime * @param fadeOutTime
* Fade out time * 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.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
this.fadeInTime = fadeInTime; this.fadeInTime = fadeInTime;
@ -108,8 +112,9 @@ public class DefaultTitleManager {
/** /**
* Load spigot and NMS classes * Load spigot and NMS classes
* @throws ClassNotFoundException
*/ */
private void loadClasses() { private void loadClasses() throws ClassNotFoundException {
packetTitle = getNMSClass("PacketPlayOutTitle"); packetTitle = getNMSClass("PacketPlayOutTitle");
packetActions = getNMSClass("EnumTitleAction"); packetActions = getNMSClass("EnumTitleAction");
chatBaseComponent = getNMSClass("IChatBaseComponent"); chatBaseComponent = getNMSClass("IChatBaseComponent");
@ -363,15 +368,10 @@ public class DefaultTitleManager {
return version; return version;
} }
private Class<?> getNMSClass(String className) { private Class<?> getNMSClass(String className) throws ClassNotFoundException {
String fullName = "net.minecraft.server." + getVersion() + className; String fullName = "net.minecraft.server." + getVersion() + className;
Class<?> clazz = null; Class<?> clazz = null;
try { clazz = Class.forName(fullName);
clazz = Class.forName(fullName);
}
catch (Exception e) {
e.printStackTrace();
}
return clazz; return clazz;
} }

View File

@ -41,8 +41,9 @@ public class HackTitleManager {
* *
* @param title * @param title
* Title * Title
* @throws ClassNotFoundException
*/ */
public HackTitleManager(String title) { public HackTitleManager(String title) throws ClassNotFoundException {
this.title = title; this.title = title;
loadClasses(); loadClasses();
} }
@ -54,8 +55,9 @@ public class HackTitleManager {
* Title text * Title text
* @param subtitle * @param subtitle
* Subtitle text * Subtitle text
* @throws ClassNotFoundException
*/ */
public HackTitleManager(String title, String subtitle) { public HackTitleManager(String title, String subtitle) throws ClassNotFoundException {
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
loadClasses(); loadClasses();
@ -66,8 +68,9 @@ public class HackTitleManager {
* *
* @param title * @param title
* Title * Title
* @throws ClassNotFoundException
*/ */
public HackTitleManager(HackTitleManager title) { public HackTitleManager(HackTitleManager title) throws ClassNotFoundException {
// Copy title // Copy title
this.title = title.title; this.title = title.title;
this.subtitle = title.subtitle; this.subtitle = title.subtitle;
@ -93,9 +96,10 @@ public class HackTitleManager {
* Stay on screen time * Stay on screen time
* @param fadeOutTime * @param fadeOutTime
* Fade out time * Fade out time
* @throws ClassNotFoundException
*/ */
public HackTitleManager(String title, String subtitle, int fadeInTime, int stayTime, public HackTitleManager(String title, String subtitle, int fadeInTime, int stayTime,
int fadeOutTime) { int fadeOutTime) throws ClassNotFoundException {
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
this.fadeInTime = fadeInTime; this.fadeInTime = fadeInTime;
@ -106,8 +110,9 @@ public class HackTitleManager {
/** /**
* Load spigot and NMS classes * Load spigot and NMS classes
* @throws ClassNotFoundException
*/ */
private void loadClasses() { private void loadClasses() throws ClassNotFoundException {
packetTitle = getClass("org.spigotmc.ProtocolInjector$PacketTitle"); packetTitle = getClass("org.spigotmc.ProtocolInjector$PacketTitle");
packetActions = getClass("org.spigotmc.ProtocolInjector$PacketTitle$Action"); packetActions = getClass("org.spigotmc.ProtocolInjector$PacketTitle$Action");
nmsChatSerializer = getNMSClass("ChatSerializer"); nmsChatSerializer = getNMSClass("ChatSerializer");
@ -439,14 +444,10 @@ public class HackTitleManager {
return version; return version;
} }
private Class<?> getNMSClass(String className) { private Class<?> getNMSClass(String className) throws ClassNotFoundException {
String fullName = "net.minecraft.server." + getVersion() + className; String fullName = "net.minecraft.server." + getVersion() + className;
Class<?> clazz = null; Class<?> clazz = null;
try { clazz = Class.forName(fullName);
clazz = Class.forName(fullName);
} catch (Exception e) {
e.printStackTrace();
}
return clazz; return clazz;
} }

View File

@ -765,7 +765,8 @@ import com.intellectualcrafters.plot.object.PlotWorld;
PlotWorld plotworld = PlotMain.getWorldSettings(world); PlotWorld plotworld = PlotMain.getWorldSettings(world);
if (plotworld.TERRAIN != 0) { if (plotworld.TERRAIN != 0) {
ChunkManager.clearPlotExperimental(world, plot, isDelete); final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
ChunkManager.regenerateRegion(pos1, pos2);
return; return;
} }