+ * This method adds a plugin's commands to help and sets their executor. + *
+ *+ * The command must be registered in the caller plugin's plugin.yml. Otherwise the plugin will output a messsage to console. + *
+ *+ * Using this method after the server is done loading will have no effect. + *
+ * + * @param plugin + * The caller plugin + * @param acmdclass + * A command's class to get the package name for commands. The provided class's package and subpackages are scanned for commands. + */ + public static void AddCommands(JavaPlugin plugin, Class extends TBMCCommandBase> acmdclass) { + plugin.getLogger().info("Registering commands for " + plugin.getName()); + Reflections rf = new Reflections( + new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(plugin.getClass().getClassLoader())) + .addClassLoader(plugin.getClass().getClassLoader()).addScanners(new SubTypesScanner()) + .filterInputsBy((String pkg) -> pkg.contains(acmdclass.getPackage().getName()))); + Set+ * Add player information for {@link PlayerInfoCommand}. Only mods can see the given information. + *
+ * + * @param player + * @param infoline + */ + public void AddPlayerInfoForMods(TBMCPlayer player, String infoline) { + // TODO + } + + /** + *+ * Add player information for hover text at {@link ChatProcessing}. Every online player can see the given information. + *
+ * + * @param player + * @param infoline + */ + public void AddPlayerInfoForHover(TBMCPlayer player, String infoline) { + // TODO + } +} diff --git a/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java b/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java new file mode 100644 index 0000000..d1d4f3d --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java @@ -0,0 +1,26 @@ +package buttondevteam.lib.chat; + +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; + +public abstract class TBMCCommandBase { + + public TBMCCommandBase() { + } + + public abstract String[] GetHelpText(String alias); + + public abstract boolean OnCommand(CommandSender sender, String alias, String[] args); + + public abstract String GetCommandPath(); + + public abstract boolean GetPlayerOnly(); + + public abstract boolean GetModOnly(); + + Plugin plugin; // Used By TBMCChatAPI + + public Plugin getPlugin() { // Used by CommandCaller (ButtonChat) + return plugin; + } +}