mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-13 10:25:14 +01:00
Fix rainbow wool on sheep self disguises not working
This commit is contained in:
parent
16c294ae6f
commit
7cff37eebc
@ -855,8 +855,8 @@ public abstract class Disguise {
|
||||
}
|
||||
|
||||
// Sometimes someone may set the custom name stuff on the actual player... Normally harmless, until I come along..
|
||||
if (getEntity() instanceof Player && !getWatcher().hasCustomName() && !getWatcher().isUpsideDown() &&
|
||||
(!(getWatcher() instanceof SheepWatcher) || !((SheepWatcher) getWatcher()).isRainbowWool())) {
|
||||
if (getEntity() instanceof Player && !getWatcher().hasCustomName() && !isUpsideDown() &&
|
||||
!(getWatcher() instanceof SheepWatcher && ((SheepWatcher) getWatcher()).isRainbowWool())) {
|
||||
getWatcher().setInteralCustomName("");
|
||||
getWatcher().setInternalCustomNameVisible(false);
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.bukkit.DyeColor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class SheepWatcher extends AgeableWatcher {
|
||||
|
||||
public SheepWatcher(Disguise disguise) {
|
||||
@ -28,7 +32,22 @@ public class SheepWatcher extends AgeableWatcher {
|
||||
}
|
||||
|
||||
public boolean isRainbowWool() {
|
||||
return "jeb_".equals(getCustomName());
|
||||
if (!NmsVersion.v1_13.isSupported()) {
|
||||
if (!hasValue(MetaIndex.ENTITY_CUSTOM_NAME_OLD)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return "jeb_".equals(getData(MetaIndex.ENTITY_CUSTOM_NAME_OLD));
|
||||
}
|
||||
|
||||
if (!hasValue(MetaIndex.ENTITY_CUSTOM_NAME)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<WrappedChatComponent> optional = getData(MetaIndex.ENTITY_CUSTOM_NAME);
|
||||
|
||||
return optional.filter(wrappedChatComponent -> "{\"text\":\"jeb_\"}".equals(wrappedChatComponent.getJson())).isPresent();
|
||||
|
||||
}
|
||||
|
||||
public void setRainbowWool(boolean rainbow) {
|
||||
|
Loading…
Reference in New Issue
Block a user