Tablist thingy for 1.8, sort of helps the situation a bit but doesnt perfectly solve it

This commit is contained in:
Shaun Bennett 2015-02-06 23:39:22 -05:00
parent de1d2d4688
commit ed8638ae9f
4 changed files with 63 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_7_R4.Packet;
public class UtilPlayer
{
@ -569,6 +570,11 @@ public class UtilPlayer
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47;
}
public static void sendPacket(Player player, Packet packet)
{
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
/*
public void setListName(Player player, CoreClient client)
{

View File

@ -0,0 +1,53 @@
package mineplex.core;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
public class TablistFix extends MiniPlugin
{
public TablistFix(JavaPlugin plugin)
{
super("Tablist Fix", plugin);
}
// This is sort of experimental!
@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerJoinEvent event)
{
final Player player = event.getPlayer();
runSyncLater(new Runnable()
{
@Override
public void run()
{
if (!player.isOnline())
return;
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle());
if (UtilPlayer.is1_8(player))
{
UtilPlayer.sendPacket(player, packet);
}
for (Player other : UtilServer.getPlayers())
{
if (other.equals(player) || !other.canSee(player))
continue;
if (UtilPlayer.is1_8(other))
UtilPlayer.sendPacket(other, packet);
}
}
}, 20L);
}
}

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.TablistFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -111,6 +112,7 @@ public class Hub extends JavaPlugin implements IRelation
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new CustomTagFix(this, packetHandler);
new TablistFix(this);
//new Replay(this, packetHandler);
new PersonalServerManager(this, clientManager);

View File

@ -7,6 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import mineplex.core.CustomTagFix;
import mineplex.core.TablistFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.blockrestore.BlockRestore;
@ -122,6 +123,7 @@ public class Arcade extends JavaPlugin
new MemoryFix(this);
new CustomTagFix(this, packetHandler);
new TablistFix(this);
new FriendManager(this, _clientManager, preferenceManager, portal);