Remove custom name on players on join and arcade spectator

This commit is contained in:
libraryaddict 2015-12-14 15:42:32 +13:00
parent e7213fdb7e
commit b5bdf7ced4
2 changed files with 20 additions and 5 deletions

View File

@ -35,6 +35,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
@ -81,6 +83,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_loggedIn.remove(event.getPlayer()); _loggedIn.remove(event.getPlayer());
} }
@EventHandler(priority = EventPriority.LOW)
public void playerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
player.setCustomName("");
player.setCustomNameVisible(false);
}
@EventHandler @EventHandler
public void ncpExempt(final PlayerToggleFlightEvent event) public void ncpExempt(final PlayerToggleFlightEvent event)
{ {
@ -140,7 +151,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{ {
Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next(); Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next();
for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator.hasNext();) for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator
.hasNext();)
{ {
final Entry<CheckType, Long> entry2 = innerIterator.next(); final Entry<CheckType, Long> entry2 = innerIterator.next();
@ -469,8 +481,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityRiding.get(owner.getName()).remove(attachPacket.b); _entityRiding.get(owner.getName()).remove(attachPacket.b);
sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], _entityNameMap.get(owner.getName()).get(vehicleId),
_entityNameMap.get(owner.getName()).get(vehicleId), verifier, true, ids.length > 1 ? ids[0] : -1); verifier, true, ids.length > 1 ? ids[0] : -1);
} }
else else
{ {

View File

@ -921,6 +921,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); ((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
player.setCustomName("");
player.setCustomNameVisible(false);
player.setSprinting(false); player.setSprinting(false);
player.setSneaking(false); player.setSneaking(false);