daily pastebin goal
47%
SHARE
TWEET

Example Custom Feudal Command

a guest Jul 15th, 2017 8 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.bukkit.entity.Player;
  2.  
  3. import us.forseth11.feudal.commands.Command;
  4. import us.forseth11.feudal.commands.CustomCommand;
  5. import us.forseth11.feudal.commands.HelpMessage;
  6. import us.forseth11.feudal.core.Feudal;
  7. import us.forseth11.feudal.user.User;
  8.  
  9. /**
  10.  *
  11.  * Used to add another feudal command
  12.  * @author Michael Forseth
  13.  *
  14.  */
  15. public class MenuCommand extends Command implements CustomCommand {
  16.  
  17.     @Override
  18.     public HelpMessage[] getHelpMessage() {
  19.         return new HelpMessage[]{new HelpMessage("feudal.commands.user.general.help",
  20.                 "§6§l> §2/f menu §7- Open menu to run most commands.")};
  21.     }
  22.  
  23.     @Override
  24.     public CommandType getType() {
  25.         return CommandType.PLAYER;
  26.     }
  27.  
  28.     @Override
  29.     public boolean run(String[] args, Player player) {
  30.         if(args.length == 1){
  31.             if(args[0].equalsIgnoreCase("menu")){
  32.                 User user = Feudal.getUser(player.getUniqueId().toString());
  33.                 if(user != null){
  34.                     try {
  35.                         new KingdomMenu(player, user);
  36.                     } catch (Exception e) {
  37.                         player.sendMessage("§5Failed to load menu.");
  38.                         e.printStackTrace();
  39.                     }
  40.                 }else{
  41.                     player.sendMessage("§5Unable to load your player data.");
  42.                 }
  43.                 return true;
  44.             }
  45.         }
  46.         return false;
  47.     }
  48.  
  49.     @Override
  50.     public int getHelpIndex() {
  51.         return 0;
  52.     }
  53.  
  54. }
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