mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-14 15:26:54 +01:00
Allow unignition of creeper disguise
This commit is contained in:
parent
4b40a67b00
commit
bd214728cd
@ -2,6 +2,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import org.bukkit.entity.Creeper;
|
||||
|
||||
public class CreeperWatcher extends InsentientWatcher {
|
||||
|
||||
@ -13,13 +15,23 @@ public class CreeperWatcher extends InsentientWatcher {
|
||||
return getData(MetaIndex.CREEPER_IGNITED);
|
||||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
return getData(MetaIndex.CREEPER_POWERED);
|
||||
}
|
||||
|
||||
public void setIgnited(boolean ignited) {
|
||||
// If creeper is already ignited and they want to set it to unignited, then resend disguise
|
||||
boolean resend = !ignited && getDisguise() != null && getDisguise().isDisguiseInUse() &&
|
||||
((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
|
||||
(getDisguise().getEntity() instanceof Creeper &&
|
||||
((Creeper) getDisguise().getEntity()).isPowered()));
|
||||
|
||||
setData(MetaIndex.CREEPER_IGNITED, ignited);
|
||||
sendData(MetaIndex.CREEPER_IGNITED);
|
||||
|
||||
if (resend) {
|
||||
DisguiseUtilities.refreshTrackers(getDisguise());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
return getData(MetaIndex.CREEPER_POWERED);
|
||||
}
|
||||
|
||||
public void setPowered(boolean powered) {
|
||||
|
Loading…
Reference in New Issue
Block a user