Package com.bergerkiller.bukkit.mw

Examples of com.bergerkiller.bukkit.mw.WorldConfig


  public void execute() {
    this.genWorldname(1);
    if (this.handleWorld()) {
      if (args.length != 0) {
        WorldConfig wc = WorldConfig.get(worldname);
        SpawnControl sc = wc.spawnControl;
        //Get the type to set
        String type = null;
        if (args[0].equalsIgnoreCase("animal")) {
          type = "animal";
View Full Code Here


  }

  public void execute() {
    this.genWorldname(1);
    if (this.handleWorld()) {
      WorldConfig wc = WorldConfig.get(worldname);
      if (args.length > 0) {
        wc.forcedRespawn = ParseUtil.parseBool(args[0]);
      }
      if (wc.forcedRespawn) {
        message(ChatColor.GREEN + "Forced respawning on World: '" + worldname + "' is enabled");
View Full Code Here

      this.genForcedWorldMode();
      if (!WorldManager.worldExists(worldname)) {
        long seedval = WorldManager.getRandomSeed(StringUtil.combine(" ", this.args));
        logAction("Issued a world creation command for world: " + worldname);
            WorldConfig.remove(worldname);
            WorldConfig wc = WorldConfig.get(worldname, this.forcedWorldMode);
        if (gen == null) {
          message(ChatColor.YELLOW + "Creating world '" + worldname + "' (this can take a while) ...");
          message(ChatColor.WHITE + "World generator: " + ChatColor.YELLOW + "Default (Vanilla)");
        } else {
          String cgenName = WorldManager.fixGeneratorName(gen);
          if (cgenName == null || cgenName.length() <= 1) {
            message(ChatColor.RED + "Failed to create world because the generator '" + gen + "' is missing!");
            return;
          }
          message(ChatColor.YELLOW + "Creating world '" + worldname + "' (this can take a while) ...");
          if (cgenName.indexOf(':') == 0) {
            String args = cgenName.substring(1);
            // Write a level.dat with the options changed
            CommonTagCompound data = wc.createData(seedval);
            data.putValue("generatorName", wc.worldmode.getTypeName());
            data.putValue("generatorVersion", 0);
            data.putValue("generatorOptions", args);
            wc.setData(data);
            message(ChatColor.WHITE + "World options: " + ChatColor.YELLOW + args);
            message(ChatColor.WHITE + "World generator: " + ChatColor.YELLOW + "Default (Vanilla)");
          } else {
            wc.setChunkGeneratorName(cgenName);
            message(ChatColor.WHITE + "World generator: " + ChatColor.YELLOW + cgenName);
          }
        }
            message(ChatColor.WHITE + "World seed: " + ChatColor.YELLOW + seedval);
            message(ChatColor.WHITE + "World environment: " + ChatColor.YELLOW + wc.worldmode.getName());
            MyWorlds.plugin.initDisableSpawn(worldname);
            final World world = WorldManager.createWorld(worldname, seedval, sender);
        if (world != null) {
          //load chunks
          final int keepdimension = 15;
          final int keepedgedim = 2 * keepdimension + 1;
          final int total = keepedgedim * keepedgedim;
          int current = 0;
          int spawnx = world.getSpawnLocation().getBlockX() >> 4;
            int spawnz = world.getSpawnLocation().getBlockZ() >> 4;
          for (int x = -keepdimension; x <= keepdimension; x++) {
            for (int z = -keepdimension; z <= keepdimension; z++) {
              // Spam messages every 64 chunks
              boolean first = (current & 63) == 0x0;
              int cx = spawnx + x;
              int cz = spawnz + z;
              Runnable t = null;
              if (first || (current + 2) == total) {
                final int percent = first ? (100 * current / total) : 100;
                t = new Runnable() {
                  public void run() {
                      message(ChatColor.YELLOW + "Preparing spawn area (" + percent + "%)...");
                      MyWorlds.plugin.log(Level.INFO, "Preparing spawn area (" + percent + "%)...");
                  }
                };
                first = false;
              }
              if (++current == total) {
                t = new Runnable() {
                  public void run() {
                    WorldConfig wc = WorldConfig.get(world);

                    // Set to True, any mistakes in loading chunks will be corrected here
                    world.setKeepSpawnInMemory(true);

                    // Fix up the spawn location
                    wc.fixSpawnLocation();

                    // Call onLoad (it was ignored while initing to avoid chunk loads when finding spawn)
                    wc.onWorldLoad(world);

                    // Confirmation message
                      message(ChatColor.GREEN + "World '" + world.getName() + "' has been loaded and is ready for use!");
                      MyWorlds.plugin.log(Level.INFO, "World '"+ world.getName() + "' loaded.");
                  }
View Full Code Here

              MyWorlds.plugin.log(Level.INFO, "Player '" + ((Player) sender).getName() + " de-opped '" + playername + "' on all worlds!");
            }
          }
        }
      } else if (this.handleWorld()) {
        WorldConfig wc = WorldConfig.get(worldname);
        String playername = args[0];
        if (playername.startsWith("*")) {
          wc.OPlist.clear();
          if (commandNode.equals("world.op")) {
            wc.OPlist.add("*");
            message(ChatColor.YELLOW + "Everyone on world '" + worldname + "' is an operator now!");
            if (sender instanceof Player) {
              MyWorlds.plugin.log(Level.INFO, "Player '" + ((Player) sender).getName() + " opped everyone on world '" + worldname + "'!");
            }
          } else {
            message(ChatColor.YELLOW + "Operators on world '" + worldname + "' have been cleared!");
            if (sender instanceof Player) {
              MyWorlds.plugin.log(Level.INFO, "Player '" + ((Player) sender).getName() + " de-opped everyone on world '" + worldname + "'!");
            }
          }
        } else {
          if (commandNode.equals("world.op")) {
            wc.OPlist.add(playername.toLowerCase());
            message(ChatColor.WHITE + playername + ChatColor.YELLOW + " is now an operator on world '" + worldname + "'!");
            if (sender instanceof Player) {
              MyWorlds.plugin.log(Level.INFO, "Player '" + ((Player) sender).getName() + " opped '" + playername + "' on world '" + worldname + "'!");
            }
          } else {
            wc.OPlist.remove(playername.toLowerCase());
            message(ChatColor.WHITE + playername + ChatColor.YELLOW + " is no longer an operator on world '" + worldname + "'!");
            if (sender instanceof Player) {
              MyWorlds.plugin.log(Level.INFO, "Player '" + ((Player) sender).getName() + " de-opped '" + playername + "' on world '" + worldname + "'!");
            }
          }
        }
        wc.updateOP(wc.getWorld());
      }
    } else {
      //list Operators
      WorldConfig wc = WorldConfig.get(WorldManager.getWorldName(sender, args, false));
      message(ChatColor.YELLOW + "Operators of world '" + wc.worldname + "':");
      if (sender instanceof Player) {
        //perform some nice layout coloring
        String msgpart = "";
        for (String player : wc.OPlist) {
View Full Code Here

  }

  public void execute() {
    this.genWorldname(1);
    if (this.handleWorld()) {
      WorldConfig wc = WorldConfig.get(worldname);
      if (args.length == 0) {
        // Display
        if (wc.pvp) {
          message(ChatColor.GREEN + "PvP on World: '" + worldname + "' is enabled");
        } else {
          message(ChatColor.YELLOW + "PvP on World: '" + worldname + "' is disabled");
        }
      } else {
        // Set
        wc.pvp = ParseUtil.parseBool(args[0]);
        wc.updatePVP(wc.getWorld());
        if (wc.pvp) {
          message(ChatColor.GREEN + "PvP on World: '" + worldname + "' enabled!");
        } else {
          message(ChatColor.YELLOW + "PvP on World: '" + worldname + "' disabled!");
        }
View Full Code Here

  }
 
  public void execute() {
    this.genWorldname(0);
    if (worldname != null) {
      WorldConfig wc = WorldConfig.get(worldname);
      com.bergerkiller.bukkit.mw.WorldInfo info = wc.getInfo();
      if (info == null) {
        message(ChatColor.RED + "' " + worldname + "' is broken, no information can be shown!");
      } else {
        message(ChatColor.YELLOW + "Information about the world: " + worldname);
        message(ChatColor.WHITE + "Environment: " + ChatColor.YELLOW + wc.worldmode.getName());
        String chunkGenerator = wc.getChunkGeneratorName();
        if (chunkGenerator == null) {
          message(ChatColor.WHITE + "Chunk generator: " + ChatColor.YELLOW + "Default");
        } else {
          message(ChatColor.WHITE + "Chunk generator: " + ChatColor.YELLOW + chunkGenerator);
        }
        message(ChatColor.WHITE + "Auto-saving: " + ChatColor.YELLOW + wc.autosave);
        message(ChatColor.WHITE + "Keep spawn loaded: " + ChatColor.YELLOW + wc.keepSpawnInMemory);
        message(ChatColor.WHITE + "World seed: " + ChatColor.YELLOW + info.seed);
        if (info.size > 1000000) {
          message(ChatColor.WHITE + "World size: " + ChatColor.YELLOW + (info.size / 1000000) + " Megabytes");
        } else if (info.size > 1000) {
          message(ChatColor.WHITE + "World size: " + ChatColor.YELLOW + (info.size / 1000) + " Kilobytes");
        } else if (info.size > 1) {
          message(ChatColor.WHITE + "World size: " + ChatColor.YELLOW + (info.size) + " Bytes");
        } else {
          message(ChatColor.WHITE + "World size: " + ChatColor.YELLOW + "Unknown (calculation is disabled)");
        }
        //Default portals
        if (wc.getNetherPortal() == null) {
          message(ChatColor.WHITE + "Nether portal: " + ChatColor.YELLOW + "None (will auto-detect when available)");
        } else if (wc.getNetherPortal().isEmpty()) {
          message(ChatColor.WHITE + "Nether portal: " + ChatColor.YELLOW + "Disabled");
        } else {
          message(ChatColor.WHITE + "Nether portal: " + ChatColor.YELLOW + wc.getNetherPortal());
        }
        if (wc.getEnderPortal() == null) {
          message(ChatColor.WHITE + "Ender portal: " + ChatColor.YELLOW + "None (will auto-detect when available)");
        } else if (wc.getEnderPortal().isEmpty()) {
          message(ChatColor.WHITE + "Ender portal: " + ChatColor.YELLOW + "Disabled");
        } else {
          message(ChatColor.WHITE + "Ender portal: " + ChatColor.YELLOW + wc.getEnderPortal());
        }
        //PvP
        if (wc.pvp) {
          message(ChatColor.WHITE + "PvP: " + ChatColor.GREEN + "Enabled");
        } else {
View Full Code Here

  public void execute() {
    if (args.length != 0) {
      this.genWorldname(1);
      if (this.handleWorld()) {
        WorldConfig wc = WorldConfig.get(worldname);
        if (ParseUtil.isBool(args[0])) {
          boolean set = ParseUtil.parseBool(args[0]);
          wc.autosave = set;
          wc.updateAutoSave(wc.getWorld());
          if (set) {
            message(ChatColor.YELLOW + "Auto-saving on world '" + worldname + "' is now enabled!");
          } else {
            message(ChatColor.YELLOW + "Auto-saving on world '" + worldname + "' is now disabled!");
          }
View Full Code Here

  }

  public void execute() {
    this.genWorldname(1);
    if (this.handleWorld()) {
      WorldConfig wc = WorldConfig.get(worldname);
      if (args.length > 0) {
        wc.rememberLastPlayerPosition = ParseUtil.parseBool(args[0]);
      }
      if (wc.rememberLastPlayerPosition) {
        message(ChatColor.GREEN + "Player last position memory on World: '" + worldname + "' is enabled");
View Full Code Here

  }

  public void execute() {
    this.genWorldname(1);
    if (this.handleWorld()) {
      WorldConfig wc = WorldConfig.get(worldname);
      if (args.length == 0) {
        // Display
        if (wc.allowHunger) {
          message(ChatColor.GREEN + "Hunger on World: '" + worldname + "' is enabled");
        } else {
          message(ChatColor.YELLOW + "Hunger on World: '" + worldname + "' is disabled");
        }
      } else {
        // Set
        wc.allowHunger = ParseUtil.parseBool(args[0]);
        wc.updateHunger(wc.getWorld());
        if (wc.allowHunger) {
          message(ChatColor.GREEN + "Hunger on World: '" + worldname + "' enabled!");
        } else {
          message(ChatColor.YELLOW + "Hunger on World: '" + worldname + "' disabled!");
        }
View Full Code Here

  public void execute() {
    if (args.length != 0) {
      this.genWorldname(1);
      if (this.handleWorld()) {
        WorldConfig wc = WorldConfig.get(worldname);
        if (ParseUtil.isBool(args[0])) {
          wc.formSnow = ParseUtil.parseBool(args[0]);
          if (wc.formSnow) {
            message(ChatColor.YELLOW + "Snow will now form on world '" + worldname + "'!");
          } else {
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.mw.WorldConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.