Package com.sijobe.spc.command

Source Code of com.sijobe.spc.command.Hardcore

package com.sijobe.spc.command;

import com.sijobe.spc.util.FontColour;
import com.sijobe.spc.validation.Parameters;
import com.sijobe.spc.wrapper.CommandSender;
import com.sijobe.spc.wrapper.Player;
import com.sijobe.spc.wrapper.World;

import java.util.List;

/**
* Toggles hardcore mode on/off
*
* @author simo_415
* @version 1.0
*/
@Command (
   name = "hardcore",
   description = "Configures the world to be in hardcore mode or not",
   example = "enable",
   videoURL = "http://www.youtube.com/watch?v=1_woyXQ3io4",
   version = "1.0"
)
public class Hardcore extends StandardCommand {
   /**
    * @see com.sijobe.spc.wrapper.CommandBase#execute(net.minecraft.src.ICommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) {
      Player player = super.getSenderAsPlayer(sender);
      World world = player.getWorld();
      if (params.size() > 0) {
         world.setHardcore((Boolean)params.get(0));
      } else {
         world.setHardcore(!world.isHardcore());
      }
      player.sendChatMessage("Hardcore mode was " +
               FontColour.AQUA + (world.isHardcore() ? "enabled" : "disabled"));
   }

   /**
    * @see com.sijobe.spc.wrapper.CommandBase#getParameters()
    */
   @Override
   public Parameters getParameters() {
      return Parameters.DEFAULT_BOOLEAN;
   }
}
TOP

Related Classes of com.sijobe.spc.command.Hardcore

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.