Пример #1
0
  public void Save() {
    try (FileWriter fw = new FileWriter(igFile);
        JsonWriter writer = new JsonWriter(fw)) {
      writer.setIndent(" ");
      writer.beginArray(); // begin players array
      for (IgnorePlayer player : playerIgnoreList) {
        writer.beginObject(); // begin player object
        writer.name("uuid").value(player.getUUID().toString());
        writer.name("ignoreall").value(player.isAllIgnored());
        writer.name("ignores");
        writer.beginArray(); // begin ignore array
        for (UUID uuid : player.getIgnoreList()) {
          writer.beginObject(); // begin ignored player object
          writer.name("uuid").value(uuid.toString());
          writer.endObject(); // end ignored player object
        }
        writer.endArray(); // end ignore array

        writer.endObject(); // end player object
      }
      writer.endArray(); // end players array
    } catch (IOException e) {
      PickleCraftPlugin.log.warning(e.getMessage());
    }
  }
Пример #2
0
 public void listIgnores(IgnorePlayer player) {
   if (player.isAllIgnored()) {
     player
         .getPlayer()
         .sendMessage(plugin.getStringFromConfig("ignorecraft.messages.info.ignoreall"));
   } else {
     ArrayList<UUID> ignores = (ArrayList<UUID>) player.getIgnoreList();
     if (ignores.size() <= 0) {
       player
           .getPlayer()
           .sendMessage(plugin.getStringFromConfig("ignorecraft.messages.errors.noignores"));
     } else {
       StringBuilder s = new StringBuilder();
       s.append("&2Ignoring: ");
       for (int i = 0; i < ignores.size(); i++) {
         Player p = plugin.getServer().getPlayer(ignores.get(i));
         s.append("&e");
         s.append(p.getName());
         s.append(", ");
         if (i % 8 == 0 && i != 0) {
           player.getPlayer().sendMessage(PickleCraftPlugin.Colorize(s.toString()));
           s = new StringBuilder();
         }
       }
       String d = s.toString();
       if (!d.isEmpty()) {
         // incase not enough indexs to fire the sendmessage in le loop :c
         player.getPlayer().sendMessage(PickleCraftPlugin.Colorize(d));
       }
     }
   }
 }