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