diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/compat/NullSafeConsoleCommandSender.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/compat/NullSafeConsoleCommandSender.java index e78b4fedd..87a8d7eaf 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/compat/NullSafeConsoleCommandSender.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/compat/NullSafeConsoleCommandSender.java @@ -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 getEffectivePermissions() { throw new UnsupportedOperationException(); } + @Override public @NonNull Set getEffectivePermissions() { throw new UnsupportedOperationException(); } @Override public void setOp(boolean b) { throw new UnsupportedOperationException(); } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPermissibleBase.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPermissibleBase.java index 52a988ee7..031243beb 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPermissibleBase.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPermissibleBase.java @@ -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 getEffectivePermissions() { return Collections.emptySet(); } + @Override public @NonNull Set getEffectivePermissions() { return Collections.emptySet(); } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPlugin.java index 58eed0199..7bb9324d2 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/dummy/DummyPlugin.java @@ -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 onTabComplete(@NonNull CommandSender commandSender, @NonNull Command command, @NonNull String s, @NonNull String[] strings) { return null; } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java index dbc00c294..acc0ed180 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissible.java @@ -201,17 +201,15 @@ public class LPPermissible extends PermissibleBase { this.player.setOp(value); } - @NonNull @Override - public Set getEffectivePermissions() { + public @NonNull Set 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"); } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissionAttachment.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissionAttachment.java index e0f240f70..f3bf219be 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissionAttachment.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LPPermissionAttachment.java @@ -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 getPermissions() { + public @NonNull Map getPermissions() { return this.perms; } - @NonNull @Override - public Plugin getPlugin() { + public @NonNull Plugin getPlugin() { return this.owner != null ? this.owner : this.permissible.getPlugin().getBootstrap(); } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/MonitoredPermissibleBase.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/MonitoredPermissibleBase.java index 680ad2dff..da10bde9a 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/MonitoredPermissibleBase.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/MonitoredPermissibleBase.java @@ -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 getEffectivePermissions() { return this.delegate.getEffectivePermissions(); } + @Override public @NonNull Set getEffectivePermissions() { return this.delegate.getEffectivePermissions(); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java b/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java index 9bd678852..9a359af25 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java @@ -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); } diff --git a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPlatform.java b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPlatform.java index d827e896e..9f87a744e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPlatform.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPlatform.java @@ -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()); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/context/contextset/ContextImpl.java b/common/src/main/java/me/lucko/luckperms/common/context/contextset/ContextImpl.java index 1c9f6a34e..4e7c5a13d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/context/contextset/ContextImpl.java +++ b/common/src/main/java/me/lucko/luckperms/common/context/contextset/ContextImpl.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/util/Predicates.java b/common/src/main/java/me/lucko/luckperms/common/util/Predicates.java index 8d439e6b2..3129c7522 100644 --- a/common/src/main/java/me/lucko/luckperms/common/util/Predicates.java +++ b/common/src/main/java/me/lucko/luckperms/common/util/Predicates.java @@ -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 Predicate alwaysFalse() {