mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-13 15:16:50 +01:00
Fix Fox disguise type not saving the color properly as reported by rosa on discord
This commit is contained in:
parent
fe0628753f
commit
fa90946089
@ -47,11 +47,11 @@ public class FoxWatcher extends AgeableWatcher {
|
||||
setFoxFlag(32, value);
|
||||
}
|
||||
|
||||
@RandomDefaultValue
|
||||
public Fox.Type getType() {
|
||||
return Fox.Type.values()[getData(MetaIndex.FOX_TYPE)];
|
||||
}
|
||||
|
||||
@RandomDefaultValue
|
||||
public void setType(Fox.Type type) {
|
||||
setData(MetaIndex.FOX_TYPE, type.ordinal());
|
||||
sendData(MetaIndex.FOX_TYPE);
|
||||
|
@ -41,7 +41,6 @@ public class PlayerWatcher extends LivingWatcher {
|
||||
((PlayerDisguise) getDisguise()).setNameVisible(nameVisible);
|
||||
}
|
||||
|
||||
@RandomDefaultValue
|
||||
public String getName() {
|
||||
return ((PlayerDisguise) getDisguise()).getName();
|
||||
}
|
||||
|
@ -7,8 +7,11 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 31/12/2019.
|
||||
* <p>
|
||||
* This annotation should only be used on setter methods
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface RandomDefaultValue {
|
||||
|
||||
}
|
||||
|
@ -170,6 +170,12 @@ public class CompileMethods {
|
||||
info.setReturnType(method.getReturnType().getName());
|
||||
info.setRandomDefault(method.isAnnotationPresent(RandomDefaultValue.class));
|
||||
|
||||
if (info.isRandomDefault() && !"void".equals(info.getReturnType())) {
|
||||
throw new IllegalStateException(
|
||||
"@RandomDefaultValue is intended for use only on setter methods, " + info.getMethod() + " on " + c.getSimpleName() +
|
||||
" does not met this criteria!");
|
||||
}
|
||||
|
||||
String s = new Gson().toJson(info);
|
||||
|
||||
if (methods.contains(s)) {
|
||||
|
Loading…
Reference in New Issue
Block a user