Updated documentation
This commit is contained in:
parent
b4f74f993b
commit
2feafd057f
4 changed files with 28 additions and 28 deletions
|
@ -2,7 +2,7 @@ package buttondevteam.lib;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class EventExceptionCoreHandler extends EventExceptionHandler {
|
class EventExceptionCoreHandler extends EventExceptionHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Throwable ex, Event event) {
|
public boolean handle(Throwable ex, Event event) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.bukkit.plugin.RegisteredListener;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
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
|
// For wrapping a registered listener
|
||||||
private static class ExceptionRegisteredListener extends RegisteredListener {
|
private static class ExceptionRegisteredListener extends RegisteredListener {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,12 +102,28 @@ public final class TBMCCoreAPI {
|
||||||
return body;
|
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) {
|
public static void SendException(String sourcemsg, Throwable e) {
|
||||||
Bukkit.getPluginManager().callEvent(new TBMCExceptionEvent(sourcemsg, e));
|
Bukkit.getPluginManager().callEvent(new TBMCExceptionEvent(sourcemsg, e));
|
||||||
Bukkit.getLogger().warning(sourcemsg);
|
Bukkit.getLogger().warning(sourcemsg);
|
||||||
e.printStackTrace();
|
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) {
|
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
|
||||||
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
|
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -14,7 +13,6 @@ import org.reflections.util.ClasspathHelper;
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
import org.reflections.util.ConfigurationBuilder;
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.TBMCPlayer;
|
|
||||||
|
|
||||||
public class TBMCChatAPI {
|
public class TBMCChatAPI {
|
||||||
|
|
||||||
|
@ -24,6 +22,13 @@ public class TBMCChatAPI {
|
||||||
return commands;
|
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) {
|
public static String[] GetSubCommands(TBMCCommandBase command) {
|
||||||
ArrayList<String> cmds = new ArrayList<String>();
|
ArrayList<String> cmds = new ArrayList<String>();
|
||||||
cmds.add("§6---- Subcommands ----");
|
cmds.add("§6---- Subcommands ----");
|
||||||
|
@ -43,6 +48,9 @@ public class TBMCChatAPI {
|
||||||
* This method adds a plugin's commands to help and sets their executor.
|
* This method adds a plugin's commands to help and sets their executor.
|
||||||
* </p>
|
* </p>
|
||||||
* <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.
|
* 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>
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -130,28 +138,4 @@ public class TBMCChatAPI {
|
||||||
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.GetCommandPath(), e);
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue