Javadoc a bit of Geyser (#392)

* A bunch of javadoc comments

* Cleaned up javadocs
This commit is contained in:
rtm516 2020-04-21 06:28:44 +01:00 committed by GitHub
parent 4ee95f585d
commit 1b15f3058f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 280 additions and 12 deletions

View file

@ -14,6 +14,13 @@ public enum AuthType {
return id < VALUES.length ? VALUES[id] : OFFLINE;
}
/**
* Convert the AuthType string (from config) to the enum, OFFLINE on fail
*
* @param name AuthType string
*
* @return The converted AuthType
*/
public static AuthType getByName(String name) {
String upperCase = name.toUpperCase();
for (AuthType type : VALUES) {

View file

@ -51,6 +51,13 @@ public class ChatColor {
public static final String ITALIC = ESCAPE + "o";
public static final String RESET = ESCAPE + "r";
/**
* Convert chat colour codes to terminal colours
*
* @param string The text to replace colours for
*
* @return A string ready for terminal printing
*/
public static String toANSI(String string) {
string = string.replace(BOLD, (char) 0x1b + "[1m");
string = string.replace(OBFUSCATED, (char) 0x1b + "[5m");
@ -81,6 +88,13 @@ public class ChatColor {
return message.replace(color, ESCAPE);
}
/**
* Remove all colour formatting tags from a message
*
* @param message Message to remove colour tags from
*
* @return The sanitised message
*/
public static String stripColors(String message) {
return message = message.replaceAll("(&([a-fk-or0-9]))","").replaceAll("(§([a-fk-or0-9]))","").replaceAll("s/\\x1b\\[[0-9;]*[a-zA-Z]//g","");
}

View file

@ -31,13 +31,34 @@ import org.geysermc.common.logger.IGeyserLogger;
public interface IGeyserBootstrap {
/**
* Called when the GeyserBootstrap is enabled
*/
void onEnable();
/**
* Called when the GeyserBootstrap is disabled
*/
void onDisable();
/**
* Returns the current GeyserConfig
*
* @return The current GeyserConfig
*/
IGeyserConfiguration getGeyserConfig();
/**
* Returns the current GeyserLogger
*
* @return The current GeyserLogger
*/
IGeyserLogger getGeyserLogger();
/**
* Returns the current GeyserCommandManager
*
* @return The current GeyserCommandManager
*/
ICommandManager getGeyserCommandManager();
}

View file

@ -27,5 +27,12 @@ package org.geysermc.common.command;
public interface ICommandManager {
/**
* Returns the description of the given command
*
* @param command Command to get the description for
*
* @return Command description
*/
String getDescription(String command);
}