mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Minor tweaks to work with build.js
This commit is contained in:
parent
f6b844e53c
commit
a8b0fd21bb
@ -30,7 +30,9 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
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.scripting.CraftScriptContext;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
@ -138,9 +140,15 @@ public class ScriptingCommands {
|
||||
|
||||
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<>();
|
||||
vars.put("argv", args);
|
||||
vars.put("context", scriptContext);
|
||||
vars.put("actor", actor);
|
||||
vars.put("player", player);
|
||||
|
||||
try {
|
||||
result = engine.evaluate(script, filename, vars);
|
||||
@ -155,6 +163,7 @@ public class ScriptingCommands {
|
||||
} catch (Throwable e) {
|
||||
actor.printError(BBC.getPrefix() + "Failed to execute (see console):");
|
||||
actor.printRaw(e.getClass().getCanonicalName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (result instanceof NativeJavaObject) {
|
||||
return (T) ((NativeJavaObject) result).unwrap();
|
||||
|
@ -200,6 +200,10 @@ public class BaseBlock implements BlockStateHolder<BaseBlock> {
|
||||
return blockState.getBlockType();
|
||||
}
|
||||
|
||||
public BlockType getType() {
|
||||
return getBlockType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrdinal() {
|
||||
return blockState.getOrdinal();
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.world.item;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.RegistryItem;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
@ -105,6 +106,9 @@ public class ItemType implements RegistryItem {
|
||||
}
|
||||
|
||||
public BaseItem getDefaultState() {
|
||||
if (defaultState == null) {
|
||||
this.defaultState = new BaseItemStack(this);
|
||||
}
|
||||
return this.defaultState;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user