Sponge support

This commit is contained in:
Luck
2016-08-05 12:58:27 +02:00
Unverified
parent 56e11b8b85
commit 03450c3339
37 changed files with 908 additions and 126 deletions
@@ -22,14 +22,14 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
init();
if (Patterns.NON_ALPHA_NUMERIC.matcher(getServer()).find()) {
plugin.getLogger().severe("Server name defined in config.yml contains invalid characters. Server names can " +
plugin.getLog().severe("Server name defined in config.yml contains invalid characters. Server names can " +
"only contain alphanumeric characters.\nDefined server name '" + getServer() + "' will be replaced with '" +
defaultServerName + "' (the default)");
set("server", defaultServerName);
}
if (Patterns.NON_ALPHA_NUMERIC.matcher(getDefaultGroupName()).find()) {
plugin.getLogger().severe("Default group defined in config.yml contains invalid characters. Group names can " +
plugin.getLog().severe("Default group defined in config.yml contains invalid characters. Group names can " +
"only contain alphanumeric characters.\nDefined default group name '" + getDefaultGroupName() +
"' will be replaced with 'default' (the default)");
set("default-group", "default");
@@ -0,0 +1,49 @@
package me.lucko.luckperms.utils;
import lombok.experimental.UtilityClass;
import me.lucko.luckperms.api.Logger;
@UtilityClass
public class LogUtil {
public static Logger wrap(org.slf4j.Logger l) {
return new Logger() {
private final org.slf4j.Logger logger = l;
@Override
public void info(String s) {
logger.info(s);
}
@Override
public void warn(String s) {
logger.warn(s);
}
@Override
public void severe(String s) {
logger.error(s);
}
};
}
public static Logger wrap(java.util.logging.Logger l) {
return new Logger() {
private final java.util.logging.Logger logger = l;
@Override
public void info(String s) {
logger.info(s);
}
@Override
public void warn(String s) {
logger.warning(s);
}
@Override
public void severe(String s) {
logger.severe(s);
}
};
}
}
@@ -6,6 +6,7 @@ import java.util.regex.Pattern;
@UtilityClass
public class Patterns {
public static final Pattern SPACE_SPLIT = Pattern.compile(" ");
public static final Pattern SERVER_SPLIT = Pattern.compile("\\/");
public static final Pattern WORLD_SPLIT = Pattern.compile("\\-");
public static final Pattern TEMP_SPLIT = Pattern.compile("\\$");
@@ -580,7 +580,7 @@ public abstract class PermissionObject {
if (group != null) {
perms.putAll(group.getLocalPermissions(server, excludedGroups));
} else {
plugin.getLogger().warning("Error whilst refreshing the permissions of '" + objectName + "'." +
plugin.getLog().warn("Error whilst refreshing the permissions of '" + objectName + "'." +
"\n The group '" + groupName + "' is not loaded.");
}
}
@@ -603,7 +603,7 @@ public abstract class PermissionObject {
if (group != null) {
perms.putAll(group.getLocalPermissions(server, excludedGroups));
} else {
plugin.getLogger().warning("Error whilst refreshing the permissions of '" + objectName + "'." +
plugin.getLog().warn("Error whilst refreshing the permissions of '" + objectName + "'." +
"\n The group '" + groupName + "' is not loaded.");
}
}