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