Fix scripting initialization

This commit is contained in:
Jesse Boyd 2016-06-18 16:29:51 +10:00
parent ab51d27e49
commit cff30a1db4
4 changed files with 20 additions and 18 deletions

View File

@ -167,20 +167,6 @@ public class PS {
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
this.IMP.runEntityTask(); this.IMP.runEntityTask();
} }
// WorldEdit
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
if (this.IMP.initWorldEdit()) {
PS.debug("PlotSquared hooked into WorldEdit.");
this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
new WE_Anywhere();
}
} catch (Throwable e) {
PS.debug("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
}
}
if (Settings.Enabled_Components.EVENTS) { if (Settings.Enabled_Components.EVENTS) {
this.IMP.registerPlayerEvents(); this.IMP.registerPlayerEvents();
this.IMP.registerInventoryEvents(); this.IMP.registerInventoryEvents();
@ -232,6 +218,22 @@ public class PS {
if (Settings.Enabled_Components.COMMANDS) { if (Settings.Enabled_Components.COMMANDS) {
this.IMP.registerCommands(); this.IMP.registerCommands();
} }
// WorldEdit
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
if (this.IMP.initWorldEdit()) {
PS.debug("PlotSquared hooked into WorldEdit.");
this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
if (Settings.Enabled_Components.COMMANDS) {
new WE_Anywhere();
}
}
} catch (Throwable e) {
PS.debug("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
}
}
// Economy // Economy
if (Settings.Enabled_Components.ECONOMY) { if (Settings.Enabled_Components.ECONOMY) {
TaskManager.runTask(new Runnable() { TaskManager.runTask(new Runnable() {

View File

@ -78,7 +78,9 @@ public class DebugExec extends SubCommand {
this.engine.eval(script, this.scope); this.engine.eval(script, this.scope);
} }
} }
} catch (IOException | ScriptException ignored) {} } catch (IOException | ScriptException ignored) {
ignored.printStackTrace();
}
} }
public ScriptEngine getEngine() { public ScriptEngine getEngine() {

View File

@ -74,9 +74,7 @@ public class Merge extends SubCommand {
final PlotArea plotArea = plot.getArea(); final PlotArea plotArea = plot.getArea();
Expression<Double> priceExr = plotArea.PRICES.containsKey("merge") ? plotArea.PRICES.get("merge") : null; Expression<Double> priceExr = plotArea.PRICES.containsKey("merge") ? plotArea.PRICES.get("merge") : null;
final int size = plot.getConnectedPlots().size(); final int size = plot.getConnectedPlots().size();
System.out.println("EXPRESSIONL " + priceExr);
final double price = priceExr == null ? 0d : priceExr.evalute((double) size); final double price = priceExr == null ? 0d : priceExr.evalute((double) size);
System.out.println("PRICE: " + price + " | " + EconHandler.manager + " | " + plotArea.USE_ECONOMY);
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(player) < price) { if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(player) < price) {
sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price)); sendMessage(player, C.CANNOT_AFFORD_MERGE, String.valueOf(price));
return false; return false;

View File

@ -751,7 +751,7 @@ public enum C {
// HashMap<String, String> replacements = new HashMap<>(); // HashMap<String, String> replacements = new HashMap<>();
replacements.clear(); replacements.clear();
for (String style : styles) { for (String style : styles) {
replacements.put('$' + style, '§' + config.getString(style)); replacements.put('$' + style, '\u00A7' + config.getString(style));
} }
for (char letter : "1234567890abcdefklmnor".toCharArray()) { for (char letter : "1234567890abcdefklmnor".toCharArray()) {
replacements.put("&" + letter, "\u00a7" + letter); replacements.put("&" + letter, "\u00a7" + letter);