Skip to content

Commit 36af17f

Browse files
Apply review suggestions
1 parent df6adeb commit 36af17f

File tree

15 files changed

+24
-120
lines changed

15 files changed

+24
-120
lines changed

NOTICE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ The project includes software developed by third parties. For their full license
2828
- Licensed by: **Slikey**
2929
- License: **MIT License** (See `3rd_party_licenses/LICENSE-MIT`)
3030

31-
- Annotation Command Framework (ACF):
32-
- Repository: `Chronoken/EffectLib`
33-
- Licensed by: **Daniel Ennis and Contributors**
31+
- Cloud Command Framework:
32+
- Repository: `Incendo/cloud`
33+
- Licensed by: **Alexander Söderberg**
3434
- License: **MIT License** (See `3rd_party_licenses/LICENSE-MIT`)
3535

3636
- bStats:

core/src/main/java/com/nisovin/magicspells/Spell.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.nisovin.magicspells;
22

3-
import net.kyori.adventure.text.format.TextDecoration;
4-
import net.kyori.adventure.text.format.TextDecorationAndState;
53
import org.jetbrains.annotations.NotNull;
64
import org.jetbrains.annotations.Nullable;
75

@@ -1245,6 +1243,11 @@ protected boolean preCastTimeCheck(LivingEntity livingEntity, String[] args) {
12451243
return true;
12461244
}
12471245

1246+
@Deprecated(forRemoval = true)
1247+
public List<String> tabComplete(CommandSender sender, String[] args) {
1248+
return null;
1249+
}
1250+
12481251
public SuggestionProvider<CommandSourceStack> suggestionProvider() {
12491252
return this instanceof SuggestionProvider ? (SuggestionProvider<CommandSourceStack>) this : SuggestionProvider.noSuggestions();
12501253
}

core/src/main/java/com/nisovin/magicspells/commands/MagicCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static void register(@NotNull PaperCommandManager<CommandSourceStack> man
8484
if (fallbackMapping != null && fallbackMapping.mapper() != null)
8585
return fallbackMapping.mapper().apply(fallbackParser);
8686

87-
ArgumentTypeFactory<?> fallbackFactory = defaultArgumentFactories.get(GenericTypeReflector.erase(fallbackParserClass));
87+
ArgumentTypeFactory<?> fallbackFactory = defaultArgumentFactories.get(GenericTypeReflector.erase(fallbackParserClass));
8888
if (fallbackFactory != null)
8989
return fallbackFactory.create();
9090

core/src/main/java/com/nisovin/magicspells/commands/ResetCooldownCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,4 @@ private static void resetCooldown(CommandContext<CommandSourceStack> context) {
136136
));
137137
}
138138

139-
140139
}

core/src/main/java/com/nisovin/magicspells/commands/exceptions/InvalidCommandArgumentException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ public InvalidCommandArgumentException(String message, Throwable cause) {
1010
super(message, cause);
1111
}
1212

13-
}
13+
}

core/src/main/java/com/nisovin/magicspells/commands/parsers/SpellCastArgumentsParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static ParserDescriptor<CommandSourceStack, String[]> spellCastArgumentsP
9191
.suggestionProcessor()
9292
.process(
9393
CommandPreprocessingContext.of(context, input.cursor(preParseCursor)),
94-
(Stream<Suggestion>) StreamSupport.stream(result.spliterator(), false)
94+
StreamSupport.stream(result.spliterator(), false)
9595
)
9696
.toList();
9797

core/src/main/java/com/nisovin/magicspells/mana/ManaBar.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.nisovin.magicspells.mana;
22

3-
import net.kyori.adventure.text.Component;
4-
import net.kyori.adventure.text.format.Style;
5-
63
import org.bukkit.Bukkit;
74
import org.bukkit.entity.Player;
85

