Fixed command logging regression caused by merge.

Dieser Commit ist enthalten in:
sk89q 2014-06-27 18:28:31 -07:00
Ursprung 1431cd2a67
Commit 47076b313e
2 geänderte Dateien mit 18 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -144,9 +144,12 @@ public final class CommandManager {
// Register log
if (!logging || path.isEmpty()) {
dynamicHandler.setHandler(null);
logger.setLevel(Level.OFF);
} else {
File file = new File(config.getWorkingDirectory(), path);
logger.setLevel(Level.ALL);
logger.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath());
try {

Datei anzeigen

@ -23,6 +23,8 @@ import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.command.parametric.AbstractInvokeListener;
import com.sk89q.worldedit.util.command.parametric.InvokeHandler;
import com.sk89q.worldedit.util.command.parametric.ParameterData;
@ -72,11 +74,19 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
logMode = loggingAnnotation.value();
}
LocalPlayer sender = context.getLocals().get(LocalPlayer.class);
Actor sender = context.getLocals().get(Actor.class);
Player player;
if (sender == null) {
return;
}
if (sender instanceof Player) {
player = (Player) sender;
} else {
return;
}
builder.append("WorldEdit: ").append(sender.getName());
if (sender.isPlayer()) {
builder.append(" (in \"" + sender.getWorld().getName() + "\")");
@ -89,13 +99,13 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
}
if (logMode != null && sender.isPlayer()) {
Vector position = sender.getPosition();
LocalSession session = worldEdit.getSession(sender);
Vector position = player.getPosition();
LocalSession session = worldEdit.getSessionManager().get(player);
switch (logMode) {
case PLACEMENT:
try {
position = session.getPlacementPosition(sender);
position = session.getPlacementPosition(player);
} catch (IncompleteRegionException e) {
break;
}
@ -110,8 +120,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
/* FALL-THROUGH */
case ORIENTATION_REGION:
builder.append(" - Orientation: "
+ sender.getCardinalDirection().name());
builder.append(" - Orientation: " + player.getCardinalDirection().name());
/* FALL-THROUGH */
case REGION: