mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Migrate to SLF4J
This commit is contained in:
@ -35,6 +35,7 @@ import com.sk89q.worldedit.math.MathUtils;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.storage.LegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.McRegionChunkStore;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
@ -184,4 +185,5 @@ public class ChunkCommands {
|
||||
player.printError(BBC.getPrefix() + "Shell script type must be configured: 'bat' or 'bash' expected.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -35,10 +38,6 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
|
||||
|
||||
/**
|
||||
* Commands for moving the player around.
|
||||
*/
|
||||
@ -58,11 +57,11 @@ public class NavigationCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"unstuck", "!"},
|
||||
usage = "",
|
||||
desc = "Escape from being stuck inside a block",
|
||||
min = 0,
|
||||
max = 0
|
||||
aliases = { "unstuck", "!" },
|
||||
usage = "",
|
||||
desc = "Escape from being stuck inside a block",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.navigation.unstuck")
|
||||
public void unstuck(Player player) throws WorldEditException {
|
||||
@ -234,4 +233,4 @@ public class NavigationCommands {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -48,15 +48,18 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@ -66,12 +69,10 @@ import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Commands that work with schematic files.
|
||||
@ -79,7 +80,7 @@ import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
@Command(aliases = {"schematic", "schem", "/schematic", "/schem", "clipboard", "/clipboard"}, desc = "Commands that work with schematic files")
|
||||
public class SchematicCommands extends MethodCommands {
|
||||
|
||||
private static final Logger log = Logger.getLogger(SchematicCommands.class.getCanonicalName());
|
||||
private static final Logger log = LoggerFactory.getLogger(SchematicCommands.class);
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -266,7 +267,7 @@ public class SchematicCommands extends MethodCommands {
|
||||
player.printError("Unknown filename: " + filename);
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
player.printError("File could not be read or it does not exist: " + e.getMessage());
|
||||
log.log(Level.WARNING, "Failed to load a saved clipboard", e);
|
||||
log.warn("Failed to load a saved clipboard", e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
@ -363,7 +364,7 @@ public class SchematicCommands extends MethodCommands {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
player.printError("Schematic could not written: " + e.getMessage());
|
||||
log.log(Level.WARNING, "Failed to write a saved clipboard", e);
|
||||
log.warn("Failed to write a saved clipboard", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,13 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
|
||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Snapshot commands.
|
||||
@ -47,7 +47,6 @@ import java.util.logging.Logger;
|
||||
@Command(aliases = {"snapshot", "snap"}, desc = "List, load and view information related to snapshots")
|
||||
public class SnapshotCommands {
|
||||
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
|
||||
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
||||
|
||||
private final WorldEdit we;
|
||||
@ -93,10 +92,10 @@ public class SnapshotCommands {
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
|
||||
try {
|
||||
logger.info("WorldEdit found no snapshots: looked in: "
|
||||
WorldEdit.logger.info("WorldEdit found no snapshots: looked in: "
|
||||
+ dir.getCanonicalPath());
|
||||
} catch (IOException e) {
|
||||
logger.info("WorldEdit found no snapshots: looked in "
|
||||
WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
|
||||
+ "(NON-RESOLVABLE PATH - does it exist?): "
|
||||
+ dir.getPath());
|
||||
}
|
||||
@ -107,7 +106,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"use"},
|
||||
aliases = { "use" },
|
||||
usage = "<snapshot>",
|
||||
desc = "Choose a snapshot to use",
|
||||
min = 1,
|
||||
@ -150,7 +149,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"sel"},
|
||||
aliases = { "sel" },
|
||||
usage = "<index>",
|
||||
desc = "Choose the snapshot based on the list id",
|
||||
min = 1,
|
||||
@ -197,7 +196,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"before"},
|
||||
aliases = { "before" },
|
||||
usage = "<date>",
|
||||
desc = "Choose the nearest snapshot before a date",
|
||||
min = 1,
|
||||
@ -236,7 +235,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"after"},
|
||||
aliases = { "after" },
|
||||
usage = "<date>",
|
||||
desc = "Choose the nearest snapshot after a date",
|
||||
min = 1,
|
||||
@ -261,7 +260,8 @@ public class SnapshotCommands {
|
||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
|
||||
if (snapshot == null) {
|
||||
dateFormat.setTimeZone(session.getTimeZone());
|
||||
player.printError("Couldn't find a snapshot after " + dateFormat.format(date.getTime()) + ".");
|
||||
player.printError("Couldn't find a snapshot after "
|
||||
+ dateFormat.format(date.getTime()) + ".");
|
||||
} else {
|
||||
session.setSnapshot(snapshot);
|
||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
||||
@ -271,4 +271,5 @@ public class SnapshotCommands {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,18 +37,15 @@ import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||
import com.sk89q.worldedit.world.snapshot.SnapshotRestore;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
||||
|
||||
@Command(aliases = {}, desc = "[More Info](http://wiki.sk89q.com/wiki/WorldEdit/Snapshots)")
|
||||
public class SnapshotUtilCommands {
|
||||
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
|
||||
|
||||
private final WorldEdit we;
|
||||
|
||||
public SnapshotUtilCommands(WorldEdit we) {
|
||||
@ -56,7 +53,7 @@ public class SnapshotUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"restore", "/restore"},
|
||||
aliases = { "restore", "/restore" },
|
||||
usage = "[snapshot]",
|
||||
desc = "Restore the selection from a snapshot",
|
||||
min = 0,
|
||||
@ -99,10 +96,10 @@ public class SnapshotUtilCommands {
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
|
||||
try {
|
||||
logger.info("FAWE found no snapshots: looked in: "
|
||||
WorldEdit.logger.info("WorldEdit found no snapshots: looked in: "
|
||||
+ dir.getCanonicalPath());
|
||||
} catch (IOException e) {
|
||||
logger.info("FAWE found no snapshots: looked in "
|
||||
WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
|
||||
+ "(NON-RESOLVABLE PATH - does it exist?): "
|
||||
+ dir.getPath());
|
||||
}
|
||||
|
@ -81,20 +81,25 @@ public class SelectionCommand extends SimpleCommand<Operation> {
|
||||
if (!testPermission(locals)) {
|
||||
throw new CommandPermissionsException();
|
||||
}
|
||||
|
||||
Contextual<? extends Operation> operationFactory = delegate.call(args, locals);
|
||||
|
||||
Actor actor = locals.get(Actor.class);
|
||||
if (actor instanceof Player) {
|
||||
try {
|
||||
Player player = (Player) actor;
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(player);
|
||||
Region selection = session.getSelection(player.getWorld());
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.enableQueue();
|
||||
locals.put(EditSession.class, editSession);
|
||||
session.tellVersion(player);
|
||||
|
||||
EditContext editContext = new EditContext();
|
||||
editContext.setDestination(locals.get(EditSession.class));
|
||||
editContext.setRegion(selection);
|
||||
|
||||
Operation operation = operationFactory.createFromContext(editContext);
|
||||
// Shortcut
|
||||
if (selection instanceof CuboidRegion && editSession.hasFastMode() && operation instanceof RegionVisitor) {
|
||||
@ -191,4 +196,4 @@ public class SelectionCommand extends SimpleCommand<Operation> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -38,6 +33,11 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A mode that cycles the data values of supported blocks.
|
||||
*/
|
||||
@ -47,7 +47,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
public boolean canUse(Actor player) {
|
||||
return player.hasPermission("worldedit.tool.data-cycler");
|
||||
}
|
||||
|
||||
|
||||
private Map<UUID, Property<?>> selectedProperties = new HashMap<>();
|
||||
|
||||
private boolean handleCycle(Platform server, LocalConfiguration config,
|
||||
@ -104,7 +104,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,16 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
/**
|
||||
* A mode that replaces one block.
|
||||
|
@ -49,24 +49,24 @@ public class TreePlanter implements BlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
try {
|
||||
boolean successful = false;
|
||||
|
||||
try {
|
||||
boolean successful = false;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (treeType.generate(editSession, clicked.add(0, 1, 0).toBlockPoint())) {
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!successful) {
|
||||
player.printError("A tree can't go there.");
|
||||
|
||||
if (!successful) {
|
||||
player.printError("A tree can't go there.");
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max. blocks changed reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max. blocks changed reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
public class CylinderBrush implements Brush {
|
||||
|
||||
|
@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
public class HollowCylinderBrush implements Brush {
|
||||
|
@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
public class HollowSphereBrush implements Brush {
|
||||
|
@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.tool.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
public class SphereBrush implements Brush {
|
||||
|
Reference in New Issue
Block a user