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;
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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}