mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Fixed command logging regression caused by merge.
This commit is contained in:
parent
1431cd2a67
commit
47076b313e
@ -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 {
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user