mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Make some classes final
This commit is contained in:
1 parent
c62c30ee5e
commit
7abfbe2090
10 files changed
+28
-16
No files matched your search
@@ -36,12 +36,17 @@ public class CarbonChatEvent extends CancellableCarbonEvent {
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link PlayerComponentRenderer} for the event.
|
||||
*
|
||||
* @param renderer new {@link PlayerComponentRenderer}
|
||||
*/
|
||||
public void renderer(final @NonNull PlayerComponentRenderer renderer) {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The renderer used to construct components for each player in recipients.
|
||||
* Get the renderer used to construct components for each player in recipients.
|
||||
*
|
||||
* @return The per-player component renderer.
|
||||
*/
|
||||
@@ -50,7 +55,8 @@ public class CarbonChatEvent extends CancellableCarbonEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* The sender of the message.
|
||||
* Get the sender of the message.
|
||||
*
|
||||
* @return The message sender.
|
||||
*/
|
||||
public CarbonPlayer sender() {
|
||||
@@ -58,7 +64,8 @@ public class CarbonChatEvent extends CancellableCarbonEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* The original message that was sent.
|
||||
* Get the original message that was sent.
|
||||
*
|
||||
* @return The original message.
|
||||
*/
|
||||
public Component originalMessage() {
|
||||
@@ -66,13 +73,19 @@ public class CarbonChatEvent extends CancellableCarbonEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* The chat message that will be sent.
|
||||
* Get the chat message that will be sent.
|
||||
*
|
||||
* @return The chat message.
|
||||
*/
|
||||
public Component message() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the chat message that will be sent.
|
||||
*
|
||||
* @param message new message
|
||||
*/
|
||||
public void message(final @NonNull Component message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@@ -5,16 +5,15 @@ import net.draycia.carbon.bukkit.listeners.BukkitChatListener;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class CarbonChatBukkitEntry extends JavaPlugin {
|
||||
public final class CarbonChatBukkitEntry extends JavaPlugin {
|
||||
|
||||
private static final int BSTATS_PLUGIN_ID = 8720;
|
||||
|
||||
@SuppressWarnings("initialization.fields.uninitialized")
|
||||
private @NonNull CarbonChatBukkit carbon;
|
||||
private @MonotonicNonNull CarbonChatBukkit carbon;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BukkitChatListener implements Listener {
|
||||
public final class BukkitChatListener implements Listener {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
private final UserManager userManager;
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.UUID;
|
||||
import static java.util.Objects.requireNonNullElseGet;
|
||||
import static net.kyori.adventure.text.Component.translatable;
|
||||
|
||||
public class CarbonPlayerBukkit extends CarbonPlayerCommon {
|
||||
public final class CarbonPlayerBukkit extends CarbonPlayerCommon {
|
||||
|
||||
public CarbonPlayerBukkit(
|
||||
final @NonNull String username,
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.UUID;
|
||||
* No data is persisted or saved.
|
||||
* This exists merely as a placeholder.
|
||||
*/
|
||||
public class MemoryUserManagerBukkit implements UserManager {
|
||||
public final class MemoryUserManagerBukkit implements UserManager {
|
||||
|
||||
private final @NonNull Map<UUID, @NonNull CarbonPlayer> users = new HashMap<>();
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class CarbonChatCommon implements CarbonChat {
|
||||
protected abstract @NonNull CommandManager<Commander> createCommandManager();
|
||||
|
||||
@Override
|
||||
public @NonNull CarbonEventHandler eventHandler() {
|
||||
public final @NonNull CarbonEventHandler eventHandler() {
|
||||
return this.eventHandler;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.spongepowered.plugin.PluginContainer;
|
||||
import org.spongepowered.plugin.jvm.Plugin;
|
||||
|
||||
@Plugin("carbonchat")
|
||||
public class CarbonChatSponge extends CarbonChatCommon {
|
||||
public final class CarbonChatSponge extends CarbonChatCommon {
|
||||
|
||||
private static final int BSTATS_PLUGIN_ID = 11279;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.message.PlayerChatEvent;
|
||||
|
||||
public class SpongeChatListener {
|
||||
public final class SpongeChatListener {
|
||||
|
||||
@Listener
|
||||
public void onPlayerChat(final @NonNull PlayerChatEvent event) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.spongepowered.api.item.inventory.ItemStack;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CarbonPlayerSponge extends CarbonPlayerCommon {
|
||||
public final class CarbonPlayerSponge extends CarbonPlayerCommon {
|
||||
|
||||
public CarbonPlayerSponge(
|
||||
final @NonNull String username,
|
||||
|
||||
@@ -19,7 +19,7 @@ import static net.kyori.adventure.text.Component.text;
|
||||
* No data is persisted or saved.
|
||||
* This exists merely as a placeholder.
|
||||
*/
|
||||
public class MemoryUserManagerSponge implements UserManager {
|
||||
public final class MemoryUserManagerSponge implements UserManager {
|
||||
|
||||
private final @NonNull Map<UUID, @NonNull CarbonPlayer> users = new HashMap<>();
|
||||
|
||||
|
||||
Reference in new issue
Block a user