Scripting stuff + remove PlotSquared-Null

This commit is contained in:
boy0001
2015-08-02 02:12:49 +10:00
parent 858d1453f2
commit 0a3ec5dcd8
11 changed files with 295 additions and 32 deletions

View File

@ -17,4 +17,6 @@ public abstract class EconHandler {
public abstract void depositMoney(PlotPlayer player, double amount);
public abstract void depositMoney(OfflinePlotPlayer player, double amount);
public abstract void setPermission(PlotPlayer player, String perm, boolean value);
// public abstract void setPermission(OfflinePlotPlayer player, String perm, boolean value);
// public abstract void getPermission(OfflinePlotPlayer player, String perm);
}

View File

@ -132,7 +132,7 @@ public class ExpireManager {
if (plot.isMerged()) {
MainUtil.unlinkPlot(plot);
}
plot.delete();
plot.deletePlot(null);
expiredPlots.get(world).remove(plot);
int complexity = changed == null ? 0 : changed.getComplexity();
int modified = changed == null ? 0 : changed.changes;

View File

@ -29,6 +29,7 @@ import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.BlockLoc;
@ -765,6 +766,15 @@ public class MainUtil {
}
public static void removeSign(final Plot p) {
if (!PS.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
removeSign(p);
}
});
return;
}
final String world = p.world;
final PlotManager manager = PS.get().getPlotManager(world);
final PlotWorld plotworld = PS.get().getPlotWorld(world);
@ -783,16 +793,23 @@ public class MainUtil {
setSign(UUIDHandler.getName(p.owner), p);
}
public static void setSign(String name, final Plot p) {
if (name == null) {
name = "unknown";
public static void setSign(final String name, final Plot p) {
if (!PS.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
setSign(name, p);
}
});
return;
}
String rename = name == null ? "unknown" : name;
final PlotManager manager = PS.get().getPlotManager(p.world);
final PlotWorld plotworld = PS.get().getPlotWorld(p.world);
if (plotworld.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(plotworld, p);
final String id = p.id.x + ";" + p.id.y;
final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name) };
final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename), C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename), C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename) };
BlockManager.setSign(p.world, loc.getX(), loc.getY(), loc.getZ(), lines);
}
}
@ -1762,4 +1779,8 @@ public class MainUtil {
}
return ratings;
}
public static void setComponent(Plot plot, String component, PlotBlock[] blocks) {
PS.get().getPlotManager(plot.world).setComponent(PS.get().getPlotWorld(plot.world), plot.id, component, blocks);
}
}