Package com.github.zathrus_writer.commandsex.commands

Source Code of com.github.zathrus_writer.commandsex.commands.Command_cex_tp

package com.github.zathrus_writer.commandsex.commands;


import com.github.zathrus_writer.commandsex.CombatTag;
import com.github.zathrus_writer.commandsex.helpers.LogHelper;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.github.zathrus_writer.commandsex.helpers.Permissions;
import com.github.zathrus_writer.commandsex.helpers.PlayerHelper;
import com.github.zathrus_writer.commandsex.helpers.Teleportation;

public class Command_cex_tp extends Teleportation {
  /***
   * TP - teleports one player to another (either via arguments or the command sender to the player given)
   * @param sender
   * @param args
   * @return
   */
  public static Boolean run(CommandSender sender, String alias, String[] args) {
    if (PlayerHelper.checkIsPlayer(sender)) {
      Player player = (Player)sender;

            if (CombatTag.isInCombat(player)){
                LogHelper.showWarning("combatTagCannotDo", player);
                return true;
            }

      // check permissions and call to action
      if (args.length > 1) {
        // teleporting players one to another
        if (Permissions.checkPerms(player, "cex.tp")) {
          tp_common(sender, args, "tp", alias);
        }
      } else {
        // teleporting sender to another player
        if (Permissions.checkPerms(player, "OR", "cex.tp", "cex.tpto")) {
          tp_common(sender, args, "tp", alias);
        }
      }
    }
        return true;
  }
}
TOP

Related Classes of com.github.zathrus_writer.commandsex.commands.Command_cex_tp

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.