Added new constructor for MiscDisguise, fixed potential issue in packet editing
This commit is contained in:
parent
d252e5f60f
commit
ce9697b1ab
@ -18,6 +18,10 @@ public class MiscDisguise extends Disguise {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType, boolean replaceSounds) {
|
||||
this(disguiseType, replaceSounds, -1, -1);
|
||||
}
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType, int id, int data) {
|
||||
this(disguiseType, true, id, data);
|
||||
}
|
||||
|
@ -65,7 +65,10 @@ public class LibsDisguises extends JavaPlugin implements Listener {
|
||||
if (DisguiseAPI.isDisguised(entity)) {
|
||||
Disguise disguise = DisguiseAPI.getDisguise(entity);
|
||||
if (event.getPacketID() == Packets.Server.ENTITY_METADATA) {
|
||||
mods.write(1, disguise.getWatcher().convert((List<WatchableObject>) mods.read(1)));
|
||||
event.setPacket(event.getPacket().deepClone());
|
||||
mods.write(1,
|
||||
disguise.getWatcher()
|
||||
.convert((List<WatchableObject>) event.getPacket().getModifier().read(1)));
|
||||
} else if (event.getPacketID() == Packets.Server.NAMED_ENTITY_SPAWN) {
|
||||
if (disguise.getType().isPlayer()) {
|
||||
String name = (String) mods.read(1);
|
||||
|
Loading…
Reference in New Issue
Block a user