Skip to content

Commit

Permalink
removes all weird imports left over
Browse files Browse the repository at this point in the history
  • Loading branch information
RUGMJ committed Dec 31, 2023
1 parent f71fc09 commit 3ebf2ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -58,7 +57,6 @@ protected Feedback execute(ServerCommandSource source) throws CommandSyntaxExcep
if (isEmpty) {
return Feedback.invalidUsage("Cannot minimize empty selections.");
}


minimiseSelection(selectionWorld, selection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand All @@ -72,8 +70,7 @@ public void register() {
info.name(),
InputUtil.Type.KEYSYM,
-1,
"Redstone Tools"
));
"Redstone Tools"));

keyBindings.add(keyBinding);

Expand Down Expand Up @@ -101,7 +98,8 @@ public void register() {
@SuppressWarnings({ "rawtypes", "unchecked" })

@Override
protected void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess, RegistrationEnvironment environment) {
protected void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher,
CommandRegistryAccess registryAccess, RegistrationEnvironment environment) {
var baseCommand = literal(getCommand())
.executes(this::toggle);

Expand All @@ -111,7 +109,8 @@ protected void registerCommands(CommandDispatcher<ServerCommandSource> 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());
Expand All @@ -125,8 +124,7 @@ protected void registerCommands(CommandDispatcher<ServerCommandSource> dispatche
IO_EXECUTOR.execute(this::saveConfig);

return Feedback.success("Set {} to {} for feature {}", name, value, getName()).send(context);
}))
);
})));
}

dispatcher.register(baseCommand);
Expand Down Expand Up @@ -185,13 +183,16 @@ public int disable(CommandContext<ServerCommandSource> 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" })
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,7 +31,6 @@ public MacroManager() {
.resolve("redstonetools")
.resolve("macros.json");


JsonArray macrosJson = null;
try {
Files.createDirectories(macrosFilePath.getParent());
Expand Down Expand Up @@ -136,8 +133,7 @@ private List<Macro> getDefaultMacros() {
"/gamerule doContainerDrops false",
"/time set noon",
"/weather clear"
})
);
}));
}

private Macro createCommandMacro(String name, String[] commands) {
Expand Down

0 comments on commit 3ebf2ee

Please sign in to comment.