mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-26 02:57:56 +01:00
small cleanup
This commit is contained in:
parent
0380b7017d
commit
85989aeb7c
@ -16,6 +16,7 @@ public class BukkitConfig implements LPConfiguration {
|
||||
create();
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private void create() {
|
||||
File configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
|
||||
|
@ -8,7 +8,7 @@ import me.lucko.luckperms.users.User;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class VaultHook extends Permission {
|
||||
class VaultHook extends Permission {
|
||||
private final LPBukkitPlugin plugin;
|
||||
|
||||
@Override
|
||||
@ -90,9 +90,7 @@ public class VaultHook extends Permission {
|
||||
@Override
|
||||
public boolean playerInGroup(String world, String player, String group) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
return user.getGroupNames().contains(group);
|
||||
return user != null && user.getGroupNames().contains(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class PlayerListener implements Listener {
|
||||
plugin.getUserManager().unloadUser(user);
|
||||
}
|
||||
|
||||
public static String color(String string) {
|
||||
private static String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@ public class BukkitUser extends User {
|
||||
@Setter
|
||||
private PermissionAttachment attachment = null;
|
||||
|
||||
public BukkitUser(UUID uuid, LPBukkitPlugin plugin) {
|
||||
BukkitUser(UUID uuid, LPBukkitPlugin plugin) {
|
||||
super(uuid, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public BukkitUser(UUID uuid, String username, LPBukkitPlugin plugin) {
|
||||
BukkitUser(UUID uuid, String username, LPBukkitPlugin plugin) {
|
||||
super(uuid, username, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public class BungeeConfig implements LPConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private File makeFile(String file) throws IOException {
|
||||
File cfg = new File(plugin.getDataFolder(), file);
|
||||
|
||||
|
@ -8,7 +8,7 @@ import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MainCommand extends Command {
|
||||
class MainCommand extends Command {
|
||||
private final CommandManager manager;
|
||||
|
||||
public MainCommand(CommandManager manager) {
|
||||
|
@ -3,7 +3,6 @@ package me.lucko.luckperms.listeners;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.LPBungeePlugin;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
@ -12,12 +12,12 @@ public class BungeeUser extends User {
|
||||
|
||||
private final LPBungeePlugin plugin;
|
||||
|
||||
public BungeeUser(UUID uuid, LPBungeePlugin plugin) {
|
||||
BungeeUser(UUID uuid, LPBungeePlugin plugin) {
|
||||
super(uuid, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public BungeeUser(UUID uuid, String username, LPBungeePlugin plugin) {
|
||||
BungeeUser(UUID uuid, String username, LPBungeePlugin plugin) {
|
||||
super(uuid, username, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class CommandManager {
|
||||
|
||||
}
|
||||
|
||||
public void registerMainCommand(MainCommand command) {
|
||||
private void registerMainCommand(MainCommand command) {
|
||||
plugin.getLogger().log(Level.INFO, "[CommandManager] Registered main command '" + command.getName() + "'");
|
||||
mainCommands.add(command);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public abstract class MainCommand {
|
||||
@Getter
|
||||
private final int requiredArgsLength;
|
||||
|
||||
public MainCommand(String name, String usage, int requiredArgsLength) {
|
||||
protected MainCommand(String name, String usage, int requiredArgsLength) {
|
||||
this.name = name;
|
||||
this.usage = usage;
|
||||
this.requiredArgsLength = requiredArgsLength;
|
||||
|
@ -16,7 +16,7 @@ public abstract class SubCommand {
|
||||
@Getter
|
||||
private final String permission;
|
||||
|
||||
public SubCommand(String name, String description, String usage, String permission) {
|
||||
protected SubCommand(String name, String description, String usage, String permission) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.usage = usage;
|
||||
|
@ -9,7 +9,7 @@ import me.lucko.luckperms.groups.Group;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class GroupSubCommand extends SubCommand {
|
||||
public GroupSubCommand(String name, String description, String usage, String permission) {
|
||||
protected GroupSubCommand(String name, String description, String usage, String permission) {
|
||||
super(name, description, usage, permission);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import me.lucko.luckperms.users.User;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class UserSubCommand extends SubCommand {
|
||||
public UserSubCommand(String name, String description, String usage, String permission) {
|
||||
protected UserSubCommand(String name, String description, String usage, String permission) {
|
||||
super(name, description, usage, permission);
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,13 @@ public abstract class Datastore {
|
||||
protected final LuckPermsPlugin plugin;
|
||||
|
||||
@Getter
|
||||
public String name;
|
||||
public final String name;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean acceptingLogins;
|
||||
|
||||
public Datastore(LuckPermsPlugin plugin, String name) {
|
||||
protected Datastore(LuckPermsPlugin plugin, String name) {
|
||||
this.plugin = plugin;
|
||||
this.name = name;
|
||||
this.acceptingLogins = true;
|
||||
|
@ -13,7 +13,7 @@ public class MySQLDatastore extends SQLDatastore {
|
||||
private static final String CREATETABLE_USERS = "CREATE TABLE IF NOT EXISTS `lp_users` (`uuid` VARCHAR(36) NOT NULL, `name` VARCHAR(16) NOT NULL, `perms` TEXT NOT NULL, PRIMARY KEY (`uuid`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
|
||||
private static final String CREATETABLE_GROUPS = "CREATE TABLE IF NOT EXISTS `lp_groups` (`name` VARCHAR(36) NOT NULL, `perms` TEXT NULL, PRIMARY KEY (`name`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
|
||||
|
||||
private MySQLConfiguration configuration;
|
||||
private final MySQLConfiguration configuration;
|
||||
private HikariDataSource hikari;
|
||||
|
||||
public MySQLDatastore(LuckPermsPlugin plugin, MySQLConfiguration configuration) {
|
||||
|
@ -39,9 +39,9 @@ public abstract class SQLDatastore extends Datastore {
|
||||
private static final String UUIDCACHE_SELECT = "SELECT uuid FROM lp_uuid WHERE name=?";
|
||||
private static final String UUIDCACHE_UPDATE = "UPDATE lp_uuid SET uuid=? WHERE name=?";
|
||||
|
||||
private Gson gson;
|
||||
private final Gson gson;
|
||||
|
||||
public SQLDatastore(LuckPermsPlugin plugin, String name) {
|
||||
SQLDatastore(LuckPermsPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
gson = new Gson();
|
||||
}
|
||||
@ -317,7 +317,7 @@ public abstract class SQLDatastore extends Datastore {
|
||||
}
|
||||
|
||||
private class Closer {
|
||||
private List<AutoCloseable> objects = new ArrayList<>();
|
||||
private final List<AutoCloseable> objects = new ArrayList<>();
|
||||
|
||||
public void add(AutoCloseable a) {
|
||||
objects.add(a);
|
||||
|
@ -13,7 +13,7 @@ public class SQLiteDatastore extends SQLDatastore {
|
||||
private static final String CREATETABLE_USERS = "CREATE TABLE IF NOT EXISTS `lp_users` (`uuid` VARCHAR(36) NOT NULL, `name` VARCHAR(16) NOT NULL, `perms` TEXT NOT NULL, PRIMARY KEY (`uuid`));";
|
||||
private static final String CREATETABLE_GROUPS = "CREATE TABLE IF NOT EXISTS `lp_groups` (`name` VARCHAR(36) NOT NULL, `perms` TEXT NULL, PRIMARY KEY (`name`));";
|
||||
|
||||
private File file;
|
||||
private final File file;
|
||||
private Connection connection = null;
|
||||
|
||||
public SQLiteDatastore(LuckPermsPlugin plugin, File file) {
|
||||
|
@ -12,7 +12,7 @@ public class Group extends PermissionObject {
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
public Group(String name, LuckPermsPlugin plugin) {
|
||||
Group(String name, LuckPermsPlugin plugin) {
|
||||
super(plugin, name);
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ public abstract class User extends PermissionObject {
|
||||
@Setter
|
||||
private String name;
|
||||
|
||||
public User(UUID uuid, LuckPermsPlugin plugin) {
|
||||
User(UUID uuid, LuckPermsPlugin plugin) {
|
||||
super(plugin, uuid.toString());
|
||||
this.uuid = uuid;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
public User(UUID uuid, String name, LuckPermsPlugin plugin) {
|
||||
User(UUID uuid, String name, LuckPermsPlugin plugin) {
|
||||
super(plugin, uuid.toString());
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
|
@ -2,9 +2,6 @@ package me.lucko.luckperms.users;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -42,7 +42,7 @@ public abstract class PermissionObject {
|
||||
@Setter
|
||||
private Map<String, Boolean> nodes = new HashMap<>();
|
||||
|
||||
public PermissionObject(LuckPermsPlugin plugin, String objectName) {
|
||||
protected PermissionObject(LuckPermsPlugin plugin, String objectName) {
|
||||
this.objectName = objectName;
|
||||
this.plugin = plugin;
|
||||
this.includeGlobalPermissions = plugin.getConfiguration().getIncludeGlobalPerms();
|
||||
|
Loading…
Reference in New Issue
Block a user