Skip to content

Commit

Permalink
chore: remove last of jb nullability annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Nov 26, 2023
1 parent 2c4e881 commit 05ec40e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import java.util.ResourceBundle;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.translation.GlobalTranslator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.Nullable;

public final class TranslationRegistry {

Expand All @@ -49,7 +48,7 @@ public static void registerAll(final Locale locale, final ResourceBundle bundle)
});
}

public static @NotNull Optional<String> translate(final @NotNull String key, final @NotNull Locale locale) {
public static Optional<String> translate(final String key, final Locale locale) {
final Translation translation = TRANSLATIONS.get(key);
if (translation == null) {
return Optional.empty();
Expand All @@ -66,11 +65,11 @@ private Translation(final String key) {
this.key = key;
}

void register(final @NotNull Locale locale, final @NotNull String message) {
void register(final Locale locale, final String message) {
this.messages.put(locale, message);
}

@Nullable String translate(final @NotNull Locale locale) {
@Nullable String translate(final Locale locale) {
String message = this.messages.get(locale);
if (message == null) {
message = this.messages.get(new Locale(locale.getLanguage()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Set;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public final class Interactions {

Expand All @@ -36,13 +35,13 @@ public static void registerHandler(final Handler handler) {
HANDLERS.add(handler);
}

public static boolean isAllowedInteraction(final @NotNull Player player, final @NotNull Block clickedBlock) {
public static boolean isAllowedInteraction(final Player player, final Block clickedBlock) {
return HANDLERS.stream().allMatch(handler -> handler.checkBlock(player, clickedBlock));
}

@FunctionalInterface
public interface Handler {

boolean checkBlock(@NotNull Player player, @NotNull Block clickedBlock);
boolean checkBlock(Player player, Block clickedBlock);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class GPInteractionHandler implements Interactions.Handler {

Expand All @@ -39,7 +38,7 @@ public class GPInteractionHandler implements Interactions.Handler {

@SuppressWarnings("deprecation") // GP api uses ChatColor
@Override
public boolean checkBlock(final @NotNull Player player, final @NotNull Block clickedBlock) {
public boolean checkBlock(final Player player, final Block clickedBlock) {
final PlayerData playerData = DATA_STORE.get().getPlayerData(player.getUniqueId());
final Claim claim = DATA_STORE.get().getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
if (claim != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.TextComponent;
import org.jetbrains.annotations.NotNull;

import static net.kyori.adventure.text.Component.text;

Expand All @@ -50,7 +49,7 @@ public ComponentLike build(final S1 object1, final S2 object2) {
return this.addExtras(builder, this.extra1.build(object2));
}

public ComponentLike addExtras(final ComponentLike builder, final ComponentLike @NotNull ... components) {
public ComponentLike addExtras(final ComponentLike builder, final ComponentLike ... components) {
final List<Component> children = new ArrayList<>(builder.asComponent().children());
final int offset = children.size() - 1;
for (int i = 0; i < components.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.Recipe;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

public abstract class ModuleLifecycle {

Expand Down Expand Up @@ -75,7 +74,7 @@ protected final JavaPlugin getPlugin() {
return this.plugin;
}

public @NotNull ModuleInfo moduleInfo() {
public ModuleInfo moduleInfo() {
return this.moduleInfo;
}

Expand Down

0 comments on commit 05ec40e

Please sign in to comment.