From 4196141db1f8db4f03332cc33adbf426a53bf99e Mon Sep 17 00:00:00 2001 From: Antti Koponen Date: Fri, 10 Jun 2022 16:21:53 +0300 Subject: [PATCH] Fixes for Fabric 1.19 by Kopo (#2419) * Gradle 7.4.2 * Build changes for MC 1.19 - Updated loom to minor version 0.12 & moved to root project - Updated mappings, command API, fabric API & loader version - Moved Selenium to common module because of a conflict with loom's dependency resolution * Add remap folder to .gitignore * Fix version token replacement * Update to Minecraft 1.19 * Don't forget the pipelines Affects issues: - Fixed #2417 --- .github/workflows/gradle-pr.yml | 2 +- .github/workflows/gradle.yml | 2 +- .github/workflows/javadocs.yml | 2 +- .gitignore | 30 ++-------------- Plan/build.gradle | 2 +- Plan/common/build.gradle | 2 +- Plan/fabric/build.gradle | 36 +++++++------------ .../net/playeranalytics/plan/PlanFabric.java | 4 +-- .../plan/commands/CommandManager.java | 6 ++-- .../commands/use/FabricMessageBuilder.java | 13 ++++--- .../listeners/events/mixin/EntityMixin.java | 4 +-- .../events/mixin/PlayerEntityMixin.java | 6 ++-- .../mixin/ServerCommandSourceMixin.java | 3 +- .../mixin/ServerPlayNetworkHandlerMixin.java | 4 +-- .../listeners/fabric/ChatListener.java | 2 +- .../listeners/fabric/DeathEventListener.java | 8 ++--- .../fabric/GameModeChangeListener.java | 2 +- .../fabric/PlayerOnlineListener.java | 6 ++-- .../listeners/fabric/WorldChangeListener.java | 2 +- .../fabric/src/main/resources/fabric.mod.json | 9 +++-- .../src/main/resources/plan.mixins.json | 2 +- Plan/gradle/wrapper/gradle-wrapper.properties | 2 +- Plan/settings.gradle | 1 + 23 files changed, 59 insertions(+), 91 deletions(-) diff --git a/.github/workflows/gradle-pr.yml b/.github/workflows/gradle-pr.yml index 07f3dcf4a..04edc7668 100644 --- a/.github/workflows/gradle-pr.yml +++ b/.github/workflows/gradle-pr.yml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '16' + java-version: '17' - name: Setup Selenium Webdriver uses: nanasess/setup-chromedriver@v1 - name: Setup Selenium Webdriver settings diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 78a03b341..0d77b67f2 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,7 +28,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '16' + java-version: '17' - name: Setup Selenium Webdriver uses: nanasess/setup-chromedriver@v1 - name: Setup Selenium Webdriver settings diff --git a/.github/workflows/javadocs.yml b/.github/workflows/javadocs.yml index 465b11c2c..c398fc6a0 100644 --- a/.github/workflows/javadocs.yml +++ b/.github/workflows/javadocs.yml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '16' + java-version: '17' - name: Build Javadocs 🔧 run: | cd Plan diff --git a/.gitignore b/.gitignore index 01b07fa6c..12447f2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ server.log **/.gradle out/ +# Fabric +remappedSrc/ + # Created by https://www.gitignore.io/api/maven,eclipse,intellij,netbeans,osx,windows,notepadpp,windows,java ### Maven ### @@ -165,33 +168,6 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk - -### NotepadPP ### -# Notepad++ backups # -*.bak - - -### Windows ### -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - - ### Java ### *.class diff --git a/Plan/build.gradle b/Plan/build.gradle index aa2d89860..2697ebbb2 100644 --- a/Plan/build.gradle +++ b/Plan/build.gradle @@ -12,6 +12,7 @@ plugins { id "jacoco" id "checkstyle" id "org.sonarqube" version "3.4.0.2513" + id 'fabric-loom' version '0.12.+' apply false } apply plugin: 'nebula-aggregate-javadocs' @@ -115,7 +116,6 @@ subprojects { testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" // JUnit 5 testImplementation "org.mockito:mockito-core:$mockitoVersion" // Mockito Core testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion" // Mockito JUnit 5 Extension - testImplementation "org.seleniumhq.selenium:selenium-java:4.2.1" // Selenium (Browser tests) testImplementation "com.jayway.awaitility:awaitility:1.7.0" // Awaitility (Concurrent wait conditions) // Testing dependencies required by Plan diff --git a/Plan/common/build.gradle b/Plan/common/build.gradle index c83a9f49c..48b6c7005 100644 --- a/Plan/common/build.gradle +++ b/Plan/common/build.gradle @@ -52,7 +52,7 @@ dependencies { testImplementation project(":api") testImplementation "com.google.code.gson:gson:$gsonVersion" - + testImplementation "org.seleniumhq.selenium:selenium-java:4.2.1" testImplementation "org.testcontainers:testcontainers:$testContainersVersion" testImplementation "org.testcontainers:junit-jupiter:$testContainersVersion" testImplementation "org.testcontainers:nginx:$testContainersVersion" diff --git a/Plan/fabric/build.gradle b/Plan/fabric/build.gradle index 3d9d0cd23..f256cd1c6 100644 --- a/Plan/fabric/build.gradle +++ b/Plan/fabric/build.gradle @@ -1,8 +1,4 @@ -import org.apache.tools.ant.filters.ReplaceTokens - -plugins { - id 'fabric-loom' version '0.9.+' -} +apply plugin: 'fabric-loom' dependencies { shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion" @@ -11,42 +7,36 @@ dependencies { compileOnly project(":api") modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT') - minecraft "com.mojang:minecraft:1.17.1" - mappings "net.fabricmc:yarn:1.17.1+build.35:v2" - modImplementation "net.fabricmc:fabric-loader:0.11.6" + minecraft "com.mojang:minecraft:1.19" + mappings "net.fabricmc:yarn:1.19+build.1:v2" + modImplementation "net.fabricmc:fabric-loader:0.14.7" // Fabric API Set apiModules = [ 'fabric-api-base', - 'fabric-command-api-v1', + 'fabric-command-api-v2', 'fabric-entity-events-v1', 'fabric-lifecycle-events-v1', 'fabric-networking-api-v1' ] apiModules.forEach { - modImplementation(fabricApi.module(it, "0.37.1+1.17")) + modImplementation(fabricApi.module(it, "0.55.3+1.19")) } testImplementation project(path: ":common", configuration: 'testArtifacts') } -compileJava { - options.release = 16 -} - -tasks.register('updateVersion', Copy) { - from('src/main/resources') { - include 'fabric.mod.json' - } - into 'build/sources/resources/' - filter(ReplaceTokens, tokens: [version: '' + project.ext.fullVersion]) +tasks.withType(JavaCompile).configureEach { + options.release = 17 } processResources { - dependsOn updateVersion - duplicatesStrategy = DuplicatesStrategy.INCLUDE - from 'build/sources/resources' + inputs.property "version", project.ext.fullVersion + + filesMatching("fabric.mod.json") { + expand "version": project.ext.fullVersion + } } shadowJar { diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/PlanFabric.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/PlanFabric.java index be7c91664..a6def72b1 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/PlanFabric.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/PlanFabric.java @@ -26,7 +26,7 @@ import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.lang.PluginLang; import com.djrapitops.plan.settings.theme.PlanColorScheme; import net.fabricmc.api.DedicatedServerModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.server.dedicated.MinecraftDedicatedServer; @@ -163,7 +163,7 @@ public class PlanFabric implements PlanPlugin, DedicatedServerModInitializer { onEnable(); }); - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> commandManager = new CommandManager(dispatcher, this)); + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> commandManager = new CommandManager(dispatcher, this)); ServerLifecycleEvents.SERVER_STOPPING.register(server -> onDisable()); } diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/CommandManager.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/CommandManager.java index 7e1477af5..066121269 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/CommandManager.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/CommandManager.java @@ -32,7 +32,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import me.lucko.fabric.api.permissions.v0.Permissions; import net.minecraft.command.CommandSource; import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.playeranalytics.plan.PlanFabric; import net.playeranalytics.plugin.scheduling.RunnableFactory; @@ -82,9 +82,9 @@ public class CommandManager { subcommand.getExecutor().accept((CMDSender) ctx.getSource(), new Arguments(getCommandArguments(ctx))); } catch (Exception e) { if (e instanceof IllegalArgumentException) { - ctx.getSource().sendError(new LiteralText(e.getMessage())); + ctx.getSource().sendError(Text.literal(e.getMessage())); } else { - ctx.getSource().sendError(new LiteralText("An internal error occurred, see the console for details.")); + ctx.getSource().sendError(Text.literal("An internal error occurred, see the console for details.")); plugin.getSystem().getErrorLogger().error(e, ErrorContext.builder() .related(ctx.getSource().getClass()) .related(subcommand.getPrimaryAlias() + " " + getCommandArguments(ctx)) diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/use/FabricMessageBuilder.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/use/FabricMessageBuilder.java index b90cc9819..8ba2f30eb 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/use/FabricMessageBuilder.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/commands/use/FabricMessageBuilder.java @@ -19,7 +19,10 @@ package net.playeranalytics.plan.commands.use; import com.djrapitops.plan.commands.use.CMDSender; import com.djrapitops.plan.commands.use.MessageBuilder; import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.*; +import net.minecraft.text.ClickEvent; +import net.minecraft.text.HoverEvent; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; import org.apache.commons.text.TextStringBuilder; import java.util.Collection; @@ -36,7 +39,7 @@ public class FabricMessageBuilder implements MessageBuilder { FabricMessageBuilder(ServerCommandSource sender, FabricMessageBuilder previous) { this.sender = sender; - this.builder = new LiteralText(""); + this.builder = Text.literal(""); this.previous = previous; } @@ -67,19 +70,19 @@ public class FabricMessageBuilder implements MessageBuilder { @Override public MessageBuilder hover(String message) { - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(message)))); + builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(message)))); return this; } @Override public MessageBuilder hover(String... lines) { - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); + builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); return this; } @Override public MessageBuilder hover(Collection lines) { - builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); + builder.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(new TextStringBuilder().appendWithSeparators(lines, "\n").toString())))); return this; } diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/EntityMixin.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/EntityMixin.java index f49a7c34d..1b66dd990 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/EntityMixin.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/EntityMixin.java @@ -23,13 +23,13 @@ import net.playeranalytics.plan.gathering.listeners.events.PlanFabricEvents; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Entity.class) public class EntityMixin { @Inject(method = "onKilledOther", at = @At(value = "TAIL")) - public void onDeath(ServerWorld world, LivingEntity other, CallbackInfo ci) { + public void onDeath(ServerWorld world, LivingEntity other, CallbackInfoReturnable cir) { PlanFabricEvents.ON_KILLED.invoker().onKilled(other, (Entity) (Object) this); } diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/PlayerEntityMixin.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/PlayerEntityMixin.java index 8c71adb7e..ce82e6368 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/PlayerEntityMixin.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/PlayerEntityMixin.java @@ -23,13 +23,13 @@ import net.playeranalytics.plan.gathering.listeners.events.PlanFabricEvents; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerEntity.class) public class PlayerEntityMixin { - @Inject(method = "onKilledOther", at = @At(value = "TAIL")) - public void onDeath(ServerWorld world, LivingEntity other, CallbackInfo ci) { + @Inject(method = "onKilledOther", at = @At("TAIL")) + public void onDeath(ServerWorld world, LivingEntity other, CallbackInfoReturnable cir) { PlanFabricEvents.ON_KILLED.invoker().onKilled(other, (PlayerEntity) (Object) this); } diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerCommandSourceMixin.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerCommandSourceMixin.java index 808477748..1a06a8f44 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerCommandSourceMixin.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerCommandSourceMixin.java @@ -20,7 +20,6 @@ import com.djrapitops.plan.commands.use.*; import net.minecraft.entity.Entity; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.playeranalytics.plan.commands.CommandManager; import net.playeranalytics.plan.commands.use.FabricMessageBuilder; @@ -73,7 +72,7 @@ public abstract class ServerCommandSourceMixin implements CMDSender { @Override public void send(String message) { - this.sendFeedback(new LiteralText(message), false); + this.sendFeedback(Text.literal(message), false); } @Override diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerPlayNetworkHandlerMixin.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerPlayNetworkHandlerMixin.java index ee1f3e3a0..1e995527b 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerPlayNetworkHandlerMixin.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/events/mixin/ServerPlayNetworkHandlerMixin.java @@ -28,12 +28,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ServerPlayNetworkHandler.class) public class ServerPlayNetworkHandlerMixin { - @Inject(method = "onGameMessage", at = @At(value = "INVOKE", target = "Ljava/lang/String;startsWith(Ljava/lang/String;)Z")) + @Inject(method = "onChatMessage", at = @At("TAIL")) public void onChatMessage(ChatMessageC2SPacket packet, CallbackInfo ci) { PlanFabricEvents.ON_CHAT.invoker().onChat((ServerPlayNetworkHandler) (Object) this, packet.getChatMessage()); } - @Inject(method = "onPlayerMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;getServerWorld()Lnet/minecraft/server/world/ServerWorld;")) + @Inject(method = "onPlayerMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;getWorld()Lnet/minecraft/server/world/ServerWorld;")) public void onPlayerMove(PlayerMoveC2SPacket packet, CallbackInfo ci) { PlanFabricEvents.ON_MOVE.invoker().onMove((ServerPlayNetworkHandler) (Object) this, packet); } diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/ChatListener.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/ChatListener.java index 5abd47add..913941575 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/ChatListener.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/ChatListener.java @@ -72,7 +72,7 @@ public class ChatListener implements FabricListener { long time = System.currentTimeMillis(); ServerPlayerEntity player = handler.player; UUID uuid = player.getUuid(); - String displayName = player.getDisplayName().asString(); + String displayName = player.getDisplayName().getString(); dbSystem.getDatabase().executeTransaction(new NicknameStoreTransaction( uuid, new Nickname(displayName, time, serverInfo.getServerUUID()), diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/DeathEventListener.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/DeathEventListener.java index ff6cac424..3544b5fef 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/DeathEventListener.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/DeathEventListener.java @@ -89,11 +89,11 @@ public class DeathEventListener implements FabricListener { } private PlayerKill.Killer getKiller(ServerPlayerEntity killer) { - return new PlayerKill.Killer(killer.getUuid(), killer.getName().asString()); + return new PlayerKill.Killer(killer.getUuid(), killer.getName().getString()); } private PlayerKill.Victim getVictim(ServerPlayerEntity victim) { - return new PlayerKill.Victim(victim.getUuid(), victim.getName().asString()); + return new PlayerKill.Victim(victim.getUuid(), victim.getName().getString()); } public Optional getCause(Entity killer) { @@ -107,12 +107,12 @@ public class DeathEventListener implements FabricListener { if (killer instanceof ServerPlayerEntity) return getItemInHand((ServerPlayerEntity) killer); // Projectile, EnderCrystal and all other causes that are not known yet - return new EntityNameFormatter().apply(killer.getType().getName().asString()); + return new EntityNameFormatter().apply(killer.getType().getName().getString()); } private String getItemInHand(ServerPlayerEntity killer) { ItemStack itemInHand = killer.getMainHandStack(); - return itemInHand.getItem().getName().asString(); + return itemInHand.getItem().getName().getString(); } private Optional getShooter(ProjectileEntity projectile) { diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/GameModeChangeListener.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/GameModeChangeListener.java index 1583365f8..6eef734a5 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/GameModeChangeListener.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/GameModeChangeListener.java @@ -72,7 +72,7 @@ public class GameModeChangeListener implements FabricListener { UUID uuid = player.getUuid(); long time = System.currentTimeMillis(); String gameMode = newGameMode.name(); - String worldName = player.getServerWorld().getRegistryKey().getValue().toString(); + String worldName = player.getWorld().getRegistryKey().getValue().toString(); dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName)); worldAliasSettings.addWorld(worldName); diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/PlayerOnlineListener.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/PlayerOnlineListener.java index 368c5cab6..d1e6a4951 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/PlayerOnlineListener.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/PlayerOnlineListener.java @@ -179,7 +179,7 @@ public class PlayerOnlineListener implements FabricListener { FabricAFKListener.afkTracker.performedAction(playerUUID, time); - String world = player.getServerWorld().getRegistryKey().getValue().toString(); + String world = player.getWorld().getRegistryKey().getValue().toString(); String gm = player.interactionManager.getGameMode().name(); Database database = dbSystem.getDatabase(); @@ -188,7 +188,7 @@ public class PlayerOnlineListener implements FabricListener { Supplier getHostName = () -> getHostname(player); String playerName = player.getEntityName(); - String displayName = player.getDisplayName().asString(); + String displayName = player.getDisplayName().getString(); database.executeTransaction(new PlayerServerRegisterTransaction(playerUUID, @@ -199,7 +199,7 @@ public class PlayerOnlineListener implements FabricListener { gatherGeolocation(player, playerUUID, time, database); } - database.executeTransaction(new OperatorStatusTransaction(playerUUID, serverUUID, server.getPlayerManager().getOpList().isOp(player.getGameProfile()))); + database.executeTransaction(new OperatorStatusTransaction(playerUUID, serverUUID, server.getPlayerManager().getOpList().get(player.getGameProfile()) != null)); ActiveSession session = new ActiveSession(playerUUID, serverUUID, time, world, gm); session.getExtraData().put(PlayerName.class, new PlayerName(playerName)); diff --git a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/WorldChangeListener.java b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/WorldChangeListener.java index cca8ecba9..b37709b14 100644 --- a/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/WorldChangeListener.java +++ b/Plan/fabric/src/main/java/net/playeranalytics/plan/gathering/listeners/fabric/WorldChangeListener.java @@ -67,7 +67,7 @@ public class WorldChangeListener implements FabricListener { UUID uuid = player.getUuid(); - String worldName = player.getServerWorld().getRegistryKey().getValue().toString(); + String worldName = player.getWorld().getRegistryKey().getValue().toString(); String gameMode = player.interactionManager.getGameMode().name(); dbSystem.getDatabase().executeTransaction(new WorldNameStoreTransaction(serverInfo.getServerUUID(), worldName)); diff --git a/Plan/fabric/src/main/resources/fabric.mod.json b/Plan/fabric/src/main/resources/fabric.mod.json index 98e8fc189..05ec25a74 100644 --- a/Plan/fabric/src/main/resources/fabric.mod.json +++ b/Plan/fabric/src/main/resources/fabric.mod.json @@ -2,8 +2,7 @@ "schemaVersion": 1, "id": "plan", "name": "Plan", - "version": "@version@", - + "version": "${version}", "environment": "server", "entrypoints": { "server": [ @@ -14,10 +13,10 @@ "plan.mixins.json" ], "depends": { - "minecraft": ">=1.17", - "java": ">=16", + "minecraft": ">=1.19", + "java": ">=17", "fabric-api-base": "*", - "fabric-command-api-v1": "*", + "fabric-command-api-v2": "*", "fabric-entity-events-v1": "*", "fabric-lifecycle-events-v1": "*", "fabric-networking-v0": "*" diff --git a/Plan/fabric/src/main/resources/plan.mixins.json b/Plan/fabric/src/main/resources/plan.mixins.json index dfa6b9437..478167ae1 100644 --- a/Plan/fabric/src/main/resources/plan.mixins.json +++ b/Plan/fabric/src/main/resources/plan.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "net.playeranalytics.plan.gathering.listeners.events.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "EntityMixin", "KickCommandMixin", diff --git a/Plan/gradle/wrapper/gradle-wrapper.properties b/Plan/gradle/wrapper/gradle-wrapper.properties index 05679dc3c..aa991fcea 100644 --- a/Plan/gradle/wrapper/gradle-wrapper.properties +++ b/Plan/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/Plan/settings.gradle b/Plan/settings.gradle index 5bc6a5315..38b634137 100644 --- a/Plan/settings.gradle +++ b/Plan/settings.gradle @@ -4,6 +4,7 @@ pluginManagement { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + mavenCentral() gradlePluginPortal() } }