Esempio n. 1
0
 @Override
 public void resetTexture(Material item, short data) {
   long info = toLong(item.getId(), data);
   if (customTextures.containsKey(info)) {
     customTextures.remove(info);
     String pluginName = (String) customTexturesPlugin.remove(info);
     for (Player player : Bukkit.getServer().getOnlinePlayers()) {
       if (player instanceof SpoutCraftPlayer) {
         if (((SpoutPlayer) player).isSpoutCraftEnabled()) {
           ((SpoutPlayer) player)
               .sendPacket(
                   new PacketItemTexture(msw(info), (short) lsw(info), pluginName, "[reset]"));
         }
       }
     }
   }
 }
 public SNode remove(SNodeId key) {
   if (key instanceof Regular) {
     return myRegularMap.remove(((Regular) key).getId());
   } else if (key instanceof Foreign) {
     return myForeignMap.remove(((Foreign) key).getId());
   } else {
     return myOtherMap.remove(key);
   }
 }
Esempio n. 3
0
 @Override
 public SNode remove(SNodeId key) {
   if (!(key instanceof Regular)) {
     LOG.error(
         "Trying to remove node with id class "
             + key.getClass().getName()
             + " from a regular model");
     return null;
   }
   return myRegularMap.remove(((Regular) key).getId());
 }
Esempio n. 4
0
  @Override
  public void setCustomBlockDesign(Integer blockId, Integer metaData, BlockDesign design) {
    Player[] players = Spout.getInstance().getServer().getOnlinePlayers();

    long info = toLong(blockId, metaData);

    if (design != null) {
      customBlockDesigns.put(info, design);
    } else {
      customBlockDesigns.remove(info);
    }

    updateCustomBlockDesigns(players, info, design);
  }
Esempio n. 5
0
 @Override
 public void resetName(Material item, short data) {
   long key = toLong(item.getId(), data);
   if (customNames.containsKey(key)) {
     customNames.remove(key);
     for (Player player : Bukkit.getServer().getOnlinePlayers()) {
       if (player instanceof SpoutCraftPlayer) {
         if (((SpoutPlayer) player).isSpoutCraftEnabled()) {
           ((SpoutPlayer) player)
               .sendPacket(new PacketItemName(msw(key), (short) lsw(key), "[reset]"));
         }
       }
     }
   }
 }
Esempio n. 6
0
  TLongObjectHashMap<Value> solve() {
    while (!moving.empty()) {
      long id = moving.pop();
      Value value = solved.get(id);

      boolean stable = id > 0;
      long[] pIds = stable ? new long[] {id, -id} : new long[] {-id, id};
      Value[] pVals = stable ? new Value[] {value, value} : new Value[] {value, lattice.top};

      for (int i = 0; i < pIds.length; i++) {
        long pId = pIds[i];
        Value pVal = pVals[i];
        TLongHashSet dIds = dependencies.get(pId);
        if (dIds == null) {
          continue;
        }
        TLongIterator dIdsIterator = dIds.iterator();
        while (dIdsIterator.hasNext()) {
          long dId = dIdsIterator.next();
          IdPending pend = pending.remove(dId);
          if (pend != null) {
            IdResult pend1 = substitute(pend, pId, pVal);
            if (pend1 instanceof IdFinal) {
              IdFinal fi = (IdFinal) pend1;
              solved.put(dId, fi.value);
              moving.push(dId);
            } else {
              pending.put(dId, (IdPending) pend1);
            }
          }
        }
      }
    }
    pending.clear();
    return solved;
  }
Esempio n. 7
0
 @Override
 public void setItemTexture(Material item, short data, Plugin plugin, String texture) {
   String pluginName;
   if (plugin == null) {
     pluginName = null;
   } else {
     pluginName = plugin.getDescription().getName();
   }
   long newKey = toLong(item.getId(), data);
   customTextures.put(newKey, texture);
   if (pluginName == null) {
     customTexturesPlugin.remove(newKey);
   } else {
     customTexturesPlugin.put(newKey, pluginName);
   }
   for (Player player : Bukkit.getServer().getOnlinePlayers()) {
     if (player instanceof SpoutCraftPlayer) {
       if (((SpoutPlayer) player).isSpoutCraftEnabled()) {
         ((SpoutPlayer) player)
             .sendPacket(new PacketItemTexture(item.getId(), data, pluginName, texture));
       }
     }
   }
 }