A library blessed by pinki that facilitates many things 7u7
Features:
* simple system to create advanced commands .
Create Commands
SingleCommand
Single command:
Create a class extending PLIBCommand and implement the methods.
public class CustomCmd extends PLIBCommand {
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] setAliases() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public int setMaxArgs() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int setMinArgs() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String setFewArgumentsMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setTooManyArgumentsMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setPermission() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setNotPermissionMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public SenderType onlyFor() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setOnlyForMessage() {
// TODO Auto-generated method stub
return null;
}
}The execute method will be who executes the command.
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
sender.sendMessage("custom command");
return true;
}The other methods are to adjust the parameters of the command, leaving them as null will make them return to the default value.
Set onlyFor:
Set sender type with SenderType:
@Override
public SenderType onlyFor() {
return SenderType.PLAYER;
}There are three types of sender: PLAYER, CONSOLE and ALL.
Returning it null will be the same as returning it ALL
To register, in the onEnable method place:
@Override
public void onEnable() {
PLIBCommandAPI comandAPI = PLIB.CommandCreatorAPI;
commandAPI.newCommand(YourPlugin, "NameOfCommand", new CustomCmd());
}change "new CustomCmd()" for the class you created.
RootCommand
public class CustomCmd extends PLIBSubCommandRoot {
@Override
public boolean execute(CommandSender sender, String Label) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] setAliases() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setNoSubcommandExistMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setPermission() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setNotPermissionMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public SenderType onlyFor() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setOnlyForMessage() {
// TODO Auto-generated method stub
return null;
}
}Root Command and SubCommand:
To create a root command create a class and extend PLIBSubCommandRoot and follow the same steps as with the single command.
To create subcommands is the same but extending PLIBSubCommand.
public class SubCustomCmd extends PLIBSubCommand {
public CustomCmd(String name) {
super(name);
// TODO Auto-generated constructor stub
}
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public int setMaxArgs() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int setMinArgs() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String setPermission() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setNotPermissionMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setFewArgumentsMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setTooManyArgumentsMessage() {
// TODO Auto-generated method stub
return null;
}
@Override
public SenderType onlyFor() {
// TODO Auto-generated method stub
return null;
}
@Override
public String setOnlyForMessage() {
// TODO Auto-generated method stub
return null;
}
}the difference is that this has a constructor.
To register a root command and its respective subcommands, in onEnable () place:
@Override
public void onEnable() {
PLIBCommandAPI comandAPI = PLIB.CommandCreatorAPI;
commandAPI.newCommand(YourPlugin, "NameOfRootCommand", new CustomCmd(), new PLIBSubCommand[]{new SubCustomCmd("NameOfSubCommand")});
}change "new CustomCmd()" for the the root command class that you created, in PLIBSubCommand[] put all the subcommand classes you want.
Planned features:
* packet interceptor
* reflection util
* NMS implementation
* give ideas uwu
This library will be updated when one of my plugins so requires, or suggest an idea for this that facilitates the construction of plugins.
Hail Pinki!
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta