SHARE
TWEET

Untitled

a guest Jul 18th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.konjcek.healmanager;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8.  
  9. public class MenuCommand implements CommandExecutor {
  10.  
  11.     private Main main;
  12.    
  13.     public MenuCommand(Main main) {
  14.         this.main = main;
  15.     }
  16.  
  17.     @Override
  18.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  19.    
  20.         Player player = (Player) sender;
  21.        
  22.         if (sender instanceof Player) {
  23.        
  24.         if (args.length == 1) {
  25.             Player target = org.bukkit.Bukkit.getPlayer(args[0]);
  26.             if (target == null) {
  27.                 player.sendMessage(ChatColor.RED + "The player is invalid or offline.");
  28.                 return true;
  29.                 }
  30.             }
  31.             else {
  32.                 player.sendMessage(ChatColor.RED + "Invalid usage: /health <player>");
  33.             }
  34.         }
  35.         else {
  36.             System.out.println("You cannot use this command via Console.");
  37.         }
  38.        
  39.         return false;
  40.     }
  41.  
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top