Exemplo n.º 1
0
 public void addItem(ItemStack i, int loc, BSShop shop, BasicConnector c) {
   to_ping.add(c);
   if (!i.hasItemMeta()) {
     c.setOldData(null, null, i, shop, loc);
     return;
   }
   c.setOldData(i.getItemMeta().getLore(), i.getItemMeta().getDisplayName(), i, shop, loc);
 }
 @Override
 public void reset() {
   synchronized (circularBuffer) {
     reset = true;
     super.reset();
     circularBuffer.notifyAll();
   }
 }
Exemplo n.º 3
0
  public void updateItem(BasicConnector c) {
    c.update();

    ItemStack i = c.getItem();

    ItemMeta meta = i.getItemMeta();

    String motd = c.getMotd();

    if (motd == null) {
      System.out.print(
          "[BossShop] [ServerPinging] Was not able to get the motd of Server "
              + c.getHost()
              + ":"
              + c.getPort());
      return;
    }

    String players = c.getPlayerCount();

    if (meta.hasDisplayName()) {
      meta.setDisplayName(transform(c.getOldName(), meta.getDisplayName(), motd, players));
    }

    if (meta.hasLore()) {
      List<String> list = c.getOldLore();
      List<String> l = new ArrayList<String>();
      for (String s : list) {
        l.add(transform(s, meta.getLore().get(l.size()), motd, players));
      }
      if (l != null && l.size() > 0) {
        meta.setLore(l);
      }
    }

    i.setItemMeta(meta);
    if (c.getShop() != null) {
      if (c.getShop().getInventory() != null) {
        // TODO wenn inventory customizable ist ist es auch nicht existent hier
        c.getShop().getInventory().setItem(c.getLocation(), i);
      }
    }
  }