diff --git a/build.gradle b/build.gradle index 02ee40d..07af375 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ plugins { id "com.modrinth.minotaur" version "2.+" } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version @@ -81,7 +81,7 @@ tasks.withType(JavaCompile).configureEach { // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. // We'll use that if it's available, but otherwise we'll use the older option. - it.options.release = 17 + it.options.release = 21 } java { diff --git a/gradle.properties b/gradle.properties index 735d8de..1d2af40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.20.5-rc1 - yarn_mappings=1.20.5-rc1+build.1 - loader_version=0.15.10 + minecraft_version=1.21-pre2 + yarn_mappings=1.21-pre2+build.2 + loader_version=0.15.11 #Fabric api - fabric_version=0.97.3+1.20.5 + fabric_version=0.99.4+1.21 # Mod Properties - mod_version = 2.4.0-pre.1+1.20.5 + mod_version = 2.5.0-pre.2+1.21 maven_group = eu.pb4 archives_base_name = placeholder-api diff --git a/src/main/java/eu/pb4/placeholders/api/PlaceholderContext.java b/src/main/java/eu/pb4/placeholders/api/PlaceholderContext.java index 713dfa6..21f699b 100644 --- a/src/main/java/eu/pb4/placeholders/api/PlaceholderContext.java +++ b/src/main/java/eu/pb4/placeholders/api/PlaceholderContext.java @@ -128,7 +128,7 @@ public static PlaceholderContext of(Entity entity, ViewObject view) { public interface ViewObject { - ViewObject DEFAULT = of(new Identifier("placeholder_api", "default")); + ViewObject DEFAULT = of(Identifier.of("placeholder_api", "default")); static ViewObject of(Identifier identifier) { return new ViewObjectImpl(identifier); diff --git a/src/main/java/eu/pb4/placeholders/impl/GeneralUtils.java b/src/main/java/eu/pb4/placeholders/impl/GeneralUtils.java index 7e25183..633cfa3 100644 --- a/src/main/java/eu/pb4/placeholders/impl/GeneralUtils.java +++ b/src/main/java/eu/pb4/placeholders/impl/GeneralUtils.java @@ -3,14 +3,10 @@ import eu.pb4.placeholders.api.node.*; import eu.pb4.placeholders.api.node.parent.*; import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.api.Version; -import net.fabricmc.loader.api.VersionParsingException; -import net.minecraft.component.DataComponentType; import net.minecraft.component.DataComponentTypes; import net.minecraft.item.ItemStack; import net.minecraft.text.*; import net.minecraft.util.Formatting; -import net.minecraft.util.math.ColorHelper; import org.jetbrains.annotations.ApiStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/PlayerPlaceholders.java b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/PlayerPlaceholders.java index 58bc45f..886fbc2 100644 --- a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/PlayerPlaceholders.java +++ b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/PlayerPlaceholders.java @@ -19,7 +19,7 @@ public class PlayerPlaceholders { public static void register() { - Placeholders.register(new Identifier("player", "name"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "name"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(ctx.player().getName()); } else if (ctx.hasGameProfile()) { @@ -29,7 +29,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "name_visual"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "name_visual"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(GeneralUtils.removeHoverAndClick(ctx.player().getName())); } else if (ctx.hasGameProfile()) { @@ -39,7 +39,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "name_unformatted"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "name_unformatted"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(ctx.player().getName().getString()); } else if (ctx.hasGameProfile()) { @@ -49,7 +49,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "ping"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "ping"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(String.valueOf(ctx.player().networkHandler.getLatency())); } else { @@ -57,7 +57,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "ping_colored"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "ping_colored"), (ctx, arg) -> { if (ctx.hasPlayer()) { int x = ctx.player().networkHandler.getLatency(); return PlaceholderResult.value(Text.literal(String.valueOf(x)).formatted(x < 100 ? Formatting.GREEN : x < 200 ? Formatting.GOLD : Formatting.RED)); @@ -66,7 +66,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "displayname"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "displayname"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(ctx.player().getDisplayName()); } else if (ctx.hasGameProfile()) { @@ -76,9 +76,9 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "display_name"), Placeholders.getPlaceholders().get(new Identifier("player", "displayname"))); + Placeholders.register(Identifier.of("player", "display_name"), Placeholders.getPlaceholders().get(Identifier.of("player", "displayname"))); - Placeholders.register(new Identifier("player", "displayname_visual"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "displayname_visual"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(GeneralUtils.removeHoverAndClick(ctx.player().getDisplayName())); } else if (ctx.hasGameProfile()) { @@ -88,9 +88,9 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "display_name_visual"), Placeholders.getPlaceholders().get(new Identifier("player", "displayname_visual"))); + Placeholders.register(Identifier.of("player", "display_name_visual"), Placeholders.getPlaceholders().get(Identifier.of("player", "displayname_visual"))); - Placeholders.register(new Identifier("player", "displayname_unformatted"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "displayname_unformatted"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(Text.literal(ctx.player().getDisplayName().getString())); } else if (ctx.hasGameProfile()) { @@ -99,9 +99,9 @@ public static void register() { return PlaceholderResult.invalid("No player!"); } }); - Placeholders.register(new Identifier("player", "display_name_unformatted"), Placeholders.getPlaceholders().get(new Identifier("player", "displayname_unformatted"))); + Placeholders.register(Identifier.of("player", "display_name_unformatted"), Placeholders.getPlaceholders().get(Identifier.of("player", "displayname_unformatted"))); - Placeholders.register(new Identifier("player", "inventory_slot"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "inventory_slot"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { int slot = Integer.parseInt(arg); @@ -123,7 +123,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "inventory_slot_no_rarity"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "inventory_slot_no_rarity"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { int slot = Integer.parseInt(arg); @@ -145,7 +145,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "equipment_slot"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "equipment_slot"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { var slot = EquipmentSlot.byName(arg); @@ -161,7 +161,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "equipment_slot_no_rarity"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "equipment_slot_no_rarity"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { var slot = EquipmentSlot.byName(arg); @@ -177,7 +177,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "playtime"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "playtime"), (ctx, arg) -> { if (ctx.hasPlayer()) { int x = ctx.player().getStatHandler().getStat(Stats.CUSTOM.getOrCreateStat(Stats.PLAY_TIME)); return PlaceholderResult.value(arg != null @@ -189,7 +189,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "statistic"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "statistic"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { var args = arg.split(" "); @@ -226,7 +226,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "statistic_raw"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "statistic_raw"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { var args = arg.split(" "); @@ -263,7 +263,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "objective"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "objective"), (ctx, arg) -> { if (ctx.hasPlayer() && arg != null) { try { ServerScoreboard scoreboard = ctx.server().getScoreboard(); @@ -282,7 +282,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "pos_x"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "pos_x"), (ctx, arg) -> { if (ctx.hasPlayer()) { double value = ctx.player().getX(); String format = "%.2f"; @@ -302,7 +302,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "pos_y"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "pos_y"), (ctx, arg) -> { if (ctx.hasPlayer()) { double value = ctx.player().getY(); String format = "%.2f"; @@ -322,7 +322,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "pos_z"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "pos_z"), (ctx, arg) -> { if (ctx.hasPlayer()) { double value = ctx.player().getZ(); String format = "%.2f"; @@ -342,7 +342,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "uuid"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "uuid"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(ctx.player().getUuidAsString()); } else if (ctx.hasGameProfile()) { @@ -352,7 +352,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "health"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "health"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(String.format("%.0f", ctx.player().getHealth())); } else { @@ -360,7 +360,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "max_health"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "max_health"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(String.format("%.0f", ctx.player().getMaxHealth())); } else { @@ -368,7 +368,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "hunger"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "hunger"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(String.valueOf(ctx.player().getHungerManager().getFoodLevel())); } else { @@ -376,7 +376,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "saturation"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "saturation"), (ctx, arg) -> { if (ctx.hasPlayer()) { return PlaceholderResult.value(String.format("%.0f", ctx.player().getHungerManager().getSaturationLevel())); } else { @@ -384,7 +384,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "team_name"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "team_name"), (ctx, arg) -> { if (ctx.hasPlayer()) { var team = ctx.player().getScoreboardTeam(); return PlaceholderResult.value(team==null ? Text.empty() : Text.of(team.getName())); @@ -393,7 +393,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "team_displayname"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "team_displayname"), (ctx, arg) -> { if (ctx.hasPlayer()) { var team = (Team) ctx.player().getScoreboardTeam(); return PlaceholderResult.value(team==null ? Text.empty() : team.getDisplayName()); @@ -402,7 +402,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("player", "team_displayname_formatted"), (ctx, arg) -> { + Placeholders.register(Identifier.of("player", "team_displayname_formatted"), (ctx, arg) -> { if (ctx.hasPlayer()) { var team = (Team) ctx.player().getScoreboardTeam(); return PlaceholderResult.value(team==null ? Text.empty() : team.getFormattedName()); diff --git a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/ServerPlaceholders.java b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/ServerPlaceholders.java index 0e7b4e9..427494b 100644 --- a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/ServerPlaceholders.java +++ b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/ServerPlaceholders.java @@ -12,7 +12,6 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; -import net.minecraft.util.TimeHelper; import org.apache.commons.lang3.time.DurationFormatUtils; import java.lang.management.ManagementFactory; @@ -30,7 +29,7 @@ public class ServerPlaceholders { public static void register() { - Placeholders.register(new Identifier("server", "tps"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "tps"), (ctx, arg) -> { double tps = TimeUnit.SECONDS.toMillis(1) / Math.max(ctx.server().getAverageTickTime(), ctx.server().getTickManager().getMillisPerTick()); String format = "%.1f"; @@ -46,7 +45,7 @@ public static void register() { return PlaceholderResult.value(String.format(format, tps)); }); - Placeholders.register(new Identifier("server", "tps_colored"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "tps_colored"), (ctx, arg) -> { double tps = TimeUnit.SECONDS.toMillis(1) / Math.max(ctx.server().getAverageTickTime(), ctx.server().getTickManager().getMillisPerTick()); String format = "%.1f"; @@ -61,20 +60,20 @@ public static void register() { return PlaceholderResult.value(Text.literal(String.format(format, tps)).formatted(tps > 19 ? Formatting.GREEN : tps > 16 ? Formatting.GOLD : Formatting.RED)); }); - Placeholders.register(new Identifier("server", "mspt"), (ctx, arg) -> PlaceholderResult.value(String.format("%.0f", ctx.server().getAverageTickTime()))); + Placeholders.register(Identifier.of("server", "mspt"), (ctx, arg) -> PlaceholderResult.value(String.format("%.0f", ctx.server().getAverageTickTime()))); - Placeholders.register(new Identifier("server", "mspt_colored"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "mspt_colored"), (ctx, arg) -> { float x = ctx.server().getAverageTickTime(); return PlaceholderResult.value(Text.literal(String.format("%.0f", x)).formatted(x < 45 ? Formatting.GREEN : x < 51 ? Formatting.GOLD : Formatting.RED)); }); - Placeholders.register(new Identifier("server", "time"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "time"), (ctx, arg) -> { SimpleDateFormat format = new SimpleDateFormat(arg != null ? arg : "HH:mm:ss"); return PlaceholderResult.value(format.format(new Date(System.currentTimeMillis()))); }); - Placeholders.register(new Identifier("server", "time_new"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "time_new"), (ctx, arg) -> { var args = arg == null ? StringArgs.empty() : StringArgs.full(arg, ' ', ':'); var format = DateTimeFormatter.ofPattern(args.get("format", "HH:mm:ss")); var date = args.get("zone") != null ? LocalDateTime.now(ZoneId.of(args.get("zone", ""))) : LocalDateTime.now(); @@ -87,7 +86,7 @@ public static void register() { long ms; }; - Placeholders.register(new Identifier("server", "uptime"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "uptime"), (ctx, arg) -> { if (ref.server == null || !ref.server.refersTo(ctx.server())) { ref.server = new WeakReference<>(ctx.server()); ref.ms = System.currentTimeMillis() - ctx.server().getTicks() * 50L; @@ -100,9 +99,9 @@ public static void register() { }); } - Placeholders.register(new Identifier("server", "version"), (ctx, arg) -> PlaceholderResult.value(ctx.server().getVersion())); + Placeholders.register(Identifier.of("server", "version"), (ctx, arg) -> PlaceholderResult.value(ctx.server().getVersion())); - Placeholders.register(new Identifier("server", "motd"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "motd"), (ctx, arg) -> { var metadata = ctx.server().getServerMetadata(); if (metadata == null) { @@ -112,7 +111,7 @@ public static void register() { return PlaceholderResult.value(metadata.description()); }); - Placeholders.register(new Identifier("server", "mod_version"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "mod_version"), (ctx, arg) -> { if (arg != null) { var container = FabricLoader.getInstance().getModContainer(arg); @@ -123,7 +122,7 @@ public static void register() { return PlaceholderResult.invalid("Invalid argument"); }); - Placeholders.register(new Identifier("server", "mod_name"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "mod_name"), (ctx, arg) -> { if (arg != null) { var container = FabricLoader.getInstance().getModContainer(arg); @@ -134,15 +133,15 @@ public static void register() { return PlaceholderResult.invalid("Invalid argument"); }); - Placeholders.register(new Identifier("server", "brand"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "brand"), (ctx, arg) -> { return PlaceholderResult.value(Text.literal(ctx.server().getServerModName())); }); - Placeholders.register(new Identifier("server", "mod_count"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "mod_count"), (ctx, arg) -> { return PlaceholderResult.value(Text.literal("" + FabricLoader.getInstance().getAllMods().size())); }); - Placeholders.register(new Identifier("server", "mod_description"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "mod_description"), (ctx, arg) -> { if (arg != null) { var container = FabricLoader.getInstance().getModContainer(arg); @@ -153,9 +152,9 @@ public static void register() { return PlaceholderResult.invalid("Invalid argument"); }); - Placeholders.register(new Identifier("server", "name"), (ctx, arg) -> PlaceholderResult.value(ctx.server().getName())); + Placeholders.register(Identifier.of("server", "name"), (ctx, arg) -> PlaceholderResult.value(ctx.server().getName())); - Placeholders.register(new Identifier("server", "used_ram"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "used_ram"), (ctx, arg) -> { MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); MemoryUsage heapUsage = memoryMXBean.getHeapMemoryUsage(); @@ -164,7 +163,7 @@ public static void register() { : String.format("%d", heapUsage.getUsed() / 1048576)); }); - Placeholders.register(new Identifier("server", "max_ram"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "max_ram"), (ctx, arg) -> { MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); MemoryUsage heapUsage = memoryMXBean.getHeapMemoryUsage(); @@ -173,10 +172,10 @@ public static void register() { : String.format("%d", heapUsage.getMax() / 1048576)); }); - Placeholders.register(new Identifier("server", "online"), (ctx, arg) -> PlaceholderResult.value(String.valueOf(ctx.server().getPlayerManager().getCurrentPlayerCount()))); - Placeholders.register(new Identifier("server", "max_players"), (ctx, arg) -> PlaceholderResult.value(String.valueOf(ctx.server().getPlayerManager().getMaxPlayerCount()))); + Placeholders.register(Identifier.of("server", "online"), (ctx, arg) -> PlaceholderResult.value(String.valueOf(ctx.server().getPlayerManager().getCurrentPlayerCount()))); + Placeholders.register(Identifier.of("server", "max_players"), (ctx, arg) -> PlaceholderResult.value(String.valueOf(ctx.server().getPlayerManager().getMaxPlayerCount()))); - Placeholders.register(new Identifier("server", "objective_name_top"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "objective_name_top"), (ctx, arg) -> { var args = arg.split(" "); if (args.length >= 2) { ServerScoreboard scoreboard = ctx.server().getScoreboard(); @@ -196,7 +195,7 @@ public static void register() { } return PlaceholderResult.invalid("Not enough arguments!"); }); - Placeholders.register(new Identifier("server", "objective_score_top"), (ctx, arg) -> { + Placeholders.register(Identifier.of("server", "objective_score_top"), (ctx, arg) -> { var args = arg.split(" "); if (args.length >= 2) { ServerScoreboard scoreboard = ctx.server().getScoreboard(); diff --git a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/WorldPlaceholders.java b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/WorldPlaceholders.java index aa414a7..899950a 100644 --- a/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/WorldPlaceholders.java +++ b/src/main/java/eu/pb4/placeholders/impl/placeholder/builtin/WorldPlaceholders.java @@ -17,7 +17,7 @@ public class WorldPlaceholders { static final int CHUNK_AREA = (int)Math.pow(17.0D, 2.0D); public static void register() { - Placeholders.register(new Identifier("world", "time"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "time"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -30,7 +30,7 @@ public static void register() { return PlaceholderResult.value(String.format("%02d:%02d", (dayTime / 60 + 6) % 24, dayTime % 60)); }); - Placeholders.register(new Identifier("world", "time_alt"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "time_alt"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -47,7 +47,7 @@ public static void register() { return PlaceholderResult.value(String.format("%02d:%02d %s", y, dayTime % 60, x > 11 ? "PM" : "AM" )); }); - Placeholders.register(new Identifier("world", "day"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "day"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -58,7 +58,7 @@ public static void register() { return PlaceholderResult.value("" + world.getTimeOfDay() / 24000); }); - Placeholders.register(new Identifier("world", "id"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "id"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -69,7 +69,7 @@ public static void register() { return PlaceholderResult.value(world.getRegistryKey().getValue().toString()); }); - Placeholders.register(new Identifier("world", "name"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "name"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -90,7 +90,7 @@ public static void register() { - Placeholders.register(new Identifier("world", "player_count"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "player_count"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -101,7 +101,7 @@ public static void register() { return PlaceholderResult.value("" + world.getPlayers().size()); }); - Placeholders.register(new Identifier("world", "mob_count_colored"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "mob_count_colored"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -138,7 +138,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("world", "mob_count"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "mob_count"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld(); @@ -165,7 +165,7 @@ public static void register() { } }); - Placeholders.register(new Identifier("world", "mob_cap"), (ctx, arg) -> { + Placeholders.register(Identifier.of("world", "mob_cap"), (ctx, arg) -> { ServerWorld world; if (ctx.player() != null) { world = ctx.player().getServerWorld();