9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Fix protocols (#534)

* Try to fix LMS

* Fix jade empty ender chest

* Remove useless code
This commit is contained in:
Lumine1909
2025-06-06 14:55:18 +08:00
committed by GitHub
parent 59856751ab
commit 9d32c5bd3d
2 changed files with 7 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.leavesmc.leaves.LeavesConfig;
@@ -67,9 +68,9 @@ public class LMSPasterProtocol implements LeavesProtocol {
private static void triggerCommand(ServerPlayer player, String playerName, String command) {
if (command.isEmpty()) {
LeavesLogger.LOGGER.warning(String.format("Player %s sent an empty command", playerName));
} else {
player.getBukkitEntity().performCommand(command);
return;
}
MinecraftServer.getServer().execute(() -> player.getBukkitEntity().performCommand(command));
}
@Override

View File

@@ -13,6 +13,7 @@ import net.minecraft.world.entity.vehicle.ContainerEntity;
import net.minecraft.world.inventory.PlayerEnderChestContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.EnderChestBlock;
import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.entity.EnderChestBlockEntity;
@@ -99,6 +100,9 @@ public enum ItemStorageExtensionProvider implements IServerExtensionProvider<Ite
case ContainerEntity containerEntity when containerEntity.getContainerLootTable() != null -> {
return List.of();
}
case EnderChestBlockEntity enderChest when request.getPlayer().getEnderChestInventory().isEmpty() -> {
return List.of();
}
default -> {
}
}