Package com.bergerkiller.bukkit.mw.commands

Source Code of com.bergerkiller.bukkit.mw.commands.WorldSetPVP

package com.bergerkiller.bukkit.mw.commands;

import org.bukkit.ChatColor;

import com.bergerkiller.bukkit.common.utils.ParseUtil;
import com.bergerkiller.bukkit.mw.Permission;
import com.bergerkiller.bukkit.mw.WorldConfig;
import com.bergerkiller.bukkit.mw.WorldManager;

public class WorldSetPVP extends Command {

  public WorldSetPVP() {
    super(Permission.COMMAND_TOGGLEPVP, "world.pvp");
  }

  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!");
        }
        if (!WorldManager.isLoaded(worldname)) {
          message(ChatColor.YELLOW + "Please note that this world is not loaded!");
        }
      }
    }
  }
}
TOP

Related Classes of com.bergerkiller.bukkit.mw.commands.WorldSetPVP

TOP
Copyright © 2018 www.massapi.com. 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.