Skip to content

Commit 07e5a35

Browse files
committed
Merge remote-tracking branch 'upstream/2.x' into 2.x
# Conflicts: # Essentials/src/main/java/com/earth2me/essentials/MetaItemStack.java
2 parents be9ec16 + 993d7ed commit 07e5a35

File tree

344 files changed

+26542
-30594
lines changed

Some content is hidden

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

344 files changed

+26542
-30594
lines changed

.github/workflows/build-master.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,32 @@ jobs:
1616

1717
steps:
1818
- name: Checkout Git repo
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
2222

2323
- name: Set up JDK 17
24-
uses: actions/setup-java@v3
24+
uses: actions/setup-java@v4
2525
with:
2626
distribution: 'temurin'
2727
java-version: 17
2828

2929
- name: Setup Gradle
30-
uses: gradle/gradle-build-action@v2
30+
uses: gradle/gradle-build-action@v3
3131

3232
- name: Build with Gradle
3333
run: |
3434
chmod +x gradlew
3535
./gradlew build --stacktrace
3636
37+
- name: Publish JUnit report
38+
uses: mikepenz/action-junit-report@v4
39+
if: success() || failure() # Run even if the previous step fails
40+
with:
41+
report_paths: '**/build/test-results/test*/TEST-*.xml'
42+
3743
- name: Archive plugin jars on GitHub
38-
uses: actions/upload-artifact@v3
44+
uses: actions/upload-artifact@v4
3945
with:
4046
name: EssentialsX plugin jars
4147
path: jars/
@@ -61,7 +67,7 @@ jobs:
6167
cp -r EssentialsXMPP/build/docs/javadoc/ javadocs/EssentialsXMPP/
6268
6369
- name: Archive Javadocs
64-
uses: actions/upload-artifact@v3
70+
uses: actions/upload-artifact@v4
6571
with:
6672
name: javadocs
6773
path: javadocs/
@@ -74,12 +80,12 @@ jobs:
7480

7581
steps:
7682
- name: Setup Node
77-
uses: actions/setup-node@v3
83+
uses: actions/setup-node@v4
7884
with:
7985
node-version: 16
8086

8187
- name: Download Javadocs
82-
uses: actions/download-artifact@v3
88+
uses: actions/download-artifact@v4
8389
with:
8490
name: javadocs
8591
path: javadocs/

.github/workflows/build-pr.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,32 @@ jobs:
1818

1919
steps:
2020
- name: Checkout Git repo
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
2424

2525
- name: Set up JDK 17
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@v4
2727
with:
2828
distribution: 'temurin'
2929
java-version: 17
3030

3131
- name: Setup Gradle
32-
uses: gradle/gradle-build-action@v2
32+
uses: gradle/gradle-build-action@v3
3333

3434
- name: Build with Gradle
3535
run: |
3636
chmod +x gradlew
3737
./gradlew build --stacktrace
3838
39+
- name: Publish JUnit report
40+
uses: mikepenz/action-junit-report@v4
41+
if: success() || failure() # Run even if the previous step fails
42+
with:
43+
report_paths: '**/build/test-results/test*/TEST-*.xml'
44+
3945
- name: Archive plugin jars on GitHub
40-
uses: actions/upload-artifact@v3
46+
uses: actions/upload-artifact@v4
4147
with:
4248
name: EssentialsX plugin jars
4349
path: jars/

