Skip to content

Commit 0dc1018

Browse files
chore: fix more lint warnings
1 parent 9647176 commit 0dc1018

86 files changed

Lines changed: 229 additions & 218 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/meteordevelopment/meteorclient/asm/AsmTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected AsmTransformer(String targetName) {
2020

2121
protected MethodNode getMethod(ClassNode klass, MethodInfo methodInfo) {
2222
for (MethodNode method : klass.methods) {
23-
if (methodInfo.equals(method)) return method;
23+
if (methodInfo.matches(method)) return method;
2424
}
2525

2626
return null;

src/main/java/meteordevelopment/meteorclient/asm/FieldInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public FieldInfo(String owner, String name, Descriptor descriptor, boolean map)
1818
String ownerDot = owner.replace('/', '.');
1919

2020
if (owner != null) this.owner = mappings.mapClassName("intermediary", ownerDot).replace('.', '/');
21-
if (name != null && descriptor != null) this.name = mappings.mapFieldName("intermediary", ownerDot, name, descriptor.toString(false, false));
22-
}
23-
else {
21+
if (name != null && descriptor != null)
22+
this.name = mappings.mapFieldName("intermediary", ownerDot, name, descriptor.toString(false, false));
23+
} else {
2424
this.owner = owner;
2525
this.name = name;
2626
}
2727

2828
if (descriptor != null) this.descriptor = descriptor.toString(false, map);
2929
}
3030

31-
public boolean equals(FieldInsnNode insn) {
31+
public boolean matches(FieldInsnNode insn) {
3232
return (owner == null || insn.owner.equals(owner)) && (name == null || insn.name.equals(name)) && (descriptor == null || insn.desc.equals(descriptor));
3333
}
3434
}

src/main/java/meteordevelopment/meteorclient/asm/MethodInfo.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ public MethodInfo(String owner, String name, Descriptor descriptor, boolean map)
1919
String ownerDot = owner.replace('/', '.');
2020

2121
if (owner != null) this.owner = mappings.mapClassName("intermediary", ownerDot).replace('.', '/');
22-
if (name != null && descriptor != null) this.name = mappings.mapMethodName("intermediary", ownerDot, name, descriptor.toString(true, false));
23-
}
24-
else {
22+
if (name != null && descriptor != null)
23+
this.name = mappings.mapMethodName("intermediary", ownerDot, name, descriptor.toString(true, false));
24+
} else {
2525
this.owner = owner;
2626
this.name = name;
2727
}
2828

2929
if (descriptor != null) this.descriptor = descriptor.toString(true, map);
3030
}
3131

