Package net.wiskr.simplefreeforall.commands

Source Code of net.wiskr.simplefreeforall.commands.Select

package net.wiskr.simplefreeforall.commands;

import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;

import net.wiskr.simplefreeforall.CommandManager;

public class Select
{
  public static void run(Command cmd, String[] args)
  {
    if(!Util.isPlayer() || !Util.senderHasPermission("edit"))
    {
      Util.sendDenied(args);
      return;
    }
   
    if(args.length == 1)
    {
      Help.getSelect();
      return;
    }
    if(args.length > 2)
    {
      Util.sendInvalid(cmd, args);
      return;
    }
   
    Location loc = null;
    Player player = (Player) CommandManager.getSender();
   
    if(args[1].equalsIgnoreCase("hpos1"))
    {
      loc = player.getTargetBlock(null, 100).getLocation();
      Util.sendSuccess ("First point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 0);
    }
    else if(args[1].equalsIgnoreCase("pos1"))
    {
      loc = player.getLocation();
      Util.sendSuccess ("First point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 0);
    }
    else if(args[1].equalsIgnoreCase("hpos2"))
    {
      loc = player.getTargetBlock(null, 100).getLocation();
      Util.sendSuccess ("Second point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 1);
    }
    else if(args[1].equalsIgnoreCase("pos2"))
    {
      loc = player.getLocation();
      Util.sendSuccess ("Second point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 1);
    }
    else
    {
      Util.sendInvalid(cmd, args);
      return;
    }
   
    return;
  }
}
TOP

Related Classes of net.wiskr.simplefreeforall.commands.Select

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.