コード例 #1
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));
       }
     }
   }
 }
コード例 #2
0
 @Override
 public void onEnable() {
   taPlayerListener = new TAskPlayerListener(this);
   plugin.getServer().getPluginManager().registerEvents(taPlayerListener, plugin);
   for (Player player : plugin.getServer().getOnlinePlayers()) {
     teleportPlayerList.add(new TeleportPlayer(this, player));
   }
   /* run update on teleport players..
    * 20L = 1 second worth of ticks.
    */
   new BukkitRunnable() {
     @Override
     public void run() {
       for (TeleportPlayer player : teleportPlayerList) {
         player.Update();
       }
     }
   }.runTaskTimer(plugin, 0L, UPDATE_PERIOD);
 }
コード例 #3
0
  @Override
  public void onEnable() {
    igPlayerListener = new IgnorePlayerListener(this);
    plugin.getServer().getPluginManager().registerEvents(igPlayerListener, plugin);
    plugin.getServer().getPluginManager().registerEvents(this, plugin);
    Load();

    // Automatic save after time
    new BukkitRunnable() {

      @Override
      public void run() {
        Save();
      }
    }.runTaskTimer(plugin, 0L, SAVE_PERIOD);
  }