32-
public boolean equals(MethodNode method) {
32+
public boolean matches(MethodNode method) {
3333
return (name == null || method.name.equals(name)) && (descriptor == null || method.desc.equals(descriptor));
3434
}
3535

36-
public boolean equals(MethodInsnNode insn) {
36+
public boolean matches(MethodInsnNode insn) {
3737
return (owner == null || insn.owner.equals(owner)) && (name == null || insn.name.equals(name)) && (descriptor == null || insn.desc.equals(descriptor));
3838
}
3939
}

src/main/java/meteordevelopment/meteorclient/commands/arguments/BlockPosArgumentType.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import net.minecraft.network.chat.Component;
2323
import net.minecraft.util.Mth;
2424
import net.minecraft.world.level.ChunkPos;
25+
import net.minecraft.world.level.Level;
2526
import net.minecraft.world.phys.Vec2;
2627
import net.minecraft.world.phys.Vec3;
2728

@@ -101,7 +102,7 @@ public static <S> BlockPos getBlockPos(CommandContext<S> context, String name) {
101102

102103
public static <S> BlockPos getValidBlockPos(CommandContext<S> context, String name) throws CommandSyntaxException {
103104
BlockPos blockPos = getBlockPos(context, name);
104-
if (!ClientLevel.isInSpawnableBounds(blockPos)) {
105+
if (!Level.isInSpawnableBounds(blockPos)) {
105106
throw OUT_OF_BOUNDS_EXCEPTION.create();
106107
} else {
107108
return blockPos;
@@ -112,22 +113,24 @@ public PosArgument parse(StringReader stringReader) throws CommandSyntaxExceptio
112113
return stringReader.canRead() && stringReader.peek() == '^' ? LookingPosArgument.parse(stringReader) : DefaultPosArgument.parse(stringReader);
113114
}
114115

116+
@Override
115117
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
116-
if (!(context.getSource() instanceof SharedSuggestionProvider)) {
118+
if (!(context.getSource() instanceof SharedSuggestionProvider sharedSuggestionProvider)) {
117119
return Suggestions.empty();
118120
} else {
119121
String string = builder.getRemaining();
120122
Collection<SharedSuggestionProvider.TextCoordinates> collection;
121123
if (!string.isEmpty() && string.charAt(0) == '^') {
122124
collection = Collections.singleton(SharedSuggestionProvider.TextCoordinates.DEFAULT_LOCAL);
123125
} else {
124-
collection = ((SharedSuggestionProvider) context.getSource()).getRelevantCoordinates();
126+
collection = sharedSuggestionProvider.getRelevantCoordinates();
125127
}
126128

127129
return SharedSuggestionProvider.suggestCoordinates(string, collection, builder, Commands.createValidator(this::parse));
128130
}
129131
}
130132

133+
@Override
131134
public Collection<String> getExamples() {
132135
return EXAMPLES;
133136
}

src/main/java/meteordevelopment/meteorclient/commands/arguments/CommandArgumentType.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
import java.util.LinkedHashSet;
2222
import java.util.Set;
2323
import java.util.concurrent.CompletableFuture;
24-
import java.util.stream.Collectors;
2524

2625
public class CommandArgumentType implements ArgumentType<Command> {
2726
private static final CommandArgumentType INSTANCE = new CommandArgumentType();
2827
private static final DynamicCommandExceptionType NO_SUCH_COMMAND = new DynamicCommandExceptionType(name -> Component.literal("Command with name " + name + " doesn't exist."));
29-
private static final Collection<String> EXAMPLES = Commands.COMMANDS.stream().limit(3).map(Command::getName).collect(Collectors.toList());
28+
private static final Collection<String> EXAMPLES = Commands.COMMANDS.stream().limit(3).map(Command::getName).toList();
3029

3130
private CommandArgumentType() {
3231
}

src/main/java/meteordevelopment/meteorclient/commands/arguments/MacroArgumentType.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.util.Collection;
2121
import java.util.concurrent.CompletableFuture;
22-
import java.util.stream.Collectors;
2322

2423
public class MacroArgumentType implements ArgumentType<Macro> {
2524
private static final MacroArgumentType INSTANCE = new MacroArgumentType();
@@ -59,6 +58,6 @@ public CompletableFuture<Suggestions> listSuggestions(CommandContext context, Su
5958

6059
@Override
6160
public Collection<String> getExamples() {
62-
return Macros.get().getAll().stream().limit(3).map(macro -> macro.name.get()).collect(Collectors.toList());
61+
return Macros.get().getAll().stream().limit(3).map(macro -> macro.name.get()).toList();
6362
}
6463
}

src/main/java/meteordevelopment/meteorclient/commands/arguments/ModuleArgumentType.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.util.Collection;
2121
import java.util.concurrent.CompletableFuture;
22-
import java.util.stream.Collectors;
2322

2423
public class ModuleArgumentType implements ArgumentType<Module> {
2524
private static final ModuleArgumentType INSTANCE = new ModuleArgumentType();
@@ -29,7 +28,7 @@ public class ModuleArgumentType implements ArgumentType<Module> {
2928
.stream()
3029
.limit(3)
3130
.map(module -> module.name)
32-
.collect(Collectors.toList());
31+
.toList();
3332

3433
public static ModuleArgumentType create() {
3534
return INSTANCE;

src/main/java/meteordevelopment/meteorclient/commands/arguments/NotebotSongArgumentType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> cont
4545
.map(path -> path.getFileName().toString()),
4646
builder
4747
);
48-
} catch (IOException e) {
48+
} catch (IOException _) {
4949
return Suggestions.empty();
5050
}
5151
}

src/main/java/meteordevelopment/meteorclient/commands/commands/LocateCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public LocateCommand() {
7272
public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
7373
// Overworld structures
7474

75-
builder.then(literal("buried_treasure").executes(s -> {
75+
builder.then(literal("buried_treasure").executes(_ -> {
7676
ItemStack stack = mc.player.getInventory().getSelectedItem();
7777
if (stack.getItem() != Items.FILLED_MAP
7878
|| stack.get(DataComponents.ITEM_NAME) == null
@@ -102,7 +102,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
102102
return SINGLE_SUCCESS;
103103
}));
104104

105-
builder.then(literal("mansion").executes(s -> {
105+
builder.then(literal("mansion").executes(_ -> {
106106
ItemStack stack = mc.player.getInventory().getSelectedItem();
107107
if (stack.getItem() != Items.FILLED_MAP
108108
|| stack.get(DataComponents.ITEM_NAME) == null
@@ -132,7 +132,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
132132
return SINGLE_SUCCESS;
133133
}));
134134

135-
builder.then(literal("monument").executes(s -> {
135+
builder.then(literal("monument").executes(_ -> {
136136
ItemStack stack = mc.player.getInventory().getSelectedItem();
137137
if (stack.getItem() == Items.FILLED_MAP
138138
&& stack.get(DataComponents.ITEM_NAME) != null
@@ -177,7 +177,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
177177
return SINGLE_SUCCESS;
178178
}));
179179

180-
builder.then(literal("stronghold").executes(s -> {
180+
builder.then(literal("stronghold").executes(_ -> {
181181
boolean foundEye = InvUtils.testInHotbar(Items.ENDER_EYE);
182182

183183
if (foundEye) {
@@ -207,7 +207,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
207207

208208
// Nether structures
209209

210-
builder.then(literal("nether_fortress").executes(s -> {
210+
builder.then(literal("nether_fortress").executes(_ -> {
211211
if (mc.level.dimension() != Level.NETHER) {
212212
error("You need to be in the nether to locate a nether fortress.");
213213
return SINGLE_SUCCESS;
@@ -232,7 +232,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
232232

233233
// End structures
234234

235-
builder.then(literal("end_city").executes(s -> {
235+
builder.then(literal("end_city").executes(_ -> {
236236
if (mc.level.dimension() != Level.END) {
237237
error("You need to be in the end to locate an end city.");
238238
return SINGLE_SUCCESS;
@@ -257,7 +257,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
257257

258258
// Misc structures
259259

260-
builder.then(literal("lodestone").executes(s -> {
260+
builder.then(literal("lodestone").executes(_ -> {
261261
ItemStack stack = mc.player.getInventory().getSelectedItem();
262262
if (stack.getItem() != Items.COMPASS) {
263263
error("You need to hold a (highlight)lodestone(default) compass!");
@@ -287,7 +287,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
287287
return SINGLE_SUCCESS;
288288
}));
289289

290-
builder.then(literal("cancel").executes(s -> {
290+
builder.then(literal("cancel").executes(_ -> {
291291
cancel();
292292
return SINGLE_SUCCESS;
293293
}));

src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
128128
}
129129

130130
return SINGLE_SUCCESS;
131-
}).suggests((ctx, suggestionsBuilder) -> {
131+
}).suggests((_, suggestionsBuilder) -> {
132132
ItemStack stack = mc.player.getInventory().getSelectedItem();
133133
if (stack != ItemStack.EMPTY) {
134134
DataComponentMap components = stack.getComponents();
@@ -161,7 +161,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
161161
if (!nbtElement.isEmpty()) {
162162
text.append(" ").append(NbtUtils.toPrettyComponent(nbtElement.getFirst()));
163163
}
164-
} catch (CommandSyntaxException e) {
164+
} catch (CommandSyntaxException _) {
165165
text.append("{}");
166166
}
167167

@@ -183,7 +183,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
183183
text.append(" ").append(NbtUtils.toPrettyComponent(nbtElement.getFirst()));
184184
nbt = nbtElement.getFirst().toString();
185185
}
186-
} catch (CommandSyntaxException e) {
186+
} catch (CommandSyntaxException _) {
187187
text.append("{}");
188188
}
189189

0 commit comments

Comments
 (0)