3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 03:12:37 +01:00

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 // Register log
if (!logging || path.isEmpty()) { if (!logging || path.isEmpty()) {
dynamicHandler.setHandler(null); dynamicHandler.setHandler(null);
logger.setLevel(Level.OFF);
} else { } else {
File file = new File(config.getWorkingDirectory(), path); File file = new File(config.getWorkingDirectory(), path);
logger.setLevel(Level.ALL);
logger.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath()); logger.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath());
try { 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.CommandException;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.*; 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.AbstractInvokeListener;
import com.sk89q.worldedit.util.command.parametric.InvokeHandler; import com.sk89q.worldedit.util.command.parametric.InvokeHandler;
import com.sk89q.worldedit.util.command.parametric.ParameterData; import com.sk89q.worldedit.util.command.parametric.ParameterData;
@ -72,11 +74,19 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
logMode = loggingAnnotation.value(); logMode = loggingAnnotation.value();
} }
LocalPlayer sender = context.getLocals().get(LocalPlayer.class); Actor sender = context.getLocals().get(Actor.class);
Player player;
if (sender == null) { if (sender == null) {
return; return;
} }
if (sender instanceof Player) {
player = (Player) sender;
} else {
return;
}
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 \"" + sender.getWorld().getName() + "\")");
@ -89,13 +99,13 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
} }
if (logMode != null && sender.isPlayer()) { if (logMode != null && sender.isPlayer()) {
Vector position = sender.getPosition(); Vector position = player.getPosition();
LocalSession session = worldEdit.getSession(sender); LocalSession session = worldEdit.getSessionManager().get(player);
switch (logMode) { switch (logMode) {
case PLACEMENT: case PLACEMENT:
try { try {
position = session.getPlacementPosition(sender); position = session.getPlacementPosition(player);
} catch (IncompleteRegionException e) { } catch (IncompleteRegionException e) {
break; break;
} }
@ -110,8 +120,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
/* FALL-THROUGH */ /* FALL-THROUGH */
case ORIENTATION_REGION: case ORIENTATION_REGION:
builder.append(" - Orientation: " builder.append(" - Orientation: " + player.getCardinalDirection().name());
+ sender.getCardinalDirection().name());
/* FALL-THROUGH */ /* FALL-THROUGH */
case REGION: case REGION: