AmazingTitles Core 2.0
  • ๐Ÿ’กWelcome
  • ๐Ÿ“œPlugin Details
  • ๐ŸงFunctions
    • Plugin Functions
    • Sending Animations
    • Sending Notifications
    • Sending Interactive Messages
    • HEX & Gradient colors
  • ๐ŸงจAnimations
    • NONE
    • PULSING
    • RAINBOW
    • SPLIT
    • WAVES
    • WORDS_SPLIT
    • BOUNCE
    • FADE_IN
    • FADE_IN_WRITER
    • FLASHING
    • FLASHING_SYMBOL_WRAP
    • FROM_BOTH_SIDES
    • FROM_RIGHT
    • FROM_LEFT
  • ๐Ÿ”Integrations
    • CMI Integration
  • ๐ŸŽƒExtensions
    • In Development ...
  • Plugin's API
    • Creating AmazingExtension
    • Creating Custom Animations
    • Creating Custom SubCommand
    • Other API stuff
Powered by GitBook
On this page
  • Command handler needs to extend CommandHandler interface
  • Registering your CommandHandler
  1. Plugin's API

Creating Custom SubCommand

Learn how to create custom subcommand!

Command handler needs to extend CommandHandler interface

public class APIExample implements CommandHandler {
	
	
	@Override
	public boolean readAndExecute(CommandSender s, String[] args) {
		
		/*
		* 
		* Your command handler
		* @ false - helpMessage() will be sent to command sender
		* @ true - helpMessage() won't be sent to command sender
		* 
		* */
		
		return false;
	}
	
	@Override
	public List<String> readAndReturn(CommandSender s, String[] args) {
		
		/*
		* 
		* Your tab completer
		* 
		* */
		
		return null;
	}
	
	@Override
	public String permission() {
		return "some.permission.to.use";
	}
	
	@Override
	public HandlerType handlerType() {
		return new ExtensionHandlerType();
	}
	
	@Override
	public BaseComponent[] helpMessage() {
		
		/*
		* For this you can use built in TextComponentBuilder!
		* */
		TextComponentBuilder builder = new TextComponentBuilder();
		
		// Appending legacy text (Will be colorized automatically)
		builder.appendLegacy("&aSome text");
		
		// Appending legacy text with hover (Will be colorized automatically)
		builder.appendLegacy("&aSome text", "&bSome Hover");
		
		// Appending legacy text with click (Will be colorized automatically)
		builder.appendLegacy("&aSome text", ClickEvent.Action.OPEN_URL, "some.url");
		
		// Appending legacy text with hover & click (Will be colorized automatically)
		builder.appendLegacy("&aSome text", "&bSome Hover", ClickEvent.Action.OPEN_URL, "some.url");
		 
		// Returning component
		return builder.createMessage();
	}
	
}

Registering your CommandHandler

/*
* Let's register your handler with API!
* @ String - SubArgument (For example now usage is /at clearchat)
* @ CommandHandler - Your handler object
* */
AmazingTitles.registerCommandHandler("clearChat", new ClearChatCommandHandler());
PreviousCreating Custom AnimationsNextOther API stuff

Last updated 1 year ago