diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 44d69aaeaef..ede584cb4f6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -58,8 +58,6 @@ public boolean handle(LoginPacket loginPacket) { return true; } - session.getUpstream().setPacketCodec(GeyserConnector.BEDROCK_PACKET_CODEC); - try { JSONObject chainData = (JSONObject) JSONValue.parse(loginPacket.getChainData().array()); JSONArray chainArray = (JSONArray) chainData.get("chain"); @@ -82,6 +80,7 @@ public boolean handle(LoginPacket loginPacket) { ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket(); session.getUpstream().sendPacketImmediately(resourcePacksInfo); + return true; } 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 e6136352f72..a1b9b11a68e 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 @@ -25,6 +25,7 @@ package org.geysermc.connector.network.session; +import com.github.steveice10.mc.auth.exception.request.RequestException; import com.github.steveice10.mc.protocol.MinecraftProtocol; import com.github.steveice10.packetlib.Client; import com.github.steveice10.packetlib.event.session.ConnectedEvent; 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 ca0af7eaf7c..7ec70ba670b 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 @@ -29,6 +29,7 @@ import com.flowpowered.math.vector.Vector3f; import com.flowpowered.math.vector.Vector3i; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; +import com.github.steveice10.mc.protocol.data.message.ChatFormat; import com.github.steveice10.mc.protocol.data.message.TranslationMessage; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; @@ -311,7 +312,7 @@ public static void addScoreboardPackets() { objective.setDisplaySlot(ScoreboardObjective.DisplaySlot.SIDEBAR); objective.setDisplayName(packet.getDisplayName().getFullText()); } else { - scoreboard.unregisterObjective(packet.getDisplayName().getFullText()); + scoreboard.unregisterObjective(packet.getName()); } scoreboard.onUpdate(); @@ -336,10 +337,10 @@ public static void addScoreboardPackets() { System.out.println(packet.getEntry() + " <-> objective = " + packet.getObjective() + " val " + packet.getValue()); switch (packet.getAction()) { case REMOVE: - objective.registerScore(packet.getObjective(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.REMOVE); + objective.registerScore(packet.getEntry(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.REMOVE); break; case ADD_OR_UPDATE: - objective.registerScore(packet.getObjective(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.SET); + objective.registerScore(packet.getEntry(), packet.getEntry(), packet.getValue(), SetScorePacket.Action.SET); break; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/Scoreboard.java index c3714f96995..72fecbd2635 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/Scoreboard.java @@ -30,6 +30,7 @@ import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket; import com.nukkitx.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; +import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; import java.util.Arrays; @@ -47,7 +48,10 @@ public class Scoreboard { private GeyserSession session; + @Getter + @Setter private long id; + private Map objectiveMap = new HashMap(); public Scoreboard(GeyserSession session) { @@ -101,7 +105,7 @@ public void onUpdate() { displayObjectivePacket.setObjectiveId(objective.getObjectiveName()); displayObjectivePacket.setDisplayName(objective.getDisplayName()); displayObjectivePacket.setCriteria("dummy"); - displayObjectivePacket.setDisplaySlot(ScoreboardObjective.DisplaySlot.SIDEBAR.name()); + displayObjectivePacket.setDisplaySlot("sidebar"); displayObjectivePacket.setSortOrder(1); session.getUpstream().sendPacket(displayObjectivePacket); @@ -110,7 +114,8 @@ public void onUpdate() { fakeMap.put(entry.getKey(), entry.getValue()); } - for (Score score : fakeMap.values()) { + for (String string : fakeMap.keySet()) { + Score score = fakeMap.get(string); ScoreInfo scoreInfo = new ScoreInfo(score.getScoreboardId(), objective.getObjectiveName(), score.getScore(), score.getFakeId()); SetScorePacket setScorePacket = new SetScorePacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/ScoreboardObjective.java b/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/ScoreboardObjective.java index d2178070a9c..d0a354bbd93 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/ScoreboardObjective.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/scoreboard/ScoreboardObjective.java @@ -84,16 +84,11 @@ public void setScore(String id, int value) { public void setScoreText(String id, String text) { if (scores.containsKey(id)) { - Score oldScore = scores.get(id); - oldScore.setAction(SetScorePacket.Action.REMOVE); - oldScore.setFakeId(id + "_old_changed"); - Score newScore = new Score(this, text); - newScore.setScore(oldScore.getScore()); + newScore.setScore(scores.get(id).getScore()); newScore.setFakeId(id); scores.remove(id); scores.put(id, newScore); - scores.put(id + "_old_changed", oldScore); } } diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 885e5cf7c47..a0794510cdd 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -20,6 +20,9 @@ remote: # The port of the remote (Java Edition) server port: 25565 online-mode: false + #Online Mode Credentials -Logicism + email: email@email.address + password: password # Relay the MOTD, player count and max players from the remote server ping-passthrough: false