mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2025-02-05 06:12:48 +00:00
This commit is contained in:
commit
62fb33547f
2 changed files with 16 additions and 2 deletions
|
@ -4,6 +4,7 @@ import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import me.libraryaddict.disguise.utilities.parser.RandomDefaultValue;
|
import me.libraryaddict.disguise.utilities.parser.RandomDefaultValue;
|
||||||
|
import me.libraryaddict.disguise.utilities.reflection.annotations.MethodOnlyUsedBy;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
|
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import org.bukkit.entity.Panda;
|
import org.bukkit.entity.Panda;
|
||||||
|
@ -19,11 +20,22 @@ public class PandaWatcher extends AgeableWatcher {
|
||||||
super(disguise);
|
super(disguise);
|
||||||
|
|
||||||
if (DisguiseConfig.isRandomDisguises()) {
|
if (DisguiseConfig.isRandomDisguises()) {
|
||||||
|
// We don't do 'setGene' here so it's just as random as it would be as if it was natural.
|
||||||
setMainGene(Panda.Gene.values()[new Random().nextInt(Panda.Gene.values().length)]);
|
setMainGene(Panda.Gene.values()[new Random().nextInt(Panda.Gene.values().length)]);
|
||||||
setHiddenGene(Panda.Gene.values()[new Random().nextInt(Panda.Gene.values().length)]);
|
setHiddenGene(Panda.Gene.values()[new Random().nextInt(Panda.Gene.values().length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Panda.Gene getGene() {
|
||||||
|
return getMainGene();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RandomDefaultValue
|
||||||
|
public void setGene(Panda.Gene gene) {
|
||||||
|
setMainGene(gene);
|
||||||
|
setHiddenGene(gene);
|
||||||
|
}
|
||||||
|
|
||||||
public Panda.Gene getMainGene() {
|
public Panda.Gene getMainGene() {
|
||||||
int id = getData(MetaIndex.PANDA_MAIN_GENE);
|
int id = getData(MetaIndex.PANDA_MAIN_GENE);
|
||||||
|
|
||||||
|
@ -38,7 +50,7 @@ public class PandaWatcher extends AgeableWatcher {
|
||||||
return Panda.Gene.NORMAL;
|
return Panda.Gene.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RandomDefaultValue
|
@MethodOnlyUsedBy(value = {}) // Hide from command
|
||||||
public void setMainGene(Panda.Gene gene) {
|
public void setMainGene(Panda.Gene gene) {
|
||||||
setData(MetaIndex.PANDA_MAIN_GENE, (byte) gene.ordinal());
|
setData(MetaIndex.PANDA_MAIN_GENE, (byte) gene.ordinal());
|
||||||
sendData(MetaIndex.PANDA_MAIN_GENE);
|
sendData(MetaIndex.PANDA_MAIN_GENE);
|
||||||
|
@ -58,7 +70,7 @@ public class PandaWatcher extends AgeableWatcher {
|
||||||
return Panda.Gene.NORMAL;
|
return Panda.Gene.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RandomDefaultValue
|
@MethodOnlyUsedBy(value = {}) // Hide from command
|
||||||
public void setHiddenGene(Panda.Gene gene) {
|
public void setHiddenGene(Panda.Gene gene) {
|
||||||
setData(MetaIndex.PANDA_HIDDEN_GENE, (byte) gene.ordinal());
|
setData(MetaIndex.PANDA_HIDDEN_GENE, (byte) gene.ordinal());
|
||||||
sendData(MetaIndex.PANDA_HIDDEN_GENE);
|
sendData(MetaIndex.PANDA_HIDDEN_GENE);
|
||||||
|
|
|
@ -681,6 +681,8 @@ public class DisguiseParser {
|
||||||
Entry<DisguisePerm, String> customDisguise = DisguiseConfig.getRawCustomDisguise(args[0]);
|
Entry<DisguisePerm, String> customDisguise = DisguiseConfig.getRawCustomDisguise(args[0]);
|
||||||
|
|
||||||
if (customDisguise != null) {
|
if (customDisguise != null) {
|
||||||
|
// TODO Doesn't this mean we can't add args to our custom disguise on /disguise?
|
||||||
|
// Need to add user defined args for the custom disguise
|
||||||
args = DisguiseUtilities.split(customDisguise.getValue());
|
args = DisguiseUtilities.split(customDisguise.getValue());
|
||||||
name = customDisguise.getKey().toReadable();
|
name = customDisguise.getKey().toReadable();
|
||||||
customName = true;
|
customName = true;
|
||||||
|
|
Loading…
Reference in a new issue