diff --git a/ap/pom.xml b/ap/pom.xml
new file mode 100644
index 000000000..7e263c0d1
--- /dev/null
+++ b/ap/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+
+ org.geysermc
+ geyser-parent
+ 1.4.1-SNAPSHOT
+
+
+ ap
+ 1.4.1-SNAPSHOT
+
\ No newline at end of file
diff --git a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java
new file mode 100644
index 000000000..52a6e3aae
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("org.geysermc.connector.network.translators.world.block.entity.BlockEntity")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class BlockEntityProcessor extends ClassProcessor {
+ public BlockEntityProcessor() {
+ super("org.geysermc.connector.network.translators.world.block.entity.BlockEntity");
+ }
+}
diff --git a/ap/src/main/java/org/geysermc/processor/ClassProcessor.java b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java
new file mode 100644
index 000000000..3531d8794
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+public class ClassProcessor extends AbstractProcessor {
+ private final String annotationClassName;
+
+ private Path outputPath;
+
+ private final List locations = new ArrayList<>();
+
+ public ClassProcessor(String annotationClassName) {
+ this.annotationClassName = annotationClassName;
+ }
+
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+
+ this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Initializing processor " + this.annotationClassName);
+
+ String outputFile = processingEnv.getOptions().get("metadataOutputFile");
+ if (outputFile != null && !outputFile.isEmpty()) {
+ this.outputPath = Paths.get(outputFile);
+ }
+ }
+
+ @Override
+ public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
+ if (!roundEnv.errorRaised()) {
+ complete();
+ }
+
+ return false;
+ }
+
+ if (!contains(annotations, this.annotationClassName)) {
+ return false;
+ }
+
+ for (Element element : roundEnv.getRootElements()) {
+ if (element.getKind() != ElementKind.CLASS) {
+ continue;
+ }
+
+ if (!contains(element.getAnnotationMirrors(), this.annotationClassName)) {
+ continue;
+ }
+
+ TypeElement typeElement = (TypeElement) element;
+ this.locations.add(typeElement.getQualifiedName().toString());
+ }
+ return true;
+ }
+
+ public boolean contains(Collection extends TypeElement> elements, String className) {
+ if (elements.isEmpty()) {
+ return false;
+ }
+
+ for (TypeElement element : elements) {
+ if (element.getQualifiedName().contentEquals(className)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean contains(List extends AnnotationMirror> elements, String className) {
+ if (elements.isEmpty()) {
+ return false;
+ }
+
+ for (AnnotationMirror element : elements) {
+ if (element.getAnnotationType().toString().equals(className)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void complete() {
+ try (BufferedWriter writer = this.createWriter()) {
+ for (String location : this.locations) {
+ writer.write(location);
+ writer.newLine();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+
+ this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Completed processing for " + this.annotationClassName);
+ }
+
+ private BufferedWriter createWriter() throws IOException {
+ if (this.outputPath != null) {
+ this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing " + this.annotationClassName + " to " + this.outputPath);
+ return Files.newBufferedWriter(this.outputPath);
+ }
+
+ FileObject obj = this.processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", this.annotationClassName);
+ this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing " + this.annotationClassName + " to " + obj.toUri());
+ return new BufferedWriter(obj.openWriter());
+ }
+}
diff --git a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java
new file mode 100644
index 000000000..3f9111155
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("org.geysermc.connector.network.translators.collision.CollisionRemapper")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class CollisionRemapperProcessor extends ClassProcessor {
+ public CollisionRemapperProcessor() {
+ super("org.geysermc.connector.network.translators.collision.CollisionRemapper");
+ }
+}
diff --git a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java
new file mode 100644
index 000000000..cbfd939c4
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("org.geysermc.connector.network.translators.ItemRemapper")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class ItemRemapperProcessor extends ClassProcessor {
+ public ItemRemapperProcessor() {
+ super("org.geysermc.connector.network.translators.ItemRemapper");
+ }
+}
diff --git a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java
new file mode 100644
index 000000000..cdfbcbe4a
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("org.geysermc.connector.network.translators.Translator")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class PacketTranslatorProcessor extends ClassProcessor {
+ public PacketTranslatorProcessor() {
+ super("org.geysermc.connector.network.translators.Translator");
+ }
+}
diff --git a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java
new file mode 100644
index 000000000..ee4b2ef45
--- /dev/null
+++ b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @author GeyserMC
+ * @link https://github.com/GeyserMC/Geyser
+ */
+
+package org.geysermc.processor;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("org.geysermc.connector.network.translators.sound.SoundHandler")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class SoundHandlerProcessor extends ClassProcessor {
+ public SoundHandlerProcessor() {
+ super("org.geysermc.connector.network.translators.sound.SoundHandler");
+ }
+}
diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml
index 0f13390d5..839b8982c 100644
--- a/bootstrap/bungeecord/pom.xml
+++ b/bootstrap/bungeecord/pom.xml
@@ -71,10 +71,6 @@
io.netty.channel.kqueue
org.geysermc.platform.bungeecord.shaded.io.netty.channel.kqueue
-
- org.reflections
- org.geysermc.platform.bungeecord.shaded.reflections
-
com.google.common
org.geysermc.platform.bungeecord.shaded.google.common
@@ -83,10 +79,6 @@
com.google.guava
org.geysermc.platform.bungeecord.shaded.google.guava
-
- org.dom4j
- org.geysermc.platform.bungeecord.shaded.dom4j
-
net.kyori
org.geysermc.platform.bungeecord.shaded.kyori
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 98a08ee31..6bbd1a0b6 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -29,6 +29,16 @@
https://repo.velocitypowered.com/snapshots/
+
+
+
+ org.geysermc
+ ap
+ 1.4.1-SNAPSHOT
+ provided
+
+
+
bungeecord
spigot
diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml
index 133ea7779..4277dc235 100644
--- a/bootstrap/spigot/pom.xml
+++ b/bootstrap/spigot/pom.xml
@@ -83,10 +83,6 @@
com.fasterxml.jackson
org.geysermc.platform.spigot.shaded.jackson
-
- org.reflections
- org.geysermc.platform.spigot.shaded.reflections
-
com.google.common
org.geysermc.platform.spigot.shaded.google.common
@@ -95,10 +91,6 @@
com.google.guava
org.geysermc.platform.spigot.shaded.google.guava
-
- org.dom4j
- org.geysermc.platform.spigot.shaded.dom4j
-
net.kyori
org.geysermc.platform.spigot.shaded.kyori
diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml
index e0f019152..77f4fe78a 100644
--- a/bootstrap/sponge/pom.xml
+++ b/bootstrap/sponge/pom.xml
@@ -69,10 +69,6 @@
it.unimi.dsi.fastutil
org.geysermc.platform.sponge.shaded.fastutil
-
- org.reflections
- org.geysermc.platform.sponge.shaded.reflections
-
com.google.common
org.geysermc.platform.sponge.shaded.google.common
@@ -81,10 +77,6 @@
com.google.guava
org.geysermc.platform.sponge.shaded.google.guava
-
- org.dom4j
- org.geysermc.platform.sponge.shaded.dom4j
-
net.kyori
org.geysermc.platform.sponge.shaded.kyori
diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java
index 551b0e584..1a25d2792 100644
--- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java
+++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java
@@ -30,6 +30,7 @@ import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
+import io.netty.util.ResourceLeakDetector;
import lombok.Getter;
import net.minecrell.terminalconsole.TerminalConsoleAppender;
import org.apache.logging.log4j.Level;
@@ -80,6 +81,10 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
private static final Map argsConfigKeys = new HashMap<>();
public static void main(String[] args) {
+ if (System.getProperty("io.netty.leakDetection.level") == null) {
+ ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance
+ }
+
GeyserStandaloneBootstrap bootstrap = new GeyserStandaloneBootstrap();
// Set defaults
boolean useGuiOpts = bootstrap.useGui;
diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml
index c67f5a628..5c12b6a46 100644
--- a/bootstrap/velocity/pom.xml
+++ b/bootstrap/velocity/pom.xml
@@ -65,10 +65,6 @@
it.unimi.dsi.fastutil
org.geysermc.platform.velocity.shaded.fastutil
-
- org.reflections
- org.geysermc.platform.velocity.shaded.reflections
-
com.google.common
org.geysermc.platform.velocity.shaded.google.common
@@ -77,10 +73,6 @@
com.google.guava
org.geysermc.platform.velocity.shaded.google.guava
-
- org.dom4j
- org.geysermc.platform.velocity.shaded.dom4j
-
net.kyori.adventure.text.serializer.gson.legacyimpl
org.geysermc.platform.velocity.shaded.kyori.legacyimpl
diff --git a/connector/pom.xml b/connector/pom.xml
index 6849066d9..e6cc1c302 100644
--- a/connector/pom.xml
+++ b/connector/pom.xml
@@ -18,6 +18,12 @@
+
+ org.geysermc
+ ap
+ 1.4.1-SNAPSHOT
+ provided
+
org.geysermc
common
@@ -207,18 +213,6 @@
osx-x86_64
-
- org.reflections
- reflections
- 0.9.11
- compile
-
-
- org.dom4j
- dom4j
- 2.1.3
- compile
-
net.kyori
@@ -342,54 +336,6 @@
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.9.1
-
-
- process-classes
-
- execute
-
-
-
-
-
-
-
-
-
-
- org.reflections
- reflections
- 0.9.11
-
-
- org.dom4j
- dom4j
- 2.1.3
-
-
- org.codehaus.groovy
- groovy-all
- 3.0.5
- runtime
- pom
-
-
-
org.apache.maven.plugins
maven-surefire-plugin
diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
index 291f2d7e5..173e41573 100644
--- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
+++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
@@ -524,18 +524,6 @@ public class GeyserConnector {
return !"DEV".equals(GeyserConnector.VERSION);
}
- /**
- * Whether to use XML reflections in the jar or manually find the reflections.
- * Will return true if in production and the platform is not Fabric.
- * On Fabric - it complains about being unable to create a default XMLReader.
- * On other platforms this should only be true in compiled jars.
- *
- * @return whether to use XML reflections
- */
- public boolean useXmlReflections() {
- return !this.getPlatformType().equals(PlatformType.FABRIC) && isProductionEnvironment();
- }
-
public static GeyserConnector getInstance() {
return instance;
}
diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java
index 3c94f9de2..9aca12ba5 100644
--- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java
+++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java
@@ -114,7 +114,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
if (bedPosition != null) {
bedId = session.getConnector().getWorldManager().getBlockAt(session, bedPosition);
}
- String bedRotationZ = BlockRegistries.JAVA_IDENTIFIERS.get().inverse().get(bedId);
+ String bedRotationZ = BlockRegistries.JAVA_IDENTIFIERS.get().get(bedId);
setRotation(rotation);
setOnGround(isOnGround);
this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ);
diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
index ad2e6d6c6..8f71e6fa8 100644
--- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
+++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java
@@ -560,8 +560,10 @@ public class GeyserSession implements CommandSender {
}
loggingIn = true;
- // new thread so clients don't timeout
- new Thread(() -> {
+
+ // Use a future to prevent timeouts as all the authentication is handled sync
+ // This will be changed with the new protocol library.
+ CompletableFuture.supplyAsync(() -> {
try {
if (password != null && !password.isEmpty()) {
AuthenticationService authenticationService;
@@ -587,15 +589,14 @@ public class GeyserSession implements CommandSender {
protocol = new MinecraftProtocol(validUsername);
}
-
- connectDownstream();
} catch (InvalidCredentialsException | IllegalArgumentException e) {
connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username));
disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode()));
} catch (RequestException ex) {
ex.printStackTrace();
}
- }).start();
+ return null;
+ }).whenComplete((aVoid, ex) -> connectDownstream());
}
/**
@@ -608,28 +609,31 @@ public class GeyserSession implements CommandSender {
}
loggingIn = true;
+
+ // This just looks cool
+ SetTimePacket packet = new SetTimePacket();
+ packet.setTime(16000);
+ sendUpstreamPacket(packet);
+
// new thread so clients don't timeout
- new Thread(() -> {
+ MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID);
+
+ // Use a future to prevent timeouts as all the authentication is handled sync
+ // This will be changed with the new protocol library.
+ CompletableFuture.supplyAsync(() -> {
try {
- MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID);
-
- MsaAuthenticationService.MsCodeResponse response = msaAuthenticationService.getAuthCode();
- LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response);
-
- // This just looks cool
- SetTimePacket packet = new SetTimePacket();
- packet.setTime(16000);
- sendUpstreamPacket(packet);
-
- // Wait for the code to validate
- attemptCodeAuthentication(msaAuthenticationService);
- } catch (InvalidCredentialsException | IllegalArgumentException e) {
- connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", getAuthData().getName()));
- disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode()));
- } catch (RequestException ex) {
- ex.printStackTrace();
+ return msaAuthenticationService.getAuthCode();
+ } catch (RequestException e) {
+ throw new CompletionException(e);
}
- }).start();
+ }).whenComplete((response, ex) -> {
+ if (ex != null) {
+ ex.printStackTrace();
+ return;
+ }
+ LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response);
+ attemptCodeAuthentication(msaAuthenticationService);
+ });
}
/**
@@ -646,7 +650,7 @@ public class GeyserSession implements CommandSender {
connectDownstream();
} catch (RequestException e) {
if (!(e instanceof AuthPendingException)) {
- e.printStackTrace();
+ throw new RuntimeException("Failed to log in with Microsoft code!", e);
} else {
// Wait one second before trying again
connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS);
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java
index 2469f65da..d8f726223 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java
@@ -35,13 +35,12 @@ import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils;
-import org.reflections.Reflections;
-import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.Map;
public class PacketTranslatorRegistry {
- private final Map, PacketTranslator extends T>> translators = new HashMap<>();
+ private final Map, PacketTranslator extends T>> translators = new IdentityHashMap<>();
public static final PacketTranslatorRegistry JAVA_TRANSLATOR = new PacketTranslatorRegistry<>();
public static final PacketTranslatorRegistry BEDROCK_TRANSLATOR = new PacketTranslatorRegistry<>();
@@ -49,9 +48,7 @@ public class PacketTranslatorRegistry {
private static final ObjectArrayList> IGNORED_PACKETS = new ObjectArrayList<>();
static {
- Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections("org.geysermc.connector.network.translators") : new Reflections("org.geysermc.connector.network.translators");
-
- for (Class> clazz : ref.getTypesAnnotatedWith(Translator.class)) {
+ for (Class> clazz : FileUtils.getGeneratedClassesForAnnotation(Translator.class)) {
Class> packet = clazz.getAnnotation(Translator.class).packet();
GeyserConnector.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName());
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java
index 6e02d4c6b..589fa49d0 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java
@@ -232,7 +232,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator= 2 && session.getGameMode() == GameMode.CREATIVE) {
// Otherwise insufficient permissions
int blockState = session.getBlockMappings().getJavaBlockState(packet.getBlockRuntimeId());
- String blockName = BlockRegistries.JAVA_IDENTIFIERS.get().inverse().getOrDefault(blockState, "");
+ String blockName = BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(blockState, "");
// In the future this can be used for structure blocks too, however not all elements
// are available in each GUI
if (blockName.contains("jigsaw")) {
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java
index c116045cb..2603f2a0f 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java
@@ -178,7 +178,7 @@ public class BedrockActionTranslator extends PacketTranslator 1 && (javaBlockString[0].equals("minecraft:chest") || javaBlockString[0].equals("minecraft:trapped_chest"))
&& !javaBlockString[1].contains("type=single")) {
inventory.setHolderPosition(session.getLastInteractionBlockPosition());
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
index c4d098f79..0fdfc3cc7 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
@@ -43,7 +43,6 @@ import org.geysermc.connector.registry.type.ItemMapping;
import org.geysermc.connector.registry.type.ItemMappings;
import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LocaleUtils;
-import org.reflections.Reflections;
import java.util.*;
import java.util.stream.Collectors;
@@ -61,10 +60,8 @@ public abstract class ItemTranslator {
static {
/* Load item translators */
- Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections("org.geysermc.connector.network.translators.item") : new Reflections("org.geysermc.connector.network.translators.item");
-
Map loadedNbtItemTranslators = new HashMap<>();
- for (Class> clazz : ref.getTypesAnnotatedWith(ItemRemapper.class)) {
+ for (Class> clazz : FileUtils.getGeneratedClassesForAnnotation(ItemRemapper.class)) {
int priority = clazz.getAnnotation(ItemRemapper.class).priority();
GeyserConnector.getInstance().getLogger().debug("Found annotated item translator: " + clazz.getCanonicalName());
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java
index 5abe088a9..d144e99b8 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java
@@ -101,7 +101,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator JAVA_BLOCKS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
- public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(HashBiMap::create));
+ public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(Object2IntBiMap::new));
public static final SimpleMappedRegistry JAVA_CLEAN_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java
index e3adb2e16..5ad14cb5a 100644
--- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java
+++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java
@@ -58,9 +58,9 @@ import java.util.Set;
public class Registries {
public static final SimpleRegistry BIOMES = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT);
- public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity", BlockEntityRegistryLoader::new);
+ public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new);
- public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators", "mappings/collision.json"), CollisionRegistryLoader::new);
+ public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new);
public static final VersionedRegistry