mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-30 04:02:04 +01:00
Cleanup some stuff
This commit is contained in:
parent
f0e42c6db6
commit
0251f2add9
@ -55,15 +55,13 @@ public class NullSafeConsoleCommandSender implements ConsoleCommandSender {
|
||||
return Optional.ofNullable(this.server.getConsoleSender());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Server getServer() {
|
||||
public @NonNull Server getServer() {
|
||||
return this.server;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NonNull String getName() {
|
||||
return "CONSOLE";
|
||||
}
|
||||
|
||||
@ -110,23 +108,19 @@ public class NullSafeConsoleCommandSender implements ConsoleCommandSender {
|
||||
}
|
||||
|
||||
// just throw UnsupportedOperationException - we never use any of these methods
|
||||
@NonNull
|
||||
@Override public Spigot spigot() { throw new UnsupportedOperationException(); }
|
||||
@Override public @NonNull Spigot spigot() { throw new UnsupportedOperationException(); }
|
||||
@Override public boolean isConversing() { throw new UnsupportedOperationException(); }
|
||||
@Override public void acceptConversationInput(@NonNull String s) { throw new UnsupportedOperationException(); }
|
||||
@Override public boolean beginConversation(@NonNull Conversation conversation) { throw new UnsupportedOperationException(); }
|
||||
@Override public void abandonConversation(@NonNull Conversation conversation) { throw new UnsupportedOperationException(); }
|
||||
@Override public void abandonConversation(@NonNull Conversation conversation, @NonNull ConversationAbandonedEvent conversationAbandonedEvent) { throw new UnsupportedOperationException(); }
|
||||
@Override public void sendRawMessage(@NonNull String s) { throw new UnsupportedOperationException(); }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String s, boolean b) { throw new UnsupportedOperationException(); }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin) { throw new UnsupportedOperationException(); }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String s, boolean b) { throw new UnsupportedOperationException(); }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin) { throw new UnsupportedOperationException(); }
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String s, boolean b, int i) { throw new UnsupportedOperationException(); }
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, int i) { throw new UnsupportedOperationException(); }
|
||||
@Override public void removeAttachment(@NonNull PermissionAttachment permissionAttachment) { throw new UnsupportedOperationException(); }
|
||||
@Override public void recalculatePermissions() { throw new UnsupportedOperationException(); }
|
||||
@NonNull
|
||||
@Override public Set<PermissionAttachmentInfo> getEffectivePermissions() { throw new UnsupportedOperationException(); }
|
||||
@Override public @NonNull Set<PermissionAttachmentInfo> getEffectivePermissions() { throw new UnsupportedOperationException(); }
|
||||
@Override public void setOp(boolean b) { throw new UnsupportedOperationException(); }
|
||||
}
|
||||
|
@ -108,16 +108,13 @@ public class DummyPermissibleBase extends PermissibleBase {
|
||||
@Override public boolean isPermissionSet(@NonNull Permission perm) { return false; }
|
||||
@Override public boolean hasPermission(@NonNull String inName) { return false; }
|
||||
@Override public boolean hasPermission(@NonNull Permission perm) { return false; }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value) { return null; }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin) { return null; }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value) { return null; }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin) { return null; }
|
||||
@Override public void removeAttachment(@NonNull PermissionAttachment attachment) {}
|
||||
@Override public void recalculatePermissions() {}
|
||||
@Override public void clearPermissions() {}
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value, int ticks) { return null; }
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, int ticks) { return null; }
|
||||
@NonNull
|
||||
@Override public Set<PermissionAttachmentInfo> getEffectivePermissions() { return Collections.emptySet(); }
|
||||
@Override public @NonNull Set<PermissionAttachmentInfo> getEffectivePermissions() { return Collections.emptySet(); }
|
||||
|
||||
}
|
||||
|
@ -55,31 +55,24 @@ public class DummyPlugin implements Plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override public File getDataFolder() { return null; }
|
||||
@NonNull
|
||||
@Override public PluginDescriptionFile getDescription() { return null; }
|
||||
@NonNull
|
||||
@Override public FileConfiguration getConfig() { return null; }
|
||||
@Override public @NonNull File getDataFolder() { return null; }
|
||||
@Override public @NonNull PluginDescriptionFile getDescription() { return null; }
|
||||
@Override public @NonNull FileConfiguration getConfig() { return null; }
|
||||
@Override public InputStream getResource(@NonNull String s) { return null; }
|
||||
@Override public void saveConfig() {}
|
||||
@Override public void saveDefaultConfig() {}
|
||||
@Override public void saveResource(@NonNull String s, boolean b) {}
|
||||
@Override public void reloadConfig() {}
|
||||
@NonNull
|
||||
@Override public PluginLoader getPluginLoader() { return null; }
|
||||
@NonNull
|
||||
@Override public Server getServer() { return null; }
|
||||
@Override public @NonNull PluginLoader getPluginLoader() { return null; }
|
||||
@Override public @NonNull Server getServer() { return null; }
|
||||
@Override public void onDisable() {}
|
||||
@Override public void onLoad() {}
|
||||
@Override public void onEnable() {}
|
||||
@Override public boolean isNaggable() { return false; }
|
||||
@Override public void setNaggable(boolean b) {}
|
||||
@Override public ChunkGenerator getDefaultWorldGenerator(@NonNull String s, String s1) { return null; }
|
||||
@NonNull
|
||||
@Override public Logger getLogger() { return null; }
|
||||
@NonNull
|
||||
@Override public String getName() { return null; }
|
||||
@Override public @NonNull Logger getLogger() { return null; }
|
||||
@Override public @NonNull String getName() { return null; }
|
||||
@Override public boolean onCommand(@NonNull CommandSender commandSender, @NonNull Command command, @NonNull String s, @NonNull String[] strings) { return false; }
|
||||
@Override public List<String> onTabComplete(@NonNull CommandSender commandSender, @NonNull Command command, @NonNull String s, @NonNull String[] strings) { return null; }
|
||||
|
||||
|
@ -201,17 +201,15 @@ public class LPPermissible extends PermissibleBase {
|
||||
this.player.setOp(value);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
public @NonNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return this.user.getCachedData().getPermissionData(this.queryOptionsSupplier.getQueryOptions()).getPermissionMap().entrySet().stream()
|
||||
.map(entry -> new PermissionAttachmentInfo(this.player, entry.getKey(), null, entry.getValue()))
|
||||
.collect(ImmutableCollectors.toSet());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LPPermissionAttachment addAttachment(@NonNull Plugin plugin) {
|
||||
public @NonNull LPPermissionAttachment addAttachment(@NonNull Plugin plugin) {
|
||||
if (plugin == null) {
|
||||
throw new NullPointerException("plugin");
|
||||
}
|
||||
@ -221,9 +219,8 @@ public class LPPermissible extends PermissibleBase {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String permission, boolean value) {
|
||||
public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String permission, boolean value) {
|
||||
if (plugin == null) {
|
||||
throw new NullPointerException("plugin");
|
||||
}
|
||||
|
@ -143,9 +143,8 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LPPermissible getPermissible() {
|
||||
public @NonNull LPPermissible getPermissible() {
|
||||
return this.permissible;
|
||||
}
|
||||
|
||||
@ -277,15 +276,13 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
unsetPermissionInternal(permission);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Map<String, Boolean> getPermissions() {
|
||||
public @NonNull Map<String, Boolean> getPermissions() {
|
||||
return this.perms;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Plugin getPlugin() {
|
||||
public @NonNull Plugin getPlugin() {
|
||||
return this.owner != null ? this.owner : this.permissible.getPlugin().getBootstrap();
|
||||
}
|
||||
|
||||
|
@ -134,15 +134,12 @@ public class MonitoredPermissibleBase extends PermissibleBase {
|
||||
// just forward calls to the delegate permissible
|
||||
@Override public boolean isOp() { return this.delegate.isOp(); }
|
||||
@Override public void setOp(boolean value) { this.delegate.setOp(value); }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value) { return this.delegate.addAttachment(plugin, name, value); }
|
||||
@NonNull
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin) { return this.delegate.addAttachment(plugin); }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value) { return this.delegate.addAttachment(plugin, name, value); }
|
||||
@Override public @NonNull PermissionAttachment addAttachment(@NonNull Plugin plugin) { return this.delegate.addAttachment(plugin); }
|
||||
@Override public void removeAttachment(@NonNull PermissionAttachment attachment) { this.delegate.removeAttachment(attachment); }
|
||||
@Override public void clearPermissions() { this.delegate.clearPermissions(); }
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, @NonNull String name, boolean value, int ticks) { return this.delegate.addAttachment(plugin, name, value, ticks); }
|
||||
@Override public PermissionAttachment addAttachment(@NonNull Plugin plugin, int ticks) { return this.delegate.addAttachment(plugin, ticks); }
|
||||
@NonNull
|
||||
@Override public Set<PermissionAttachmentInfo> getEffectivePermissions() { return this.delegate.getEffectivePermissions(); }
|
||||
@Override public @NonNull Set<PermissionAttachmentInfo> getEffectivePermissions() { return this.delegate.getEffectivePermissions(); }
|
||||
|
||||
}
|
||||
|
@ -85,9 +85,8 @@ public class LuckPermsApiProvider implements LuckPerms {
|
||||
this.metaStackFactory = new ApiMetaStackFactory(plugin);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getServerName() {
|
||||
public @NonNull String getServerName() {
|
||||
return this.plugin.getConfiguration().get(ConfigKeys.SERVER);
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,8 @@ public class ApiPlatform implements Platform, PluginMetadata {
|
||||
return Collections.unmodifiableSet(this.plugin.getConnectionListener().getUniqueConnections());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Instant getStartTime() {
|
||||
public @NonNull Instant getStartTime() {
|
||||
return Instant.ofEpochMilli(this.plugin.getBootstrap().getStartupTime());
|
||||
}
|
||||
}
|
||||
|
@ -38,15 +38,13 @@ public final class ContextImpl implements Context {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getKey() {
|
||||
public @NonNull String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getValue() {
|
||||
public @NonNull String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
@ -39,21 +39,21 @@ public final class Predicates {
|
||||
|
||||
private static final Predicate FALSE = new Predicate() {
|
||||
@Override public boolean test(Object o) { return false; }
|
||||
@NonNull
|
||||
@Override public Predicate and(@NonNull Predicate other) { return this; }
|
||||
@NonNull
|
||||
@Override public Predicate or(@NonNull Predicate other) { return other; }
|
||||
@NonNull
|
||||
@Override public Predicate negate() { return TRUE; }
|
||||
@Override
|
||||
public @NonNull Predicate and(@NonNull Predicate other) { return this; }
|
||||
@Override
|
||||
public @NonNull Predicate or(@NonNull Predicate other) { return other; }
|
||||
@Override
|
||||
public @NonNull Predicate negate() { return TRUE; }
|
||||
};
|
||||
private static final Predicate TRUE = new Predicate() {
|
||||
@Override public boolean test(Object o) { return true; }
|
||||
@NonNull
|
||||
@Override public Predicate and(@NonNull Predicate other) { return other; }
|
||||
@NonNull
|
||||
@Override public Predicate or(@NonNull Predicate other) { return this; }
|
||||
@NonNull
|
||||
@Override public Predicate negate() { return FALSE; }
|
||||
@Override
|
||||
public @NonNull Predicate and(@NonNull Predicate other) { return other; }
|
||||
@Override
|
||||
public @NonNull Predicate or(@NonNull Predicate other) { return this; }
|
||||
@Override
|
||||
public @NonNull Predicate negate() { return FALSE; }
|
||||
};
|
||||
|
||||
public static <T> Predicate<T> alwaysFalse() {
|
||||
|
Loading…
Reference in New Issue
Block a user