Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,7 +1,11 @@
package com.eternalcode.core;

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

public final class EternalCoreApiProvider {

@Nullable
private static EternalCoreApi api;

private EternalCoreApiProvider() {
Expand All @@ -16,6 +20,7 @@ public static EternalCoreApi provide() {
return api;
}

@ApiStatus.Internal
static void initialize(EternalCoreApi api) {
if (EternalCoreApiProvider.api != null) {
throw new IllegalStateException("EternalCoreApiProvider is already initialized");
Expand All @@ -28,6 +33,7 @@ static void initialize(EternalCoreApi api) {
EternalCoreApiProvider.api = api;
}

@ApiStatus.Internal
static void deinitialize() {
if (EternalCoreApiProvider.api == null) {
throw new IllegalStateException("EternalCoreApiProvider is not initialized");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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
@@ -1,5 +1,6 @@
package com.eternalcode.core.feature.adminchat.event;

import java.util.Objects;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand All @@ -21,40 +22,27 @@ public class AdminChatEvent extends Event implements Cancellable {
private String content;
private boolean cancelled;

public AdminChatEvent(@NonNull CommandSender sender, @NonNull String content) {
public AdminChatEvent(CommandSender sender, 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.sender = Objects.requireNonNull(sender, "sender cannot be null");
this.content = Objects.requireNonNull(content, "content cannot be null");
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;
}

public void setContent(@NonNull String content) {
if (content == null) {
throw new IllegalArgumentException("Content cannot be null");
}
public void setContent(String content) {
this.content = content;
}

Expand All @@ -69,8 +57,7 @@ public void setCancelled(boolean cancelled) {
}

@Override
@NonNull
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NonNull;

public class ButcherEntityRemoveEvent extends Event implements Cancellable {

Expand Down Expand Up @@ -31,7 +32,7 @@ public Entity getEntity() {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jspecify.annotations.NonNull;

/**
* Called when a player switches their catboy status.
Expand All @@ -26,7 +27,7 @@ public boolean isCatboy() {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

/**
* Called when one of the server administrators clear chat using /chat clear command.
Expand Down Expand Up @@ -35,7 +36,7 @@ public void setCancelled(boolean cancelled) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

/**
* Called when one of the server administrators disables chat using /chat off command.
Expand Down Expand Up @@ -35,7 +36,7 @@ public void setCancelled(boolean cancelled) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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

/**
* Called when one of the server administrators edit slowmode chat using /chat slowmode command.
Expand Down Expand Up @@ -54,7 +55,7 @@ public void setCancelled(boolean cancelled) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

/**
* Called when one of the server administrators enables chat using /chat on command.
Expand Down Expand Up @@ -35,7 +36,7 @@ public void setCancelled(boolean cancelled) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

public class HelpOpEvent extends Event implements Cancellable {

Expand Down Expand Up @@ -39,7 +40,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

/**
* Event called when a home is created.
Expand Down Expand Up @@ -62,7 +63,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.event.HandlerList;

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

/**
* Event called when a home is deleted.
Expand Down Expand Up @@ -44,7 +45,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.bukkit.event.HandlerList;

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

/**
* Event called when a player tries to create a home but has reached the limit.
Expand Down Expand Up @@ -37,7 +38,7 @@ public int getLimitAmount() {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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.NonNull;

/**
* Event called when a home is overridden with new location.
Expand Down Expand Up @@ -64,7 +64,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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.NonNull;

/**
* Called after teleportation to home.
Expand Down Expand Up @@ -37,7 +37,7 @@ public static HandlerList getHandlerList() {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jspecify.annotations.NonNull;

/**
* Called before teleportation to home.
Expand Down Expand Up @@ -59,7 +60,7 @@ public static HandlerList getHandlerList() {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NonNull
@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NonNull
@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NonNull
@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

public class JailDetainEvent extends PlayerEvent implements Cancellable {

Expand Down Expand Up @@ -34,7 +35,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

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

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

public class JailReleaseEvent extends Event implements Cancellable {

Expand Down Expand Up @@ -32,7 +33,7 @@ public void setCancelled(boolean cancel) {
}

@Override
public HandlerList getHandlers() {
public @NonNull HandlerList getHandlers() {
return HANDLER_LIST;
}

Expand Down
Loading