core/src/main/java/com/nisovin/magicspells/spells/command/AdminTeachSpell.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
public class AdminTeachSpell extends CommandSpell {
3131

32-
private static final SuggestionProvider<CommandSourceStack> suggestions = AggregateParser
32+
private static final SuggestionProvider<CommandSourceStack> SUGGESTIONS = AggregateParser
3333
.<CommandSourceStack>builder()
3434
.withComponent("player", PlayerParser.playerParser())
3535
.withComponent("spells", VarargsParser.varargsParser(new SpellParser<>()))
@@ -68,7 +68,7 @@ public boolean castFromConsole(CommandSender sender, String[] args) {
6868

6969
@Override
7070
public SuggestionProvider<CommandSourceStack> suggestionProvider() {
71-
return suggestions;
71+
return SUGGESTIONS;
7272
}
7373

7474
private static class AdminTeachTask extends BukkitRunnable {

core/src/main/java/com/nisovin/magicspells/spells/command/ScrollSpell.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,14 @@ public ItemStack createScroll(Spell spell, int uses, ItemStack item) {
249249

250250
if (!(executor instanceof ConsoleCommandSender)) return Collections.emptyList();
251251

252-
List<String> suggestions = TxtUtil.tabCompletePlayerName(executor);
253252
CommandInput original = input.copy();
254253

255254
String playerName = input.readString();
256-
if (playerName.isEmpty() || input.isEmpty() && !input.input().endsWith(" ")) return suggestions;
257-
258-
Player player = Bukkit.getPlayer(playerName);
259-
if (player == null) return suggestions;
255+
if (playerName.isEmpty() || input.isEmpty() || Bukkit.getPlayer(playerName) == null)
256+
return TxtUtil.tabCompletePlayerName(executor);
260257

261258
String diff = original.difference(input.skipWhitespace(), true);
262-
SpellParser.suggest().stream().map(spell -> diff + spell).forEach(suggestions::add);
263-
264-
return suggestions;
259+
return SpellParser.suggest().stream().map(spell -> diff + spell).toList();
265260
}
266261

267262
@EventHandler(priority=EventPriority.MONITOR)

core/src/main/java/com/nisovin/magicspells/util/Rotation.java

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,12 @@
22

33
import org.jetbrains.annotations.NotNull;
44

5-
import java.util.Objects;
6-
75
import org.bukkit.Location;
86

97
/**
108
* Represents a rotation that can be applied to a {@link Location}.
119
*/
12-
public final class Rotation {
13-
14-
private final Angle yaw;
15-
private final Angle pitch;
16-
17-
private Rotation(final @NotNull Angle yaw, final @NotNull Angle pitch) {
18-
this.yaw = yaw;
19-
this.pitch = pitch;
20-
}
10+
public record Rotation(Angle yaw, Angle pitch) {
2111

2212
/**
2313
* Create a new rotation object.
@@ -30,24 +20,6 @@ public static Rotation of(final @NotNull Angle yaw, final @NotNull Angle pitch)
3020
return new Rotation(yaw, pitch);
3121
}
3222

33-
/**
34-
* Returns the yaw of this rotation.
35-
*
36-
* @return yaw
37-
*/
38-
public Angle yaw() {
39-
return this.yaw;
40-
}
41-
42-
/**
43-
* Returns the pitch of this rotation
44-
*
45-
* @return pitch
46-
*/
47-
public Angle pitch() {
48-
return this.pitch;
49-
}
50-
5123
/**
5224
* Applies this rotation to a location.
5325
*
@@ -60,26 +32,4 @@ public Angle pitch() {
6032
return location;
6133
}
6234

63-
@Override
64-
public boolean equals(final Object o) {
65-
if (this == o) {
66-
return true;
67-
}
68-
if (o == null || getClass() != o.getClass()) {
69-
return false;
70-
}
71-
Rotation that = (Rotation) o;
72-
return this.yaw.equals(that.yaw) && this.pitch.equals(that.pitch);
73-
}
74-
75-
@Override
76-
public int hashCode() {
77-
return Objects.hash(this.yaw, this.pitch);
78-
}
79-
80-
@Override
81-
public String toString() {
82-
return String.format("Rotation{yaw=%s, pitch=%s}", this.yaw, this.pitch);
83-
}
84-
8535
}

0 commit comments

Comments
 (0)