Formatting

This commit is contained in:
TheMode 2021-06-06 04:48:43 +02:00
parent 5085f8fa58
commit 641ca02120
18 changed files with 37 additions and 31 deletions

View File

@ -1,6 +1,8 @@
package net.minestom.codegen.attribute; package net.minestom.codegen.attribute;
import com.google.gson.*; import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.squareup.javapoet.*; import com.squareup.javapoet.*;
import net.minestom.codegen.MinestomCodeGenerator; import net.minestom.codegen.MinestomCodeGenerator;
@ -135,13 +137,13 @@ public final class AttributeGenerator extends MinestomCodeGenerator {
// toString method // toString method
attributeClass.addMethod( attributeClass.addMethod(
MethodSpec.methodBuilder("toString") MethodSpec.methodBuilder("toString")
.addAnnotation(NotNull.class) .addAnnotation(NotNull.class)
.addAnnotation(Override.class) .addAnnotation(Override.class)
.returns(String.class) .returns(String.class)
// this resolves to [Namespace] // this resolves to [Namespace]
.addStatement("return \"[\" + this.id + \"]\"") .addStatement("return \"[\" + this.id + \"]\"")
.addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.PUBLIC)
.build() .build()
); );
// Creating ClampedAttribute // Creating ClampedAttribute
ClassName clampedAttributeClassName = ClassName.get("net.minestom.server.attribute", "ClampedAttribute"); ClassName clampedAttributeClassName = ClassName.get("net.minestom.server.attribute", "ClampedAttribute");

View File

@ -1,6 +1,8 @@
package net.minestom.codegen.entity; package net.minestom.codegen.entity;
import com.google.gson.*; import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.squareup.javapoet.*; import com.squareup.javapoet.*;
import net.minestom.codegen.MinestomCodeGenerator; import net.minestom.codegen.MinestomCodeGenerator;

View File

@ -1,6 +1,8 @@
package net.minestom.codegen.entity; package net.minestom.codegen.entity;
import com.google.gson.*; import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.squareup.javapoet.*; import com.squareup.javapoet.*;
import net.minestom.codegen.MinestomCodeGenerator; import net.minestom.codegen.MinestomCodeGenerator;

View File

@ -136,9 +136,9 @@ public final class FluidGenerator extends MinestomCodeGenerator {
String fluidName = fluid.get("name").getAsString(); String fluidName = fluid.get("name").getAsString();
fluidClass.addEnumConstant(fluidName, TypeSpec.anonymousClassBuilder( fluidClass.addEnumConstant(fluidName, TypeSpec.anonymousClassBuilder(
"$T.from($S)", "$T.from($S)",
namespaceIDClassName, namespaceIDClassName,
fluid.get("id").getAsString() fluid.get("id").getAsString()
).build() ).build()
); );
} }

View File

@ -284,7 +284,7 @@ public final class MaterialGenerator extends MinestomCodeGenerator {
.build() .build()
); );
if (ap.get("slot") != null) { if (ap.get("slot") != null) {
switch(ap.get("slot").getAsString()) { switch (ap.get("slot").getAsString()) {
case "head": { case "head": {
enumConst.addMethod( enumConst.addMethod(
MethodSpec.methodBuilder("isHelmet") MethodSpec.methodBuilder("isHelmet")