diff --git a/nicko-core/dependency-reduced-pom.xml b/nicko-core/dependency-reduced-pom.xml index 9070ca3..dbcbfbf 100644 --- a/nicko-core/dependency-reduced-pom.xml +++ b/nicko-core/dependency-reduced-pom.xml @@ -78,10 +78,6 @@ spigot-repo https://hub.spigotmc.org/nexus/content/groups/public/ - - dmulloy2-repo - https://repo.dmulloy2.net/repository/public/ - codemc-snapshots https://repo.codemc.io/repository/maven-snapshots/ @@ -164,12 +160,6 @@ 3.1.0 compile - - com.comphenix.protocol - ProtocolLib - 5.0.0-SNAPSHOT - compile - 17 diff --git a/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java b/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java index 6d1b7ae..d3c55b5 100644 --- a/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java +++ b/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java @@ -1,7 +1,5 @@ package net.artelnatif.nicko; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; import de.studiocode.invui.gui.structure.Structure; import de.studiocode.invui.item.builder.ItemBuilder; import de.studiocode.invui.item.impl.SimpleItem; @@ -38,7 +36,6 @@ public class NickoBukkit extends JavaPlugin { private MojangAPI mojangAPI; private PlayerDataStore dataStore; private LocaleFileManager localeFileManager; - private ProtocolManager protocolManager; public NickoBukkit() { this.unitTesting = false; } @@ -97,7 +94,6 @@ public class NickoBukkit extends JavaPlugin { saveDefaultConfig(); config = new NickoConfiguration(this); dataStore = new PlayerDataStore(this); - protocolManager = ProtocolLibrary.getProtocolManager(); getLogger().info("Loading internals..."); if (getInternals() == null) { @@ -167,10 +163,6 @@ public class NickoBukkit extends JavaPlugin { return localeFileManager; } - public ProtocolManager getProtocolManager() { - return protocolManager; - } - public boolean isUnitTesting() { return unitTesting; } diff --git a/nicko-core/src/main/java/net/artelnatif/nicko/impl/InternalsProtocolLib.java b/nicko-core/src/main/java/net/artelnatif/nicko/impl/InternalsProtocolLib.java deleted file mode 100644 index 9697648..0000000 --- a/nicko-core/src/main/java/net/artelnatif/nicko/impl/InternalsProtocolLib.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.artelnatif.nicko.impl; - -import com.comphenix.protocol.ProtocolManager; -import net.artelnatif.nicko.NickoBukkit; - -public interface InternalsProtocolLib extends Internals { - default ProtocolManager getProtocolLib() { - return NickoBukkit.getInstance().getProtocolManager(); - } -} diff --git a/v1_19_R2/src/main/java/net/artelnatif/nicko/impl/v1_19_R2.java b/v1_19_R2/src/main/java/net/artelnatif/nicko/impl/v1_19_R2.java index ea6bf4d..dd22c27 100644 --- a/v1_19_R2/src/main/java/net/artelnatif/nicko/impl/v1_19_R2.java +++ b/v1_19_R2/src/main/java/net/artelnatif/nicko/impl/v1_19_R2.java @@ -94,12 +94,9 @@ public class v1_19_R2 implements Internals { Optional skin; final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); - final GameProfile gameProfile = serverPlayer.getGameProfile(); - final GameProfile newGameProfile = new GameProfile(player.getUniqueId(), profileName); + final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profileName); final ClientboundPlayerInfoRemovePacket remove = new ClientboundPlayerInfoRemovePacket(List.of(player.getUniqueId())); - // TODO: 1/20/23 Sets Gamemode to Survival but keeps the flying? Visual effect only? - //final ClientboundPlayerInfoUpdatePacket init = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(serverPlayer)); if (skinChange || changeOnlyName) { try { @@ -108,7 +105,7 @@ public class v1_19_R2 implements Internals { if (uuid.isPresent()) { skin = (reset ? mojang.getSkinWithoutCaching(uuid.get()) : mojang.getSkin(uuid.get())); if (skin.isPresent()) { - final PropertyMap properties = newGameProfile.getProperties(); + final PropertyMap properties = gameProfile.getProperties(); properties.removeAll("textures"); properties.put("textures", new Property("textures", skin.get().value(), skin.get().signature())); updateSelf(player); @@ -137,7 +134,7 @@ public class v1_19_R2 implements Internals { field.setAccessible(true); field.set(init, List.of(new ClientboundPlayerInfoUpdatePacket.Entry( player.getUniqueId(), - newGameProfile, + gameProfile, true, serverPlayer.latency, serverPlayer.gameMode.getGameModeForPlayer(), @@ -148,15 +145,10 @@ public class v1_19_R2 implements Internals { throw new RuntimeException(e); } - System.out.println("======= AFTER "); - System.out.println("init.entries().toString() = " + init.entries().toString()); - - serverPlayer.connection.send(remove); - serverPlayer.connection.send(init); Bukkit.getOnlinePlayers().forEach(online -> { - ServerPlayer onlineEntityPlayer = ((CraftPlayer) online).getHandle(); - onlineEntityPlayer.connection.send(remove); - onlineEntityPlayer.connection.send(init); + final ServerPlayer onlinePlayer = ((CraftPlayer) online).getHandle(); + onlinePlayer.connection.send(remove); + onlinePlayer.connection.send(init); }); updateOthers(player); return new ActionResult();