Essentials/build.gradle

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ dependencies {
66
compileOnly('com.github.milkbowl:VaultAPI:1.7') {
77
exclude group: "org.bukkit", module: "bukkit"
88
}
9-
compileOnly 'net.luckperms:api:5.0'
9+
compileOnly 'net.luckperms:api:5.3'
1010

1111
api 'io.papermc:paperlib:1.0.6'
1212

13-
api 'org.bstats:bstats-bukkit:2.2.1'
14-
1513
implementation 'org.spongepowered:configurate-yaml:4.1.2'
16-
implementation 'org.checkerframework:checker-qual:3.14.0'
14+
implementation 'org.checkerframework:checker-qual:3.21.0'
15+
implementation 'nu.studer:java-ordered-properties:1.0.4'
16+
17+
implementation 'net.kyori:adventure-api:4.15.0'
18+
implementation 'net.kyori:adventure-text-minimessage:4.15.0'
19+
implementation 'net.kyori:adventure-platform-bukkit:4.3.2'
1720

1821
// Providers
1922
api project(':providers:BaseProviders')
20-
api project(':providers:PaperProvider')
23+
api project(path: ':providers:PaperProvider', configuration: 'shadow')
2124
api(project(':providers:NMSReflectionProvider')) {
2225
exclude group: "org.bukkit", module: "bukkit"
2326
}
@@ -43,8 +46,25 @@ shadowJar {
4346
include (dependency('org.yaml:snakeyaml'))
4447
include (dependency('io.leangen.geantyref:geantyref'))
4548
include (dependency('org.checkerframework:checker-qual'))
49+
include (dependency('nu.studer:java-ordered-properties'))
50+
include (dependency('net.kyori:adventure-api'))
51+
include (dependency('net.kyori:adventure-key'))
52+
include (dependency('net.kyori:examination-api'))
53+
include (dependency('net.kyori:examination-string'))
54+
include (dependency('net.kyori:option'))
55+
include (dependency('net.kyori:adventure-platform-bukkit'))
56+
include (dependency('net.kyori:adventure-platform-api'))
57+
include (dependency('net.kyori:adventure-platform-facet'))
58+
include (dependency('net.kyori:adventure-nbt'))
59+
include (dependency('net.kyori:adventure-text-serializer-bungeecord'))
60+
include (dependency('net.kyori:adventure-text-serializer-gson'))
61+
include (dependency('net.kyori:adventure-text-serializer-gson-legacy-impl'))
62+
include (dependency('net.kyori:adventure-text-serializer-json'))
63+
include (dependency('net.kyori:adventure-text-serializer-json-legacy-impl'))
64+
include (dependency('net.kyori:adventure-text-serializer-legacy'))
65+
include (dependency('net.kyori:adventure-text-minimessage'))
4666
include (project(':providers:BaseProviders'))
47-
include (project(':providers:PaperProvider'))
67+
include (project(path: ':providers:PaperProvider', configuration: 'shadow'))
4868
include (project(':providers:NMSReflectionProvider'))
4969
include (project(':providers:1_8Provider'))
5070
include (project(':providers:1_12Provider'))
@@ -55,8 +75,13 @@ shadowJar {
5575
relocate 'org.yaml.snakeyaml', 'com.earth2me.essentials.libs.snakeyaml'
5676
relocate 'io.leangen.geantyref', 'com.earth2me.essentials.libs.geantyref'
5777
relocate 'org.checkerframework', 'com.earth2me.essentials.libs.checkerframework'
78+
relocate 'net.kyori', 'com.earth2me.essentials.libs.kyori'
79+
relocate 'net.essentialsx.temp.adventure', 'net.kyori.adventure'
5880

5981
minimize {
6082
include(dependency('org.checkerframework:checker-qual'))
83+
include(dependency('net.kyori:adventure-api'))
84+
include(dependency('net.kyori:adventure-platform-bukkit'))
85+
include(dependency('net.kyori:adventure-text-minimessage'))
6186
}
6287
}

Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.ess3.api.IEssentials;
99
import net.ess3.api.IUser;
1010
import net.ess3.api.InvalidWorldException;
11+
import net.ess3.api.TranslatableException;
1112
import net.ess3.api.events.UserWarpEvent;
1213
import net.ess3.api.events.teleport.PreTeleportEvent;
1314
import net.ess3.api.events.teleport.TeleportWarmupEvent;
@@ -23,8 +24,6 @@
2324
import java.util.concurrent.CompletableFuture;
2425
import java.util.concurrent.ExecutionException;
2526

26-
import static com.earth2me.essentials.I18n.tl;
27-
2827
public class AsyncTeleport implements IAsyncTeleport {
2928
private final IUser teleportOwner;
3029
private final IEssentials ess;
@@ -73,7 +72,7 @@ && cooldownApplies()) {
7372
time.setTimeInMillis(lastTime);
7473
time.add(Calendar.SECOND, (int) cooldown);
7574
time.add(Calendar.MILLISECOND, (int) ((cooldown * 1000.0) % 1000.0));
76-
future.completeExceptionally(new Exception(tl("timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis()))));
75+
future.completeExceptionally(new TranslatableException("timeBeforeTeleport", DateUtil.formatDateDiff(time.getTimeInMillis())));
7776
return true;
7877
}
7978
}
@@ -107,7 +106,7 @@ private void warnUser(final IUser user, final double delay) {
107106
final Calendar c = new GregorianCalendar();
108107
c.add(Calendar.SECOND, (int) delay);
109108
c.add(Calendar.MILLISECOND, (int) ((delay * 1000.0) % 1000.0));
110-
user.sendMessage(tl("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
109+
user.sendTl("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis()));
111110
}
112111

113112
@Override
@@ -129,7 +128,7 @@ public void now(final Player entity, final boolean cooldown, final TeleportCause
129128
nowAsync(teleportOwner, target, cause, future);
130129
future.thenAccept(success -> {
131130
if (success) {
132-
teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
131+
teleportOwner.sendTl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ());
133132
}
134133
});
135134
}
@@ -166,7 +165,7 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele
166165

167166
if (!ess.getSettings().isForcePassengerTeleport() && !teleportee.getBase().isEmpty()) {
168167
if (!ess.getSettings().isTeleportPassengerDismount()) {
169-
future.completeExceptionally(new Exception(tl("passengerTeleportFail")));
168+
future.completeExceptionally(new TranslatableException("passengerTeleportFail"));
170169
return;
171170
}
172171

@@ -204,7 +203,7 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele
204203
}
205204
}
206205
} else {
207-
future.completeExceptionally(new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())));
206+
future.completeExceptionally(new TranslatableException("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
208207
return;
209208
}
210209
} else {
@@ -233,7 +232,7 @@ public void teleport(final Location loc, final Trade chargeFor, final TeleportCa
233232

234233
@Override
235234
public void teleport(final Player entity, final Trade chargeFor, final TeleportCause cause, final CompletableFuture<Boolean> future) {
236-
teleportOwner.sendMessage(tl("teleportToPlayer", entity.getDisplayName()));
235+
teleportOwner.sendTl("teleportToPlayer", entity.getDisplayName());
237236
teleport(teleportOwner, new PlayerTarget(entity), chargeFor, cause, future);
238237
}
239238

@@ -248,8 +247,8 @@ public void teleportPlayer(final IUser otherUser, final Player entity, final Tra
248247
teleport(otherUser, target, chargeFor, cause, future);
249248
future.thenAccept(success -> {
250249
if (success) {
251-
otherUser.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
252-
teleportOwner.sendMessage(tl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
250+
otherUser.sendTl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ());
251+
teleportOwner.sendTl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ());
253252
}
254253
});
255254
}
@@ -432,9 +431,9 @@ public void warp(final IUser otherUser, String warp, final Trade chargeFor, fina
432431
final String finalWarp = warp;
433432
future.thenAccept(success -> {
434433
if (success) {
435-
otherUser.sendMessage(tl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
434+
otherUser.sendTl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
436435
if (!otherUser.equals(teleportOwner)) {
437-
teleportOwner.sendMessage(tl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
436+
teleportOwner.sendTl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
438437
}
439438
}
440439
});
@@ -450,7 +449,7 @@ public void back(final Trade chargeFor, final CompletableFuture<Boolean> future)
450449
public void back(final IUser teleporter, final Trade chargeFor, final CompletableFuture<Boolean> future) {
451450
tpType = TeleportType.BACK;
452451
final Location loc = teleportOwner.getLastLocation();
453-
teleportOwner.sendMessage(tl("backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
452+
teleportOwner.sendTl("backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
454453
teleportOther(teleporter, teleportOwner, new LocationTarget(loc), chargeFor, TeleportCause.COMMAND, future);
455454
}
456455

Essentials/src/main/java/com/earth2me/essentials/AsyncTimedTeleport.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.UUID;
99
import java.util.concurrent.CompletableFuture;
1010

11-
import static com.earth2me.essentials.I18n.tl;
12-
1311
public class AsyncTimedTeleport implements Runnable {
1412
private static final double MOVE_CONSTANT = 0.3;
1513
private final IUser teleportOwner;
@@ -106,14 +104,14 @@ public void run() {
106104
try {
107105
teleport.cooldown(false);
108106
} catch (final Throwable ex) {
109-
teleportOwner.sendMessage(tl("cooldownWithMessage", ex.getMessage()));
107+
teleportOwner.sendTl("cooldownWithMessage", ex.getMessage());
110108
if (teleportOwner != teleportUser) {
111-
teleportUser.sendMessage(tl("cooldownWithMessage", ex.getMessage()));
109+
teleportUser.sendTl("cooldownWithMessage", ex.getMessage());
112110
}
113111
}
114112
try {
115113
cancelTimer(false);
116-
teleportUser.sendMessage(tl("teleportationCommencing"));
114+
teleportUser.sendTl("teleportationCommencing");
117115

118116
if (timer_chargeFor != null) {
119117
timer_chargeFor.isAffordableFor(teleportOwner);
@@ -152,9 +150,9 @@ void cancelTimer(final boolean notifyUser) {
152150
try {
153151
ess.getServer().getScheduler().cancelTask(timer_task);
154152
if (notifyUser) {
155-
teleportOwner.sendMessage(tl("pendingTeleportCancelled"));
153+
teleportOwner.sendTl("pendingTeleportCancelled");
156154
if (timer_teleportee != null && !timer_teleportee.equals(teleportOwner.getBase().getUniqueId())) {
157-
ess.getUser(timer_teleportee).sendMessage(tl("pendingTeleportCancelled"));
155+
ess.getUser(timer_teleportee).sendTl("pendingTeleportCancelled");
158156
}
159157
}
160158
} finally {

Essentials/src/main/java/com/earth2me/essentials/Backup.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.earth2me.essentials;
22

3+
import com.earth2me.essentials.utils.AdventureUtil;
34
import net.ess3.api.IEssentials;
45
import org.bukkit.Server;
56
import org.bukkit.command.CommandSender;
@@ -11,7 +12,7 @@
1112
import java.util.concurrent.atomic.AtomicBoolean;
1213
import java.util.logging.Level;
1314

14-
import static com.earth2me.essentials.I18n.tl;
15+
import static com.earth2me.essentials.I18n.tlLiteral;
1516

1617
public class Backup implements Runnable {
1718
private transient final Server server;
@@ -79,7 +80,7 @@ public void run() {
7980
taskLock.complete(new Object());
8081
return;
8182
}
82-
ess.getLogger().log(Level.INFO, tl("backupStarted"));
83+
ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("backupStarted")));
8384
final CommandSender cs = server.getConsoleSender();
8485
server.dispatchCommand(cs, "save-all");
8586
server.dispatchCommand(cs, "save-off");
@@ -118,7 +119,7 @@ public void run() {
118119
}
119120
active = false;
120121
taskLock.complete(new Object());
121-
ess.getLogger().log(Level.INFO, tl("backupFinished"));
122+
ess.getLogger().log(Level.INFO, AdventureUtil.miniToLegacy(tlLiteral("backupFinished")));
122123
}
123124
}
124125

0 commit comments

Comments
 (0)