Exemple #1
0
 public void changeMap() {
   List<String> mapNames = Main.getInstance().getConfig().getStringList("Maps");
   if (mapNames.size() >= 2) {
     Main.getMapManager().changeMap(mapNames.get(Maths.randInt(0, mapNames.size() - 1)));
   } else {
     Main.getMapManager().changeMap(mapNames.get(0));
   }
 }
Exemple #2
0
 private void changeMap(String newMap) {
   World newWorld;
   if (Bukkit.getWorld(newMap) != null) {
     newWorld = Bukkit.getWorld(newMap);
     setCurrentMap(newWorld.getName());
     setCurrentWorld(newWorld);
     if (Main.getInstance().getConfig().getBoolean("TPPlayers")) {
       broadcast(Msg.getMessage("MAP_CHANGED_PLAYERS_TPED").replace("mapname", newMap));
       for (Player p : Bukkit.getOnlinePlayers()) {
         p.setNoDamageTicks(2 * 20);
         p.teleport(currentWorld.getSpawnLocation());
       }
     } else {
       broadcast(Msg.getMessage("MAP_CHANGED").replace("mapname", newMap));
     }
   } else {
     broadcast(Msg.getMessage("ERROR_CHANING_MAP").replace("mapname", newMap));
     return;
   }
 }
Exemple #3
0
  public void respawnPlayer(final Player p) {
    final long respawnTime = Main.getInstance().getConfig().getLong("PRT");
    if (respawnTime == 0) {
      return;
    }
    p.sendMessage(
        Msg.getMessage("PREFIX")
            + Msg.getMessage("AUTO_RESPAWN_IN").replace("seconds", respawnTime + ""));
    Bukkit.getScheduler()
        .runTaskLater(
            main,
            new Runnable() {

              @Override
              public void run() {
                p.spigot().respawn();
                p.teleport(currentWorld.getSpawnLocation());
              }
            },
            respawnTime * 20);
  }