Updated documentation

This commit is contained in:
Norbi Peti 2016-11-03 17:46:50 +01:00
parent b4f74f993b
commit 2feafd057f
4 changed files with 28 additions and 28 deletions

View file

@ -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) {

View file

@ -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 {
/**

View file

@ -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());
}

View file

@ -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<String> cmds = new ArrayList<String>();
cmds.add("§6---- Subcommands ----");
@ -43,6 +48,9 @@ public class TBMCChatAPI {
* This method adds a plugin's commands to help and sets their executor.
* </p>
* <p>
* </p>
* <b>The command classes have to have a constructor each with no parameters</b>
* <p>
* The <u>command must be registered</u> in the caller plugin's plugin.yml. Otherwise the plugin will output a messsage to console.
* </p>
* <p>
@ -130,28 +138,4 @@ public class TBMCChatAPI {
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e);
}
}
/**
* <p>
* Add player information for {@link PlayerInfoCommand}. Only mods can see the given information.
* </p>
*
* @param player
* @param infoline
*/
public void AddPlayerInfoForMods(TBMCPlayer player, String infoline) {
// TODO
}
/**
* <p>
* Add player information for hover text at {@link ChatProcessing}. Every online player can see the given information.
* </p>
*
* @param player
* @param infoline
*/
public void AddPlayerInfoForHover(TBMCPlayer player, String infoline) {
// TODO
}
}