Skip to content

Commit 84bb71f

Browse files
committed
add support for Spigot and older versions (1.17–1.21.11)
1 parent 59922ce commit 84bb71f

File tree

7 files changed

+45
-30
lines changed

7 files changed

+45
-30
lines changed

.github/workflows/codeql.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- uses: actions/setup-java@v4
5353
with:
5454
distribution: 'temurin'
55-
java-version: 17
55+
java-version: 16
5656

5757
# Initializes the CodeQL tools for scanning.
5858
- name: Initialize CodeQL

.github/workflows/maven.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v6
27-
- name: Set up JDK 17
27+
- name: Set up JDK 16
2828
uses: actions/setup-java@v4
2929
with:
30-
java-version: '17'
30+
java-version: '16'
3131
distribution: 'temurin'
3232
cache: maven
3333
- name: Build with Maven

.github/workflows/release.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Java
1717
uses: actions/setup-java@v4
1818
with:
19-
java-version: 17
19+
java-version: 16
2020
distribution: temurin
2121
cache: maven
2222

@@ -50,6 +50,9 @@ jobs:
5050
changelog: ${{ github.event.release.body }}
5151
loaders: paper
5252
game-versions: |-
53+
1.17.x
54+
1.18.x
55+
1.19.x
5356
1.20.x
5457
1.21.x
5558
files: target/EnchantBookPlus-${{ steps.version.outputs.VERSION }}.jar

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<name>EnchantBookPlus</name>
1313

1414
<properties>
15-
<java.version>17</java.version>
15+
<java.version>16</java.version>
1616
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1717
</properties>
1818

@@ -38,17 +38,23 @@
3838

3939
<repositories>
4040
<repository>
41-
<id>papermc-repo</id>
42-
<url>https://repo.papermc.io/repository/maven-public/</url>
41+
<id>spigotmc-repo</id>
42+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
4343
</repository>
4444
</repositories>
4545

4646
<dependencies>
4747
<dependency>
48-
<groupId>io.papermc.paper</groupId>
49-
<artifactId>paper-api</artifactId>
50-
<version>1.20.4-R0.1-SNAPSHOT</version>
48+
<groupId>org.spigotmc</groupId>
49+
<artifactId>spigot-api</artifactId>
50+
<version>1.17-R0.1-SNAPSHOT</version>
5151
<scope>provided</scope>
5252
</dependency>
53+
<dependency>
54+
<groupId>org.jetbrains</groupId>
55+
<artifactId>annotations</artifactId>
56+
<version>26.0.2</version>
57+
<scope>compile</scope>
58+
</dependency>
5359
</dependencies>
5460
</project>

src/main/java/pro/cloudnode/smp/enchantbookplus/MainCommand.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package pro.cloudnode.smp.enchantbookplus;
22

3-
import net.kyori.adventure.text.minimessage.MiniMessage;
4-
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
53
import org.bukkit.command.Command;
64
import org.bukkit.command.CommandExecutor;
75
import org.bukkit.command.CommandSender;
86
import org.bukkit.command.TabCompleter;
7+
import org.bukkit.plugin.PluginDescriptionFile;
98
import org.jetbrains.annotations.NotNull;
109

1110
import java.util.List;
12-
import java.util.Optional;
1311

1412
public final class MainCommand implements CommandExecutor, TabCompleter {
1513
private final @NotNull EnchantBookPlus plugin;
@@ -19,15 +17,25 @@ public MainCommand(final @NotNull EnchantBookPlus plugin) {
1917
}
2018

2119
@Override
22-
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
20+
public boolean onCommand(
21+
final @NotNull CommandSender sender,
22+
final @NotNull Command command,
23+
final @NotNull String label,
24+
final @NotNull String @NotNull [] args
25+
) {
2326
if (args.length == 1 && args[0].equalsIgnoreCase("reload"))
2427
return reload(sender, command);
2528

2629
return overview(sender);
2730
}
2831

2932
@Override
30-
public @NotNull List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
33+
public @NotNull List<String> onTabComplete(
34+
final @NotNull CommandSender sender,
35+
final @NotNull Command command,
36+
final @NotNull String label,
37+
final @NotNull String @NotNull [] args
38+
) {
3139
if (sender.hasPermission(Permissions.RELOAD))
3240
return List.of("reload");
3341

@@ -37,15 +45,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
3745
/**
3846
* Plugin overview
3947
*/
40-
@SuppressWarnings({"UnstableApiUsage", "SameReturnValue"})
48+
@SuppressWarnings("SameReturnValue")
4149
public boolean overview(final @NotNull CommandSender sender) {
42-
sender.sendMessage(MiniMessage.miniMessage()
43-
.deserialize(
44-
"<green><name></green> <white>v<version> by</white> <gray><author></gray>",
45-
Placeholder.unparsed("name", plugin.getPluginMeta().getName()),
46-
Placeholder.unparsed("version", plugin.getPluginMeta().getVersion()),
47-
Placeholder.unparsed("author", String.join(", ", plugin.getPluginMeta().getAuthors()))
48-
));
50+
PluginDescriptionFile description = plugin.getDescription();
51+
sender.sendMessage("§а" + description.getName() + " §fv" + description.getVersion() + " by §7"
52+
+ String.join(", ", description.getAuthors()));
4953

5054
return true;
5155
}
@@ -55,15 +59,12 @@ public boolean overview(final @NotNull CommandSender sender) {
5559
*/
5660
@SuppressWarnings("SameReturnValue")
5761
public boolean reload(final @NotNull CommandSender sender, final @NotNull Command command) {
58-
if (!sender.hasPermission(Permissions.RELOAD)) {
59-
sender.sendMessage(Optional.ofNullable(command.permissionMessage())
60-
.orElse(sender.getServer().permissionMessage()));
61-
return true;
62-
}
62+
if (!sender.hasPermission(Permissions.RELOAD))
63+
return overview(sender);
6364

6465
plugin.reload();
6566

66-
sender.sendMessage(MiniMessage.miniMessage().deserialize("<green>(!) Plugin configuration reloaded."));
67+
sender.sendMessage("§a(!) Plugin configuration reloaded.");
6768

6869
return true;
6970
}

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '${project.version}'
33
author: Cloudnode
44
main: pro.cloudnode.smp.enchantbookplus.EnchantBookPlus
55
description: "Combine enchantment books to achieve levels above vanilla"
6-
api-version: '1.20'
6+
api-version: '1.17'
77
softdepend:
88
- AnvilUnlocker
99
commands:

0 commit comments

Comments
 (0)