예제 #1
0
  @Override
  public void onCommand(Player p, String[] args) {
    if (!p.hasPermission("ugungame.setspawn")) {
      MessageManager.bad(p, "You dont have the permission to do this!");
      return;
    }

    if (args.length < 2) {
      MessageManager.bad(p, usage + "setspawn <arena> <mapid(1|2)>");
      return;
    }

    if (!ArenaManager.getInstance().isExist(args[0])) {
      MessageManager.bad(p, "§cThe arena §6" + args[0] + " §cdoes not exist!");
      return;
    }

    Arena a = ArenaManager.getInstance().getArena(args[0]);

    if (args[1].equalsIgnoreCase("1")) {
      a.getCfg().set("locations.spawns.spawn.map1.world", p.getLocation().getWorld().getName());
      a.getCfg().set("locations.spawns.spawn.map1.x", Double.valueOf(p.getLocation().getX()));
      a.getCfg().set("locations.spawns.spawn.map1.y", Double.valueOf(p.getLocation().getY()));
      a.getCfg().set("locations.spawns.spawn.map1.z", Double.valueOf(p.getLocation().getZ()));
      a.getCfg().set("locations.spawns.spawn.map1.yaw", Float.valueOf(p.getLocation().getYaw()));
      a.getCfg()
          .set("locations.spawns.spawn.map1.pitch", Float.valueOf(p.getLocation().getPitch()));
      try {
        a.getCfg().save(a.getFile());
        MessageManager.good(
            p, "The spawn for arena §6" + a.getName() + " §aand for the map §61 §ahas been set!");
      } catch (IOException e) {
        e.printStackTrace();
      }
    } else if (args[1].equalsIgnoreCase("2")) {
      a.getCfg().set("locations.spawns.spawn.map2.world", p.getLocation().getWorld().getName());
      a.getCfg().set("locations.spawns.spawn.map2.x", Double.valueOf(p.getLocation().getX()));
      a.getCfg().set("locations.spawns.spawn.map2.y", Double.valueOf(p.getLocation().getY()));
      a.getCfg().set("locations.spawns.spawn.map2.z", Double.valueOf(p.getLocation().getZ()));
      a.getCfg().set("locations.spawns.spawn.map2.yaw", Float.valueOf(p.getLocation().getYaw()));
      a.getCfg()
          .set("locations.spawns.spawn.map2.pitch", Float.valueOf(p.getLocation().getPitch()));
      try {
        a.getCfg().save(a.getFile());
        MessageManager.good(
            p, "The spawn for arena §6" + a.getName() + " §aand for the map §62 §ahas been set!");
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
예제 #2
0
  @Override
  public void onCommand(Player p, String[] args) {
    if (!p.hasPermission("ugungame.create")) {
      MessageManager.bad(p, "You dont have the permission to do this!");
      return;
    }

    if (args.length < 1) {
      MessageManager.bad(p, usage + "create <arena>");
      return;
    }

    if (ArenaManager.getInstance().isExist(args[0])) {
      MessageManager.bad(p, "The arena §6" + args[0] + " §cdoes already exists!");
      return;
    }

    Arena a = new Arena(args[0]);
    ArenaManager.getInstance().addArena(a);
    MessageManager.good(p, "The arena §6" + a.getName() + " §ahas been created!");
  }