mirror of https://github.com/Minestom/Minestom.git
Merge branch 'master' of github.com:Minestom/Minestom into 1.17
This commit is contained in:
commit
905ddab484
|
@ -81,7 +81,7 @@ public final class PotionEffectGenerator extends MinestomCodeGenerator {
|
||||||
potionEffectClass.addMethod(
|
potionEffectClass.addMethod(
|
||||||
MethodSpec.methodBuilder("getId")
|
MethodSpec.methodBuilder("getId")
|
||||||
.returns(TypeName.SHORT)
|
.returns(TypeName.SHORT)
|
||||||
.addStatement("return (short) ordinal()")
|
.addStatement("return (short) (ordinal() + 1)")
|
||||||
.addModifiers(Modifier.PUBLIC)
|
.addModifiers(Modifier.PUBLIC)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -100,8 +100,8 @@ public final class PotionEffectGenerator extends MinestomCodeGenerator {
|
||||||
.returns(potionEffectClassName)
|
.returns(potionEffectClassName)
|
||||||
.addAnnotation(Nullable.class)
|
.addAnnotation(Nullable.class)
|
||||||
.addParameter(TypeName.SHORT, "id")
|
.addParameter(TypeName.SHORT, "id")
|
||||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
.beginControlFlow("if(id >= 1 && id < VALUES.length + 1)")
|
||||||
.addStatement("return VALUES[id]")
|
.addStatement("return VALUES[id - 1]")
|
||||||
.endControlFlow()
|
.endControlFlow()
|
||||||
.addStatement("return null")
|
.addStatement("return null")
|
||||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||||
|
|
|
@ -92,7 +92,7 @@ public enum PotionEffect implements Keyed {
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getId() {
|
public short getId() {
|
||||||
return (short) ordinal();
|
return (short) (ordinal() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -102,8 +102,8 @@ public enum PotionEffect implements Keyed {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PotionEffect fromId(short id) {
|
public static PotionEffect fromId(short id) {
|
||||||
if(id >= 0 && id < VALUES.length) {
|
if(id >= 1 && id < VALUES.length + 1) {
|
||||||
return VALUES[id];
|
return VALUES[id - 1];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue