diff --git a/.gitignore b/.gitignore index 85664879..b6a303e0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ bin/ run_*/ run/ +run.*/ # env .env diff --git a/build.gradle b/build.gradle index 75c42244..4840b540 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'groovy' - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' id "com.modrinth.minotaur" version "2.+" id 'com.matthewprenger.cursegradle' version "1.4.0" @@ -139,7 +139,7 @@ tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release.set(17) + it.options.release.set(21) } //jar { diff --git a/gradle.properties b/gradle.properties index 63cac444..0ac2720b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx2048M # Fabric Properties # check these on https://fabricmc.net/develup -minecraft_version=1.21 -yarn_mappings=1.21+build.1 -loader_version=0.15.11 +minecraft_version=1.21.2 +yarn_mappings=1.21.2+build.1 +loader_version=0.16.7 # Fabric API -fabric_version=0.100.1+1.21 +fabric_version=0.106.1+1.21.2 # Mod Properties mod_name = Essential Commands @@ -20,7 +20,7 @@ archives_base_name = essential_commands # Dependencies permissions_api_version=0.3.1 -placeholder_api_version=2.4.0-pre.2+1.21 +placeholder_api_version=2.5.0+1.21.2 pal_version=1.10.0 vanish_version=1.5.3+1.20.4 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a..df97d72b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..f5feea6d 100644 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e4..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/src/main/java/com/fibermc/essentialcommands/WorldDataManager.java b/src/main/java/com/fibermc/essentialcommands/WorldDataManager.java index 9fdeb1c1..0326f87b 100644 --- a/src/main/java/com/fibermc/essentialcommands/WorldDataManager.java +++ b/src/main/java/com/fibermc/essentialcommands/WorldDataManager.java @@ -104,7 +104,12 @@ public void fromNbt(NbtCompound tag) { public void save(RegistryWrapper.WrapperLookup wrapperLookup) { EssentialCommands.log(Level.INFO, "Saving world_data.dat (Spawn/Warps)..."); - super.save(this.worldDataFile, wrapperLookup); + NbtCompound data = this.toNbt(wrapperLookup); + try { + NbtIo.writeCompressed(data, this.worldDataFile.toPath()); + } catch (IOException e) { + EssentialCommands.LOGGER.error("Could not save data {}", this, e); + } EssentialCommands.log(Level.INFO, "world_data.dat saved."); } diff --git a/src/main/java/com/fibermc/essentialcommands/commands/RandomTeleportCommand.java b/src/main/java/com/fibermc/essentialcommands/commands/RandomTeleportCommand.java index c8b221af..73096ff0 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/RandomTeleportCommand.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/RandomTeleportCommand.java @@ -119,7 +119,7 @@ final static class ExecutionContext { public final int bottomY; public ExecutionContext(ServerWorld world) { - this.topY = world.getTopY(); + this.topY = world.getTopYInclusive(); this.bottomY = world.getBottomY(); } } diff --git a/src/main/java/com/fibermc/essentialcommands/commands/helpers/HeightFindingStrategy.java b/src/main/java/com/fibermc/essentialcommands/commands/helpers/HeightFindingStrategy.java index 50dce59d..899899df 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/helpers/HeightFindingStrategy.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/helpers/HeightFindingStrategy.java @@ -68,6 +68,6 @@ private static OptionalInt findYBottomUp(Chunk chunk, int x, int z) { public static int getChunkHighestNonEmptySectionYOffsetOrTopY(Chunk chunk) { int i = chunk.getHighestNonEmptySection(); - return i == chunk.getTopY() ? chunk.getBottomY() : ChunkSectionPos.getBlockCoord(chunk.sectionIndexToCoord(i)); + return i == chunk.getTopYInclusive() ? chunk.getBottomY() : ChunkSectionPos.getBlockCoord(chunk.sectionIndexToCoord(i)); } } diff --git a/src/main/java/com/fibermc/essentialcommands/commands/utility/FeedCommand.java b/src/main/java/com/fibermc/essentialcommands/commands/utility/FeedCommand.java index 1d31b42c..40255896 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/utility/FeedCommand.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/utility/FeedCommand.java @@ -25,7 +25,8 @@ public int run(CommandContext context) throws CommandSyntax hungerManager.setFoodLevel(20); hungerManager.setSaturationLevel(5); - hungerManager.setExhaustion(0); +// hungerManager.setExhaustion(0); + // idk, you ca only add to it now senderPlayerData.sendCommandFeedback("cmd.feed.feedback"); diff --git a/src/main/java/com/fibermc/essentialcommands/commands/utility/SuicideCommand.java b/src/main/java/com/fibermc/essentialcommands/commands/utility/SuicideCommand.java index 9afcf28e..d499f2ac 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/utility/SuicideCommand.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/utility/SuicideCommand.java @@ -21,7 +21,7 @@ public int run(CommandContext context) throws CommandSyntax return 0; } - player.kill(); + player.kill(player.getServerWorld()); return SINGLE_SUCCESS; } diff --git a/src/main/java/com/fibermc/essentialcommands/commands/utility/TopCommand.java b/src/main/java/com/fibermc/essentialcommands/commands/utility/TopCommand.java index 05dac048..231f49a0 100644 --- a/src/main/java/com/fibermc/essentialcommands/commands/utility/TopCommand.java +++ b/src/main/java/com/fibermc/essentialcommands/commands/utility/TopCommand.java @@ -76,7 +76,7 @@ public static OptionalInt getTop(Chunk chunk, int x, int z) { } private static int calculateMaxY(Chunk chunk) { - final int maxY = chunk.getTopY(); + final int maxY = chunk.getTopYInclusive(); ChunkSection[] sections = chunk.getSectionArray(); int maxSectionIndex = Math.min(sections.length - 1, maxY >> 4); diff --git a/src/main/java/com/fibermc/essentialcommands/mixin/PersistentStateManagerInvoker.java b/src/main/java/com/fibermc/essentialcommands/mixin/PersistentStateManagerInvoker.java index f8167590..d01cabd8 100644 --- a/src/main/java/com/fibermc/essentialcommands/mixin/PersistentStateManagerInvoker.java +++ b/src/main/java/com/fibermc/essentialcommands/mixin/PersistentStateManagerInvoker.java @@ -1,6 +1,6 @@ package com.fibermc.essentialcommands.mixin; -import java.io.File; +import java.nio.file.Path; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; @@ -11,6 +11,6 @@ public interface PersistentStateManagerInvoker { @Invoker("getFile") - File invokeGetFile(String id); + Path invokeGetFile(String id); } diff --git a/src/main/java/com/fibermc/essentialcommands/mixin/PlayerManagerMixin.java b/src/main/java/com/fibermc/essentialcommands/mixin/PlayerManagerMixin.java index 470aa3ee..374bb3b4 100644 --- a/src/main/java/com/fibermc/essentialcommands/mixin/PlayerManagerMixin.java +++ b/src/main/java/com/fibermc/essentialcommands/mixin/PlayerManagerMixin.java @@ -18,7 +18,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import net.minecraft.entity.Entity; import net.minecraft.network.ClientConnection; @@ -90,13 +89,11 @@ public void onPlayerLeave(ServerPlayerEntity player, CallbackInfo callbackInfo) // created. This lets us update the EC PlayerData, sooner, might be // before the new ServerPlayerEntity is fully initialized. target = "Lnet/minecraft/server/network/ServerPlayerEntity;copyFrom(Lnet/minecraft/server/network/ServerPlayerEntity;Z)V" - ), locals = LocalCapture.CAPTURE_FAILHARD) + )) public void onRespawnPlayer( - ServerPlayerEntity oldServerPlayerEntity, boolean alive, Entity.RemovalReason removalReason - , CallbackInfoReturnable cir - , TeleportTarget teleportTarget - , ServerWorld serverWorld - , ServerPlayerEntity serverPlayerEntity + ServerPlayerEntity oldServerPlayerEntity, boolean alive, Entity.RemovalReason removalReason, + CallbackInfoReturnable cir, + @Local(ordinal = 1) ServerPlayerEntity serverPlayerEntity ) { PlayerDataManager.handlePlayerDataRespawnSync(oldServerPlayerEntity, serverPlayerEntity); } @@ -107,7 +104,7 @@ public void onRespawnPlayer( // This target lets us modify respawn position and dimension (player maybe not _fully_ initialized, still) target = "Lnet/minecraft/server/network/ServerPlayerEntity;(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/server/world/ServerWorld;Lcom/mojang/authlib/GameProfile;Lnet/minecraft/network/packet/c2s/common/SyncedClientOptions;)V" )) - public void onRespawnPlayer_forResawnLocationOverwrite( + public void onRespawnPlayer_forRespawnLocationOverwrite( CallbackInfoReturnable cir , @Local(ordinal = 0, argsOnly = true) ServerPlayerEntity oldServerPlayerEntity , @Local(ordinal = 0) LocalRef teleportTargetLocalRef @@ -122,7 +119,6 @@ public void onRespawnPlayer_forResawnLocationOverwrite( Vec3d.ZERO, 0, 0, - false, TeleportTarget.NO_OP )); }); diff --git a/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayNetworkHandlerMixin.java b/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayNetworkHandlerMixin.java index 6df96119..0fff4b45 100644 --- a/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayNetworkHandlerMixin.java +++ b/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayNetworkHandlerMixin.java @@ -3,6 +3,7 @@ import com.fibermc.essentialcommands.access.ServerPlayerEntityAccess; import com.fibermc.essentialcommands.playerdata.PlayerData; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -15,11 +16,13 @@ @Mixin(ServerPlayNetworkHandler.class) public class ServerPlayNetworkHandlerMixin { + @Unique private PlayerData getPlayerData() { var player = ((ServerPlayNetworkHandler) (Object) this).player; return ((ServerPlayerEntityAccess) player).ec$getPlayerData(); } + @Unique private void invokeActEvent(Packet packet) { getPlayerData().playerActEvent.invoker().onPlayerAct(packet); } diff --git a/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayerEntityMixin.java b/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayerEntityMixin.java index 8822f815..25625bfe 100644 --- a/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayerEntityMixin.java +++ b/src/main/java/com/fibermc/essentialcommands/mixin/ServerPlayerEntityMixin.java @@ -1,5 +1,7 @@ package com.fibermc.essentialcommands.mixin; +import java.util.Set; + import com.fibermc.essentialcommands.EssentialCommands; import com.fibermc.essentialcommands.access.ServerPlayerEntityAccess; import com.fibermc.essentialcommands.config.EssentialCommandsConfig; @@ -16,19 +18,15 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import net.minecraft.entity.Entity; import net.minecraft.entity.damage.DamageSource; -import net.minecraft.registry.RegistryKey; -import net.minecraft.server.PlayerManager; +import net.minecraft.network.packet.s2c.play.PositionFlag; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.world.GameMode; import net.minecraft.world.TeleportTarget; -import net.minecraft.world.World; -import net.minecraft.world.WorldProperties; import static com.fibermc.essentialcommands.EssentialCommands.BACKING_CONFIG; import static com.fibermc.essentialcommands.EssentialCommands.CONFIG; @@ -48,7 +46,7 @@ public void onDeath(DamageSource damageSource, CallbackInfo callbackInfo) { } @Inject(method = "damage", at = @At("RETURN")) - public void onDamage(DamageSource damageSource, float amount, CallbackInfoReturnable cir) { + public void onDamage(ServerWorld world, DamageSource damageSource, float amount, CallbackInfoReturnable cir) { // If damage was actually applied... if (cir.getReturnValue()) { PlayerDamageCallback.EVENT.invoker().onPlayerDamaged( @@ -63,26 +61,18 @@ public void onChangeGameMode(GameMode gameMode, CallbackInfoReturnable // ((ServerPlayerEntityAccess) this).getEcPlayerData().updatePlayer(((ServerPlayerEntity) (Object) this)); } - @Inject(method = "teleportTo(Lnet/minecraft/world/TeleportTarget;)Lnet/minecraft/entity/Entity;", at = @At( + @Inject(method = "teleportTo(Lnet/minecraft/world/TeleportTarget;)Lnet/minecraft/server/network/ServerPlayerEntity;", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;sendPlayerStatus(Lnet/minecraft/server/network/ServerPlayerEntity;)V" - ), locals = LocalCapture.CAPTURE_FAILSOFT) - public void onTeleportBetweenWorlds( - TeleportTarget teleportTarget, - CallbackInfoReturnable cir, - ServerWorld serverWorld, - ServerWorld serverWorld2, - RegistryKey registryKey, - WorldProperties worldProperties, - PlayerManager playerManager) - { - var playerData = ((ServerPlayerEntityAccess) this).ec$getPlayerData(); + )) + public void onTeleportBetweenWorlds(TeleportTarget teleportTarget, CallbackInfoReturnable cir) { + var playerData = this.ec$getPlayerData(); playerData.updatePlayerEntity((ServerPlayerEntity) (Object) this); } - @Inject(method = "worldChanged", at = @At(value = "RETURN"), locals = LocalCapture.CAPTURE_FAILSOFT) - public void onWorldChanged(ServerWorld origin, CallbackInfo ci, RegistryKey registryKey, RegistryKey registryKey2) { - var playerData = ((ServerPlayerEntityAccess) this).ec$getPlayerData(); + @Inject(method = "worldChanged", at = @At(value = "RETURN")) + public void onWorldChanged(ServerWorld origin, CallbackInfo ci) { + var playerData = this.ec$getPlayerData(); if (CONFIG.RECHECK_PLAYER_ABILITY_PERMISSIONS_ON_DIMENSION_CHANGE) { PlayerDataManager.getInstance().scheduleTask(playerData::clearAbilitiesWithoutPermisisons); } @@ -170,8 +160,8 @@ public void getPlayerListName(CallbackInfoReturnable cir) { } // Teleport hook (for /back) - @Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDFF)V", at = @At("HEAD")) - public void onTeleport(ServerWorld targetWorld, double x, double y, double z, float yaw, float pitch, CallbackInfo ci) { + @Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FFZ)Z", at = @At("HEAD")) + public void onTeleport(ServerWorld world, double destX, double destY, double destZ, Set flags, float yaw, float pitch, boolean resetCamera, CallbackInfoReturnable cir) { if (!isSpectator()) { this.ec$getPlayerData().setPreviousLocation(new MinecraftLocation((ServerPlayerEntity) (Object) this)); } diff --git a/src/main/java/com/fibermc/essentialcommands/mixin/TeleportCommandMixin.java b/src/main/java/com/fibermc/essentialcommands/mixin/TeleportCommandMixin.java index 57396c7a..9beac036 100644 --- a/src/main/java/com/fibermc/essentialcommands/mixin/TeleportCommandMixin.java +++ b/src/main/java/com/fibermc/essentialcommands/mixin/TeleportCommandMixin.java @@ -23,7 +23,7 @@ public class TeleportCommandMixin { @Inject(method = "teleport", - at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FF)Z") + at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FFZ)Z") ) private static void execute( ServerCommandSource source, @@ -35,9 +35,8 @@ private static void execute( @Coerce Object facingLocation, CallbackInfo ci ) throws CommandSyntaxException { - if (target instanceof ServerPlayerEntity) { + if (target instanceof ServerPlayerEntity targetPlayer) { // This cast is guaranteed to work because of where we inject. - var targetPlayer = (ServerPlayerEntity)target; var targetPlayerData = ((ServerPlayerEntityAccess)target).ec$getPlayerData(); if (!targetPlayer.isSpectator()) { targetPlayerData.setPreviousLocation(new MinecraftLocation(targetPlayer)); diff --git a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerData.java b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerData.java index 35edd4a5..a3cdfe92 100644 --- a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerData.java +++ b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerData.java @@ -1,6 +1,7 @@ package com.fibermc.essentialcommands.playerdata; import java.io.File; +import java.io.IOException; import java.util.*; import com.fibermc.essentialcommands.ECAbilitySources; @@ -29,6 +30,7 @@ import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtIo; import net.minecraft.registry.RegistryWrapper; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; @@ -515,7 +517,13 @@ public int setNickname(Text nickname) { } public void save(RegistryWrapper.WrapperLookup wrapperLookup) { - super.save(saveFile, wrapperLookup); + NbtCompound data = this.toNbt(wrapperLookup); + + try { + NbtIo.writeCompressed(data, this.saveFile.toPath()); + } catch (IOException e) { + EssentialCommands.LOGGER.error("Could not save data {}", this, e); + } } public void setTimeUsedRtp(int i) { diff --git a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java index fdc85abf..ad733475 100644 --- a/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java +++ b/src/main/java/com/fibermc/essentialcommands/playerdata/PlayerProfile.java @@ -1,10 +1,12 @@ package com.fibermc.essentialcommands.playerdata; import java.io.File; +import java.io.IOException; import java.util.AbstractMap.SimpleEntry; import java.util.Map; import java.util.Optional; +import com.fibermc.essentialcommands.EssentialCommands; import com.fibermc.essentialcommands.access.ServerPlayerEntityAccess; import com.fibermc.essentialcommands.types.IStyleProvider; import com.fibermc.essentialcommands.types.ProfileOption; @@ -18,6 +20,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtIo; import net.minecraft.registry.RegistryWrapper; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; @@ -139,7 +142,13 @@ public NbtCompound writeNbt(NbtCompound tag, RegistryWrapper.WrapperLookup wrapp } public void save(RegistryWrapper.WrapperLookup wrapperLookup) { - super.save(saveFile, wrapperLookup); + NbtCompound data = this.toNbt(wrapperLookup); + + try { + NbtIo.writeCompressed(data, this.saveFile.toPath()); + } catch (IOException e) { + EssentialCommands.LOGGER.error("Could not save data {}", this, e); + } } @Override diff --git a/src/main/java/com/fibermc/essentialcommands/teleportation/PlayerTeleporter.java b/src/main/java/com/fibermc/essentialcommands/teleportation/PlayerTeleporter.java index 8518093f..c5fcd85f 100644 --- a/src/main/java/com/fibermc/essentialcommands/teleportation/PlayerTeleporter.java +++ b/src/main/java/com/fibermc/essentialcommands/teleportation/PlayerTeleporter.java @@ -5,12 +5,15 @@ import com.fibermc.essentialcommands.playerdata.PlayerData; import com.fibermc.essentialcommands.types.MinecraftLocation; +import net.minecraft.network.packet.s2c.play.PositionFlag; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import dev.jpcode.eccore.util.TextUtil; +import java.util.Set; + import static com.fibermc.essentialcommands.EssentialCommands.CONFIG; public final class PlayerTeleporter { @@ -65,7 +68,8 @@ private static void execTeleport(ServerPlayerEntity playerEntity, MinecraftLocat playerEntity.teleport( targetWorld, dest.pos().x, dest.pos().y, dest.pos().z, - dest.headYaw(), dest.pitch() + Set.of(), dest.headYaw(), dest.pitch(), + false ); var playerAccess = ((ServerPlayerEntityAccess) playerEntity); diff --git a/src/main/java/com/fibermc/essentialcommands/util/EssentialsXParser.java b/src/main/java/com/fibermc/essentialcommands/util/EssentialsXParser.java index 4026ea49..a07244ef 100644 --- a/src/main/java/com/fibermc/essentialcommands/util/EssentialsXParser.java +++ b/src/main/java/com/fibermc/essentialcommands/util/EssentialsXParser.java @@ -114,9 +114,9 @@ public static Map> getWorldUids(MinecraftServer server) // bukkit/spigot/paper UID. Instead, we should be reading those mods' config files to // find the correct directory. Rn this will essentially (heh) always be wrong. var persistentStateManager = ((PersistentStateManagerInvoker) world.getPersistentStateManager()); - File uidFile = persistentStateManager.invokeGetFile("uid"); + File uidFile = persistentStateManager.invokeGetFile("uid").toFile(); if (!uidFile.exists()) { - uidFile = persistentStateManager.invokeGetFile("../uid"); + uidFile = persistentStateManager.invokeGetFile("../uid").toFile(); } try {