Fix for sponge

This commit is contained in:
Jesse Boyd
2015-10-07 17:33:33 +11:00
parent 74a967b535
commit 0c4b703510
66 changed files with 1266 additions and 1198 deletions

View File

@ -157,4 +157,9 @@ public class ConsolePlayer extends PlotPlayer {
@Override
public void kick(final String message) {}
@Override
public boolean isBanned() {
return false;
}
}

View File

@ -4,6 +4,9 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.util.MainUtil;
/**
* Created 2015-02-11 for PlotSquared
*
@ -70,6 +73,18 @@ public class Location implements Cloneable, Comparable<Location> {
public String getWorld() {
return world;
}
public PlotWorld getPlotWorld() {
return PS.get().getPlotWorld(world);
}
public PlotManager getPlotManager() {
return PS.get().getPlotManager(world);
}
public Plot getPlot() {
return MainUtil.getPlot(this);
}
public void setWorld(final String world) {
this.world = world;
@ -184,7 +199,7 @@ public class Location implements Cloneable, Comparable<Location> {
}
private Object getBukkitWorld() {
try {
try {
final Class<?> clazz = Class.forName("org.bukkit.Bukkit");
return clazz.getMethod("getWorld", String.class).invoke(null, world);
} catch (final Exception e) {
@ -196,7 +211,8 @@ public class Location implements Cloneable, Comparable<Location> {
if (built) {
return o;
}
try {
try {
final Constructor<?> constructor = Class.forName("org.bukkit.Location").getConstructor(Class.forName("org.bukkit.World"), double.class, double.class, double.class, float.class,
float.class);
built = true;
return (o = constructor.newInstance(Class.forName("org.bukkit.World").cast(getBukkitWorld()), x, y, z, yaw, pitch));

View File

@ -286,7 +286,7 @@ public class Plot {
return null;
}
if (owner == null) {
return ClusterManager.getCluster(this);
return ClusterManager.getCluster(this);
}
Flag flag = FlagManager.getPlotFlagRaw(this, "cluster");
if (flag != null) {
@ -650,7 +650,7 @@ public class Plot {
/**
* Get the flag for a given key
* @param flag
*/
*/
public Flag getFlag(final String key) {
return FlagManager.getPlotFlagRaw(this, key);
}

View File

@ -36,7 +36,7 @@ public class PlotAnalysis {
public static PlotAnalysis MODIFIERS = new PlotAnalysis();
public static PlotAnalysis getAnalysis(final Plot plot) {
final Flag flag = FlagManager.getPlotFlag(plot, "analysis");
final Flag flag = FlagManager.getPlotFlagRaw(plot, "analysis");
if (flag != null) {
final PlotAnalysis analysis = new PlotAnalysis();
final List<Integer> values = (List<Integer>) flag.getValue();

View File

@ -6,11 +6,15 @@ import java.util.concurrent.ConcurrentHashMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandCaller;
import com.plotsquared.listener.PlotListener;
/**
* Created 2015-02-20 for PlotSquared
@ -301,9 +305,35 @@ public abstract class PlotPlayer implements CommandCaller {
* @param id
*/
public abstract void playMusic(final Location loc, final int id);
/**
* Check if the player is banned
* @return
*/
public abstract boolean isBanned();
/**
* Kick the player from the game
* @param message
*/
public abstract void kick(final String message);
/**
* Called when the player quits
*/
public void unregister() {
final Plot plot = getCurrentPlot();
if (plot != null) {
PlotListener.plotExit(this, plot);
}
ExpireManager.dates.put(getUUID(), System.currentTimeMillis());
EventUtil.unregisterPlayer(this);
if (Settings.DELETE_PLOTS_ON_BAN && isBanned()) {
for (final Plot owned : PS.get().getPlotsInWorld(getName())) {
owned.deletePlot(null);
PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), getName()));
}
}
UUIDHandler.getPlayers().remove(getName());
PS.get().IMP.unregister(this);
}

View File

@ -5,4 +5,9 @@ public abstract class RunnableVal<T> implements Runnable {
@Override
public abstract void run();
public void run(T value) {
this.value = value;
run();
}
}