From 3ebf2ee96bbd446b160a4a8c7d4b23eb20f0c724 Mon Sep 17 00:00:00 2001 From: rugmj Date: Sun, 31 Dec 2023 14:08:53 +0000 Subject: [PATCH] removes all weird imports left over --- .../commands/MinSelectionFeature.java | 2 - .../features/commands/QuickTpFeature.java | 2 - .../features/commands/RStackFeature.java | 6 +-- .../toggleable/ToggleableFeature.java | 40 ++++++++++--------- .../redstonetools/macros/MacroManager.java | 6 +-- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java index b97f7acf..b5ee5452 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java @@ -1,6 +1,5 @@ package tools.redstone.redstonetools.features.commands; -import Z; import com.google.auto.service.AutoService; import tools.redstone.redstonetools.features.AbstractFeature; import tools.redstone.redstonetools.features.Feature; @@ -58,7 +57,6 @@ protected Feedback execute(ServerCommandSource source) throws CommandSyntaxExcep if (isEmpty) { return Feedback.invalidUsage("Cannot minimize empty selections."); } - minimiseSelection(selectionWorld, selection); diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java index a0d9ef9f..46ffbf0e 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java @@ -18,8 +18,6 @@ import static tools.redstone.redstonetools.features.arguments.serializers.BoolSerializer.bool; import static tools.redstone.redstonetools.features.arguments.serializers.FloatSerializer.floatArg; -import D; - @AutoService(AbstractFeature.class) @Feature(name = "Quick TP", description = "Teleports you in the direction you are looking.", command = "quicktp") public class QuickTpFeature extends CommandFeature { diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java index f92d302a..77364d75 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java @@ -30,8 +30,6 @@ import static tools.redstone.redstonetools.utils.DirectionUtils.directionToBlock; import static tools.redstone.redstonetools.utils.DirectionUtils.matchDirection; -import I; - @AutoService(AbstractFeature.class) @Feature(name = "RStack", description = "Stacks with custom distance", command = "/rstack", worldedit = true) public class RStackFeature extends CommandFeature { @@ -83,15 +81,13 @@ public Mask2D toMask2D() { var stackVector = directionToBlock(stackDirection); - try (var editSession = localSession.createEditSession(actor)) { for (var i = 1; i <= count.getValue(); i++) { var copy = new ForwardExtentCopy( editSession, selection, editSession, - selection.getMinimumPoint().add(stackVector.multiply(i * offset.getValue())) - ); + selection.getMinimumPoint().add(stackVector.multiply(i * offset.getValue()))); copy.setSourceMask(airFilter); Operations.complete(copy); } diff --git a/src/main/java/tools/redstone/redstonetools/features/toggleable/ToggleableFeature.java b/src/main/java/tools/redstone/redstonetools/features/toggleable/ToggleableFeature.java index 0cd189a5..2e80d9ff 100644 --- a/src/main/java/tools/redstone/redstonetools/features/toggleable/ToggleableFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/toggleable/ToggleableFeature.java @@ -41,8 +41,6 @@ import static tools.redstone.redstonetools.RedstoneToolsClient.INJECTOR; -import Z; - import static net.minecraft.server.command.CommandManager.argument; import static net.minecraft.server.command.CommandManager.literal; @@ -53,14 +51,14 @@ public abstract class ToggleableFeature extends AbstractFeature { @Override public void register() { super.register(); - + // load user settings // and register save hook loadConfig(); ClientLifecycleEvents.CLIENT_STOPPING.register(client -> { saveConfig(); }); - + var containsRequiredArguments = ReflectionUtils.getArguments(getClass()).stream() .anyMatch(a -> !a.isOptional()); if (containsRequiredArguments) { @@ -72,8 +70,7 @@ public void register() { info.name(), InputUtil.Type.KEYSYM, -1, - "Redstone Tools" - )); + "Redstone Tools")); keyBindings.add(keyBinding); @@ -101,7 +98,8 @@ public void register() { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - protected void registerCommands(CommandDispatcher dispatcher, CommandRegistryAccess registryAccess, RegistrationEnvironment environment) { + protected void registerCommands(CommandDispatcher dispatcher, + CommandRegistryAccess registryAccess, RegistrationEnvironment environment) { var baseCommand = literal(getCommand()) .executes(this::toggle); @@ -111,7 +109,8 @@ protected void registerCommands(CommandDispatcher dispatche baseCommand.then(literal(name) .executes(context -> { Object value = argument.getValue(); - return Feedback.success("Option {} of feature {} is set to: {}", name, getName(), argument.getType().serialize(value)).send(context); + return Feedback.success("Option {} of feature {} is set to: {}", name, getName(), + argument.getType().serialize(value)).send(context); }) .then(argument("value", argument.getType()).executes(context -> { Object value = context.getArgument("value", argument.getType().getTypeClass()); @@ -125,8 +124,7 @@ protected void registerCommands(CommandDispatcher dispatche IO_EXECUTOR.execute(this::saveConfig); return Feedback.success("Set {} to {} for feature {}", name, value, getName()).send(context); - })) - ); + }))); } dispatcher.register(baseCommand); @@ -185,13 +183,16 @@ public int disable(CommandContext context) throws CommandSy return disable(context.getSource()); } - protected void onEnable() { } - protected void onDisable() { } + protected void onEnable() { + } + + protected void onDisable() { + } // todo: right now the configuration methods are assuming every - // type is serialized to a string, this should be fixed in the future - // but for now it works because every type right now serializes to a string - // + it will probably be refactored soon + // type is serialized to a string, this should be fixed in the future + // but for now it works because every type right now serializes to a string + // + it will probably be refactored soon /** Reloads the configuration from the disk. */ @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -219,9 +220,11 @@ public void loadConfig() { setEnabled(enabled); - RedstoneToolsClient.LOGGER.info("Loaded configuration for feature " + getID() + " file(" + configFile + ")"); + RedstoneToolsClient.LOGGER + .info("Loaded configuration for feature " + getID() + " file(" + configFile + ")"); } catch (Exception e) { - RedstoneToolsClient.LOGGER.error("Failed to load configuration for feature " + getID() + " file(" + configFile + ")"); + RedstoneToolsClient.LOGGER + .error("Failed to load configuration for feature " + getID() + " file(" + configFile + ")"); e.printStackTrace(); } } @@ -254,7 +257,8 @@ public void saveConfig() { RedstoneToolsClient.LOGGER.info("Saved configuration for feature " + getID() + " file(" + configFile + ")"); } catch (Exception e) { - RedstoneToolsClient.LOGGER.error("Failed to save configuration for feature " + getID() + " file(" + configFile + ")"); + RedstoneToolsClient.LOGGER + .error("Failed to save configuration for feature " + getID() + " file(" + configFile + ")"); e.printStackTrace(); } } diff --git a/src/main/java/tools/redstone/redstonetools/macros/MacroManager.java b/src/main/java/tools/redstone/redstonetools/macros/MacroManager.java index 1701fcfe..e3d02869 100644 --- a/src/main/java/tools/redstone/redstonetools/macros/MacroManager.java +++ b/src/main/java/tools/redstone/redstonetools/macros/MacroManager.java @@ -12,8 +12,6 @@ import javax.json.JsonObject; import javax.json.JsonReader; import javax.json.JsonWriter; -import ; -import Z; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -33,7 +31,6 @@ public MacroManager() { .resolve("redstonetools") .resolve("macros.json"); - JsonArray macrosJson = null; try { Files.createDirectories(macrosFilePath.getParent()); @@ -136,8 +133,7 @@ private List getDefaultMacros() { "/gamerule doContainerDrops false", "/time set noon", "/weather clear" - }) - ); + })); } private Macro createCommandMacro(String name, String[] commands) {