Fix compatibility with Java 17

This commit is contained in:
Ben Woo 2025-11-05 10:09:28 +08:00
parent ef9934f3c6
commit e62e37831b
3 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ final class PlaceholderExpansionHook extends PlaceholderExpansion {
return null;
}
final var placeholder = paramsArray.removeFirst();
final var placeholder = paramsArray.remove(0);
String worldName = parseWorldName(offlinePlayer, paramsArray);
if (worldName == null) return null;
@ -103,9 +103,9 @@ final class PlaceholderExpansionHook extends PlaceholderExpansion {
}
// Try get from params
String paramWorldName = paramsArray.getLast();
String paramWorldName = paramsArray.get(paramsArray.size() - 1);
if (worldManager.isLoadedWorld(paramWorldName)) {
paramsArray.removeLast();
paramsArray.remove(paramsArray.size() - 1);
return paramWorldName;
}
@ -177,7 +177,7 @@ final class PlaceholderExpansionHook extends PlaceholderExpansion {
return String.valueOf(world.getSeed());
}
case "time" -> {
String timeFormat = !placeholderParams.isEmpty() ? placeholderParams.getFirst() : "";
String timeFormat = !placeholderParams.isEmpty() ? placeholderParams.get(0) : "";
long time = world.getBukkitWorld().map(World::getTime).getOrElse(0L);
switch (timeFormat) {
case "" -> {

View File

@ -119,7 +119,7 @@ final class SpawnCommand extends CoreCommand {
? Message.of(MVCorei18n.GENERIC_YOU)
: Message.of(entity.getName())),
Replace.WORLD.with(mvWorld.getName()),
Replace.REASON.with(failure.getFirst().getFailureMessage())));
Replace.REASON.with(failure.get(0).getFailureMessage())));
}
private void handleMultiTeleport(MVCommandIssuer issuer, LoadedMultiverseWorld mvWorld,

View File

@ -260,7 +260,7 @@ final class MVPlayerListener implements CoreListener {
.onSuccess(result -> Logging.fine("Player %s has been teleported on join",
player.getName()))
.onFailure(failure -> Logging.warning("Failed to teleport player %s on join: %s",
player.getName(), failure.getFirst()));
player.getName(), failure.get(0)));
}
/**