示例#1
0
 public void checkIfNeedsToBeEnabledForPlayer(Player p) {
   if (!players.contains(p)) {
     return;
   }
   if (isUnique(p)) {
     PacketPlayOutScoreboardObjective pack = new PacketPlayOutScoreboardObjective();
     setReflectionValue(pack.getClass(), "a", name);
     setReflectionValue(pack.getClass(), "b", displayName);
     setReflectionValue(pack.getClass(), "c", 0);
     sendPacket(p, pack);
     for (String name2 : items.keySet()) {
       Integer valObj = items.get(name2);
       if (valObj == null) {
         continue;
       }
       int val = valObj.intValue();
       PacketPlayOutScoreboardScore pack2 = new PacketPlayOutScoreboardScore();
       setReflectionValue(pack.getClass(), "a", name2);
       setReflectionValue(pack.getClass(), "b", name);
       setReflectionValue(pack.getClass(), "c", val);
       setReflectionValue(pack.getClass(), "d", 0);
       sendPacket(p, pack2);
     }
     updatePosition(p);
   }
 }
示例#2
0
 public void checkIfNeedsToBeDisabledForPlayer(Player p) {
   if (!players.contains(p)) {
     return;
   }
   if (!isUnique(p)) {
     PacketPlayOutScoreboardObjective pack = new PacketPlayOutScoreboardObjective();
     setReflectionValue(pack.getClass(), "a", name);
     setReflectionValue(pack.getClass(), "b", displayName);
     setReflectionValue(pack.getClass(), "c", 1);
     sendPacket(p, pack);
   }
 }
示例#3
0
 public void showToPlayer(Player p, boolean show) {
   if (show) {
     if (!players.contains(p)) {
       players.add(p);
       plugin.updateForPlayer(p);
     }
   } else {
     if (players.remove(p)) {
       PacketPlayOutScoreboardObjective pack = new PacketPlayOutScoreboardObjective();
       setReflectionValue(pack.getClass(), "a", name);
       setReflectionValue(pack.getClass(), "b", "");
       setReflectionValue(pack.getClass(), "c", 1);
       sendPacket(p, pack);
       plugin.updateForPlayer(p);
     }
   }
 }