mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
Merge pull request #535 from CivMC/fixbeds
Revert "Discard entities before adding NPCs"
This commit is contained in:
@@ -33,7 +33,7 @@ public class NpcPlayer extends ServerPlayer {
|
||||
public static NpcPlayer valueOf(Player player) {
|
||||
MinecraftServer minecraftServer = MinecraftServer.getServer();
|
||||
ServerLevel worldServer = ((CraftWorld) player.getWorld()).getHandle();
|
||||
GameProfile gameProfile = new GameProfile(player.getUniqueId(), NpcNameGeneratorFactory.getNameGenerator().generate(player));
|
||||
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), NpcNameGeneratorFactory.getNameGenerator().generate(player));
|
||||
ClientInformation clientInformation = ((CraftPlayer) player).getHandle().clientInformation();
|
||||
|
||||
for (Map.Entry<String, Property> entry: ((CraftPlayer) player).getProfile().getProperties().entries()) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.food.FoodData;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -51,12 +50,7 @@ public class NpcPlayerHelperImpl implements NpcPlayerHelper {
|
||||
serverPlayer.connection.send(packet);
|
||||
}
|
||||
|
||||
Entity oldPlayer = worldServer.getEntity(player.getUniqueId());
|
||||
|
||||
if (oldPlayer != null) {
|
||||
oldPlayer.remove(Entity.RemovalReason.DISCARDED);
|
||||
worldServer.addFreshEntity(npcPlayer);
|
||||
}
|
||||
worldServer.addFreshEntity(npcPlayer);
|
||||
|
||||
return npcPlayer.getBukkitEntity();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user