Update to 1.14.1, first dev build. Other changes included.

This commit is contained in:
libraryaddict
2019-05-18 18:54:51 +12:00
parent 5208424373
commit a834190209
86 changed files with 1228 additions and 610 deletions

View File

@@ -23,8 +23,7 @@ public class PacketHandlerAnimation implements IPacketHandler {
public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer,
Entity entity) {
// Else if the disguise is attempting to send players a forbidden packet
if (disguise.getType().isMisc() || (sentPacket.getIntegers().read(1) == 2 && (!disguise.getType().isPlayer() ||
(DisguiseConfig.isBedPacketsEnabled() && ((PlayerWatcher) disguise.getWatcher()).isSleeping())))) {
if (disguise.getType().isMisc()) {
packets.clear();
}
}

View File

@@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
public class PacketHandlerBed implements IPacketHandler {
@Override
public PacketType[] getHandledPackets() {
return new PacketType[]{PacketType.Play.Server.BED};
return new PacketType[]{};
}
@Override

View File

@@ -25,18 +25,6 @@ public class PacketHandlerCollect implements IPacketHandler {
Entity entity) {
if (disguise.getType().isMisc()) {
packets.clear();
} else if (DisguiseConfig.isBedPacketsEnabled() && disguise.getType().isPlayer() &&
((PlayerWatcher) disguise.getWatcher()).isSleeping()) {
PacketContainer newPacket = new PacketContainer(PacketType.Play.Server.ANIMATION);
StructureModifier<Integer> mods = newPacket.getIntegers();
mods.write(0, disguise.getEntity().getEntityId());
mods.write(1, 3);
packets.clear();
packets.addPacket(newPacket);
packets.addPacket(sentPacket);
}
}
}

View File

@@ -240,15 +240,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
packets.addPacket(spawnPlayer);
if (DisguiseConfig.isBedPacketsEnabled() && ((PlayerWatcher) disguise.getWatcher()).isSleeping()) {
PacketContainer[] bedPackets = DisguiseUtilities.getBedPackets(
loc.clone().subtract(0, DisguiseUtilities.getYModifier(disguisedEntity, disguise), 0),
observer.getLocation(), ((PlayerDisguise) disguise));
for (PacketContainer packet : bedPackets) {
packets.addPacket(packet);
}
} else if (!selfDisguise) {
if (!selfDisguise) {
// Teleport the player back to where he's supposed to be
PacketContainer teleportPacket = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
@@ -336,7 +328,6 @@ public class PacketHandlerSpawn implements IPacketHandler {
.createSanitizedDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity),
disguise.getWatcher()));
} else if (disguise.getType().isMisc()) {
int objectId = disguise.getType().getObjectId();
int data = ((MiscDisguise) disguise).getData();
if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
@@ -351,11 +342,14 @@ public class PacketHandlerSpawn implements IPacketHandler {
data = ((((int) loc.getYaw() % 360) + 720 + 45) / 90) % 4;
}
Object nmsEntity = ReflectionManager.getNmsEntity(disguisedEntity);
Object entityType = ReflectionManager.getEntityType(disguise.getType().getEntityType());
Object[] params = new Object[]{disguisedEntity.getEntityId(), disguisedEntity.getUniqueId(), loc.getX(),
loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw(), entityType, data,
ReflectionManager.getVec3D(disguisedEntity.getVelocity())};
PacketContainer spawnEntity = ProtocolLibrary.getProtocolManager()
.createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, nmsEntity, objectId, data)
.createPacket(nmsEntity, objectId, data);
.createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, params).createPacket(params);
packets.addPacket(spawnEntity);
// If it's not the same type, then highly likely they have different velocity settings which we'd want to