Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import com.eternalcode.core.feature.spawn.SpawnService;
import com.eternalcode.core.feature.teleport.TeleportService;
import com.eternalcode.core.feature.warp.WarpService;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface EternalCoreApi {

AfkService getAfkService();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
package com.eternalcode.core;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public final class EternalCoreApiProvider {

@Nullable
@ApiStatus.Internal
private static EternalCoreApi api;

@ApiStatus.Internal
private EternalCoreApiProvider() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}

@NotNull
public static EternalCoreApi provide() {
if (api == null) {
throw new IllegalStateException("EternalCoreApiProvider is not initialized");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.Unmodifiable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;

/**
* Service responsible for managing admin chat functionality.
*/
@NullMarked
public interface AdminChatService {

/**
Expand Down Expand Up @@ -39,7 +41,6 @@ public interface AdminChatService {
*
* @return an unmodifiable collection of player UUIDs with enabled admin chat
*/
@NonNull
@Unmodifiable
Collection<UUID> getPlayersWithEnabledChat();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;

/**
* Event called when an admin chat message is being sent.
Expand All @@ -13,6 +14,7 @@
* Plugins can cancel this event to prevent the message from being sent, or modify
* the message content before it's delivered.
*/
@NullMarked
public class AdminChatEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand All @@ -24,29 +26,19 @@ public class AdminChatEvent extends Event implements Cancellable {
public AdminChatEvent(@NonNull CommandSender sender, @NonNull String content) {
super(false);

if (sender == null) {
throw new IllegalArgumentException("Sender cannot be null");
}
if (content == null) {
throw new IllegalArgumentException("Content cannot be null");
}

this.sender = sender;
this.content = content;
this.cancelled = false;
}

@NonNull
public static HandlerList getHandlerList() {
return HANDLER_LIST;
}

@NonNull
public CommandSender getSender() {
return this.sender;
}

@NonNull
public String getContent() {
return this.content;
}
Expand All @@ -69,7 +61,6 @@ public void setCancelled(boolean cancelled) {
}

@Override
@NonNull
public HandlerList getHandlers() {
return HANDLER_LIST;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import java.time.Instant;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* Represents a player being away from keyboard (AFK).
*/
@NullMarked
public class Afk {

private final UUID player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import java.util.Optional;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* This service interface handles AFK (Away From Keyboard) status for players.
*/
@NullMarked
public interface AfkService {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;

/**
* Called when a player switches their afk status.
*/
@NullMarked
public class AfkSwitchEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

@NullMarked
public class ButcherEntityRemoveEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.bukkit.entity.Cat;

import java.util.UUID;
import org.jspecify.annotations.NullMarked;

@NullMarked
public record Catboy(UUID uuid, Cat.Type selectedType) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import org.bukkit.entity.Cat;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Unmodifiable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Service for managing catboys.
*/
@NullMarked
public interface CatboyService {

/**
Expand Down Expand Up @@ -52,6 +55,6 @@ public interface CatboyService {
* Gets a set of all catboys.
*/
@Unmodifiable
Collection<Catboy> getCatboys();
Collection<@Nullable Catboy> getCatboys();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jspecify.annotations.NullMarked;

/**
* Called when a player switches their catboy status.
*/
@NullMarked
public class CatboySwitchEvent extends PlayerEvent {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.time.Duration;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface ChatService {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Called when one of the server administrators clear chat using /chat clear command.
*/
@NullMarked
public class ClearChatEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Called when one of the server administrators disables chat using /chat off command.
*/
@NullMarked
public class DisableChatEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

import java.time.Duration;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* Called when one of the server administrators edit slowmode chat using /chat slowmode command.
*/
@NullMarked
public class EditSlowModeEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Called when one of the server administrators enables chat using /chat on command.
*/
@NullMarked
public class EnableChatEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

@NullMarked
public class HelpOpEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.UUID;
import org.bukkit.Location;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface Home {

Location getLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public interface HomeService {

int getAmountOfHomes(UUID playerUniqueId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Event called when a home is created.
*/
@NullMarked
public class HomeCreateEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import org.bukkit.event.HandlerList;

import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* Event called when a home is deleted.
*/
@NullMarked
public class HomeDeleteEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.bukkit.event.HandlerList;

import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* Event called when a player tries to create a home but has reached the limit.
*/
@NullMarked
public class HomeLimitReachedEvent extends Event {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.eternalcode.core.feature.home.event;

import com.eternalcode.core.feature.home.Home;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Event called when a home is overridden with new location.
*/
@NullMarked
public class HomeOverrideEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.eternalcode.core.feature.home.event;

import com.eternalcode.core.feature.home.Home;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import java.util.UUID;
import org.jspecify.annotations.NullMarked;

/**
* Called after teleportation to home.
*/
@NullMarked
public class HomeTeleportEvent extends Event {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NullMarked;

/**
* Called before teleportation to home.
*/
@NullMarked
public class PreHomeTeleportEvent extends Event implements Cancellable {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.jspecify.annotations.NullMarked;

@NullMarked
public interface IgnoreService {

CompletableFuture<Boolean> isIgnored(UUID requester, UUID target);
Expand Down
Loading