diff --git a/src/main/java/com/cnaude/purpleirc/PurpleBot.java b/src/main/java/com/cnaude/purpleirc/PurpleBot.java index fa36913..07b1ea7 100644 --- a/src/main/java/com/cnaude/purpleirc/PurpleBot.java +++ b/src/main/java/com/cnaude/purpleirc/PurpleBot.java @@ -133,7 +133,7 @@ public final class PurpleBot { public CaseInsensitiveMap enableMessageFiltering; private final CaseInsensitiveMap shortify; public CaseInsensitiveMap heroChannel; - public CaseInsensitiveMap townyChannel; + public CaseInsensitiveMap townyChannel; public CaseInsensitiveMap> opsList; public CaseInsensitiveMap> voicesList; public CaseInsensitiveMap> worldList; diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java index 1b07943..fcb924e 100644 --- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java +++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java @@ -328,13 +328,13 @@ public void onEnable() { logInfo("DeathMessages not detected."); } if (isPluginEnabled("Shortify")) { - //String shortifyVersion = getServer().getPluginManager().getPlugin("Shortify").getDescription().getVersion(); - //if (shortifyVersion.startsWith("1.6")) { - // logError("Shortify v" + shortifyVersion + " not supported. Please install 1.7 or newer."); - //} else { - logInfo("Enabling Shortify support."); - shortifyHook = new ShortifyHook(this); - //} + String shortifyVersion = getServer().getPluginManager().getPlugin("Shortify").getDescription().getVersion(); + if (shortifyVersion.startsWith("1.8")) { + logInfo("Enabling Shortify v" + shortifyVersion + " support."); + shortifyHook = new ShortifyHook(this); + } else { + logError("Shortify v" + shortifyVersion + " not supported. Please use the latest version from http://jenkins.cnaude.org/job/Shortify/"); + } } else { logInfo("Shortify not detected."); } @@ -353,7 +353,7 @@ public void onEnable() { } vanishHook = new VanishHook(this); if (isPluginEnabled("SuperVanish")) { - logInfo("Enabling SuperVanish support."); + logInfo("Enabling SuperVanish support."); superVanishHook = new SuperVanishHook(this); } else { logInfo("SuperVanish not detected."); @@ -925,7 +925,7 @@ public String getPlayerGroup(Player player) { } return ChatColor.translateAlternateColorCodes('&', groupName); } - + /** * * @param player @@ -1096,7 +1096,7 @@ public void updateDisplayNameCache(String player, String displayName) { logDebug("Caching displayName for " + player + " = " + displayName); displayNameCache.put(player, displayName); } - + /** * * @param player @@ -1105,7 +1105,7 @@ public void updateUuidCache(Player player) { logDebug("Caching UUID for " + player.getName() + " = " + player.getUniqueId().toString()); uuidCache.put(player.getName(), player.getUniqueId()); } - + /** * * @param player @@ -1300,7 +1300,7 @@ public void loadDisplayNameCache() { logError(e.getMessage()); } } - + public void saveUuidCache() { BufferedWriter writer; try { diff --git a/src/main/java/com/cnaude/purpleirc/Utilities/NetPackets.java b/src/main/java/com/cnaude/purpleirc/Utilities/NetPackets.java index ac7180c..072febc 100644 --- a/src/main/java/com/cnaude/purpleirc/Utilities/NetPackets.java +++ b/src/main/java/com/cnaude/purpleirc/Utilities/NetPackets.java @@ -25,9 +25,14 @@ import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.injector.PacketConstructor; import com.comphenix.protocol.reflect.FieldAccessException; +import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode; +import com.comphenix.protocol.wrappers.PlayerInfoData; +import com.comphenix.protocol.wrappers.WrappedChatComponent; import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.google.common.base.Charsets; import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.UUID; import org.bukkit.entity.Player; import org.pircbotx.Channel; import org.pircbotx.User; @@ -108,7 +113,6 @@ private PacketContainer tabPacket(String name, boolean add) { String displayName = truncateName(plugin.customTabPrefix + name); PacketContainer packet = null; String version = plugin.getServer().getVersion(); - plugin.logDebug("tabPacket: " + version); if (version.contains("MC: 1.7.10")) { try { packet = protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO); @@ -121,14 +125,44 @@ private PacketContainer tabPacket(String name, boolean add) { plugin.logError("tabPacket: " + ex.getMessage()); } } else if (version.contains("MC: 1.8")) { + /* try { packet = protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO); - //packet.getChatComponents() - + UUID uuid = plugin.getPlayerUuid(name); + if (uuid == null) { + uuid = java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + displayName).getBytes(Charsets.UTF_8)); + } + PlayerInfoData pid = new PlayerInfoData( + packet, + NativeGameMode.CREATIVE, + 0, + new WrappedGameProfile(uuid, displayName), + WrappedChatComponent.fromJson("{\"text\": \"" + displayName + "\"}")); + List pil = packet.getPlayerInfoDataLists().read(0); + int count = packet.getPlayerInfoDataLists().size(); + pil.add(pid); + for (Player player : plugin.getServer().getOnlinePlayers()) { + if (plugin.vanishHook != null) { + if (plugin.vanishHook.isVanished(player)) { + continue; + } + } + pil.add(new PlayerInfoData( + packet, + NativeGameMode.valueOf(player.getGameMode().name()), + 0, + new WrappedGameProfile(player.getUniqueId(), player.getDisplayName()), + WrappedChatComponent.fromJson("{\"text\": \"" + player.getDisplayName() + "\"}")) + ); + } + packet.getPlayerInfoDataLists().write(0, pil); + return packet; + } catch (Exception ex) { plugin.logError("tabPacket: " + ex.getMessage()); ex.printStackTrace(); } + */ } else { plugin.logDebug("tabPacket: deprecated "); playerListConstructor = protocolManager.createPacketConstructor(Packets.Server.PLAYER_INFO, "", false, (int) 0);