diff --git a/commons/pom.xml b/commons/pom.xml index aa1ea8c..f7e75d9 100755 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -19,11 +19,5 @@ 1.13.2-R0.1-SNAPSHOT provided - - org.spigotmc - spigot - 1.7.10-R0.1-SNAPSHOT - provided - diff --git a/tinyprotocol/src/main/java/com/comphenix/tinyprotocol/Reflection.java b/commons/src/main/java/com/comphenix/tinyprotocol/Reflection.java similarity index 99% rename from tinyprotocol/src/main/java/com/comphenix/tinyprotocol/Reflection.java rename to commons/src/main/java/com/comphenix/tinyprotocol/Reflection.java index c2bbbec..acf0c5f 100755 --- a/tinyprotocol/src/main/java/com/comphenix/tinyprotocol/Reflection.java +++ b/commons/src/main/java/com/comphenix/tinyprotocol/Reflection.java @@ -1,7 +1,3 @@ -/* - * Copyright (c) 2018 Jitse Boonstra - */ - package com.comphenix.tinyprotocol; import org.bukkit.Bukkit; diff --git a/tinyprotocol/src/main/java/LegacyTinyProtocol.java b/commons/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java old mode 100644 new mode 100755 similarity index 94% rename from tinyprotocol/src/main/java/LegacyTinyProtocol.java rename to commons/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java index c3c54db..5623c08 --- a/tinyprotocol/src/main/java/LegacyTinyProtocol.java +++ b/commons/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java @@ -1,13 +1,11 @@ -/* - * Copyright (c) 2018 Jitse Boonstra - */ +package com.comphenix.tinyprotocol; -import Reflection.FieldAccessor; -import Reflection.MethodInvoker; -import com.comphenix.tinyprotocol.Reflection; +import com.comphenix.tinyprotocol.Reflection.FieldAccessor; +import com.comphenix.tinyprotocol.Reflection.MethodInvoker; import com.google.common.collect.Lists; import com.google.common.collect.MapMaker; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile; +import io.netty.channel.*; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -30,7 +28,7 @@ import java.util.logging.Level; * * @author Kristian */ -public abstract class LegacyTinyProtocol { +public abstract class TinyProtocol { private static final AtomicInteger ID = new AtomicInteger(0); // Used in order to lookup a channel @@ -73,13 +71,13 @@ public abstract class LegacyTinyProtocol { protected Plugin plugin; /** - * Construct a new instance of com.comphenix.tinyprotocol.TinyProtocol, and start intercepting packets for all connected clients and future clients. + * Construct a new instance of TinyProtocol, and start intercepting packets for all connected clients and future clients. *

* You can construct multiple instances per plugin. * * @param plugin - the plugin. */ - public LegacyTinyProtocol(final Plugin plugin) { + public TinyProtocol(final Plugin plugin) { this.plugin = plugin; // Compute handler name @@ -93,14 +91,14 @@ public abstract class LegacyTinyProtocol { registerPlayers(plugin); } catch (IllegalArgumentException ex) { // Damn you, late bind - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Delaying server channel injection due to late bind."); + plugin.getLogger().info("[TinyProtocol] Delaying server channel injection due to late bind."); new BukkitRunnable() { @Override public void run() { registerChannelHandler(); registerPlayers(plugin); - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Late bind injection successful."); + plugin.getLogger().info("[TinyProtocol] Late bind injection successful."); } }.runTask(plugin); } @@ -417,7 +415,7 @@ public abstract class LegacyTinyProtocol { } /** - * Determine if the given player has been injected by com.comphenix.tinyprotocol.TinyProtocol. + * Determine if the given player has been injected by TinyProtocol. * * @param player - the player. * @return TRUE if it is, FALSE otherwise. @@ -427,7 +425,7 @@ public abstract class LegacyTinyProtocol { } /** - * Determine if the given channel has been injected by com.comphenix.tinyprotocol.TinyProtocol. + * Determine if the given channel has been injected by TinyProtocol. * * @param channel - the channel. * @return TRUE if it is, FALSE otherwise. diff --git a/commons/src/main/java/net/jitse/npclib/api/NPC.java b/commons/src/main/java/net/jitse/npclib/api/NPC.java index 7b099e8..7856759 100755 --- a/commons/src/main/java/net/jitse/npclib/api/NPC.java +++ b/commons/src/main/java/net/jitse/npclib/api/NPC.java @@ -4,6 +4,8 @@ package net.jitse.npclib.api; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; import net.jitse.npclib.NPCManager; import net.jitse.npclib.events.NPCDestroyEvent; import net.jitse.npclib.events.NPCSpawnEvent; @@ -37,6 +39,7 @@ public abstract class NPC implements PacketHandler, ActionHandler { protected final List lines; protected JavaPlugin plugin; + protected GameProfile gameProfile; protected Location location; public NPC(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { @@ -48,6 +51,17 @@ public abstract class NPC implements PacketHandler, ActionHandler { NPCManager.add(this); } + protected GameProfile generateGameProfile(UUID uuid, String name) { + GameProfile gameProfile = new GameProfile(uuid, name); + + if (skin != null) { + gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + return gameProfile; + } + + public void destroy() { destroy(true); } diff --git a/commons/src/main/java/net/jitse/npclib/listeners/PacketListener.java b/commons/src/main/java/net/jitse/npclib/listeners/PacketListener.java index 453a11a..cb07d28 100755 --- a/commons/src/main/java/net/jitse/npclib/listeners/PacketListener.java +++ b/commons/src/main/java/net/jitse/npclib/listeners/PacketListener.java @@ -4,6 +4,9 @@ package net.jitse.npclib.listeners; +import com.comphenix.tinyprotocol.Reflection; +import com.comphenix.tinyprotocol.TinyProtocol; +import io.netty.channel.Channel; import net.jitse.npclib.NPCManager; import net.jitse.npclib.api.NPC; import net.jitse.npclib.events.NPCInteractEvent; @@ -11,9 +14,6 @@ import net.jitse.npclib.events.click.ClickType; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -import tinyprotocol.LegacyTinyProtocol; -import tinyprotocol.Reflection; -import tinyprotocol.TinyProtocol; import java.util.HashSet; import java.util.Set; @@ -35,75 +35,38 @@ public class PacketListener { private final Set delay = new HashSet<>(); public void start(JavaPlugin plugin) { - String versionName = plugin.getServer().getClass().getPackage().getName().split("\\.")[3]; - if (versionName.equals("v1_7_R4")) { - new LegacyTinyProtocol(plugin) { + new TinyProtocol(plugin) { - @Override - public Object onPacketInAsync(Player player, net.minecraft.util.io.netty.channel.Channel channel, Object packet) { + @Override + public Object onPacketInAsync(Player player, Channel channel, Object packet) { - if (packetPlayInUseEntityClazz.isInstance(packet)) { - NPC npc = NPCManager.getAllNPCs().stream().filter( - check -> check.isActuallyShown(player) && check.getEntityId() == (int) entityIdField.get(packet)) - .findFirst().orElse(null); + if (packetPlayInUseEntityClazz.isInstance(packet)) { + NPC npc = NPCManager.getAllNPCs().stream().filter( + check -> check.isActuallyShown(player) && check.getEntityId() == (int) entityIdField.get(packet)) + .findFirst().orElse(null); - if (npc == null) { - // Default player, not doing magic with the packet. - return super.onPacketInAsync(player, channel, packet); - } + if (npc == null) { + // Default player, not doing magic with the packet. + return super.onPacketInAsync(player, channel, packet); + } - if (delay.contains(player.getUniqueId())) { - return null; - } - - ClickType clickType = actionField.get(packet).toString() - .equals("ATTACK") ? ClickType.LEFT_CLICK : ClickType.RIGHT_CLICK; - - Bukkit.getPluginManager().callEvent(new NPCInteractEvent(player, clickType, npc)); - - UUID uuid = player.getUniqueId(); - delay.add(uuid); - Bukkit.getScheduler().runTask(plugin, () -> delay.remove(uuid)); + if (delay.contains(player.getUniqueId())) { return null; } - return super.onPacketInAsync(player, channel, packet); + ClickType clickType = actionField.get(packet).toString() + .equals("ATTACK") ? ClickType.LEFT_CLICK : ClickType.RIGHT_CLICK; + + Bukkit.getPluginManager().callEvent(new NPCInteractEvent(player, clickType, npc)); + + UUID uuid = player.getUniqueId(); + delay.add(uuid); + Bukkit.getScheduler().runTask(plugin, () -> delay.remove(uuid)); + return null; } - }; - } else { - new TinyProtocol(plugin) { - @Override - public Object onPacketInAsync(Player player, io.netty.channel.Channel channel, Object packet) { - - if (packetPlayInUseEntityClazz.isInstance(packet)) { - NPC npc = NPCManager.getAllNPCs().stream().filter( - check -> check.isActuallyShown(player) && check.getEntityId() == (int) entityIdField.get(packet)) - .findFirst().orElse(null); - - if (npc == null) { - // Default player, not doing magic with the packet. - return super.onPacketInAsync(player, channel, packet); - } - - if (delay.contains(player.getUniqueId())) { - return null; - } - - ClickType clickType = actionField.get(packet).toString() - .equals("ATTACK") ? ClickType.LEFT_CLICK : ClickType.RIGHT_CLICK; - - Bukkit.getPluginManager().callEvent(new NPCInteractEvent(player, clickType, npc)); - - UUID uuid = player.getUniqueId(); - delay.add(uuid); - Bukkit.getScheduler().runTask(plugin, () -> delay.remove(uuid)); - return null; - } - - return super.onPacketInAsync(player, channel, packet); - } - }; - } + return super.onPacketInAsync(player, channel, packet); + } + }; } } diff --git a/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java b/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java index 93d6e03..f6ae8cd 100755 --- a/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java +++ b/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.holograms; +import com.comphenix.tinyprotocol.Reflection; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; -import tinyprotocol.Reflection; import java.util.ArrayList; import java.util.HashSet; diff --git a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/NPC_v1_10_R1.java b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/NPC_v1_10_R1.java index 116c5da..b352b2d 100755 --- a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/NPC_v1_10_R1.java +++ b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/NPC_v1_10_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_10_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_10_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_10_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_10_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_10_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index 013edcd..86a6457 100755 --- a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_10_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index f93494d..3a81184 100755 --- a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_10_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_10_R1.DataWatcher; import net.minecraft.server.v1_10_R1.DataWatcherObject; import net.minecraft.server.v1_10_R1.DataWatcherRegistry; import net.minecraft.server.v1_10_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutPlayerInfoWrapper.java index 8eb3f76..d07e54a 100755 --- a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_10_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_10_R1.EnumGamemode; import net.minecraft.server.v1_10_R1.IChatBaseComponent; import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index 862f917..d8a643a 100755 --- a/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_10_R1/src/main/java/net/jitse/npclib/nms/v1_10_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,8 +4,8 @@ package net.jitse.npclib.nms.v1_10_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_10_R1.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/NPC_v1_11_R1.java b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/NPC_v1_11_R1.java index 604bd18..9cab2e7 100755 --- a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/NPC_v1_11_R1.java +++ b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/NPC_v1_11_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_11_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_11_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_11_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_11_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_11_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index afb2b71..6de5178 100755 --- a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_11_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 6f8bc62..d6e1cff 100755 --- a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_11_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_11_R1.DataWatcher; import net.minecraft.server.v1_11_R1.DataWatcherObject; import net.minecraft.server.v1_11_R1.DataWatcherRegistry; import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutPlayerInfoWrapper.java index 50cffa0..52413e5 100755 --- a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_11_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_11_R1.EnumGamemode; import net.minecraft.server.v1_11_R1.IChatBaseComponent; import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index 189cd28..957b4e5 100755 --- a/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_11_R1/src/main/java/net/jitse/npclib/nms/v1_11_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,8 +4,8 @@ package net.jitse.npclib.nms.v1_11_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/NPC_v1_12_R1.java b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/NPC_v1_12_R1.java index a68aad6..348bd9d 100755 --- a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/NPC_v1_12_R1.java +++ b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/NPC_v1_12_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_12_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_12_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_12_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_12_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_12_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index 5150f55..2abba78 100755 --- a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_12_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 4b523c0..323abde 100755 --- a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_12_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_12_R1.DataWatcher; import net.minecraft.server.v1_12_R1.DataWatcherObject; import net.minecraft.server.v1_12_R1.DataWatcherRegistry; import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutPlayerInfoWrapper.java index 5934af8..f13a0a4 100755 --- a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_12_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_12_R1.EnumGamemode; import net.minecraft.server.v1_12_R1.IChatBaseComponent; import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index c1a72fd..70a7b06 100755 --- a/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_12_R1/src/main/java/net/jitse/npclib/nms/v1_12_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,8 +4,8 @@ package net.jitse.npclib.nms.v1_12_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/NPC_v1_13_R1.java b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/NPC_v1_13_R1.java index 3f19b4e..b64b767 100755 --- a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/NPC_v1_13_R1.java +++ b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/NPC_v1_13_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_13_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_13_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -15,12 +13,12 @@ import net.jitse.npclib.nms.v1_13_R1.packets.PacketPlayOutScoreboardTeamWrapper; import net.jitse.npclib.skin.Skin; import net.minecraft.server.v1_13_R1.*; import org.bukkit.Bukkit; + import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +31,6 @@ public class NPC_v1_13_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_13_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +102,4 @@ public class NPC_v1_13_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index 54343a4..b9b91f7 100755 --- a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_13_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index e27bcb1..151619d 100755 --- a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_13_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R1.DataWatcher; import net.minecraft.server.v1_13_R1.DataWatcherObject; import net.minecraft.server.v1_13_R1.DataWatcherRegistry; import net.minecraft.server.v1_13_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutPlayerInfoWrapper.java index 298a164..578efb0 100755 --- a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_13_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_13_R1.EnumGamemode; import net.minecraft.server.v1_13_R1.IChatBaseComponent; import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerInfo; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index f6b4760..71b3bb0 100755 --- a/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_13_R1/src/main/java/net/jitse/npclib/nms/v1_13_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_13_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R1.ChatComponentText; import net.minecraft.server.v1_13_R1.IChatBaseComponent; import net.minecraft.server.v1_13_R1.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/.NPC_v1_13_R2.java.swp b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/.NPC_v1_13_R2.java.swp deleted file mode 100644 index 4de2afe..0000000 Binary files a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/.NPC_v1_13_R2.java.swp and /dev/null differ diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/NPC_v1_13_R2.java b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/NPC_v1_13_R2.java index 430b7e4..0efa24f 100755 --- a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/NPC_v1_13_R2.java +++ b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/NPC_v1_13_R2.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_13_R2; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_13_R2.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_13_R2 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_13_R2(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_13_R2 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java index 153de2d..cbfc542 100755 --- a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_13_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R2.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 3428361..e0ab83b 100755 --- a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_13_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R2.DataWatcher; import net.minecraft.server.v1_13_R2.DataWatcherObject; import net.minecraft.server.v1_13_R2.DataWatcherRegistry; import net.minecraft.server.v1_13_R2.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutPlayerInfoWrapper.java index 1062e71..79e1fbb 100755 --- a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_13_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_13_R2.EnumGamemode; import net.minecraft.server.v1_13_R2.IChatBaseComponent; import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutScoreboardTeamWrapper.java index 559569b..9beae2c 100755 --- a/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_13_R2/src/main/java/net/jitse/npclib/nms/v1_13_R2/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_13_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_13_R2.ChatComponentText; import net.minecraft.server.v1_13_R2.IChatBaseComponent; import net.minecraft.server.v1_13_R2.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_7_R4/pom.xml b/nms/v1_7_R4/pom.xml index a8da360..5324123 100755 --- a/nms/v1_7_R4/pom.xml +++ b/nms/v1_7_R4/pom.xml @@ -25,5 +25,11 @@ 2.8.5 compile + + io.netty + netty-all + 4.0.23.Final + compile + diff --git a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutEntityHeadRotationWrapper.java index eee28e8..a8af781 100755 --- a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_7_R4.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 094a6b6..95823a7 100755 --- a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_7_R4.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutPlayerInfoWrapper.java index de5002e..3673d16 100755 --- a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_7_R4.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; import net.minecraft.util.com.mojang.authlib.GameProfile; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutScoreboardTeamWrapper.java index 5be25bb..31002f1 100755 --- a/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_7_R4/src/main/java/net/jitse/npclib/nms/v1_7_R4/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_7_R4.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_7_R4.PacketPlayOutScoreboardTeam; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/NPC_v1_8_R1.java b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/NPC_v1_8_R1.java index c3f06c2..44987ec 100755 --- a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/NPC_v1_8_R1.java +++ b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/NPC_v1_8_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_8_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_8_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_8_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_8_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -104,14 +100,4 @@ public class NPC_v1_8_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index 2ad82c1..4d6eb40 100755 --- a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 51b544d..eac29db 100755 --- a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_8_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R1.DataWatcher; import net.minecraft.server.v1_8_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutPlayerInfoWrapper.java index da25dbc..283b46e 100755 --- a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_8_R1.*; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index 7d58571..e682a39 100755 --- a/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_8_R1/src/main/java/net/jitse/npclib/nms/v1_8_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R1.PacketPlayOutScoreboardTeam; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/NPC_v1_8_R2.java b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/NPC_v1_8_R2.java index a72645e..978f409 100755 --- a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/NPC_v1_8_R2.java +++ b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/NPC_v1_8_R2.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_8_R2; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_8_R2.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_8_R2 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_8_R2(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -104,14 +100,4 @@ public class NPC_v1_8_R2 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java index 90e8460..5ac6220 100755 --- a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R2.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 6ae1f99..f48b8c8 100755 --- a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_8_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R2.DataWatcher; import net.minecraft.server.v1_8_R2.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutPlayerInfoWrapper.java index 5391f9b..bca9688 100755 --- a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,11 +4,11 @@ package net.jitse.npclib.nms.v1_8_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_8_R2.IChatBaseComponent; import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R2.WorldSettings; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutScoreboardTeamWrapper.java index 4a34e33..89a6e7a 100755 --- a/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_8_R2/src/main/java/net/jitse/npclib/nms/v1_8_R2/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R2.PacketPlayOutScoreboardTeam; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/NPC_v1_8_R3.java b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/NPC_v1_8_R3.java index 39327b2..4a8af07 100755 --- a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/NPC_v1_8_R3.java +++ b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/NPC_v1_8_R3.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_8_R3; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_8_R3.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_8_R3 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_8_R3(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_8_R3 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutEntityHeadRotationWrapper.java index c402e3e..e50ebb9 100755 --- a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R3.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutNamedEntitySpawnWrapper.java index ba0d2d8..b23b72b 100755 --- a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,10 +4,10 @@ package net.jitse.npclib.nms.v1_8_R3.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutPlayerInfoWrapper.java index efa002f..3c411df 100755 --- a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,11 +4,11 @@ package net.jitse.npclib.nms.v1_8_R3.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.WorldSettings; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutScoreboardTeamWrapper.java index eba0912..3b6b53c 100755 --- a/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_8_R3/src/main/java/net/jitse/npclib/nms/v1_8_R3/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_8_R3.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/NPC_v1_9_R1.java b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/NPC_v1_9_R1.java index 33b5a5f..dd89e26 100755 --- a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/NPC_v1_9_R1.java +++ b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/NPC_v1_9_R1.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_9_R1; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_9_R1.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_9_R1 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_9_R1(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_9_R1 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java index 9533973..72b2a04 100755 --- a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_9_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java index af1ae34..d0a2504 100755 --- a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_9_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R1.DataWatcher; import net.minecraft.server.v1_9_R1.DataWatcherObject; import net.minecraft.server.v1_9_R1.DataWatcherRegistry; import net.minecraft.server.v1_9_R1.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutPlayerInfoWrapper.java index 3db1b63..43695c7 100755 --- a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_9_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_9_R1.IChatBaseComponent; import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_9_R1.WorldSettings; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutScoreboardTeamWrapper.java index 9bdac53..41e6873 100755 --- a/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_9_R1/src/main/java/net/jitse/npclib/nms/v1_9_R1/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,8 +4,8 @@ package net.jitse.npclib.nms.v1_9_R1.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R1.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/NPC_v1_9_R2.java b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/NPC_v1_9_R2.java index 7de3eea..d254033 100755 --- a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/NPC_v1_9_R2.java +++ b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/NPC_v1_9_R2.java @@ -4,8 +4,6 @@ package net.jitse.npclib.nms.v1_9_R2; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import net.jitse.npclib.api.NPC; import net.jitse.npclib.nms.holograms.Hologram; import net.jitse.npclib.nms.v1_9_R2.packets.PacketPlayOutEntityHeadRotationWrapper; @@ -20,7 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import java.util.List; -import java.util.UUID; /** * @author Jitse Boonstra @@ -33,7 +30,6 @@ public class NPC_v1_9_R2 extends NPC { private PacketPlayOutPlayerInfo packetPlayOutPlayerInfoAdd, packetPlayOutPlayerInfoRemove; private PacketPlayOutEntityHeadRotation packetPlayOutEntityHeadRotation; private PacketPlayOutEntityDestroy packetPlayOutEntityDestroy; - private GameProfile gameProfile; public NPC_v1_9_R2(JavaPlugin plugin, Skin skin, double autoHideDistance, List lines) { super(plugin, skin, autoHideDistance, lines); @@ -105,14 +101,4 @@ public class NPC_v1_9_R2 extends NPC { playerConnection.sendPacket(packetPlayOutScoreboardTeamUnregister); } } - - protected GameProfile generateGameProfile(UUID uuid, String name) { - GameProfile gameProfile = new GameProfile(uuid, name); - - if (skin != null) { - gameProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - return gameProfile; - } } diff --git a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java index 455c7ce..6b2d008 100755 --- a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java +++ b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutEntityHeadRotationWrapper.java @@ -4,9 +4,9 @@ package net.jitse.npclib.nms.v1_9_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R2.PacketPlayOutEntityHeadRotation; import org.bukkit.Location; -import tinyprotocol.Reflection; /** * @author Jitse Boonstra diff --git a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java index 5c79f9d..39f5a3c 100755 --- a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java +++ b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutNamedEntitySpawnWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_9_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R2.DataWatcher; import net.minecraft.server.v1_9_R2.DataWatcherObject; import net.minecraft.server.v1_9_R2.DataWatcherRegistry; import net.minecraft.server.v1_9_R2.PacketPlayOutNamedEntitySpawn; import org.bukkit.Location; -import tinyprotocol.Reflection; import java.util.UUID; diff --git a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutPlayerInfoWrapper.java b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutPlayerInfoWrapper.java index c5e2863..67afd64 100755 --- a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutPlayerInfoWrapper.java +++ b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutPlayerInfoWrapper.java @@ -4,12 +4,12 @@ package net.jitse.npclib.nms.v1_9_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import com.mojang.authlib.GameProfile; import net.minecraft.server.v1_9_R2.IChatBaseComponent; import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_9_R2.WorldSettings; import org.bukkit.ChatColor; -import tinyprotocol.Reflection; import java.util.List; diff --git a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutScoreboardTeamWrapper.java b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutScoreboardTeamWrapper.java index 6751de4..7856b63 100755 --- a/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutScoreboardTeamWrapper.java +++ b/nms/v1_9_R2/src/main/java/net/jitse/npclib/nms/v1_9_R2/packets/PacketPlayOutScoreboardTeamWrapper.java @@ -4,8 +4,8 @@ package net.jitse.npclib.nms.v1_9_R2.packets; +import com.comphenix.tinyprotocol.Reflection; import net.minecraft.server.v1_9_R2.PacketPlayOutScoreboardTeam; -import tinyprotocol.Reflection; import java.util.Collection; diff --git a/tinyprotocol-legacy/pom.xml b/tinyprotocol-legacy/pom.xml deleted file mode 100644 index f55b7c4..0000000 --- a/tinyprotocol-legacy/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - pom - - - net.jitse - npclib - 1.3 - - - npclib-tinyprotocol-legacy - - - - org.spigotmc - spigot - 1.7.10-R0.1-SNAPSHOT - provided - - - diff --git a/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/Reflection.java b/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/Reflection.java deleted file mode 100755 index eb52597..0000000 --- a/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/Reflection.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 2018 Jitse Boonstra - */ - -package net.comphenix.tinyprotocol; - -import org.bukkit.Bukkit; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * An utility class that simplifies reflection in Bukkit plugins. - * - * @author Kristian - */ -public final class Reflection { - /** - * An interface for invoking a specific constructor. - */ - public interface ConstructorInvoker { - /** - * Invoke a constructor for a specific class. - * - * @param arguments - the arguments to pass to the constructor. - * @return The constructed object. - */ - Object invoke(Object... arguments); - } - - /** - * An interface for invoking a specific method. - */ - public interface MethodInvoker { - /** - * Invoke a method on a specific target object. - * - * @param target - the target object, or NULL for a static method. - * @param arguments - the arguments to pass to the method. - * @return The return value, or NULL if is void. - */ - Object invoke(Object target, Object... arguments); - } - - /** - * An interface for retrieving the field content. - * - * @param - field type. - */ - public interface FieldAccessor { - /** - * Retrieve the content of a field. - * - * @param target - the target object, or NULL for a static field. - * @return The value of the field. - */ - T get(Object target); - - /** - * Set the content of a field. - * - * @param target - the target object, or NULL for a static field. - * @param value - the new value of the field. - */ - void set(Object target, Object value); - - /** - * Determine if the given object has this field. - * - * @param target - the object to test. - * @return TRUE if it does, FALSE otherwise. - */ - boolean hasField(Object target); - } - - // Deduce the net.minecraft.server.v* package - private static String OBC_PREFIX = Bukkit.getServer().getClass().getPackage().getName(); - private static String NMS_PREFIX = OBC_PREFIX.replace("org.bukkit.craftbukkit", "net.minecraft.server"); - private static String VERSION = OBC_PREFIX.replace("org.bukkit.craftbukkit", "").replace(".", ""); - - // Variable replacement - private static Pattern MATCH_VARIABLE = Pattern.compile("\\{([^}]+)\\}"); - - private Reflection() { - // Seal class - } - - /** - * Retrieve a field accessor for a specific field type and name. - * - * @param target - the target type. - * @param name - the name of the field, or NULL to ignore. - * @param fieldType - a compatible field type. - * @return The field accessor. - */ - public static FieldAccessor getField(Class target, String name, Class fieldType) { - return getField(target, name, fieldType, 0); - } - - /** - * Retrieve a field accessor for a specific field type and name. - * - * @param className - lookup name of the class, see {@link #getClass(String)}. - * @param name - the name of the field, or NULL to ignore. - * @param fieldType - a compatible field type. - * @return The field accessor. - */ - public static FieldAccessor getField(String className, String name, Class fieldType) { - return getField(getClass(className), name, fieldType, 0); - } - - /** - * Retrieve a field accessor for a specific field type and name. - * - * @param target - the target type. - * @param fieldType - a compatible field type. - * @param index - the number of compatible fields to skip. - * @return The field accessor. - */ - public static FieldAccessor getField(Class target, Class fieldType, int index) { - return getField(target, null, fieldType, index); - } - - /** - * Retrieve a field accessor for a specific field type and name. - * - * @param className - lookup name of the class, see {@link #getClass(String)}. - * @param fieldType - a compatible field type. - * @param index - the number of compatible fields to skip. - * @return The field accessor. - */ - public static FieldAccessor getField(String className, Class fieldType, int index) { - return getField(getClass(className), fieldType, index); - } - - // Common method - private static FieldAccessor getField(Class target, String name, Class fieldType, int index) { - for (final Field field : target.getDeclaredFields()) { - if ((name == null || field.getName().equals(name)) && fieldType.isAssignableFrom(field.getType()) && index-- <= 0) { - field.setAccessible(true); - - // A function for retrieving a specific field value - return new FieldAccessor() { - - @Override - @SuppressWarnings("unchecked") - public T get(Object target) { - try { - return (T) field.get(target); - } catch (IllegalAccessException e) { - throw new RuntimeException("Cannot access reflection.", e); - } - } - - @Override - public void set(Object target, Object value) { - try { - field.set(target, value); - } catch (IllegalAccessException e) { - throw new RuntimeException("Cannot access reflection.", e); - } - } - - @Override - public boolean hasField(Object target) { - // target instanceof DeclaringClass - return field.getDeclaringClass().isAssignableFrom(target.getClass()); - } - }; - } - } - - // Search in parent classes - if (target.getSuperclass() != null) - return getField(target.getSuperclass(), name, fieldType, index); - - throw new IllegalArgumentException("Cannot find field with type " + fieldType); - } - - /** - * Search for the first publicly and privately defined method of the given name and parameter count. - * - * @param className - lookup name of the class, see {@link #getClass(String)}. - * @param methodName - the method name, or NULL to skip. - * @param params - the expected parameters. - * @return An object that invokes this specific method. - * @throws IllegalStateException If we cannot find this method. - */ - public static MethodInvoker getMethod(String className, String methodName, Class... params) { - return getTypedMethod(getClass(className), methodName, null, params); - } - - /** - * Search for the first publicly and privately defined method of the given name and parameter count. - * - * @param clazz - a class to start with. - * @param methodName - the method name, or NULL to skip. - * @param params - the expected parameters. - * @return An object that invokes this specific method. - * @throws IllegalStateException If we cannot find this method. - */ - public static MethodInvoker getMethod(Class clazz, String methodName, Class... params) { - return getTypedMethod(clazz, methodName, null, params); - } - - /** - * Search for the first publicly and privately defined method of the given name and parameter count. - * - * @param clazz - a class to start with. - * @param methodName - the method name, or NULL to skip. - * @param returnType - the expected return type, or NULL to ignore. - * @param params - the expected parameters. - * @return An object that invokes this specific method. - * @throws IllegalStateException If we cannot find this method. - */ - public static MethodInvoker getTypedMethod(Class clazz, String methodName, Class returnType, Class... params) { - for (final Method method : clazz.getDeclaredMethods()) { - if ((methodName == null || method.getName().equals(methodName)) - && (returnType == null || method.getReturnType().equals(returnType)) - && Arrays.equals(method.getParameterTypes(), params)) { - method.setAccessible(true); - - return (target, arguments) -> { - try { - return method.invoke(target, arguments); - } catch (Exception e) { - throw new RuntimeException("Cannot invoke method " + method, e); - } - }; - } - } - - // Search in every superclass - if (clazz.getSuperclass() != null) - return getMethod(clazz.getSuperclass(), methodName, params); - - throw new IllegalStateException(String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params))); - } - - /** - * Search for the first publically and privately defined constructor of the given name and parameter count. - * - * @param className - lookup name of the class, see {@link #getClass(String)}. - * @param params - the expected parameters. - * @return An object that invokes this constructor. - * @throws IllegalStateException If we cannot find this method. - */ - public static ConstructorInvoker getConstructor(String className, Class... params) { - return getConstructor(getClass(className), params); - } - - /** - * Search for the first publicly and privately defined constructor of the given name and parameter count. - * - * @param clazz - a class to start with. - * @param params - the expected parameters. - * @return An object that invokes this constructor. - * @throws IllegalStateException If we cannot find this method. - */ - public static ConstructorInvoker getConstructor(Class clazz, Class... params) { - for (final Constructor constructor : clazz.getDeclaredConstructors()) { - if (Arrays.equals(constructor.getParameterTypes(), params)) { - constructor.setAccessible(true); - - return arguments -> { - try { - return constructor.newInstance(arguments); - } catch (Exception e) { - throw new RuntimeException("Cannot invoke constructor " + constructor, e); - } - }; - } - } - - throw new IllegalStateException(String.format("Unable to find constructor for %s (%s).", clazz, Arrays.asList(params))); - } - - /** - * Retrieve a class from its full name, without knowing its type on compile time. - *

- * This is useful when looking up fields by a NMS or OBC type. - *

- * - * @param lookupName - the class name with variables. - * @return The class. - * @see {@link #getClass()} for more information. - */ - public static Class getUntypedClass(String lookupName) { - @SuppressWarnings({"rawtypes", "unchecked"}) - Class clazz = (Class) getClass(lookupName); - return clazz; - } - - /** - * Retrieve a class from its full name. - *

- * Strings enclosed with curly brackets - such as {TEXT} - will be replaced according to the following table: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
VariableContent
{nms}Actual package name of net.minecraft.server.VERSION
{obc}Actual pacakge name of org.bukkit.craftbukkit.VERSION
{version}The current Minecraft package VERSION, if any.
- * - * @param lookupName - the class name with variables. - * @return The looked up class. - * @throws IllegalArgumentException If a variable or class could not be found. - */ - public static Class getClass(String lookupName) { - return getCanonicalClass(expandVariables(lookupName)); - } - - /** - * Retrieve a class in the net.minecraft.server.VERSION.* package. - * - * @param name - the name of the class, excluding the package. - * @throws IllegalArgumentException If the class doesn't exist. - */ - public static Class getMinecraftClass(String name) { - return getCanonicalClass(NMS_PREFIX + "." + name); - } - - /** - * Retrieve a class in the org.bukkit.craftbukkit.VERSION.* package. - * - * @param name - the name of the class, excluding the package. - * @throws IllegalArgumentException If the class doesn't exist. - */ - public static Class getCraftBukkitClass(String name) { - return getCanonicalClass(OBC_PREFIX + "." + name); - } - - /** - * Retrieve a class by its canonical name. - * - * @param canonicalName - the canonical name. - * @return The class. - */ - private static Class getCanonicalClass(String canonicalName) { - try { - return Class.forName(canonicalName); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException("Cannot find " + canonicalName, e); - } - } - - /** - * Expand variables such as "{nms}" and "{obc}" to their corresponding packages. - * - * @param name - the full name of the class. - * @return The expanded string. - */ - private static String expandVariables(String name) { - StringBuffer output = new StringBuffer(); - Matcher matcher = MATCH_VARIABLE.matcher(name); - - while (matcher.find()) { - String variable = matcher.group(1); - String replacement; - - // Expand all detected variables - if ("nms".equalsIgnoreCase(variable)) - replacement = NMS_PREFIX; - else if ("obc".equalsIgnoreCase(variable)) - replacement = OBC_PREFIX; - else if ("version".equalsIgnoreCase(variable)) - replacement = VERSION; - else - throw new IllegalArgumentException("Unknown variable: " + variable); - - // Assume the expanded variables are all packages, and append a dot - if (replacement.length() > 0 && matcher.end() < name.length() && name.charAt(matcher.end()) != '.') - replacement += "."; - matcher.appendReplacement(output, Matcher.quoteReplacement(replacement)); - } - - matcher.appendTail(output); - return output.toString(); - } -} \ No newline at end of file diff --git a/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/TinyProtocol.java b/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/TinyProtocol.java deleted file mode 100755 index 9fc2a39..0000000 --- a/tinyprotocol-legacy/src/main/java/net/comphenix/tinyprotocol/TinyProtocol.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2018 Jitse Boonstra - */ - -package net.comphenix.tinyprotocol; - -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; -import com.mojang.authlib.GameProfile; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitRunnable; - -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; - -/** - * Represents a very tiny alternative to ProtocolLib. - *

- * It now supports intercepting packets during login and status ping (such as OUT_SERVER_PING)! - * - * @author Kristian - */ -public abstract class TinyProtocol { - private static final AtomicInteger ID = new AtomicInteger(0); - - // Used in order to lookup a channel - private static final Reflection.MethodInvoker getPlayerHandle = Reflection.getMethod("{obc}.entity.CraftPlayer", "getHandle"); - private static final Reflection.FieldAccessor getConnection = Reflection.getField("{nms}.EntityPlayer", "playerConnection", Object.class); - private static final Reflection.FieldAccessor getManager = Reflection.getField("{nms}.PlayerConnection", "networkManager", Object.class); - private static final Reflection.FieldAccessor getChannel = Reflection.getField("{nms}.NetworkManager", Channel.class, 0); - - // Looking up ServerConnection - private static final Class minecraftServerClass = Reflection.getUntypedClass("{nms}.MinecraftServer"); - private static final Class serverConnectionClass = Reflection.getUntypedClass("{nms}.ServerConnection"); - private static final Reflection.FieldAccessor getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0); - private static final Reflection.FieldAccessor getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0); - private static final Reflection.MethodInvoker getNetworkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); - - // Packets we have to intercept - private static final Class PACKET_LOGIN_IN_START = Reflection.getMinecraftClass("PacketLoginInStart"); - private static final Reflection.FieldAccessor getGameProfile = Reflection.getField(PACKET_LOGIN_IN_START, GameProfile.class, 0); - - // Speedup channel lookup - private Map channelLookup = new MapMaker().weakValues().makeMap(); - private Listener listener; - - // Channels that have already been removed - private Set uninjectedChannels = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); - - // List of network markers - private List networkManagers; - - // Injected channel handlers - private List serverChannels = Lists.newArrayList(); - private ChannelInboundHandlerAdapter serverChannelHandler; - private ChannelInitializer beginInitProtocol; - private ChannelInitializer endInitProtocol; - - // Current handler name - private String handlerName; - - protected volatile boolean closed; - protected Plugin plugin; - - /** - * Construct a new instance of com.comphenix.tinyprotocol.TinyProtocol, and start intercepting packets for all connected clients and future clients. - *

- * You can construct multiple instances per plugin. - * - * @param plugin - the plugin. - */ - public TinyProtocol(final Plugin plugin) { - this.plugin = plugin; - - // Compute handler name - this.handlerName = getHandlerName(); - - // Prepare existing players - registerBukkitEvents(); - - try { - registerChannelHandler(); - registerPlayers(plugin); - } catch (IllegalArgumentException ex) { - // Damn you, late bind - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Delaying server channel injection due to late bind."); - - new BukkitRunnable() { - @Override - public void run() { - registerChannelHandler(); - registerPlayers(plugin); - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Late bind injection successful."); - } - }.runTask(plugin); - } - } - - private void createServerChannelHandler() { - // Handle connected channels - endInitProtocol = new ChannelInitializer() { - - @Override - protected void initChannel(Channel channel) throws Exception { - try { - // This can take a while, so we need to stop the main thread from interfering - synchronized (networkManagers) { - // Stop injecting channels - if (!closed) { - channel.eventLoop().submit(() -> injectChannelInternal(channel)); - } - } - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Cannot inject incomming channel " + channel, e); - } - } - - }; - - // This is executed before Minecraft's channel handler - beginInitProtocol = new ChannelInitializer() { - - @Override - protected void initChannel(Channel channel) throws Exception { - channel.pipeline().addLast(endInitProtocol); - } - - }; - - serverChannelHandler = new ChannelInboundHandlerAdapter() { - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - Channel channel = (Channel) msg; - - // Prepare to initialize ths channel - channel.pipeline().addFirst(beginInitProtocol); - ctx.fireChannelRead(msg); - } - - }; - } - - /** - * Register bukkit events. - */ - private void registerBukkitEvents() { - listener = new Listener() { - - @EventHandler(priority = EventPriority.LOWEST) - public final void onPlayerLogin(PlayerLoginEvent e) { - if (closed) - return; - - Channel channel = getChannel(e.getPlayer()); - - // Don't inject players that have been explicitly uninjected - if (!uninjectedChannels.contains(channel)) { - injectPlayer(e.getPlayer()); - } - } - - @EventHandler - public final void onPluginDisable(PluginDisableEvent e) { - if (e.getPlugin().equals(plugin)) { - close(); - } - } - - }; - - plugin.getServer().getPluginManager().registerEvents(listener, plugin); - } - - @SuppressWarnings("unchecked") - private void registerChannelHandler() { - Object mcServer = getMinecraftServer.get(Bukkit.getServer()); - Object serverConnection = getServerConnection.get(mcServer); - boolean looking = true; - - // We need to synchronize against this list - networkManagers = (List) getNetworkMarkers.invoke(null, serverConnection); - createServerChannelHandler(); - - // Find the correct list, or implicitly throw an exception - for (int i = 0; looking; i++) { - List list = Reflection.getField(serverConnection.getClass(), List.class, i).get(serverConnection); - - for (Object item : list) { - if (!ChannelFuture.class.isInstance(item)) - break; - - // Channel future that contains the server connection - Channel serverChannel = ((ChannelFuture) item).channel(); - - serverChannels.add(serverChannel); - serverChannel.pipeline().addFirst(serverChannelHandler); - looking = false; - } - } - } - - private void unregisterChannelHandler() { - if (serverChannelHandler == null) - return; - - for (Channel serverChannel : serverChannels) { - final ChannelPipeline pipeline = serverChannel.pipeline(); - - // Remove channel handler - serverChannel.eventLoop().execute(new Runnable() { - - @Override - public void run() { - try { - pipeline.remove(serverChannelHandler); - } catch (NoSuchElementException e) { - // That's fine - } - } - - }); - } - } - - private void registerPlayers(Plugin plugin) { - for (Player player : plugin.getServer().getOnlinePlayers()) { - injectPlayer(player); - } - } - - /** - * Invoked when the server is starting to send a packet to a player. - *

- * Note that this is not executed on the main thread. - * - * @param receiver - the receiving player, NULL for early login/status packets. - * @param channel - the channel that received the packet. Never NULL. - * @param packet - the packet being sent. - * @return The packet to send instead, or NULL to cancel the transmission. - */ - public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) { - return packet; - } - - /** - * Invoked when the server has received a packet from a given player. - *

- * Use {@link Channel#remoteAddress()} to get the remote address of the client. - * - * @param sender - the player that sent the packet, NULL for early login/status packets. - * @param channel - channel that received the packet. Never NULL. - * @param packet - the packet being received. - * @return The packet to recieve instead, or NULL to cancel. - */ - public Object onPacketInAsync(Player sender, Channel channel, Object packet) { - return packet; - } - - /** - * Send a packet to a particular player. - *

- * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param player - the destination player. - * @param packet - the packet to send. - */ - public void sendPacket(Player player, Object packet) { - sendPacket(getChannel(player), packet); - } - - /** - * Send a packet to a particular client. - *

- * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param channel - client identified by a channel. - * @param packet - the packet to send. - */ - public void sendPacket(Channel channel, Object packet) { - channel.pipeline().writeAndFlush(packet); - } - - /** - * Pretend that a given packet has been received from a player. - *

- * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param player - the player that sent the packet. - * @param packet - the packet that will be received by the server. - */ - public void receivePacket(Player player, Object packet) { - receivePacket(getChannel(player), packet); - } - - /** - * Pretend that a given packet has been received from a given client. - *

- * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param channel - client identified by a channel. - * @param packet - the packet that will be received by the server. - */ - public void receivePacket(Channel channel, Object packet) { - channel.pipeline().context("encoder").fireChannelRead(packet); - } - - /** - * Retrieve the name of the channel injector, default implementation is "tiny-" + plugin name + "-" + a unique ID. - *

- * Note that this method will only be invoked once. It is no longer necessary to override this to support multiple instances. - * - * @return A unique channel handler name. - */ - protected String getHandlerName() { - return "tiny-" + plugin.getName() + "-" + ID.incrementAndGet(); - } - - /** - * Add a custom channel handler to the given player's channel pipeline, allowing us to intercept sent and received packets. - *

- * This will automatically be called when a player has logged in. - * - * @param player - the player to inject. - */ - public void injectPlayer(Player player) { - injectChannelInternal(getChannel(player)).player = player; - } - - /** - * Add a custom channel handler to the given channel. - * - * @param channel - the channel to inject. - */ - public void injectChannel(Channel channel) { - injectChannelInternal(channel); - } - - /** - * Add a custom channel handler to the given channel. - * - * @param channel - the channel to inject. - * @return The packet interceptor. - */ - private PacketInterceptor injectChannelInternal(Channel channel) { - try { - PacketInterceptor interceptor = (PacketInterceptor) channel.pipeline().get(handlerName); - - // Inject our packet interceptor - if (interceptor == null) { - interceptor = new PacketInterceptor(); - channel.pipeline().addBefore("packet_handler", handlerName, interceptor); - uninjectedChannels.remove(channel); - } - - return interceptor; - } catch (IllegalArgumentException e) { - // Try again - return (PacketInterceptor) channel.pipeline().get(handlerName); - } - } - - /** - * Retrieve the Netty channel associated with a player. This is cached. - * - * @param player - the player. - * @return The Netty channel. - */ - public Channel getChannel(Player player) { - Channel channel = channelLookup.get(player.getName()); - - // Lookup channel again - if (channel == null) { - Object connection = getConnection.get(getPlayerHandle.invoke(player)); - Object manager = getManager.get(connection); - - channelLookup.put(player.getName(), channel = getChannel.get(manager)); - } - - return channel; - } - - /** - * Uninject a specific player. - * - * @param player - the injected player. - */ - public void uninjectPlayer(Player player) { - uninjectChannel(getChannel(player)); - } - - /** - * Uninject a specific channel. - *

- * This will also disable the automatic channel injection that occurs when a player has properly logged in. - * - * @param channel - the injected channel. - */ - public void uninjectChannel(final Channel channel) { - // No need to guard against this if we're closing - if (!closed) { - uninjectedChannels.add(channel); - } - - // See ChannelInjector in ProtocolLib, line 590 - channel.eventLoop().execute(() -> channel.pipeline().remove(handlerName)); - } - - /** - * Determine if the given player has been injected by com.comphenix.tinyprotocol.TinyProtocol. - * - * @param player - the player. - * @return TRUE if it is, FALSE otherwise. - */ - public boolean hasInjected(Player player) { - return hasInjected(getChannel(player)); - } - - /** - * Determine if the given channel has been injected by com.comphenix.tinyprotocol.TinyProtocol. - * - * @param channel - the channel. - * @return TRUE if it is, FALSE otherwise. - */ - public boolean hasInjected(Channel channel) { - return channel.pipeline().get(handlerName) != null; - } - - /** - * Cease listening for packets. This is called automatically when your plugin is disabled. - */ - public final void close() { - if (!closed) { - closed = true; - - // Remove our handlers - for (Player player : plugin.getServer().getOnlinePlayers()) { - uninjectPlayer(player); - } - - // Clean up Bukkit - HandlerList.unregisterAll(listener); - unregisterChannelHandler(); - } - } - - /** - * Channel handler that is inserted into the player's channel pipeline, allowing us to intercept sent and received packets. - * - * @author Kristian - */ - private final class PacketInterceptor extends ChannelDuplexHandler { - // Updated by the login event - public volatile Player player; - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - // Intercept channel - final Channel channel = ctx.channel(); - handleLoginStart(channel, msg); - - try { - msg = onPacketInAsync(player, channel, msg); - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Error in onPacketInAsync().", e); - } - - if (msg != null) { - super.channelRead(ctx, msg); - } - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - try { - msg = onPacketOutAsync(player, ctx.channel(), msg); - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Error in onPacketOutAsync().", e); - } - - if (msg != null) { - super.write(ctx, msg, promise); - } - } - - private void handleLoginStart(Channel channel, Object packet) { - if (PACKET_LOGIN_IN_START.isInstance(packet)) { - GameProfile profile = getGameProfile.get(packet); - channelLookup.put(profile.getName(), channel); - } - } - } -} \ No newline at end of file diff --git a/tinyprotocol/pom.xml b/tinyprotocol/pom.xml deleted file mode 100644 index 7a3e612..0000000 --- a/tinyprotocol/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - pom - - - net.jitse - npclib - 1.3 - - - npclib-tinyprotocol - - - - org.spigotmc - spigot - 1.13.2-R0.1-SNAPSHOT - provided - - - diff --git a/tinyprotocol/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java b/tinyprotocol/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java deleted file mode 100755 index a9b6e59..0000000 --- a/tinyprotocol/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java +++ /dev/null @@ -1,499 +0,0 @@ -package com.comphenix.tinyprotocol; - -import com.google.common.collect.Lists; -import com.google.common.collect.MapMaker; -import com.mojang.authlib.GameProfile; -import io.netty.channel.*; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitRunnable; - -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; - -/** - * Represents a very tiny alternative to ProtocolLib. - *

- * It now supports intercepting packets during login and status ping (such as OUT_SERVER_PING)! - * - * @author Kristian - */ -public abstract class TinyProtocol { - private static final AtomicInteger ID = new AtomicInteger(0); - - // Used in order to lookup a channel - private static final Reflection.MethodInvoker getPlayerHandle = Reflection.getMethod("{obc}.entity.CraftPlayer", "getHandle"); - private static final Reflection.FieldAccessor getConnection = Reflection.getField("{nms}.EntityPlayer", "playerConnection", Object.class); - private static final Reflection.FieldAccessor getManager = Reflection.getField("{nms}.PlayerConnection", "networkManager", Object.class); - private static final Reflection.FieldAccessor getChannel = Reflection.getField("{nms}.NetworkManager", Channel.class, 0); - - // Looking up ServerConnection - private static final Class minecraftServerClass = Reflection.getUntypedClass("{nms}.MinecraftServer"); - private static final Class serverConnectionClass = Reflection.getUntypedClass("{nms}.ServerConnection"); - private static final Reflection.FieldAccessor getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0); - private static final Reflection.FieldAccessor getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0); - private static final Reflection.MethodInvoker getNetworkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); - - // Packets we have to intercept - private static final Class PACKET_LOGIN_IN_START = Reflection.getMinecraftClass("PacketLoginInStart"); - private static final Reflection.FieldAccessor getGameProfile = Reflection.getField(PACKET_LOGIN_IN_START, GameProfile.class, 0); - - // Speedup channel lookup - private Map channelLookup = new MapMaker().weakValues().makeMap(); - private Listener listener; - - // Channels that have already been removed - private Set uninjectedChannels = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); - - // List of network markers - private List networkManagers; - - // Injected channel handlers - private List serverChannels = Lists.newArrayList(); - private ChannelInboundHandlerAdapter serverChannelHandler; - private ChannelInitializer beginInitProtocol; - private ChannelInitializer endInitProtocol; - - // Current handler name - private String handlerName; - - protected volatile boolean closed; - protected Plugin plugin; - - /** - * Construct a new instance of com.comphenix.tinyprotocol.TinyProtocol, and start intercepting packets for all connected clients and future clients. - *

- * You can construct multiple instances per plugin. - * - * @param plugin - the plugin. - */ - public TinyProtocol(final Plugin plugin) { - this.plugin = plugin; - - // Compute handler name - this.handlerName = getHandlerName(); - - // Prepare existing players - registerBukkitEvents(); - - try { - registerChannelHandler(); - registerPlayers(plugin); - } catch (IllegalArgumentException ex) { - // Damn you, late bind - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Delaying server channel injection due to late bind."); - - new BukkitRunnable() { - @Override - public void run() { - registerChannelHandler(); - registerPlayers(plugin); - plugin.getLogger().info("[com.comphenix.tinyprotocol.TinyProtocol] Late bind injection successful."); - } - }.runTask(plugin); - } - } - - private void createServerChannelHandler() { - // Handle connected channels - endInitProtocol = new ChannelInitializer() { - - @Override - protected void initChannel(Channel channel) throws Exception { - try { - // This can take a while, so we need to stop the main thread from interfering - synchronized (networkManagers) { - // Stop injecting channels - if (!closed) { - channel.eventLoop().submit(() -> injectChannelInternal(channel)); - } - } - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Cannot inject incomming channel " + channel, e); - } - } - - }; - - // This is executed before Minecraft's channel handler - beginInitProtocol = new ChannelInitializer() { - - @Override - protected void initChannel(Channel channel) throws Exception { - channel.pipeline().addLast(endInitProtocol); - } - - }; - - serverChannelHandler = new ChannelInboundHandlerAdapter() { - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - Channel channel = (Channel) msg; - - // Prepare to initialize ths channel - channel.pipeline().addFirst(beginInitProtocol); - ctx.fireChannelRead(msg); - } - - }; - } - - /** - * Register bukkit events. - */ - private void registerBukkitEvents() { - listener = new Listener() { - - @EventHandler(priority = EventPriority.LOWEST) - public final void onPlayerLogin(PlayerLoginEvent e) { - if (closed) - return; - - Channel channel = getChannel(e.getPlayer()); - - // Don't inject players that have been explicitly uninjected - if (!uninjectedChannels.contains(channel)) { - injectPlayer(e.getPlayer()); - } - } - - @EventHandler - public final void onPluginDisable(PluginDisableEvent e) { - if (e.getPlugin().equals(plugin)) { - close(); - } - } - - }; - - plugin.getServer().getPluginManager().registerEvents(listener, plugin); - } - - @SuppressWarnings("unchecked") - private void registerChannelHandler() { - Object mcServer = getMinecraftServer.get(Bukkit.getServer()); - Object serverConnection = getServerConnection.get(mcServer); - boolean looking = true; - - // We need to synchronize against this list - networkManagers = (List) getNetworkMarkers.invoke(null, serverConnection); - createServerChannelHandler(); - - // Find the correct list, or implicitly throw an exception - for (int i = 0; looking; i++) { - List list = Reflection.getField(serverConnection.getClass(), List.class, i).get(serverConnection); - - for (Object item : list) { - if (!ChannelFuture.class.isInstance(item)) - break; - - // Channel future that contains the server connection - Channel serverChannel = ((ChannelFuture) item).channel(); - - serverChannels.add(serverChannel); - serverChannel.pipeline().addFirst(serverChannelHandler); - looking = false; - } - } - } - - private void unregisterChannelHandler() { - if (serverChannelHandler == null) - return; - - for (Channel serverChannel : serverChannels) { - final ChannelPipeline pipeline = serverChannel.pipeline(); - - // Remove channel handler - serverChannel.eventLoop().execute(new Runnable() { - - @Override - public void run() { - try { - pipeline.remove(serverChannelHandler); - } catch (NoSuchElementException e) { - // That's fine - } - } - - }); - } - } - - private void registerPlayers(Plugin plugin) { - for (Player player : plugin.getServer().getOnlinePlayers()) { - injectPlayer(player); - } - } - - /** - * Invoked when the server is starting to send a packet to a player. - *

- * Note that this is not executed on the main thread. - * - * @param receiver - the receiving player, NULL for early login/status packets. - * @param channel - the channel that received the packet. Never NULL. - * @param packet - the packet being sent. - * @return The packet to send instead, or NULL to cancel the transmission. - */ - public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) { - return packet; - } - - /** - * Invoked when the server has received a packet from a given player. - *

- * Use {@link Channel#remoteAddress()} to get the remote address of the client. - * - * @param sender - the player that sent the packet, NULL for early login/status packets. - * @param channel - channel that received the packet. Never NULL. - * @param packet - the packet being received. - * @return The packet to recieve instead, or NULL to cancel. - */ - public Object onPacketInAsync(Player sender, Channel channel, Object packet) { - return packet; - } - - /** - * Send a packet to a particular player. - *

- * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param player - the destination player. - * @param packet - the packet to send. - */ - public void sendPacket(Player player, Object packet) { - sendPacket(getChannel(player), packet); - } - - /** - * Send a packet to a particular client. - *

- * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param channel - client identified by a channel. - * @param packet - the packet to send. - */ - public void sendPacket(Channel channel, Object packet) { - channel.pipeline().writeAndFlush(packet); - } - - /** - * Pretend that a given packet has been received from a player. - *

- * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param player - the player that sent the packet. - * @param packet - the packet that will be received by the server. - */ - public void receivePacket(Player player, Object packet) { - receivePacket(getChannel(player), packet); - } - - /** - * Pretend that a given packet has been received from a given client. - *

- * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. - * - * @param channel - client identified by a channel. - * @param packet - the packet that will be received by the server. - */ - public void receivePacket(Channel channel, Object packet) { - channel.pipeline().context("encoder").fireChannelRead(packet); - } - - /** - * Retrieve the name of the channel injector, default implementation is "tiny-" + plugin name + "-" + a unique ID. - *

- * Note that this method will only be invoked once. It is no longer necessary to override this to support multiple instances. - * - * @return A unique channel handler name. - */ - protected String getHandlerName() { - return "tiny-" + plugin.getName() + "-" + ID.incrementAndGet(); - } - - /** - * Add a custom channel handler to the given player's channel pipeline, allowing us to intercept sent and received packets. - *

- * This will automatically be called when a player has logged in. - * - * @param player - the player to inject. - */ - public void injectPlayer(Player player) { - injectChannelInternal(getChannel(player)).player = player; - } - - /** - * Add a custom channel handler to the given channel. - * - * @param channel - the channel to inject. - */ - public void injectChannel(Channel channel) { - injectChannelInternal(channel); - } - - /** - * Add a custom channel handler to the given channel. - * - * @param channel - the channel to inject. - * @return The packet interceptor. - */ - private PacketInterceptor injectChannelInternal(Channel channel) { - try { - PacketInterceptor interceptor = (PacketInterceptor) channel.pipeline().get(handlerName); - - // Inject our packet interceptor - if (interceptor == null) { - interceptor = new PacketInterceptor(); - channel.pipeline().addBefore("packet_handler", handlerName, interceptor); - uninjectedChannels.remove(channel); - } - - return interceptor; - } catch (IllegalArgumentException e) { - // Try again - return (PacketInterceptor) channel.pipeline().get(handlerName); - } - } - - /** - * Retrieve the Netty channel associated with a player. This is cached. - * - * @param player - the player. - * @return The Netty channel. - */ - public Channel getChannel(Player player) { - Channel channel = channelLookup.get(player.getName()); - - // Lookup channel again - if (channel == null) { - Object connection = getConnection.get(getPlayerHandle.invoke(player)); - Object manager = getManager.get(connection); - - channelLookup.put(player.getName(), channel = getChannel.get(manager)); - } - - return channel; - } - - /** - * Uninject a specific player. - * - * @param player - the injected player. - */ - public void uninjectPlayer(Player player) { - uninjectChannel(getChannel(player)); - } - - /** - * Uninject a specific channel. - *

- * This will also disable the automatic channel injection that occurs when a player has properly logged in. - * - * @param channel - the injected channel. - */ - public void uninjectChannel(final Channel channel) { - // No need to guard against this if we're closing - if (!closed) { - uninjectedChannels.add(channel); - } - - // See ChannelInjector in ProtocolLib, line 590 - channel.eventLoop().execute(() -> channel.pipeline().remove(handlerName)); - } - - /** - * Determine if the given player has been injected by com.comphenix.tinyprotocol.TinyProtocol. - * - * @param player - the player. - * @return TRUE if it is, FALSE otherwise. - */ - public boolean hasInjected(Player player) { - return hasInjected(getChannel(player)); - } - - /** - * Determine if the given channel has been injected by com.comphenix.tinyprotocol.TinyProtocol. - * - * @param channel - the channel. - * @return TRUE if it is, FALSE otherwise. - */ - public boolean hasInjected(Channel channel) { - return channel.pipeline().get(handlerName) != null; - } - - /** - * Cease listening for packets. This is called automatically when your plugin is disabled. - */ - public final void close() { - if (!closed) { - closed = true; - - // Remove our handlers - for (Player player : plugin.getServer().getOnlinePlayers()) { - uninjectPlayer(player); - } - - // Clean up Bukkit - HandlerList.unregisterAll(listener); - unregisterChannelHandler(); - } - } - - /** - * Channel handler that is inserted into the player's channel pipeline, allowing us to intercept sent and received packets. - * - * @author Kristian - */ - private final class PacketInterceptor extends ChannelDuplexHandler { - // Updated by the login event - public volatile Player player; - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - // Intercept channel - final Channel channel = ctx.channel(); - handleLoginStart(channel, msg); - - try { - msg = onPacketInAsync(player, channel, msg); - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Error in onPacketInAsync().", e); - } - - if (msg != null) { - super.channelRead(ctx, msg); - } - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - try { - msg = onPacketOutAsync(player, ctx.channel(), msg); - } catch (Exception e) { - plugin.getLogger().log(Level.SEVERE, "Error in onPacketOutAsync().", e); - } - - if (msg != null) { - super.write(ctx, msg, promise); - } - } - - private void handleLoginStart(Channel channel, Object packet) { - if (PACKET_LOGIN_IN_START.isInstance(packet)) { - GameProfile profile = getGameProfile.get(packet); - channelLookup.put(profile.getName(), channel); - } - } - } -} \ No newline at end of file