Exemple #1
0
  @Override
  public void run() {
    int i = 0;
    while (!exitFlag) {
      Message m = new Message();
      m.setAuthor("Test,author");
      m.setText("test text " + i);
      m.setSource(Source.TEST);
      if (i % 3 == 0) {
        m.setHighlighted(true);
      }
      //            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      //            try {
      //                m.setText(br.readLine());
      //            } catch (IOException e) {
      //                logger.log(Level.WARNING, "Something goes wrong...", e);
      //            }
      messageManager.sendMessage(m);

      Source[] sources = Source.values();
      if (i % 5 == 0) {
        MessageManager.getInstance()
            .sendInfoMessage(
                new InfoMessage(sources[(i / 5) % sources.length], "test info message " + i));
      }
      i++;
      synchronized (this) {
        try {
          wait(1000);
        } catch (InterruptedException e) {
          logger.log(Level.WARNING, "Something goes wrong...", e);
        }
      }
    }
  }
 public void removeFromOtherQueues(Player p, int id) {
   for (Game g : getGames()) {
     if (g.isInQueue(p) && g.getID() != id) {
       g.removeFromQueue(p);
       msgmgr.sendMessage(PrefixType.INFO, "Removed from the queue in arena " + g.getID(), p);
     }
   }
 }
  public void createArenaFromSelection(Player pl) {
    FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
    // SettingsManager s = SettingsManager.getInstance();

    WorldEditPlugin we = getWorldEdit();
    Selection sel = we.getSelection(pl);
    if (sel == null) {
      msgmgr.sendMessage(PrefixType.WARNING, "You must make a WorldEdit Selection first!", pl);
      return;
    }
    Location max = sel.getMaximumPoint();
    Location min = sel.getMinimumPoint();

    /* if(max.getWorld()!=SettingsManager.getGameWorld() || min.getWorld()!=SettingsManager.getGameWorld()){
        pl.sendMessage(ChatColor.RED+"Wrong World!");
        return;
    }*/

    /*
     *
     *
     *
     *     RE-IMPLEMENT THIS PART
     *     LEAVING AS A REFRENCE
     *
     *
     */

    int no = c.getInt("sg-system.arenano") + 1;
    c.set("sg-system.arenano", no);
    if (games.size() == 0) {
      no = 1;
    } else no = games.get(games.size() - 1).getID() + 1;
    SettingsManager.getInstance().getSpawns().set(("spawns." + no), null);
    c.set("sg-system.arenas." + no + ".world", max.getWorld().getName());
    c.set("sg-system.arenas." + no + ".x1", max.getBlockX());
    c.set("sg-system.arenas." + no + ".y1", max.getBlockY());
    c.set("sg-system.arenas." + no + ".z1", max.getBlockZ());
    c.set("sg-system.arenas." + no + ".x2", min.getBlockX());
    c.set("sg-system.arenas." + no + ".y2", min.getBlockY());
    c.set("sg-system.arenas." + no + ".z2", min.getBlockZ());
    c.set("sg-system.arenas." + no + ".enabled", true);

    SettingsManager.getInstance().saveSystemConfig();
    hotAddArena(no);
    pl.sendMessage(ChatColor.GREEN + "Arena ID " + no + " Succesfully added");
  }