Don't add potioneffect when watcher already has a potion effect. Don't compare the length of custom name. But check if its null
This commit is contained in:
parent
aed3bbddf4
commit
8f2c5d6e54
@ -53,11 +53,12 @@ public class LivingWatcher extends FlagWatcher {
|
||||
}
|
||||
|
||||
public void addPotionEffect(PotionEffectType potionEffect) {
|
||||
if (hasPotionEffect(potionEffect))
|
||||
if (!hasPotionEffect(potionEffect)) {
|
||||
removePotionEffect(potionEffect);
|
||||
potionEffects.add(potionEffect.getId());
|
||||
sendPotionEffects();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingWatcher clone(Disguise disguise) {
|
||||
@ -115,7 +116,7 @@ public class LivingWatcher extends FlagWatcher {
|
||||
}
|
||||
|
||||
public boolean hasCustomName() {
|
||||
return getCustomName().length() > 0;
|
||||
return getCustomName() != null;
|
||||
}
|
||||
|
||||
public boolean hasPotionEffect(PotionEffectType type) {
|
||||
@ -148,8 +149,9 @@ public class LivingWatcher extends FlagWatcher {
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
if (name != null && name.length() > 64)
|
||||
if (name != null && name.length() > 64) {
|
||||
name = name.substring(0, 64);
|
||||
}
|
||||
setValue(10, name);
|
||||
sendData(10);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user