Nametag fix for Replay, Tablist fix for replay
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
dbaaa938eb
Commit
f5d958286a
@ -52,8 +52,11 @@ public class REntity {
|
||||
@Getter
|
||||
protected final UUID uuid;
|
||||
|
||||
@Getter
|
||||
protected double x;
|
||||
@Getter
|
||||
protected double y;
|
||||
@Getter
|
||||
protected double z;
|
||||
private byte yaw;
|
||||
private byte pitch;
|
||||
@ -257,18 +260,6 @@ public class REntity {
|
||||
return isGlowing;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
private static int spawnPacketOffset() {
|
||||
switch (Core.getVersion()) {
|
||||
case 8:
|
||||
@ -309,6 +300,10 @@ public class REntity {
|
||||
return packet;
|
||||
}
|
||||
|
||||
void list(Consumer<Object> packetSink) {
|
||||
// empty for regular entity
|
||||
}
|
||||
|
||||
private static final Function<REntity, Object> livingSpawnPacketGenerator = Core.getVersion() >= 19 ? REntity::spawnPacketGenerator : entitySpawnPacketGenerator(ProtocolWrapper.spawnLivingPacket, Core.getVersion() == 8 ? 2 : 0);
|
||||
void spawn(Consumer<Object> packetSink) {
|
||||
if(entityType.isAlive()) {
|
||||
@ -365,6 +360,10 @@ public class REntity {
|
||||
packetSink.accept(packet);
|
||||
}
|
||||
|
||||
void delist(Consumer<Object> packetSink) {
|
||||
// empty for regular entity
|
||||
}
|
||||
|
||||
double x() {
|
||||
return x;
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ public class REntityServer implements Listener {
|
||||
void addEntity(REntity entity) {
|
||||
entityMap.put(entity.entityId, entity);
|
||||
addEntityToChunk(entity);
|
||||
entity.list(packet -> updateEntity(entity, packet));
|
||||
entity.spawn(packet -> updateEntity(entity, packet));
|
||||
}
|
||||
|
||||
@ -140,6 +141,7 @@ public class REntityServer implements Listener {
|
||||
|
||||
if(!entity.isHidden())
|
||||
onMissing(players.get(fromId), players.get(toId), entity::despawn);
|
||||
onMissing(players.get(fromId), players.get(toId), entity::delist);
|
||||
removeEntityFromChunk(entity);
|
||||
}
|
||||
|
||||
@ -150,6 +152,7 @@ public class REntityServer implements Listener {
|
||||
return;
|
||||
|
||||
addEntityToChunk(entity);
|
||||
onMissing(players.get(toId), players.get(fromId), entity::list);
|
||||
if(!entity.isHidden())
|
||||
onMissing(players.get(toId), players.get(fromId), entity::spawn);
|
||||
}
|
||||
@ -166,6 +169,7 @@ public class REntityServer implements Listener {
|
||||
void removeEntity(REntity entity) {
|
||||
entity.despawn(packet -> updateEntity(entity, packet));
|
||||
removeEntityFromChunk(entity);
|
||||
entity.delist(packet -> updateEntity(entity, packet));
|
||||
entityMap.remove(entity.entityId);
|
||||
}
|
||||
|
||||
@ -265,6 +269,7 @@ public class REntityServer implements Listener {
|
||||
long id = chunkToId(x, z);
|
||||
players.computeIfAbsent(id, i -> new HashSet<>()).add(player);
|
||||
for(REntity entity : entities.getOrDefault(id, emptyEntities)) {
|
||||
entity.list(packet -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
if(!entity.isHidden())
|
||||
entity.spawn(packet -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
}
|
||||
@ -281,6 +286,7 @@ public class REntityServer implements Listener {
|
||||
for(REntity entity : entities.getOrDefault(id, emptyEntities)) {
|
||||
if(!entity.isHidden())
|
||||
entity.despawn(packet -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
entity.delist(packet -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,21 +36,9 @@ import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Getter
|
||||
public class RPlayer extends REntity {
|
||||
|
||||
/*
|
||||
private static final String SCOREBOARD_TEAMNAME = "Replay";
|
||||
private static final Team team;
|
||||
|
||||
static {
|
||||
if(FightScoreboard.getBukkit().getTeam(SCOREBOARD_TEAMNAME) == null)
|
||||
team = FightScoreboard.getBukkit().registerNewTeam(SCOREBOARD_TEAMNAME);
|
||||
else
|
||||
team = FightScoreboard.getBukkit().getTeam(SCOREBOARD_TEAMNAME);
|
||||
team.setNameTagVisibility(NameTagVisibility.NEVER);
|
||||
}
|
||||
*/
|
||||
|
||||
private static int skinPartsIndex() {
|
||||
switch(Core.getVersion()) {
|
||||
case 8:
|
||||
@ -73,19 +61,21 @@ public class RPlayer extends REntity {
|
||||
|
||||
private static final Object skinPartsDataWatcher = BountifulWrapper.impl.getDataWatcherObject(skinPartsIndex(), Byte.class);
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
public RPlayer(REntityServer server, UUID uuid, String name, Location location) {
|
||||
super(server, EntityType.PLAYER, uuid, location,0);
|
||||
this.name = name;
|
||||
//team.addEntry(name);
|
||||
server.addEntity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
void spawn(Consumer<Object> packetSink) {
|
||||
void list(Consumer<Object> packetSink) {
|
||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(uuid, name), GameMode.CREATIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
void spawn(Consumer<Object> packetSink) {
|
||||
packetSink.accept(getNamedSpawnPacket());
|
||||
packetSink.accept(getDataWatcherPacket(skinPartsDataWatcher, (byte) 0x7F));
|
||||
|
||||
@ -97,9 +87,7 @@ public class RPlayer extends REntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
void despawn(Consumer<Object> packetSink) {
|
||||
//team.removeEntry(name);
|
||||
super.despawn(packetSink);
|
||||
void delist(Consumer<Object> packetSink) {
|
||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(uuid, name), GameMode.CREATIVE));
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren