3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 21:10:05 +01:00

Minor tweaks to work with build.js

Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-14 22:46:01 +10:00
Ursprung f6b844e53c
Commit a8b0fd21bb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
3 geänderte Dateien mit 17 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -30,7 +30,9 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.CommandManager; import com.sk89q.worldedit.extension.platform.CommandManager;
import com.sk89q.worldedit.scripting.CraftScriptContext;
import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.CraftScriptEngine;
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
@ -138,9 +140,15 @@ public class ScriptingCommands {
engine.setTimeLimit(worldEdit.getConfiguration().scriptTimeout); engine.setTimeLimit(worldEdit.getConfiguration().scriptTimeout);
Player player = actor instanceof Player ? (Player) actor : null;
CraftScriptContext scriptContext = new CraftScriptContext(worldEdit, WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.USER_COMMANDS),
WorldEdit.getInstance().getConfiguration(), session, player, args);
Map<String, Object> vars = new HashMap<>(); Map<String, Object> vars = new HashMap<>();
vars.put("argv", args); vars.put("argv", args);
vars.put("context", scriptContext);
vars.put("actor", actor); vars.put("actor", actor);
vars.put("player", player);
try { try {
result = engine.evaluate(script, filename, vars); result = engine.evaluate(script, filename, vars);
@ -155,6 +163,7 @@ public class ScriptingCommands {
} catch (Throwable e) { } catch (Throwable e) {
actor.printError(BBC.getPrefix() + "Failed to execute (see console):"); actor.printError(BBC.getPrefix() + "Failed to execute (see console):");
actor.printRaw(e.getClass().getCanonicalName()); actor.printRaw(e.getClass().getCanonicalName());
e.printStackTrace();
} }
if (result instanceof NativeJavaObject) { if (result instanceof NativeJavaObject) {
return (T) ((NativeJavaObject) result).unwrap(); return (T) ((NativeJavaObject) result).unwrap();

Datei anzeigen

@ -200,6 +200,10 @@ public class BaseBlock implements BlockStateHolder<BaseBlock> {
return blockState.getBlockType(); return blockState.getBlockType();
} }
public BlockType getType() {
return getBlockType();
}
@Override @Override
public int getOrdinal() { public int getOrdinal() {
return blockState.getOrdinal(); return blockState.getOrdinal();

Datei anzeigen

@ -21,6 +21,7 @@ package com.sk89q.worldedit.world.item;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.registry.RegistryItem; import com.sk89q.worldedit.registry.RegistryItem;
import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.registry.NamespacedRegistry;
@ -105,6 +106,9 @@ public class ItemType implements RegistryItem {
} }
public BaseItem getDefaultState() { public BaseItem getDefaultState() {
if (defaultState == null) {
this.defaultState = new BaseItemStack(this);
}
return this.defaultState; return this.defaultState;
} }