コード例 #1
0
 public void setScoreboardName(String displayName) {
   this.displayName = displayName;
   PacketPlayOutScoreboardScore pack = new PacketPlayOutScoreboardScore();
   setReflectionValue(pack.getClass(), "a", name);
   setReflectionValue(pack.getClass(), "b", displayName);
   setReflectionValue(pack.getClass(), "c", 2);
   for (Player p : players) {
     if (!isUnique(p)) {
       continue;
     }
     sendPacket(p, pack);
   }
 }
コード例 #2
0
 public void removeItem(String name2) {
   if (items.remove(name2) != null) {
     PacketPlayOutScoreboardScore pack = new PacketPlayOutScoreboardScore();
     setReflectionValue(pack.getClass(), "a", name2);
     setReflectionValue(pack.getClass(), "b", name);
     setReflectionValue(pack.getClass(), "c", 0);
     setReflectionValue(pack.getClass(), "d", 1);
     for (Player p : players) {
       if (!isUnique(p)) {
         continue;
       }
       ((CraftPlayer) p).getHandle().playerConnection.sendPacket(pack);
     }
   }
 }
コード例 #3
0
  public void setItem(String name2, int value) {
    items.put(name2, value);
    PacketPlayOutScoreboardScore pack = new PacketPlayOutScoreboardScore();
    setReflectionValue(pack.getClass(), "a", name2);
    setReflectionValue(pack.getClass(), "b", name);
    setReflectionValue(pack.getClass(), "c", value);
    setReflectionValue(pack.getClass(), "d", 0);

    for (Player p : players) {
      if (!isUnique(p)) {
        continue;
      }
      sendPacket(p, pack);
    }
  }