Various small changes
This commit is contained in:
parent
5e23b6961e
commit
56e11b8b85
@ -5,7 +5,6 @@ import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import me.lucko.luckperms.api.implementation.ApiProvider;
|
||||
import me.lucko.luckperms.api.vault.VaultHook;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.data.MySQLConfiguration;
|
||||
import me.lucko.luckperms.data.methods.FlatfileDatastore;
|
||||
import me.lucko.luckperms.data.methods.MySQLDatastore;
|
||||
import me.lucko.luckperms.data.methods.SQLiteDatastore;
|
||||
@ -60,12 +59,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
final String storageMethod = configuration.getStorageMethod();
|
||||
if (storageMethod.equalsIgnoreCase("mysql")) {
|
||||
getLogger().info("Using MySQL as storage method.");
|
||||
datastore = new MySQLDatastore(this, new MySQLConfiguration(
|
||||
configuration.getDatabaseValue("address"),
|
||||
configuration.getDatabaseValue("database"),
|
||||
configuration.getDatabaseValue("username"),
|
||||
configuration.getDatabaseValue("password")
|
||||
));
|
||||
datastore = new MySQLDatastore(this, configuration.getDatabaseValues());
|
||||
} else if (storageMethod.equalsIgnoreCase("sqlite")) {
|
||||
getLogger().info("Using SQLite as storage method.");
|
||||
datastore = new SQLiteDatastore(this, new File(getDataFolder(), "luckperms.sqlite"));
|
||||
|
@ -21,6 +21,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
||||
final long startTime = System.currentTimeMillis();
|
||||
if (!plugin.getDatastore().isAcceptingLogins()) {
|
||||
// Datastore is disabled, prevent players from joining the server
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, KICK_MESSAGE);
|
||||
@ -43,6 +44,10 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
plugin.getDatastore().loadOrCreateUser(cache.getUUID(e.getUniqueId()), e.getName());
|
||||
final long time = System.currentTimeMillis() - startTime;
|
||||
if (time >= 1000) {
|
||||
plugin.getLogger().warning("Processing login for " + e.getName() + " took " + time + "ms.");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -4,7 +4,6 @@ import lombok.Getter;
|
||||
import me.lucko.luckperms.api.implementation.ApiProvider;
|
||||
import me.lucko.luckperms.commands.CommandManager;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.data.MySQLConfiguration;
|
||||
import me.lucko.luckperms.data.methods.FlatfileDatastore;
|
||||
import me.lucko.luckperms.data.methods.MySQLDatastore;
|
||||
import me.lucko.luckperms.groups.GroupManager;
|
||||
@ -51,12 +50,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
final String storageMethod = configuration.getStorageMethod();
|
||||
if (storageMethod.equalsIgnoreCase("mysql")) {
|
||||
getLogger().info("Using MySQL as storage method.");
|
||||
datastore = new MySQLDatastore(this, new MySQLConfiguration(
|
||||
configuration.getDatabaseValue("address"),
|
||||
configuration.getDatabaseValue("database"),
|
||||
configuration.getDatabaseValue("username"),
|
||||
configuration.getDatabaseValue("password")
|
||||
));
|
||||
datastore = new MySQLDatastore(this, configuration.getDatabaseValues());
|
||||
} else if (storageMethod.equalsIgnoreCase("flatfile")) {
|
||||
getLogger().info("Using Flatfile (JSON) as storage method.");
|
||||
datastore = new FlatfileDatastore(this, getDataFolder());
|
||||
|
@ -34,6 +34,7 @@ public class PlayerListener implements Listener {
|
||||
Offline mode. */
|
||||
e.registerIntent(plugin);
|
||||
plugin.doAsync(() -> {
|
||||
final long startTime = System.currentTimeMillis();
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
final PendingConnection c = e.getConnection();
|
||||
|
||||
@ -54,6 +55,10 @@ public class PlayerListener implements Listener {
|
||||
// We have to make a new user on this thread whilst the connection is being held, or we get concurrency issues as the Bukkit server
|
||||
// and the BungeeCord server try to make a new user at the same time.
|
||||
plugin.getDatastore().loadOrCreateUser(cache.getUUID(c.getUniqueId()), c.getName());
|
||||
final long time = System.currentTimeMillis() - startTime;
|
||||
if (time >= 1000) {
|
||||
plugin.getLogger().warning("Processing login for " + c.getName() + " took " + time + "ms.");
|
||||
}
|
||||
e.completeIntent(plugin);
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package me.lucko.luckperms.commands;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@UtilityClass
|
||||
@ -14,19 +16,19 @@ public class Predicate {
|
||||
return t -> true;
|
||||
}
|
||||
|
||||
public static java.util.function.Predicate<Integer> notinRange(Integer start, Integer end) {
|
||||
public static java.util.function.Predicate<Integer> notInRange(Integer start, Integer end) {
|
||||
return inverse(inRange(start, end));
|
||||
}
|
||||
|
||||
public static java.util.function.Predicate<Integer> inRange(Integer start, Integer end) {
|
||||
return isOneOf(IntStream.rangeClosed(start, end).boxed().toArray(Integer[]::new));
|
||||
return isOneOf(IntStream.rangeClosed(start, end).boxed().collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> notOneOf(T[] ts) {
|
||||
public static <T> java.util.function.Predicate<T> notOneOf(Set<T> ts) {
|
||||
return inverse(isOneOf(ts));
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> isOneOf(T[] ta) {
|
||||
public static <T> java.util.function.Predicate<T> isOneOf(Set<T> ta) {
|
||||
return t -> {
|
||||
for (T i : ta) {
|
||||
if (i == t) {
|
||||
@ -37,6 +39,14 @@ public class Predicate {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> not(T t) {
|
||||
return inverse(is(t));
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> is(T t) {
|
||||
return t2 -> t == t2;
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> inverse(java.util.function.Predicate<T> t) {
|
||||
return t2 -> !t.test(t2);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.lucko.luckperms.commands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.data.Callback;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -10,13 +11,21 @@ import java.util.List;
|
||||
* An extension of {@link MainCommand} for implementations without any subcommands
|
||||
*/
|
||||
public class SingleMainCommand extends MainCommand<Object> {
|
||||
public SingleMainCommand(String name, String usage, int requiredArgsLength) {
|
||||
private final Permission permission;
|
||||
|
||||
public SingleMainCommand(String name, String usage, int requiredArgsLength, Permission permission) {
|
||||
super(name, usage, requiredArgsLength);
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
|
||||
// Do nothing, allow the implementation to override this
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getTarget(String target, LuckPermsPlugin plugin, Sender sender, Callback onSuccess) {
|
||||
|
||||
// Do nothing, don't run callback
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,4 +42,9 @@ public class SingleMainCommand extends MainCommand<Object> {
|
||||
public List<SubCommand<Object>> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return permission.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
public class CreateGroup extends SingleMainCommand {
|
||||
public CreateGroup() {
|
||||
super("CreateGroup", "/%s creategroup <group>", 1);
|
||||
super("CreateGroup", "/%s creategroup <group>", 1, Permission.CREATE_GROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,9 +48,4 @@ public class CreateGroup extends SingleMainCommand {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.CREATE_GROUP.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class DeleteGroup extends SingleMainCommand {
|
||||
public DeleteGroup() {
|
||||
super("DeleteGroup", "/%s deletegroup <group>", 1);
|
||||
super("DeleteGroup", "/%s deletegroup <group>", 1, Permission.DELETE_GROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,9 +73,4 @@ public class DeleteGroup extends SingleMainCommand {
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.DELETE_GROUP.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public class ListGroups extends SingleMainCommand {
|
||||
public ListGroups() {
|
||||
super("ListGroups", "/%s listgroups", 0);
|
||||
super("ListGroups", "/%s listgroups", 0, Permission.LIST_GROUPS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -25,9 +25,4 @@ public class ListGroups extends SingleMainCommand {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.LIST_GROUPS.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class GroupHasPerm extends SubCommand<Group> {
|
||||
public GroupHasPerm() {
|
||||
super("haspermission", "Checks to see if a group has a certain permission node",
|
||||
"/%s group <group> haspermission <node> [server] [world]", Permission.GROUP_HASPERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GroupInheritsPerm extends SubCommand<Group> {
|
||||
public GroupInheritsPerm() {
|
||||
super("inheritspermission", "Checks to see if a group inherits a certain permission node",
|
||||
"/%s group <group> inheritspermission <node> [server] [world]", Permission.GROUP_INHERITSPERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GroupSetInherit extends SubCommand<Group> {
|
||||
public GroupSetInherit() {
|
||||
super("setinherit", "Sets another group for this group to inherit permissions from",
|
||||
"/%s group <group> setinherit <group> [server] [world]", Permission.GROUP_SETINHERIT,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class GroupSetPermission extends SubCommand<Group> {
|
||||
public GroupSetPermission() {
|
||||
super("set", "Sets a permission for a group", "/%s group <group> set <node> <true|false> [server] [world]",
|
||||
Permission.GROUP_SETPERMISSION, Predicate.notinRange(2, 4));
|
||||
Permission.GROUP_SETPERMISSION, Predicate.notInRange(2, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
||||
public GroupSetTempInherit() {
|
||||
super("settempinherit", "Sets another group for this group to inherit permissions from temporarily",
|
||||
"/%s group <group> settempinherit <group> <duration> [server] [world]",
|
||||
Permission.GROUP_SET_TEMP_INHERIT, Predicate.notinRange(2, 4));
|
||||
Permission.GROUP_SET_TEMP_INHERIT, Predicate.notInRange(2, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
||||
public GroupSetTempPermission() {
|
||||
super("settemp", "Sets a temporary permission for a group",
|
||||
"/%s group <group> settemp <node> <true|false> <duration> [server] [world]",
|
||||
Permission.GROUP_SET_TEMP_PERMISSION, Predicate.notinRange(3, 5));
|
||||
Permission.GROUP_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class GroupUnSetPermission extends SubCommand<Group> {
|
||||
public GroupUnSetPermission() {
|
||||
super("unset", "Unsets a permission for a group", "/%s group <group> unset <node> [server] [world]",
|
||||
Permission.GROUP_UNSETPERMISSION, Predicate.notinRange(1, 3));
|
||||
Permission.GROUP_UNSETPERMISSION, Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
|
||||
public GroupUnsetInherit() {
|
||||
super("unsetinherit", "Unsets another group for this group to inherit permissions from",
|
||||
"/%s group <group> unsetinherit <group> [server] [world]", Permission.GROUP_UNSETINHERIT,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
|
||||
public GroupUnsetTempInherit() {
|
||||
super("unsettempinherit", "Unsets another group for this group to inherit permissions from",
|
||||
"/%s group <group> unsettempinherit <group> [server] [world]", Permission.GROUP_UNSET_TEMP_INHERIT,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
|
||||
public GroupUnsetTempPermission() {
|
||||
super("unsettemp", "Unsets a temporary permission for a group",
|
||||
"/%s group <group> unsettemp <node> [server] [world]", Permission.GROUP_UNSET_TEMP_PERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
public class DebugCommand extends SingleMainCommand {
|
||||
public DebugCommand() {
|
||||
super("Debug", "/%s debug", 0);
|
||||
super("Debug", "/%s debug", 0, Permission.DEBUG);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -19,9 +19,4 @@ public class DebugCommand extends SingleMainCommand {
|
||||
plugin.getGroupManager().getGroups().size(), plugin.getTrackManager().getTracks().size()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.DEBUG.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
public class InfoCommand extends SingleMainCommand {
|
||||
public InfoCommand() {
|
||||
super("Info", "/%s info", 0);
|
||||
super("Info", "/%s info", 0, Permission.INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -20,9 +20,4 @@ public class InfoCommand extends SingleMainCommand {
|
||||
Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName(), c.getServer(),
|
||||
c.getDefaultGroupName(), c.getSyncTime(), c.getIncludeGlobalPerms(), c.getOnlineMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.INFO.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
public class SyncCommand extends SingleMainCommand {
|
||||
public SyncCommand() {
|
||||
super("Sync", "/%s sync", 0);
|
||||
super("Sync", "/%s sync", 0, Permission.SYNC);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -18,9 +18,4 @@ public class SyncCommand extends SingleMainCommand {
|
||||
Message.UPDATE_TASK_RUN.send(sender);
|
||||
plugin.runUpdateTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.SYNC.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
public class CreateTrack extends SingleMainCommand {
|
||||
public CreateTrack() {
|
||||
super("CreateTrack", "/%s createtrack <track>", 1);
|
||||
super("CreateTrack", "/%s createtrack <track>", 1, Permission.CREATE_TRACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,9 +48,4 @@ public class CreateTrack extends SingleMainCommand {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.CREATE_TRACK.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class DeleteTrack extends SingleMainCommand {
|
||||
public DeleteTrack() {
|
||||
super("DeleteTrack", "/%s deletetrack <track>", 1);
|
||||
super("DeleteTrack", "/%s deletetrack <track>", 1, Permission.DELETE_TRACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,9 +68,4 @@ public class DeleteTrack extends SingleMainCommand {
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.DELETE_TRACK.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public class ListTracks extends SingleMainCommand {
|
||||
public ListTracks() {
|
||||
super("ListTracks", "/%s listtracks", 0);
|
||||
super("ListTracks", "/%s listtracks", 0, Permission.LIST_TRACKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -25,9 +25,4 @@ public class ListTracks extends SingleMainCommand {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAuthorized(Sender sender) {
|
||||
return Permission.LIST_TRACKS.isAuthorized(sender);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
public class TrackAppend extends SubCommand<Track> {
|
||||
public TrackAppend() {
|
||||
super("append", "Appends a group onto the end of the track", "/%s track <track> append <group>",
|
||||
Permission.TRACK_APPEND, Predicate.notOneOf(new Integer[]{1}));
|
||||
Permission.TRACK_APPEND, Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
public class TrackInsert extends SubCommand<Track> {
|
||||
public TrackInsert() {
|
||||
super("insert", "Inserts a group at a given position along the track",
|
||||
"/%s track <track> insert <group> <position>", Permission.TRACK_INSERT, Predicate.notOneOf(new Integer[]{2}));
|
||||
"/%s track <track> insert <group> <position>", Permission.TRACK_INSERT, Predicate.not(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class TrackRemove extends SubCommand<Track> {
|
||||
public TrackRemove() {
|
||||
super("remove", "Removes a group from the track", "/%s track <track> remove <group>", Permission.TRACK_REMOVE,
|
||||
Predicate.notOneOf(new Integer[]{1}));
|
||||
Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
public class UserAddGroup extends SubCommand<User> {
|
||||
public UserAddGroup() {
|
||||
super("addgroup", "Adds the user to a group", "/%s user <user> addgroup <group> [server] [world]",
|
||||
Permission.USER_ADDGROUP, Predicate.notinRange(1, 3));
|
||||
Permission.USER_ADDGROUP, Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ public class UserAddTempGroup extends SubCommand<User> {
|
||||
public UserAddTempGroup() {
|
||||
super("addtempgroup", "Adds the user to a group temporarily",
|
||||
"/%s user <user> addtempgroup <group> <duration> [server] [world]", Permission.USER_ADDTEMPGROUP,
|
||||
Predicate.notinRange(2, 4));
|
||||
Predicate.notInRange(2, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
public class UserDemote extends SubCommand<User> {
|
||||
public UserDemote() {
|
||||
super("demote", "Demotes a user along a track", "/%s user <user> demote <track>", Permission.USER_DEMOTE,
|
||||
Predicate.notOneOf(new Integer[]{1}));
|
||||
Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class UserHasPerm extends SubCommand<User> {
|
||||
public UserHasPerm() {
|
||||
super("haspermission", "Checks to see if a user has a certain permission node",
|
||||
"/%s user <user> haspermission <node> [server] [world]", Permission.USER_HASPERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class UserInheritsPerm extends SubCommand<User> {
|
||||
public UserInheritsPerm() {
|
||||
super("inheritspermission", "Checks to see if a user inherits a certain permission node",
|
||||
"/%s user <user> inheritspermission <node> [server] [world]", Permission.USER_INHERITSPERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
public class UserPromote extends SubCommand<User> {
|
||||
public UserPromote() {
|
||||
super("promote", "Promotes the user along a track", "/%s user <user> promote <track>", Permission.USER_PROMOTE,
|
||||
Predicate.notOneOf(new Integer[]{1}));
|
||||
Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class UserRemoveGroup extends SubCommand<User> {
|
||||
public UserRemoveGroup() {
|
||||
super("removegroup", "Removes a user from a group", "/%s user <user> removegroup <group> [server] [world]",
|
||||
Permission.USER_REMOVEGROUP, Predicate.notinRange(1, 3));
|
||||
Permission.USER_REMOVEGROUP, Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class UserRemoveTempGroup extends SubCommand<User> {
|
||||
public UserRemoveTempGroup() {
|
||||
super("removetempgroup", "Removes a user from a temporary group",
|
||||
"/%s user <user> removetempgroup <group> [server] [world]", Permission.USER_REMOVETEMPGROUP,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class UserSetPermission extends SubCommand<User> {
|
||||
public UserSetPermission() {
|
||||
super("set", "Sets a permission for a user",
|
||||
"/%s user <user> set <node> <true|false> [server] [world]", Permission.USER_SETPERMISSION,
|
||||
Predicate.notinRange(2, 4));
|
||||
Predicate.notInRange(2, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserSetPrimaryGroup extends SubCommand<User> {
|
||||
public UserSetPrimaryGroup() {
|
||||
super("setprimarygroup", "Sets a users primary group",
|
||||
"/%s user <user> setprimarygroup <group>", Permission.USER_SETPRIMARYGROUP, Predicate.notOneOf(new Integer[]{1}));
|
||||
"/%s user <user> setprimarygroup <group>", Permission.USER_SETPRIMARYGROUP, Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ public class UserSetTempPermission extends SubCommand<User> {
|
||||
public UserSetTempPermission() {
|
||||
super("settemp", "Sets a temporary permission for a user",
|
||||
"/%s user <user> settemp <node> <true|false> <duration> [server] [world]",
|
||||
Permission.USER_SET_TEMP_PERMISSION, Predicate.notinRange(3, 5));
|
||||
Permission.USER_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class UserShowPos extends SubCommand<User> {
|
||||
public UserShowPos() {
|
||||
super("showpos", "Shows a users position on a track", "/%s user <user> showpos <track>", Permission.USER_SHOWPOS,
|
||||
Predicate.notOneOf(new Integer[]{1}));
|
||||
Predicate.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class UserUnSetPermission extends SubCommand<User> {
|
||||
public UserUnSetPermission() {
|
||||
super("unset", "Unsets a permission for a user",
|
||||
"/%s user <user> unset <node> [server] [world]", Permission.USER_UNSETPERMISSION, Predicate.notinRange(1, 3));
|
||||
"/%s user <user> unset <node> [server] [world]", Permission.USER_UNSETPERMISSION, Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class UserUnsetTempPermission extends SubCommand<User> {
|
||||
public UserUnsetTempPermission() {
|
||||
super("unsettemp", "Unsets a temporary permission for a user",
|
||||
"/%s user <user> unsettemp <node> [server] [world]", Permission.USER_UNSET_TEMP_PERMISSION,
|
||||
Predicate.notinRange(1, 3));
|
||||
Predicate.notInRange(1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package me.lucko.luckperms.utils;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.data.MySQLConfiguration;
|
||||
|
||||
public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
||||
|
||||
@ -65,8 +66,13 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
||||
return getBoolean("online-mode", true);
|
||||
}
|
||||
|
||||
public String getDatabaseValue(String value) {
|
||||
return getString("sql." + value, null);
|
||||
public MySQLConfiguration getDatabaseValues() {
|
||||
return new MySQLConfiguration(
|
||||
getString("sql.address", null),
|
||||
getString("sql.database", null),
|
||||
getString("sql.username", null),
|
||||
getString("sql.password", null)
|
||||
);
|
||||
}
|
||||
|
||||
public String getStorageMethod() {
|
||||
|
Loading…
Reference in New Issue
Block a user