void translate(Class extends P> clazz, P packet, GeyserSession session) { + public
boolean translate(Class extends P> clazz, P packet, GeyserSession session) { try { if (MAP.containsKey(clazz)) { ((PacketTranslator
) MAP.get(clazz)).translate(packet, session);
+ return true;
}
} catch (NullPointerException ex) {
- GeyserLogger.DEFAULT.debug("Could not translate packet " + packet.getClass().getSimpleName());
- ex.printStackTrace();
+ GeyserLogger.DEFAULT.error("Could not translate packet " + packet.getClass().getSimpleName(), ex);
}
+ return false;
}
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java b/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java
index 88e142cd..b48483a4 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java
@@ -34,6 +34,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.Serv
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket;
+import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
@@ -50,11 +51,7 @@ import org.geysermc.connector.network.translators.block.BlockTranslator;
import org.geysermc.connector.network.translators.inventory.GenericInventoryTranslator;
import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
import org.geysermc.connector.network.translators.item.ItemTranslator;
-import org.geysermc.connector.network.translators.java.JavaChatTranslator;
-import org.geysermc.connector.network.translators.java.JavaDifficultyTranslator;
-import org.geysermc.connector.network.translators.java.JavaJoinGameTranslator;
-import org.geysermc.connector.network.translators.java.JavaRespawnTranslator;
-import org.geysermc.connector.network.translators.java.JavaTitleTranslator;
+import org.geysermc.connector.network.translators.java.*;
import org.geysermc.connector.network.translators.java.entity.*;
import org.geysermc.connector.network.translators.java.entity.player.JavaPlayerHealthTranslator;
import org.geysermc.connector.network.translators.java.entity.player.JavaPlayerPositionRotationTranslator;
@@ -62,6 +59,7 @@ import org.geysermc.connector.network.translators.java.entity.player.JavaPlayerS
import org.geysermc.connector.network.translators.java.entity.spawn.*;
import org.geysermc.connector.network.translators.java.scoreboard.JavaDisplayScoreboardTranslator;
import org.geysermc.connector.network.translators.java.scoreboard.JavaScoreboardObjectiveTranslator;
+import org.geysermc.connector.network.translators.java.scoreboard.JavaTeamTranslator;
import org.geysermc.connector.network.translators.java.scoreboard.JavaUpdateScoreTranslator;
import org.geysermc.connector.network.translators.java.window.JavaOpenWindowTranslator;
import org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator;
@@ -119,6 +117,7 @@ public class TranslatorsInit {
Registry.registerJava(ServerEntityRotationPacket.class, new JavaEntityRotationTranslator());
Registry.registerJava(ServerEntityHeadLookPacket.class, new JavaEntityHeadLookTranslator());
Registry.registerJava(ServerEntityMetadataPacket.class, new JavaEntityMetadataTranslator());
+ Registry.registerJava(ServerBossBarPacket.class, new JavaBossBarTranslator());
Registry.registerJava(ServerSpawnExpOrbPacket.class, new JavaSpawnExpOrbTranslator());
Registry.registerJava(ServerSpawnGlobalEntityPacket.class, new JavaSpawnGlobalEntityTranslator());
@@ -141,6 +140,7 @@ public class TranslatorsInit {
Registry.registerJava(ServerScoreboardObjectivePacket.class, new JavaScoreboardObjectiveTranslator());
Registry.registerJava(ServerDisplayScoreboardPacket.class, new JavaDisplayScoreboardTranslator());
Registry.registerJava(ServerUpdateScorePacket.class, new JavaUpdateScoreTranslator());
+ Registry.registerJava(ServerTeamPacket.class, new JavaTeamTranslator());
Registry.registerJava(ServerBlockChangePacket.class, new JavaBlockChangeTranslator());
Registry.registerJava(ServerMultiBlockChangePacket.class, new JavaMultiBlockChangeTranslator());
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java
index d74bb833..a09d0daa 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java
@@ -49,15 +49,17 @@ public class BedrockMovePlayerTranslator extends PacketTranslator
+ * Just like 1.8 but it doesn't care about which entity
+ */
+ private void addBossEntity(GeyserSession session, long entityId) {
+ AddEntityPacket addEntityPacket = new AddEntityPacket();
+ addEntityPacket.setUniqueEntityId(entityId);
+ addEntityPacket.setRuntimeEntityId(entityId);
+ addEntityPacket.setIdentifier("minecraft:creeper");
+ addEntityPacket.setEntityType(33);
+ addEntityPacket.setPosition(session.getPlayerEntity().getPosition());
+ addEntityPacket.setRotation(Vector3f.ZERO);
+ addEntityPacket.setMotion(Vector3f.ZERO);
+ addEntityPacket.getMetadata().put(EntityData.SCALE, 0.01F); // scale = 0 doesn't work?
+
+ session.getUpstream().sendPacket(addEntityPacket);
+ }
+
+ private void removeBossEntity(GeyserSession session, long entityId) {
+ RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket();
+ removeEntityPacket.setUniqueEntityId(entityId);
+
+ session.getUpstream().sendPacket(removeEntityPacket);
+ }
+}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityDestroyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityDestroyTranslator.java
index 55da3c73..06546323 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityDestroyTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityDestroyTranslator.java
@@ -36,7 +36,10 @@ public class JavaEntityDestroyTranslator extends PacketTranslator
+ * Only used in {@link Objective Objective}
+ */
+ UPDATE
+}
diff --git a/connector/src/main/java/org/geysermc/connector/utils/ProvidedSkinData.java b/connector/src/main/java/org/geysermc/connector/utils/ProvidedSkinData.java
deleted file mode 100644
index 9618edcd..00000000
--- a/connector/src/main/java/org/geysermc/connector/utils/ProvidedSkinData.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.geysermc.connector.utils;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import lombok.Getter;
-import org.apache.commons.codec.Charsets;
-
-import java.util.Base64;
-
-@Getter
-public class ProvidedSkinData {
- private static final Gson gson = new GsonBuilder().create();
- private String skinId;
- private String skinName;
- private String geometryId;
- private ObjectNode geometryData;
-
- public static ProvidedSkinData getProvidedSkin(String skinName) {
- try {
- ObjectMapper objectMapper = new ObjectMapper(new JsonFactory());
- return objectMapper.readValue(ProvidedSkinData.class.getClassLoader().getResource(skinName), ProvidedSkinData.class);
- } catch (Exception ex) {
- ex.printStackTrace();
- return null;
- }
- }
-
- public String getGeometryDataEncoded() {
- try {
- return new String(Base64.getEncoder().encode(geometryData.toString().getBytes(Charsets.UTF_8)));
- } catch (Exception ex) {
- ex.printStackTrace();
- return null;
- }
- }
-}
diff --git a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java
new file mode 100644
index 00000000..aab8574a
--- /dev/null
+++ b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java
@@ -0,0 +1,190 @@
+package org.geysermc.connector.utils;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.geysermc.api.Geyser;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.*;
+
+public class SkinProvider {
+ private static final ExecutorService executorService = Executors.newFixedThreadPool(14);
+ @Getter private static final Gson gson = new GsonBuilder().create();
+
+ private static Map