From 2feafd057f255ddf8858a74a5e22718e9c6edbd1 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 3 Nov 2016 17:46:50 +0100 Subject: [PATCH] Updated documentation --- .../lib/EventExceptionCoreHandler.java | 2 +- .../lib/EventExceptionHandler.java | 2 +- .../java/buttondevteam/lib/TBMCCoreAPI.java | 16 +++++++++ .../buttondevteam/lib/chat/TBMCChatAPI.java | 36 ++++++------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java b/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java index 9ed7476..0cffe71 100644 --- a/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java +++ b/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java @@ -2,7 +2,7 @@ package buttondevteam.lib; import org.bukkit.event.Event; -public class EventExceptionCoreHandler extends EventExceptionHandler { +class EventExceptionCoreHandler extends EventExceptionHandler { @Override public boolean handle(Throwable ex, Event event) { diff --git a/src/main/java/buttondevteam/lib/EventExceptionHandler.java b/src/main/java/buttondevteam/lib/EventExceptionHandler.java index 11ebc8f..e84cb2c 100644 --- a/src/main/java/buttondevteam/lib/EventExceptionHandler.java +++ b/src/main/java/buttondevteam/lib/EventExceptionHandler.java @@ -20,7 +20,7 @@ import org.bukkit.plugin.RegisteredListener; import com.google.common.collect.Lists; -public abstract class EventExceptionHandler { // https://gist.github.com/aadnk/5430459 +abstract class EventExceptionHandler { // https://gist.github.com/aadnk/5430459 // For wrapping a registered listener private static class ExceptionRegisteredListener extends RegisteredListener { /** diff --git a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java index 163d7c6..540fa43 100644 --- a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java +++ b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java @@ -102,12 +102,28 @@ public final class TBMCCoreAPI { return body; } + /** + * Send exception to the {@link TBMCExceptionEvent}. + * + * @param sourcemsg + * A message that is shown at the top of the exception (before the exception's message) + * @param e + * The exception to send + */ public static void SendException(String sourcemsg, Throwable e) { Bukkit.getPluginManager().callEvent(new TBMCExceptionEvent(sourcemsg, e)); Bukkit.getLogger().warning(sourcemsg); e.printStackTrace(); } + /** + * Registers Bukkit events, handling the exceptions occuring in those events + * + * @param listener + * The class that handles the events + * @param plugin + * The plugin which the listener belongs to + */ public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) { EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler()); } diff --git a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java index 21c7a62..54e69b3 100644 --- a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java +++ b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java @@ -1,6 +1,5 @@ package buttondevteam.lib.chat; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; @@ -14,7 +13,6 @@ import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; import buttondevteam.lib.TBMCCoreAPI; -import buttondevteam.lib.TBMCPlayer; public class TBMCChatAPI { @@ -24,6 +22,13 @@ public class TBMCChatAPI { return commands; } + /** + * Returns messages formatted for Minecraft chat listing the subcommands of the command. + * + * @param command + * The command which we want the subcommands of + * @return The subcommands + */ public static String[] GetSubCommands(TBMCCommandBase command) { ArrayList cmds = new ArrayList(); cmds.add("ยง6---- Subcommands ----"); @@ -43,6 +48,9 @@ public class TBMCChatAPI { * This method adds a plugin's commands to help and sets their executor. *

*

+ *

+ * The command classes have to have a constructor each with no parameters + *

* The command must be registered in the caller plugin's plugin.yml. Otherwise the plugin will output a messsage to console. *

*

@@ -130,28 +138,4 @@ public class TBMCChatAPI { TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e); } } - - /** - *

- * 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 - } }