@Override public void resetName(Material item) { int id = item.getRawId(); int data = item.getRawData(); if (customNames.containsKey(id, data)) { customNames.remove(id, data); for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player instanceof SpoutCraftPlayer) { if (((SpoutPlayer) player).isSpoutCraftEnabled()) { ((SpoutPlayer) player).sendPacket(new PacketItemName(id, (short) data, "[reset]")); } } } } }
@Override public void reset() { customNames.clear(); for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player instanceof SpoutCraftPlayer) { if (((SpoutPlayer) player).isSpoutCraftEnabled()) { ((SpoutPlayer) player).sendPacket(new PacketItemName(0, (short) 0, "[resetall]")); } } } }
@Override public void setItemName(Material item, String name) { customNames.put(item.getRawId(), item.getRawData(), name); for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player instanceof SpoutCraftPlayer) { if (((SpoutPlayer) player).isSpoutCraftEnabled()) { ((SpoutPlayer) player) .sendPacket(new PacketItemName(item.getRawId(), (short) item.getRawData(), name)); } } } }
public void onPlayerJoin(SpoutPlayer player) { if ((player).isSpoutCraftEnabled()) { for (TLongObjectIterator<String> it = customNames.iterator(); it.hasNext(); ) { it.advance(); (player) .sendPacket( new PacketItemName( TIntPairHashSet.longToKey1(it.key()), (short) TIntPairHashSet.longToKey2(it.key()), it.value())); } } }