Fix clone trying to access null watcher

This commit is contained in:
libraryaddict 2020-05-21 20:48:14 +12:00
parent c387d7e66e
commit 8d5efcbe56
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 5 additions and 3 deletions

@ -212,7 +212,7 @@ public abstract class Disguise {
disguise.multiName = Arrays.copyOf(multiName, multiName.length);
disguise.setDynamicName(isDynamicName());
if (getWatcher() != null) {
if (getWatcher() != null && disguise.getWatcher() == null) {
disguise.setWatcher(getWatcher().clone(disguise));
}

@ -4,8 +4,6 @@ import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import lombok.Getter;
import lombok.Setter;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
@ -210,6 +208,10 @@ public class PlayerDisguise extends TargetedDisguise {
public PlayerDisguise clone() {
PlayerDisguise disguise = new PlayerDisguise();
if (getWatcher() != null) {
disguise.setWatcher(getWatcher().clone(disguise));
}
if (currentLookup == null && gameProfile != null) {
disguise.skinToUse = getSkin();
disguise.gameProfile = ReflectionManager