mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 03:25:19 +01:00
cleanup & fix build
This commit is contained in:
parent
dee41b315f
commit
230d9725e8
@ -174,7 +174,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
// Make a LuckPerms user for the one being migrated.
|
||||
plugin.getStorage().loadUser(uuid, "null").join();
|
||||
plugin.getStorage().loadUser(uuid, null).join();
|
||||
User lpUser = plugin.getUserManager().getIfLoaded(uuid);
|
||||
|
||||
migrateHolder(world, user, lpUser);
|
||||
|
@ -262,7 +262,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
log.log("Starting user migration.");
|
||||
AtomicInteger userCount = new AtomicInteger(0);
|
||||
for (Map.Entry<UUID, Set<Node>> e : users.entrySet()) {
|
||||
plugin.getStorage().loadUser(e.getKey(), "null").join();
|
||||
plugin.getStorage().loadUser(e.getKey(), null).join();
|
||||
me.lucko.luckperms.common.model.User user = plugin.getUserManager().getIfLoaded(e.getKey());
|
||||
|
||||
for (Node node : e.getValue()) {
|
||||
|
@ -231,7 +231,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
for (UUID uuid : uuids) {
|
||||
|
||||
// Create a LuckPerms user for the UUID
|
||||
plugin.getStorage().loadUser(uuid, "null").join();
|
||||
plugin.getStorage().loadUser(uuid, null).join();
|
||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
||||
|
||||
List<Permission> permissions = joinFuture(pm.getPlayerOwnPermissions(uuid));
|
||||
|
@ -151,7 +151,7 @@ public class LPPermissible extends PermissibleBase {
|
||||
*
|
||||
* @return the calculated contexts for the player.
|
||||
*/
|
||||
public Contexts calculateContexts() {
|
||||
private Contexts calculateContexts() {
|
||||
return plugin.getContextManager().getApplicableContexts(player);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class PermissionCalculator implements CacheLoader<String, Tristate> {
|
||||
|
||||
// convert the permission to lowercase, as all values in the backing map are also lowercase.
|
||||
// this allows fast case insensitive lookups
|
||||
permission = permission.toLowerCase();
|
||||
permission = permission.toLowerCase().intern();
|
||||
|
||||
// get the result
|
||||
Tristate result = lookupCache.get(permission);
|
||||
@ -72,11 +72,7 @@ public class PermissionCalculator implements CacheLoader<String, Tristate> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tristate load(String s) {
|
||||
return lookupPermissionValue(s);
|
||||
}
|
||||
|
||||
private Tristate lookupPermissionValue(String permission) {
|
||||
public Tristate load(String permission) {
|
||||
|
||||
// offer the permission to the permission vault
|
||||
// we only need to do this once per permission, so it doesn't matter
|
||||
|
@ -95,16 +95,12 @@ public class TreeCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
Message.TREE_UPLOAD_START.send(sender);
|
||||
|
||||
String url = view.uploadPasteData(plugin.getVersion(), user.getFriendlyName(), permissionData);
|
||||
if (url == null) {
|
||||
url = "null";
|
||||
}
|
||||
|
||||
Message.TREE_URL.send(sender);
|
||||
|
||||
Component message = TextComponent.builder(url).color(TextColor.AQUA)
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, String.valueOf(url)))
|
||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to open the tree view.").color(TextColor.GRAY)))
|
||||
.build();
|
||||
|
||||
@ -120,16 +116,12 @@ public class TreeCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
Message.TREE_UPLOAD_START.send(sender);
|
||||
|
||||
String url = view.uploadPasteData(plugin.getVersion());
|
||||
if (url == null) {
|
||||
url = "null";
|
||||
}
|
||||
|
||||
Message.TREE_URL.send(sender);
|
||||
|
||||
Component message = TextComponent.builder(url).color(TextColor.AQUA)
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, String.valueOf(url)))
|
||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to open the tree view.").color(TextColor.GRAY)))
|
||||
.build();
|
||||
|
||||
|
@ -109,16 +109,12 @@ public class VerboseCommand extends SingleCommand {
|
||||
Message.VERBOSE_OFF.send(sender);
|
||||
} else {
|
||||
Message.VERBOSE_UPLOAD_START.send(sender);
|
||||
|
||||
String url = listener.uploadPasteData(!noTraces, attachRaw);
|
||||
if (url == null) {
|
||||
url = "null";
|
||||
}
|
||||
|
||||
Message.VERBOSE_RESULTS_URL.send(sender);
|
||||
|
||||
Component message = TextComponent.builder(url).color(TextColor.AQUA)
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))
|
||||
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, String.valueOf(url)))
|
||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to open the results page.").color(TextColor.GRAY)))
|
||||
.build();
|
||||
|
||||
|
@ -112,11 +112,12 @@ public class GenericUserManager extends AbstractManager<UserIdentifier, User> im
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateAllUsers() {
|
||||
return CompletableFuture.supplyAsync(plugin::getOnlinePlayers, plugin.getScheduler().sync())
|
||||
.thenAcceptAsync(players -> players.forEach(uuid -> {
|
||||
UUID internal = plugin.getUuidCache().getUUID(uuid);
|
||||
plugin.getStorage().loadUser(internal, "null").join();
|
||||
}), plugin.getScheduler().async());
|
||||
return CompletableFuture.runAsync(
|
||||
() -> plugin.getOnlinePlayers()
|
||||
.map(u -> plugin.getUuidCache().getUUID(u))
|
||||
.forEach(u -> plugin.getStorage().loadUser(u, null).join()),
|
||||
plugin.getScheduler().async()
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean giveDefaultIfNeeded(User user, boolean save, LuckPermsPlugin plugin) {
|
||||
|
@ -733,13 +733,13 @@ public abstract class PermissionHolder {
|
||||
Map<String, Boolean> perms = new HashMap<>();
|
||||
boolean applyShorthand = plugin.getConfiguration().get(ConfigKeys.APPLYING_SHORTHAND);
|
||||
for (Node node : entries) {
|
||||
String perm = lowerCase ? node.getPermission().toLowerCase() : node.getPermission();
|
||||
String perm = lowerCase ? node.getPermission().toLowerCase().intern() : node.getPermission();
|
||||
|
||||
if (perms.putIfAbsent(perm, node.getValuePrimitive()) == null) {
|
||||
if (applyShorthand) {
|
||||
List<String> sh = node.resolveShorthand();
|
||||
if (!sh.isEmpty()) {
|
||||
sh.stream().map(s -> lowerCase ? s.toLowerCase() : s).forEach(s -> perms.putIfAbsent(s, node.getValuePrimitive()));
|
||||
if (perms.putIfAbsent(perm, node.getValuePrimitive()) == null && applyShorthand) {
|
||||
List<String> shorthand = node.resolveShorthand();
|
||||
if (!shorthand.isEmpty()) {
|
||||
for (String s : shorthand) {
|
||||
perms.putIfAbsent((lowerCase ? s.toLowerCase() : s).intern(), node.getValuePrimitive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,6 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
userData.recalculatePermissions();
|
||||
userData.recalculateMeta();
|
||||
getPlugin().getApiProvider().getEventFactory().handleUserDataRecalculate(this, userData);
|
||||
getPlugin().onUserRefresh(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ public abstract class ConfigurateDao extends AbstractDao {
|
||||
User u = plugin.getUserManager().getIfLoaded(uuid);
|
||||
if (u != null) {
|
||||
plugin.getLog().info("[FileWatcher] Refreshing user " + u.getFriendlyName());
|
||||
plugin.getStorage().loadUser(uuid, "null");
|
||||
plugin.getStorage().loadUser(uuid, null);
|
||||
}
|
||||
});
|
||||
watcher.subscribe("group", groupsDirectory.toPath(), s -> {
|
||||
|
@ -225,7 +225,7 @@ public class SqlDao extends AbstractDao {
|
||||
ps.setString(2, entry.getActor().toString());
|
||||
ps.setString(3, entry.getActorName());
|
||||
ps.setString(4, Character.toString(entry.getEntryType().getCode()));
|
||||
ps.setString(5, entry.getActed() == null ? "null" : entry.getActed().toString());
|
||||
ps.setString(5, String.valueOf(entry.getActed()));
|
||||
ps.setString(6, entry.getActedName());
|
||||
ps.setString(7, entry.getAction());
|
||||
ps.execute();
|
||||
|
@ -197,11 +197,12 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateAllUsers() {
|
||||
return CompletableFuture.supplyAsync(plugin::getOnlinePlayers, plugin.getScheduler().sync())
|
||||
.thenAcceptAsync(players -> players.forEach(uuid -> {
|
||||
UUID internal = plugin.getUuidCache().getUUID(uuid);
|
||||
plugin.getStorage().loadUser(internal, "null").join();
|
||||
}), plugin.getScheduler().async());
|
||||
return CompletableFuture.runAsync(
|
||||
() -> plugin.getOnlinePlayers()
|
||||
.map(u -> plugin.getUuidCache().getUUID(u))
|
||||
.forEach(u -> plugin.getStorage().loadUser(u, null).join()),
|
||||
plugin.getScheduler().async()
|
||||
);
|
||||
}
|
||||
|
||||
/* ------------------------------------------
|
||||
|
@ -181,7 +181,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
// Make a LuckPerms user for the one being migrated
|
||||
plugin.getStorage().loadUser(uuid, "null").join();
|
||||
plugin.getStorage().loadUser(uuid, null).join();
|
||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
||||
if (user.getEnduringNodes().size() <= 1) {
|
||||
user.clearNodes(false);
|
||||
|
Loading…
Reference in New Issue
Block a user