mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-25 03:42:45 +02: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);
|
setFoxFlag(32, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RandomDefaultValue
|
|
||||||
public Fox.Type getType() {
|
public Fox.Type getType() {
|
||||||
return Fox.Type.values()[getData(MetaIndex.FOX_TYPE)];
|
return Fox.Type.values()[getData(MetaIndex.FOX_TYPE)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RandomDefaultValue
|
||||||
public void setType(Fox.Type type) {
|
public void setType(Fox.Type type) {
|
||||||
setData(MetaIndex.FOX_TYPE, type.ordinal());
|
setData(MetaIndex.FOX_TYPE, type.ordinal());
|
||||||
sendData(MetaIndex.FOX_TYPE);
|
sendData(MetaIndex.FOX_TYPE);
|
||||||
|
@ -41,7 +41,6 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
((PlayerDisguise) getDisguise()).setNameVisible(nameVisible);
|
((PlayerDisguise) getDisguise()).setNameVisible(nameVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RandomDefaultValue
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return ((PlayerDisguise) getDisguise()).getName();
|
return ((PlayerDisguise) getDisguise()).getName();
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,11 @@ import java.lang.annotation.Target;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 31/12/2019.
|
* Created by libraryaddict on 31/12/2019.
|
||||||
|
* <p>
|
||||||
|
* This annotation should only be used on setter methods
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface RandomDefaultValue {
|
public @interface RandomDefaultValue {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,12 @@ public class CompileMethods {
|
|||||||
info.setReturnType(method.getReturnType().getName());
|
info.setReturnType(method.getReturnType().getName());
|
||||||
info.setRandomDefault(method.isAnnotationPresent(RandomDefaultValue.class));
|
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);
|
String s = new Gson().toJson(info);
|
||||||
|
|
||||||
if (methods.contains(s)) {
|
if (methods.contains(s)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user