1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-08-25 07:20:44 +02:00

Misc refactoring and tidying up

This commit is contained in:
Luck
2021-02-10 11:12:30 +00:00
parent ab009ed110
commit cb9e0899fc
54 changed files with 71 additions and 71 deletions

View File

@@ -48,47 +48,47 @@ public interface NodeType<T extends Node> {
/** /**
* Node type for {@link PermissionNode}. * Node type for {@link PermissionNode}.
*/ */
NodeType<PermissionNode> PERMISSION = new SimpleNodeType<>("PERMISSION", n -> n instanceof PermissionNode, n -> ((PermissionNode) n)); NodeType<PermissionNode> PERMISSION = new SimpleNodeType<>("PERMISSION", n -> n instanceof PermissionNode, n -> (PermissionNode) n);
/** /**
* Node type for {@link RegexPermissionNode}. * Node type for {@link RegexPermissionNode}.
*/ */
NodeType<RegexPermissionNode> REGEX_PERMISSION = new SimpleNodeType<>("REGEX_PERMISSION", n -> n instanceof RegexPermissionNode, n -> ((RegexPermissionNode) n)); NodeType<RegexPermissionNode> REGEX_PERMISSION = new SimpleNodeType<>("REGEX_PERMISSION", n -> n instanceof RegexPermissionNode, n -> (RegexPermissionNode) n);
/** /**
* Node type for {@link InheritanceNode}. * Node type for {@link InheritanceNode}.
*/ */
NodeType<InheritanceNode> INHERITANCE = new SimpleNodeType<>("INHERITANCE", n -> n instanceof InheritanceNode, n -> ((InheritanceNode) n)); NodeType<InheritanceNode> INHERITANCE = new SimpleNodeType<>("INHERITANCE", n -> n instanceof InheritanceNode, n -> (InheritanceNode) n);
/** /**
* Node type for {@link PrefixNode}. * Node type for {@link PrefixNode}.
*/ */
NodeType<PrefixNode> PREFIX = new SimpleNodeType<>("PREFIX", n -> n instanceof PrefixNode, n -> ((PrefixNode) n)); NodeType<PrefixNode> PREFIX = new SimpleNodeType<>("PREFIX", n -> n instanceof PrefixNode, n -> (PrefixNode) n);
/** /**
* Node type for {@link SuffixNode}. * Node type for {@link SuffixNode}.
*/ */
NodeType<SuffixNode> SUFFIX = new SimpleNodeType<>("SUFFIX", n -> n instanceof SuffixNode, n -> ((SuffixNode) n)); NodeType<SuffixNode> SUFFIX = new SimpleNodeType<>("SUFFIX", n -> n instanceof SuffixNode, n -> (SuffixNode) n);
/** /**
* Node type for {@link MetaNode}. * Node type for {@link MetaNode}.
*/ */
NodeType<MetaNode> META = new SimpleNodeType<>("META", n -> n instanceof MetaNode, n -> ((MetaNode) n)); NodeType<MetaNode> META = new SimpleNodeType<>("META", n -> n instanceof MetaNode, n -> (MetaNode) n);
/** /**
* Node type for {@link WeightNode}. * Node type for {@link WeightNode}.
*/ */
NodeType<WeightNode> WEIGHT = new SimpleNodeType<>("WEIGHT", n -> n instanceof WeightNode, n -> ((WeightNode) n)); NodeType<WeightNode> WEIGHT = new SimpleNodeType<>("WEIGHT", n -> n instanceof WeightNode, n -> (WeightNode) n);
/** /**
* Node type for {@link DisplayNameNode}. * Node type for {@link DisplayNameNode}.
*/ */
NodeType<DisplayNameNode> DISPLAY_NAME = new SimpleNodeType<>("DISPLAY_NAME", n -> n instanceof DisplayNameNode, n -> ((DisplayNameNode) n)); NodeType<DisplayNameNode> DISPLAY_NAME = new SimpleNodeType<>("DISPLAY_NAME", n -> n instanceof DisplayNameNode, n -> (DisplayNameNode) n);
/** /**
* Node type for {@link ChatMetaNode}. * Node type for {@link ChatMetaNode}.
*/ */
NodeType<ChatMetaNode<?, ?>> CHAT_META = new SimpleNodeType<>("CHAT_META", n -> n instanceof ChatMetaNode<?, ?>, n -> ((ChatMetaNode<?, ?>) n)); NodeType<ChatMetaNode<?, ?>> CHAT_META = new SimpleNodeType<>("CHAT_META", n -> n instanceof ChatMetaNode<?, ?>, n -> (ChatMetaNode<?, ?>) n);
/** /**
* Node type for {@link ChatMetaNode} or {@link MetaNode}. * Node type for {@link ChatMetaNode} or {@link MetaNode}.

View File

@@ -140,7 +140,7 @@ public class BukkitCommandExecutor extends CommandManager implements TabExecutor
try { try {
matchedPlayers = this.plugin.getBootstrap().getServer().selectEntities(sender, arg).stream() matchedPlayers = this.plugin.getBootstrap().getServer().selectEntities(sender, arg).stream()
.filter(e -> e instanceof Player) .filter(e -> e instanceof Player)
.map(e -> ((Player) e)) .map(e -> (Player) e)
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
this.plugin.getLogger().warn("Error parsing selector '" + arg + "' for " + sender + " executing " + args, e); this.plugin.getLogger().warn("Error parsing selector '" + arg + "' for " + sender + " executing " + args, e);

View File

@@ -67,7 +67,7 @@ public class DefaultsProcessor implements PermissionProcessor {
Permission defPerm = this.plugin.getPermissionMap().get(permission); Permission defPerm = this.plugin.getPermissionMap().get(permission);
if (defPerm != null) { if (defPerm != null) {
PermissionDefault def = defPerm.getDefault(); PermissionDefault def = defPerm.getDefault();
if (def == PermissionDefault.FALSE || (this.isOp && def == PermissionDefault.NOT_OP)) { if (def == PermissionDefault.FALSE || this.isOp && def == PermissionDefault.NOT_OP) {
return PERMISSION_MAP_RESULT_FACTORY.result(Tristate.FALSE, "permission map (overriding wildcard): " + prev.cause()); return PERMISSION_MAP_RESULT_FACTORY.result(Tristate.FALSE, "permission map (overriding wildcard): " + prev.cause());
} }
} }

View File

@@ -331,7 +331,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment {
return null; return null;
} }
String permission = ((String) key); String permission = (String) key;
// grab the previous result, so we can still satisfy the method signature of Map // grab the previous result, so we can still satisfy the method signature of Map
Boolean previous = LuckPermsPermissionAttachment.this.perms.get(permission); Boolean previous = LuckPermsPermissionAttachment.this.perms.get(permission);

View File

@@ -127,7 +127,7 @@ public final class PermissibleInjector {
// only uninject if the permissible was a luckperms one. // only uninject if the permissible was a luckperms one.
if (permissible instanceof LuckPermsPermissible) { if (permissible instanceof LuckPermsPermissible) {
LuckPermsPermissible lpPermissible = ((LuckPermsPermissible) permissible); LuckPermsPermissible lpPermissible = (LuckPermsPermissible) permissible;
// clear all permissions // clear all permissions
lpPermissible.clearPermissions(); lpPermissible.clearPermissions();

View File

@@ -133,7 +133,7 @@ public final class LuckPermsPermissionMap extends ForwardingMap<String, Permissi
@Override @Override
public boolean remove(Object key, Object value) { public boolean remove(Object key, Object value) {
return key != null && value != null && super.remove(key, uninject(((Permission) value))); return key != null && value != null && super.remove(key, uninject((Permission) value));
} }
// check for null // check for null

View File

@@ -95,7 +95,7 @@ public final class LuckPermsSubscriptionMap extends HashMap<String, Map<Permissi
return null; return null;
} }
String permission = ((String) key); String permission = (String) key;
LPSubscriptionValueMap result = (LPSubscriptionValueMap) super.get(key); LPSubscriptionValueMap result = (LPSubscriptionValueMap) super.get(key);
if (result == null) { if (result == null) {

View File

@@ -58,7 +58,7 @@ public class BungeePermissionCheckListener implements Listener {
Objects.requireNonNull(e.getPermission(), "permission"); Objects.requireNonNull(e.getPermission(), "permission");
Objects.requireNonNull(e.getSender(), "sender"); Objects.requireNonNull(e.getSender(), "sender");
ProxiedPlayer player = ((ProxiedPlayer) e.getSender()); ProxiedPlayer player = (ProxiedPlayer) e.getSender();
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId()); User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
if (user == null) { if (user == null) {
@@ -87,7 +87,7 @@ public class BungeePermissionCheckListener implements Listener {
Objects.requireNonNull(e.getPermission(), "permission"); Objects.requireNonNull(e.getPermission(), "permission");
Objects.requireNonNull(e.getSender(), "sender"); Objects.requireNonNull(e.getSender(), "sender");
ProxiedPlayer player = ((ProxiedPlayer) e.getSender()); ProxiedPlayer player = (ProxiedPlayer) e.getSender();
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId()); User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
if (user == null) { if (user == null) {

View File

@@ -69,7 +69,7 @@ public class LogDispatcher {
this.plugin.getOnlineSenders() this.plugin.getOnlineSenders()
.filter(CommandPermission.LOG_NOTIFY::isAuthorized) .filter(CommandPermission.LOG_NOTIFY::isAuthorized)
.filter(s -> { .filter(s -> {
boolean shouldCancel = LogNotify.isIgnoring(this.plugin, s.getUniqueId()) || (sender != null && s.getUniqueId().equals(sender.getUniqueId())); boolean shouldCancel = LogNotify.isIgnoring(this.plugin, s.getUniqueId()) || sender != null && s.getUniqueId().equals(sender.getUniqueId());
return !this.plugin.getEventDispatcher().dispatchLogNotify(shouldCancel, entry, origin, s); return !this.plugin.getEventDispatcher().dispatchLogNotify(shouldCancel, entry, origin, s);
}) })
.forEach(s -> Message.LOG.send(s, entry)); .forEach(s -> Message.LOG.send(s, entry));

View File

@@ -241,7 +241,7 @@ public class Importer implements Runnable {
} }
private void sendProgress(int processedCount, int total) { private void sendProgress(int processedCount, int total) {
int percent = (processedCount * 100) / total; int percent = processedCount * 100 / total;
this.notify.forEach(s -> Message.IMPORT_PROGRESS.send(s, percent, processedCount, total)); this.notify.forEach(s -> Message.IMPORT_PROGRESS.send(s, percent, processedCount, total));
} }

View File

@@ -68,7 +68,7 @@ public abstract class ExpiringCache<T> implements Supplier<T> {
nanos = now + this.durationNanos; nanos = now + this.durationNanos;
// In the very unlikely event that nanos is 0, set it to 1; // In the very unlikely event that nanos is 0, set it to 1;
// no one will notice 1 ns of tardiness. // no one will notice 1 ns of tardiness.
this.expirationNanos = (nanos == 0) ? 1 : nanos; this.expirationNanos = nanos == 0 ? 1 : nanos;
return t; return t;
} }
} }

View File

@@ -33,6 +33,6 @@ public abstract class UsageTracked {
} }
public boolean usedSince(long duration) { public boolean usedSince(long duration) {
return this.lastUsed > (System.currentTimeMillis() - duration); return this.lastUsed > System.currentTimeMillis() - duration;
} }
} }

View File

@@ -47,7 +47,7 @@ public class WildcardProcessor extends AbstractPermissionProcessor implements Pe
} }
public static boolean isWildcardPermission(String permission) { public static boolean isWildcardPermission(String permission) {
return isRootWildcard(permission) || (permission.endsWith(WILDCARD_SUFFIX) && permission.length() > 2); return isRootWildcard(permission) || permission.endsWith(WILDCARD_SUFFIX) && permission.length() > 2;
} }
private Map<String, TristateResult> wildcardPermissions = Collections.emptyMap(); private Map<String, TristateResult> wildcardPermissions = Collections.emptyMap();

View File

@@ -150,7 +150,7 @@ public class CommandManager {
applyConvenienceAliases(arguments, true); applyConvenienceAliases(arguments, true);
// Handle no arguments // Handle no arguments
if (arguments.isEmpty() || (arguments.size() == 1 && arguments.get(0).trim().isEmpty())) { if (arguments.isEmpty() || arguments.size() == 1 && arguments.get(0).trim().isEmpty()) {
sender.sendMessage(Message.prefixed(Component.text() sender.sendMessage(Message.prefixed(Component.text()
.color(NamedTextColor.DARK_GREEN) .color(NamedTextColor.DARK_GREEN)
.append(Component.text("Running ")) .append(Component.text("Running "))

View File

@@ -107,7 +107,7 @@ public final class ArgumentPermissions {
} }
if (target instanceof User) { if (target instanceof User) {
User targetUser = ((User) target); User targetUser = (User) target;
if (targetUser.getUniqueId().equals(sender.getUniqueId())) { if (targetUser.getUniqueId().equals(sender.getUniqueId())) {
// the sender is trying to edit themselves // the sender is trying to edit themselves
@@ -131,7 +131,7 @@ public final class ArgumentPermissions {
} }
} }
} else if (target instanceof Group) { } else if (target instanceof Group) {
Group targetGroup = ((Group) target); Group targetGroup = (Group) target;
Tristate state = sender.getPermissionValue(base.getPermission() + ".modify." + targetGroup.getName()); Tristate state = sender.getPermissionValue(base.getPermission() + ".modify." + targetGroup.getName());
if (state != Tristate.UNDEFINED) { if (state != Tristate.UNDEFINED) {
@@ -142,7 +142,7 @@ public final class ArgumentPermissions {
return !globalState.asBoolean(); return !globalState.asBoolean();
} }
} else if (target instanceof Track) { } else if (target instanceof Track) {
Track targetTrack = ((Track) target); Track targetTrack = (Track) target;
Tristate state = sender.getPermissionValue(base.getPermission() + ".modify." + targetTrack.getName()); Tristate state = sender.getPermissionValue(base.getPermission() + ".modify." + targetTrack.getName());
if (state != Tristate.UNDEFINED) { if (state != Tristate.UNDEFINED) {
@@ -172,7 +172,7 @@ public final class ArgumentPermissions {
} }
if (target instanceof User) { if (target instanceof User) {
User targetUser = ((User) target); User targetUser = (User) target;
if (targetUser.getUniqueId().equals(sender.getUniqueId())) { if (targetUser.getUniqueId().equals(sender.getUniqueId())) {
// the sender is trying to view themselves // the sender is trying to view themselves
@@ -196,7 +196,7 @@ public final class ArgumentPermissions {
} }
} }
} else if (target instanceof Group) { } else if (target instanceof Group) {
Group targetGroup = ((Group) target); Group targetGroup = (Group) target;
Tristate state = sender.getPermissionValue(base.getPermission() + ".view." + targetGroup.getName()); Tristate state = sender.getPermissionValue(base.getPermission() + ".view." + targetGroup.getName());
if (state != Tristate.UNDEFINED) { if (state != Tristate.UNDEFINED) {
@@ -207,7 +207,7 @@ public final class ArgumentPermissions {
return !globalState.asBoolean(); return !globalState.asBoolean();
} }
} else if (target instanceof Track) { } else if (target instanceof Track) {
Track targetTrack = ((Track) target); Track targetTrack = (Track) target;
Tristate state = sender.getPermissionValue(base.getPermission() + ".view." + targetTrack.getName()); Tristate state = sender.getPermissionValue(base.getPermission() + ".view." + targetTrack.getName());
if (state != Tristate.UNDEFINED) { if (state != Tristate.UNDEFINED) {

View File

@@ -110,7 +110,7 @@ public enum CommandSpec {
USER_INFO, USER_INFO,
USER_SWITCHPRIMARYGROUP( USER_SWITCHPRIMARYGROUP(
(arg("group", true)) arg("group", true)
), ),
USER_PROMOTE( USER_PROMOTE(
arg("track", false), arg("track", false),

View File

@@ -82,7 +82,7 @@ public class TabCompleter {
String partial; String partial;
// nothing entered yet // nothing entered yet
if (args.isEmpty() || (partial = args.get((lastIndex = args.size() - 1))).trim().isEmpty()) { if (args.isEmpty() || (partial = args.get(lastIndex = args.size() - 1)).trim().isEmpty()) {
return getCompletions(lastIndex, ""); return getCompletions(lastIndex, "");
} }

View File

@@ -126,10 +126,10 @@ public final class StorageAssistant {
public static void save(PermissionHolder holder, Sender sender, LuckPermsPlugin plugin) { public static void save(PermissionHolder holder, Sender sender, LuckPermsPlugin plugin) {
if (holder.getType() == HolderType.USER) { if (holder.getType() == HolderType.USER) {
User user = ((User) holder); User user = (User) holder;
save(user, sender, plugin); save(user, sender, plugin);
} else if (holder.getType() == HolderType.GROUP) { } else if (holder.getType() == HolderType.GROUP) {
Group group = ((Group) holder); Group group = (Group) holder;
save(group, sender, plugin); save(group, sender, plugin);
} else { } else {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@@ -80,7 +80,7 @@ public class MetaInfo extends GenericChildCommand {
SuffixNode sn = (SuffixNode) node; SuffixNode sn = (SuffixNode) node;
suffixes.add(Maps.immutableEntry(sn.getPriority(), sn)); suffixes.add(Maps.immutableEntry(sn.getPriority(), sn));
} else if (node instanceof MetaNode) { } else if (node instanceof MetaNode) {
meta.add(((MetaNode) node)); meta.add((MetaNode) node);
} }
} }

View File

@@ -94,7 +94,7 @@ public class ParentClearTrack extends GenericChildCommand {
target.removeIf(DataType.NORMAL, context.isEmpty() ? null : context, NodeType.INHERITANCE.predicate(n -> track.containsGroup(n.getGroupName())), false); target.removeIf(DataType.NORMAL, context.isEmpty() ? null : context, NodeType.INHERITANCE.predicate(n -> track.containsGroup(n.getGroupName())), false);
if (target.getType() == HolderType.USER) { if (target.getType() == HolderType.USER) {
plugin.getUserManager().giveDefaultIfNeeded(((User) target)); plugin.getUserManager().giveDefaultIfNeeded((User) target);
} }
int changed = before - target.normalData().size(); int changed = before - target.normalData().size();

View File

@@ -101,7 +101,7 @@ public class ParentRemove extends GenericChildCommand {
.build().submit(plugin, sender); .build().submit(plugin, sender);
if (target.getType() == HolderType.USER) { if (target.getType() == HolderType.USER) {
plugin.getUserManager().giveDefaultIfNeeded(((User) target)); plugin.getUserManager().giveDefaultIfNeeded((User) target);
} }
StorageAssistant.save(target, sender, plugin); StorageAssistant.save(target, sender, plugin);

View File

@@ -84,7 +84,7 @@ public class ParentSetTrack extends GenericChildCommand {
String groupName; String groupName;
if (index > 0) { if (index > 0) {
List<String> trackGroups = track.getGroups(); List<String> trackGroups = track.getGroups();
if ((index - 1) >= trackGroups.size()) { if (index - 1 >= trackGroups.size()) {
Message.DOES_NOT_EXIST.send(sender, String.valueOf(index)); Message.DOES_NOT_EXIST.send(sender, String.valueOf(index));
return CommandResult.INVALID_ARGS; return CommandResult.INVALID_ARGS;
} }

View File

@@ -63,7 +63,7 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
// cast to user // cast to user
// although this command is build as a sharedsubcommand, // although this command is build as a sharedsubcommand,
// it is only added to the listings for users. // it is only added to the listings for users.
User user = ((User) target); User user = (User) target;
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, user)) { if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, user)) {
Message.COMMAND_NO_PERMISSION.send(sender); Message.COMMAND_NO_PERMISSION.send(sender);

View File

@@ -225,7 +225,7 @@ public final class ImmutableContextSetImpl extends AbstractContextSet implements
public @NonNull BuilderImpl addAll(@NonNull ContextSet contextSet) { public @NonNull BuilderImpl addAll(@NonNull ContextSet contextSet) {
Objects.requireNonNull(contextSet, "contextSet"); Objects.requireNonNull(contextSet, "contextSet");
if (contextSet instanceof AbstractContextSet) { if (contextSet instanceof AbstractContextSet) {
AbstractContextSet other = ((AbstractContextSet) contextSet); AbstractContextSet other = (AbstractContextSet) contextSet;
if (!other.isEmpty()) { if (!other.isEmpty()) {
builder().putAll(other.backing()); builder().putAll(other.backing());
} }

View File

@@ -160,7 +160,7 @@ public final class MutableContextSetImpl extends AbstractContextSet implements M
public void addAll(@NonNull ContextSet contextSet) { public void addAll(@NonNull ContextSet contextSet) {
Objects.requireNonNull(contextSet, "contextSet"); Objects.requireNonNull(contextSet, "contextSet");
if (contextSet instanceof AbstractContextSet) { if (contextSet instanceof AbstractContextSet) {
AbstractContextSet other = ((AbstractContextSet) contextSet); AbstractContextSet other = (AbstractContextSet) contextSet;
other.copyTo(this.map); other.copyTo(this.map);
} else { } else {
addAll(contextSet.toSet()); addAll(contextSet.toSet());

View File

@@ -163,7 +163,7 @@ public abstract class AbstractEventBus<P> implements EventBus, AutoCloseable {
//noinspection unchecked //noinspection unchecked
return super.subscribers().values().stream() return super.subscribers().values().stream()
.filter(s -> s instanceof EventSubscription && ((EventSubscription<?>) s).getEventClass().isAssignableFrom(eventClass)) .filter(s -> s instanceof EventSubscription && ((EventSubscription<?>) s).getEventClass().isAssignableFrom(eventClass))
.map(s -> ((EventSubscription<T>) s)) .map(s -> (EventSubscription<T>) s)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
} }

View File

@@ -173,7 +173,7 @@ public enum TraversalAlgorithm {
NodeAndSuccessors node = this.stack.getFirst(); NodeAndSuccessors node = this.stack.getFirst();
boolean firstVisit = this.visited.add(node.node); boolean firstVisit = this.visited.add(node.node);
boolean lastVisit = !node.successorIterator.hasNext(); boolean lastVisit = !node.successorIterator.hasNext();
boolean produceNode = (firstVisit && this.order == Order.PRE_ORDER) || (lastVisit && this.order == Order.POST_ORDER); boolean produceNode = firstVisit && this.order == Order.PRE_ORDER || lastVisit && this.order == Order.POST_ORDER;
if (lastVisit) { if (lastVisit) {
this.stack.pop(); this.stack.pop();
} else { } else {

View File

@@ -41,7 +41,7 @@ public class InheritanceComparator implements Comparator<PermissionHolder> {
public static Comparator<? super PermissionHolder> getFor(PermissionHolder origin) { public static Comparator<? super PermissionHolder> getFor(PermissionHolder origin) {
if (origin.getType() == HolderType.USER) { if (origin.getType() == HolderType.USER) {
return new InheritanceComparator(((User) origin)).reversed(); return new InheritanceComparator((User) origin).reversed();
} }
return NULL_ORIGIN; return NULL_ORIGIN;
} }

View File

@@ -2797,7 +2797,7 @@ public interface Message {
// "&aInstalling language {}..." // "&aInstalling language {}..."
.key("luckperms.command.translations.installing-specific") .key("luckperms.command.translations.installing-specific")
.color(GREEN) .color(GREEN)
.args(text((name))) .args(text(name))
); );
Args0 TRANSLATIONS_INSTALL_COMPLETE = () -> prefixed(translatable() Args0 TRANSLATIONS_INSTALL_COMPLETE = () -> prefixed(translatable()

View File

@@ -138,7 +138,7 @@ public abstract class AbstractNode<N extends ScopedNode<N, B>, B extends NodeBui
public boolean equals(Object o) { public boolean equals(Object o) {
if (o == this) return true; if (o == this) return true;
if (!(o instanceof Node)) return false; if (!(o instanceof Node)) return false;
return NodeEquality.KEY_VALUE_EXPIRY_CONTEXTS.equals(this, ((AbstractNode<?, ?>) o)); return NodeEquality.KEY_VALUE_EXPIRY_CONTEXTS.equals(this, (AbstractNode<?, ?>) o);
} }
@Override @Override

View File

@@ -52,7 +52,7 @@ public final class NodeCommandFactory {
// value // value
sb.append(((InheritanceNode) node).getGroupName()); sb.append(((InheritanceNode) node).getGroupName());
} else if (node.getValue() && (node instanceof ChatMetaNode<?, ?>)) { } else if (node.getValue() && node instanceof ChatMetaNode<?, ?>) {
ChatMetaNode<?, ?> chatNode = (ChatMetaNode<?, ?>) node; ChatMetaNode<?, ?> chatNode = (ChatMetaNode<?, ?>) node;
// command // command

View File

@@ -45,7 +45,7 @@ public enum ShorthandParser {
@Override @Override
public Iterator<String> extract(String input) throws NumberFormatException { public Iterator<String> extract(String input) throws NumberFormatException {
int index = input.indexOf(RANGE_SEPARATOR); int index = input.indexOf(RANGE_SEPARATOR);
if (index == -1 || index == 0 || index == (input.length() - 1)) { if (index == -1 || index == 0 || index == input.length() - 1) {
return null; return null;
} }

View File

@@ -40,7 +40,7 @@ final class FlagUtils {
/* bitwise utility methods */ /* bitwise utility methods */
static boolean read(byte b, Flag setting) { static boolean read(byte b, Flag setting) {
return ((b >> setting.ordinal()) & 1) == 1; return (b >> setting.ordinal() & 1) == 1;
} }
static byte toByte(Set<Flag> settings) { static byte toByte(Set<Flag> settings) {
@@ -54,7 +54,7 @@ final class FlagUtils {
private static byte toByte0(Set<Flag> settings) { private static byte toByte0(Set<Flag> settings) {
byte b = 0; byte b = 0;
for (Flag setting : settings) { for (Flag setting : settings) {
b |= (1 << setting.ordinal()); b |= 1 << setting.ordinal();
} }
return b; return b;
} }

View File

@@ -42,7 +42,7 @@ public final class SqlRowId {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return this == o || (o instanceof SqlRowId && this.rowId == ((SqlRowId) o).rowId); return this == o || o instanceof SqlRowId && this.rowId == ((SqlRowId) o).rowId;
} }
@Override @Override

View File

@@ -68,7 +68,7 @@ public class H2ConnectionFactory extends FlatfileConnectionFactory {
return (Connection) this.connectionConstructor.newInstance("jdbc:h2:" + file.toString(), new Properties()); return (Connection) this.connectionConstructor.newInstance("jdbc:h2:" + file.toString(), new Properties());
} catch (ReflectiveOperationException e) { } catch (ReflectiveOperationException e) {
if (e.getCause() instanceof SQLException) { if (e.getCause() instanceof SQLException) {
throw ((SQLException) e.getCause()); throw (SQLException) e.getCause();
} }
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -68,7 +68,7 @@ public class SqliteConnectionFactory extends FlatfileConnectionFactory {
return (Connection) this.connectionConstructor.newInstance("jdbc:sqlite:" + file.toString(), file.toString(), new Properties()); return (Connection) this.connectionConstructor.newInstance("jdbc:sqlite:" + file.toString(), file.toString(), new Properties());
} catch (ReflectiveOperationException e) { } catch (ReflectiveOperationException e) {
if (e.getCause() instanceof SQLException) { if (e.getCause() instanceof SQLException) {
throw ((SQLException) e.getCause()); throw (SQLException) e.getCause();
} }
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -118,6 +118,6 @@ public class ImmutableTreeNode implements Comparable<ImmutableTreeNode> {
@Override @Override
public int compareTo(@NonNull ImmutableTreeNode o) { public int compareTo(@NonNull ImmutableTreeNode o) {
return (this.children != null) == o.getChildren().isPresent() ? 0 : (this.children != null ? 1 : -1); return (this.children != null) == o.getChildren().isPresent() ? 0 : this.children != null ? 1 : -1;
} }
} }

View File

@@ -139,7 +139,7 @@ public class TreeView {
// work out the prefix to apply // work out the prefix to apply
// since the view is relative, we need to prepend this to all permissions // since the view is relative, we need to prepend this to all permissions
String prefix = this.rootPosition.equals(".") ? "" : (this.rootPosition + "."); String prefix = this.rootPosition.equals(".") ? "" : this.rootPosition + ".";
JsonObject jsonTree = this.view.toJson(prefix); JsonObject jsonTree = this.view.toJson(prefix);
JObject metadata = new JObject() JObject metadata = new JObject()

View File

@@ -56,7 +56,7 @@ public class Paginated<T> {
throw new IllegalArgumentException("pageNo cannot be less than 1: " + pageNo); throw new IllegalArgumentException("pageNo cannot be less than 1: " + pageNo);
} }
int first = ((pageNo - 1) * pageSize); int first = (pageNo - 1) * pageSize;
if (this.content.size() <= first) { if (this.content.size() <= first) {
throw new IllegalStateException("Content does not contain that many elements. (requested page: " + pageNo + throw new IllegalStateException("Content does not contain that many elements. (requested page: " + pageNo +
", page size: " + pageSize + ", page first index: " + first + ", content size: " + this.content.size() + ")"); ", page size: " + pageSize + ", page first index: " + first + ", content size: " + this.content.size() + ")");

View File

@@ -256,7 +256,7 @@ public class BooleanExpressionCompiler {
case '!': case '!':
return ConstantToken.NOT; return ConstantToken.NOT;
default: default:
throw new LexerException("Unknown token: " + ((char) token) + "(" + token + ")"); throw new LexerException("Unknown token: " + (char) token + "(" + token + ")");
} }
} catch (IOException e) { } catch (IOException e) {
throw new LexerException(e); throw new LexerException(e);

View File

@@ -32,7 +32,7 @@ import net.minecraft.server.world.ServerWorld;
// TODO: Use Fabric API alternative when merged. // TODO: Use Fabric API alternative when merged.
public interface PlayerChangeWorldCallback { public interface PlayerChangeWorldCallback {
Event<PlayerChangeWorldCallback> EVENT = EventFactory.createArrayBacked(PlayerChangeWorldCallback.class, (callbacks) -> (originalWorld, destination, player) -> { Event<PlayerChangeWorldCallback> EVENT = EventFactory.createArrayBacked(PlayerChangeWorldCallback.class, callbacks -> (originalWorld, destination, player) -> {
for (PlayerChangeWorldCallback callback : callbacks) { for (PlayerChangeWorldCallback callback : callbacks) {
callback.onChangeWorld(originalWorld, destination, player); callback.onChangeWorld(originalWorld, destination, player);
} }

View File

@@ -85,7 +85,7 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
@Override @Override
public QueryOptionsCache<ServerPlayerEntity> getQueryOptionsCache(FabricContextManager contextManager) { public QueryOptionsCache<ServerPlayerEntity> getQueryOptionsCache(FabricContextManager contextManager) {
if (this.luckperms$queryOptions == null) { if (this.luckperms$queryOptions == null) {
this.luckperms$queryOptions = contextManager.newQueryOptionsCache(((ServerPlayerEntity) (Object) this)); this.luckperms$queryOptions = contextManager.newQueryOptionsCache((ServerPlayerEntity) (Object) this);
} }
return this.luckperms$queryOptions; return this.luckperms$queryOptions;
} }

View File

@@ -64,7 +64,7 @@ public class DefaultsProcessor implements PermissionProcessor {
if (canOverrideWildcard(prev)) { if (canOverrideWildcard(prev)) {
PermissionDefault def = PermissionDefault.fromPermission(this.plugin.getPermissionMap().get(permission)); PermissionDefault def = PermissionDefault.fromPermission(this.plugin.getPermissionMap().get(permission));
if (def != null) { if (def != null) {
if (def == PermissionDefault.FALSE || (this.isOp && def == PermissionDefault.NOT_OP)) { if (def == PermissionDefault.FALSE || this.isOp && def == PermissionDefault.NOT_OP) {
return PERMISSION_MAP_RESULT_FACTORY.result(Tristate.FALSE, "permission map (overriding wildcard): " + prev.cause()); return PERMISSION_MAP_RESULT_FACTORY.result(Tristate.FALSE, "permission map (overriding wildcard): " + prev.cause());
} }
} }

View File

@@ -360,7 +360,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment {
return null; return null;
} }
String permission = ((String) key); String permission = (String) key;
// grab the previous result, so we can still satisfy the method signature of Map // grab the previous result, so we can still satisfy the method signature of Map
Boolean previous = LuckPermsPermissionAttachment.this.perms.get(permission); Boolean previous = LuckPermsPermissionAttachment.this.perms.get(permission);

View File

@@ -117,7 +117,7 @@ public final class PermissibleInjector {
// only uninject if the permissible was a luckperms one. // only uninject if the permissible was a luckperms one.
if (permissible instanceof LuckPermsPermissible) { if (permissible instanceof LuckPermsPermissible) {
LuckPermsPermissible lpPermissible = ((LuckPermsPermissible) permissible); LuckPermsPermissible lpPermissible = (LuckPermsPermissible) permissible;
// clear all permissions // clear all permissions
lpPermissible.clearPermissions(); lpPermissible.clearPermissions();

View File

@@ -133,7 +133,7 @@ public final class LuckPermsPermissionMap extends ForwardingMap<String, Permissi
@Override @Override
public boolean remove(Object key, Object value) { public boolean remove(Object key, Object value) {
return key != null && value != null && super.remove(key, uninject(((Permission) value))); return key != null && value != null && super.remove(key, uninject((Permission) value));
} }
// check for null // check for null

View File

@@ -93,7 +93,7 @@ public final class LuckPermsSubscriptionMap extends HashMap<String, Set<Permissi
return null; return null;
} }
String permission = ((String) key); String permission = (String) key;
LPSubscriptionValueSet result = (LPSubscriptionValueSet) super.get(key); LPSubscriptionValueSet result = (LPSubscriptionValueSet) super.get(key);
if (result == null) { if (result == null) {

View File

@@ -99,7 +99,7 @@ final class CachedSubjectReference implements LPSubjectReference {
} }
private LPSubject tryCache() { private LPSubject tryCache() {
if ((System.currentTimeMillis() - this.lastLookup) < CACHE_TIME) { if (System.currentTimeMillis() - this.lastLookup < CACHE_TIME) {
if (this.cache != null) { if (this.cache != null) {
return this.cache.get(); return this.cache.get();
} }

View File

@@ -95,7 +95,7 @@ public final class SubjectReferenceFactory {
public LPSubjectReference obtain(SubjectReference reference) { public LPSubjectReference obtain(SubjectReference reference) {
Objects.requireNonNull(reference, "reference"); Objects.requireNonNull(reference, "reference");
if (reference instanceof LPSubjectReference) { if (reference instanceof LPSubjectReference) {
return ((LPSubjectReference) reference); return (LPSubjectReference) reference;
} else { } else {
return obtain(reference.getCollectionIdentifier(), reference.getSubjectIdentifier()); return obtain(reference.getCollectionIdentifier(), reference.getSubjectIdentifier());
} }

View File

@@ -104,7 +104,7 @@ public class SpongeCommandExecutor extends CommandManager implements CommandCall
try { try {
matchedPlayers = Selector.parse(arg).resolve(source).stream() matchedPlayers = Selector.parse(arg).resolve(source).stream()
.filter(e -> e instanceof Player) .filter(e -> e instanceof Player)
.map(e -> ((Player) e)) .map(e -> (Player) e)
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
this.plugin.getLogger().warn("Error parsing selector '" + arg + "' for " + source + " executing " + args, e); this.plugin.getLogger().warn("Error parsing selector '" + arg + "' for " + source + " executing " + args, e);

View File

@@ -45,7 +45,7 @@ public class SpongePlatformListener {
if (source == null) return; if (source == null) return;
final String name = e.getCommand().toLowerCase(); final String name = e.getCommand().toLowerCase();
if (((name.equals("op") || name.equals("minecraft:op")) && source.hasPermission("minecraft.command.op")) || ((name.equals("deop") || name.equals("minecraft:deop")) && source.hasPermission("minecraft.command.deop"))) { if ((name.equals("op") || name.equals("minecraft:op")) && source.hasPermission("minecraft.command.op") || (name.equals("deop") || name.equals("minecraft:deop")) && source.hasPermission("minecraft.command.deop")) {
Message.OP_DISABLED_SPONGE.send(this.plugin.getSenderFactory().wrap(source)); Message.OP_DISABLED_SPONGE.send(this.plugin.getSenderFactory().wrap(source));
} }
} }

View File

@@ -51,7 +51,7 @@ public class SubjectInheritanceGraph implements Graph<CalculatedSubject> {
return subject.getCombinedParents(this.queryOptions).stream() return subject.getCombinedParents(this.queryOptions).stream()
.map(ref -> ref.resolveLp().join()) .map(ref -> ref.resolveLp().join())
.filter(p -> p instanceof CalculatedSubject) .filter(p -> p instanceof CalculatedSubject)
.map(p -> ((CalculatedSubject) p)) .map(p -> (CalculatedSubject) p)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@@ -371,10 +371,10 @@ public class PermissionHolderSubjectData implements LPSubjectData {
} }
if (t.getType() == HolderType.USER) { if (t.getType() == HolderType.USER) {
User user = ((User) t); User user = (User) t;
return this.service.getPlugin().getStorage().saveUser(user); return this.service.getPlugin().getStorage().saveUser(user);
} else { } else {
Group group = ((Group) t); Group group = (Group) t;
return this.service.getPlugin().getStorage().saveGroup(group); return this.service.getPlugin().getStorage().saveGroup(group);
} }
} }

View File

@@ -101,7 +101,7 @@ public class SubjectDataContainer {
return new JsonArray(); return new JsonArray();
} }
Preconditions.checkArgument(element instanceof JsonArray); Preconditions.checkArgument(element instanceof JsonArray);
return ((JsonArray) element); return (JsonArray) element;
} }
private SubjectDataContainer(LPPermissionService service, JsonObject root) { private SubjectDataContainer(LPPermissionService service, JsonObject root) {