mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Infer nullability, pre human pass
This commit is contained in:
62 files changed
+303
-249
No files matched your search
@@ -9,16 +9,17 @@ import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class AliasedChannelCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
private final ChatChannel chatChannel;
|
||||
private final @NonNull ChatChannel chatChannel;
|
||||
private final String commandName;
|
||||
|
||||
public AliasedChannelCommand(CarbonChat carbonChat, ChatChannel chatChannel) {
|
||||
public AliasedChannelCommand(CarbonChat carbonChat, @NonNull ChatChannel chatChannel) {
|
||||
this.carbonChat = carbonChat;
|
||||
this.chatChannel = chatChannel;
|
||||
|
||||
@@ -71,7 +72,7 @@ public class AliasedChannelCommand {
|
||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||
}
|
||||
|
||||
public ChatChannel getChatChannel() {
|
||||
public @NonNull ChatChannel getChatChannel() {
|
||||
return chatChannel;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class ChannelCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ChannelCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -25,7 +26,7 @@ public class ChannelListCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ChannelListCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ChannelListCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -54,14 +55,14 @@ public class ChannelListCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
public void executeSelf(Player player, Object[] args) {
|
||||
public void executeSelf(@NonNull Player player, Object[] args) {
|
||||
Iterator<ChatChannel> allChannels = carbonChat.getChannelManager().getRegistry().values().iterator();
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
|
||||
getListAndSend(player, user, allChannels);
|
||||
}
|
||||
|
||||
public void executeOther(CommandSender sender, Object[] args) {
|
||||
public void executeOther(@NonNull CommandSender sender, Object[] args) {
|
||||
Audience cmdSender = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
|
||||
@@ -75,7 +76,7 @@ public class ChannelListCommand {
|
||||
getListAndSend(sender, user, allChannels);
|
||||
}
|
||||
|
||||
private void getListAndSend(CommandSender sender, ChatUser user, Iterator<ChatChannel> allChannels) {
|
||||
private void getListAndSend(@NonNull CommandSender sender, ChatUser user, @NonNull Iterator<ChatChannel> allChannels) {
|
||||
ChatChannel channel;
|
||||
List<ChatChannel> canSee = new ArrayList<>();
|
||||
List<ChatChannel> cannotSee = new ArrayList<>();
|
||||
@@ -118,7 +119,7 @@ public class ChannelListCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private void makeList(Iterator<ChatChannel> iterator, TextComponent.Builder list) {
|
||||
private void makeList(@NonNull Iterator<ChatChannel> iterator, TextComponent.@NonNull Builder list) {
|
||||
String listSeparator = carbonChat.getLanguage().getString("channel-list-separator", ", ");
|
||||
// TODO: Larry, why did you double assign the listSeparatorComponent?
|
||||
Component listSeparatorComponent = TextComponent.of(listSeparator);
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -16,7 +17,7 @@ public class ChatReloadCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ChatReloadCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ChatReloadCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -32,7 +33,7 @@ public class ChatReloadCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(CommandSender sender, Object[] args) {
|
||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
||||
carbonChat.reloadConfig();
|
||||
carbonChat.reloadFilters();
|
||||
|
||||
|
||||
@@ -11,12 +11,13 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ClearChatCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ClearChatCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ClearChatCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -32,7 +33,7 @@ public class ClearChatCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(CommandSender sender, Object[] args) {
|
||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
||||
String format = carbonChat.getModConfig().getString("clear-chat.message", "");
|
||||
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n");
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class IgnoreCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public IgnoreCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public IgnoreCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -39,7 +40,7 @@ public class IgnoreCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(Player player, Object[] args) {
|
||||
private void execute(@NonNull Player player, Object[] args) {
|
||||
ChatUser targetUser = (ChatUser) args[0];
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class MeCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public MeCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public MeCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -39,7 +40,7 @@ public class MeCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(Player player, Object[] args) {
|
||||
private void execute(@NonNull Player player, Object[] args) {
|
||||
String message = ((String) args[0]).replace("</pre>", "");
|
||||
String format = PlaceholderAPI.setPlaceholders(player, carbonChat.getLanguage().getString("me"));
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -17,7 +18,7 @@ public class MessageCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public MessageCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public MessageCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class MuteCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public MuteCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public MuteCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -40,7 +41,7 @@ public class MuteCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(CommandSender sender, Object[] args) {
|
||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class NicknameCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public NicknameCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public NicknameCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -50,7 +51,7 @@ public class NicknameCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void executeSelf(Player player, Object[] args) {
|
||||
private void executeSelf(@NonNull Player player, Object[] args) {
|
||||
String nickname = (String) args[0];
|
||||
ChatUser sender = carbonChat.getUserService().wrap(player);
|
||||
|
||||
@@ -73,7 +74,7 @@ public class NicknameCommand {
|
||||
"user", sender.asOfflinePlayer().getName()));
|
||||
}
|
||||
|
||||
private void executeOther(CommandSender sender, Object[] args) {
|
||||
private void executeOther(@NonNull CommandSender sender, Object[] args) {
|
||||
Audience user = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||
ChatUser target = (ChatUser) args[0];
|
||||
String nickname = (String) args[1];
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -17,7 +18,7 @@ public class ReplyCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ReplyCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ReplyCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
|
||||
@@ -11,14 +11,15 @@ import net.draycia.carbon.storage.UserChannelSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class SetColorCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
private final @NonNull CarbonChat carbonChat;
|
||||
|
||||
public SetColorCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public SetColorCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class ShadowMuteCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ShadowMuteCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ShadowMuteCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -40,7 +41,7 @@ public class ShadowMuteCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(CommandSender sender, Object[] args) {
|
||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.draycia.carbon.storage.UserChannelSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class SpyChannelCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public SpyChannelCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public SpyChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class SudoChannelCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public SudoChannelCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public SudoChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -52,7 +53,7 @@ public class SudoChannelCommand {
|
||||
.register();
|
||||
}
|
||||
|
||||
private void setOtherChannel(CommandSender sender, ChatUser user, ChatChannel channel) {
|
||||
private void setOtherChannel(@NonNull CommandSender sender, @NonNull ChatUser user, @NonNull ChatChannel channel) {
|
||||
user.setSelectedChannel(channel);
|
||||
|
||||
String message = channel.getSwitchMessage();
|
||||
@@ -66,7 +67,7 @@ public class SudoChannelCommand {
|
||||
"player", user.asOfflinePlayer().getName()));
|
||||
}
|
||||
|
||||
private void sendMessageOther(CommandSender sender, ChatUser user, ChatChannel channel, String message) {
|
||||
private void sendMessageOther(CommandSender sender, ChatUser user, @NonNull ChatChannel channel, String message) {
|
||||
Component component = channel.sendMessage(user, message, false);
|
||||
|
||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class ToggleCommand {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ToggleCommand(CarbonChat carbonChat, CommandSettings commandSettings) {
|
||||
public ToggleCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
if (!commandSettings.isEnabled()) {
|
||||
@@ -72,7 +73,7 @@ public class ToggleCommand {
|
||||
"color", "<color:" + channel.getChannelColor(user).toString() + ">", "channel", channel.getName()));
|
||||
}
|
||||
|
||||
private void executeOther(CommandSender sender, Object[] args) {
|
||||
private void executeOther(@NonNull CommandSender sender, Object[] args) {
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
ChatChannel channel = (ChatChannel) args[1];
|
||||
|
||||
|
||||
Reference in new issue
Block a user