Actor should not have getWorld().

Dieser Commit ist enthalten in:
sk89q 2014-06-27 18:34:58 -07:00
Ursprung 23ce159ccf
Commit 9381beb417
5 geänderte Dateien mit 10 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -117,9 +117,4 @@ class BukkitCommandSender implements Actor {
public void dispatchCUIEvent(CUIEvent event) { public void dispatchCUIEvent(CUIEvent event) {
} }
@Override
public LocalWorld getWorld() {
throw new PlayerNeededException();
}
} }

Datei anzeigen

@ -37,13 +37,6 @@ public interface Actor {
*/ */
String getName(); String getName();
/**
* Get the actor's world.
*
* @return the world
*/
World getWorld();
/** /**
* Print a message. * Print a message.
* *

Datei anzeigen

@ -240,7 +240,7 @@ public class PlatformManager {
permActor = player; permActor = player;
} }
return (T) new PlayerProxy(player, permActor, getWorldForEditing(base.getWorld())); return (T) new PlayerProxy(player, permActor, getWorldForEditing(player.getWorld()));
} else { } else {
return base; return base;
} }

Datei anzeigen

@ -89,7 +89,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
builder.append("WorldEdit: ").append(sender.getName()); builder.append("WorldEdit: ").append(sender.getName());
if (sender.isPlayer()) { if (sender.isPlayer()) {
builder.append(" (in \"" + sender.getWorld().getName() + "\")"); builder.append(" (in \"" + player.getWorld().getName() + "\")");
} }
builder.append(": ").append(context.getCommand()); builder.append(": ").append(context.getCommand());
@ -126,7 +126,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
case REGION: case REGION:
try { try {
builder.append(" - Region: ") builder.append(" - Region: ")
.append(session.getSelection(sender.getWorld())); .append(session.getSelection(player.getWorld()));
} catch (IncompleteRegionException e) { } catch (IncompleteRegionException e) {
break; break;
} }

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.internal.command; package com.sk89q.worldedit.internal.command;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
@ -169,7 +170,9 @@ public class WorldEditBinding extends BindingHelper {
Actor actor = context.getContext().getLocals().get(Actor.class); Actor actor = context.getContext().getLocals().get(Actor.class);
ParserContext parserContext = new ParserContext(); ParserContext parserContext = new ParserContext();
parserContext.setActor(context.getContext().getLocals().get(Actor.class)); parserContext.setActor(context.getContext().getLocals().get(Actor.class));
parserContext.setWorld(actor.getWorld()); if (actor instanceof Entity) {
parserContext.setWorld(((Entity) actor).getWorld());
}
parserContext.setSession(worldEdit.getSessionManager().get(actor)); parserContext.setSession(worldEdit.getSessionManager().get(actor));
return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext); return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext);
} }
@ -189,7 +192,9 @@ public class WorldEditBinding extends BindingHelper {
Actor actor = context.getContext().getLocals().get(Actor.class); Actor actor = context.getContext().getLocals().get(Actor.class);
ParserContext parserContext = new ParserContext(); ParserContext parserContext = new ParserContext();
parserContext.setActor(context.getContext().getLocals().get(Actor.class)); parserContext.setActor(context.getContext().getLocals().get(Actor.class));
parserContext.setWorld(actor.getWorld()); if (actor instanceof Entity) {
parserContext.setWorld(((Entity) actor).getWorld());
}
parserContext.setSession(worldEdit.getSessionManager().get(actor)); parserContext.setSession(worldEdit.getSessionManager().get(actor));
return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext); return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext);
} }