mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Finalize class fields that can be final
This commit is contained in:
1 parent
15e105ac32
commit
a5da40fee5
18 files changed
+34
-43
No files matched your search
@@ -15,7 +15,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public final class SimpleChat extends JavaPlugin {
|
||||
|
||||
private List<Pattern> itemPatterns = new ArrayList<>();
|
||||
private final List<Pattern> itemPatterns = new ArrayList<>();
|
||||
|
||||
private Permission permission;
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.Map;
|
||||
|
||||
public class ChannelRegistry implements Registry<ChatChannel> {
|
||||
|
||||
private Map<String, ChatChannel> registry = new HashMap<>();
|
||||
private SimpleChat simpleChat;
|
||||
private final Map<String, ChatChannel> registry = new HashMap<>();
|
||||
private final SimpleChat simpleChat;
|
||||
|
||||
public ChannelRegistry(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
@@ -30,7 +30,7 @@ public class ChannelRegistry implements Registry<ChatChannel> {
|
||||
CommandManager commandManager = simpleChat.getCommandManager().getCommandManager();
|
||||
|
||||
commandManager.getCommandReplacements().addReplacement("channelName", value.getAliases());
|
||||
commandManager.registerCommand(new AliasedChannelCommand(simpleChat, value));
|
||||
commandManager.registerCommand(new AliasedChannelCommand(value));
|
||||
|
||||
if (value instanceof Listener) {
|
||||
Bukkit.getPluginManager().registerEvents((Listener)value, simpleChat);
|
||||
|
||||
+3
-5
@@ -19,12 +19,10 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
private String key;
|
||||
private final String key;
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private ConfigurationSection config;
|
||||
|
||||
private SimpleChatChannel() { }
|
||||
private final SimpleChat simpleChat;
|
||||
private final ConfigurationSection config;
|
||||
|
||||
public SimpleChatChannel(String key, SimpleChat simpleChat, ConfigurationSection config) {
|
||||
this.key = key;
|
||||
|
||||
+3
-2
@@ -16,8 +16,9 @@ public class AliasedChannelCommand extends BaseCommand {
|
||||
private SimpleChat simpleChat;
|
||||
private ChatChannel chatChannel;
|
||||
|
||||
public AliasedChannelCommand(SimpleChat simpleChat, ChatChannel chatChannel) {
|
||||
this.simpleChat = simpleChat;
|
||||
private final ChatChannel chatChannel;
|
||||
|
||||
public AliasedChannelCommand(ChatChannel chatChannel) {
|
||||
this.chatChannel = chatChannel;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ChatFormatEvent extends Event implements Cancellable {
|
||||
private static final HandlerList HANDLERS_LIST = new HandlerList();
|
||||
private boolean isCancelled = false;
|
||||
|
||||
private ChatUser user;
|
||||
private final ChatUser user;
|
||||
private ChatChannel chatChannel;
|
||||
private String format;
|
||||
private String message;
|
||||
|
||||
@@ -45,7 +45,6 @@ public class PrivateMessageEvent extends Event {
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
public Component getSenderComponent() {
|
||||
return senderComponent;
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
public class BukkitChatListener implements Listener {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private final SimpleChat simpleChat;
|
||||
|
||||
public BukkitChatListener(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public class EmptyChatHandler implements Listener {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private final SimpleChat simpleChat;
|
||||
|
||||
public EmptyChatHandler(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class ItemLinkHandler implements Listener {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private final SimpleChat simpleChat;
|
||||
|
||||
public ItemLinkHandler(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public class PlaceholderHandler implements Listener {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private final SimpleChat simpleChat;
|
||||
|
||||
public PlaceholderHandler(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class AdventureManager {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private BukkitAudiences audiences;
|
||||
private final SimpleChat simpleChat;
|
||||
private final BukkitAudiences audiences;
|
||||
|
||||
public AdventureManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
@@ -13,9 +13,9 @@ import java.util.Collections;
|
||||
|
||||
public class ChannelManager {
|
||||
|
||||
private ChannelRegistry registry;
|
||||
private final SimpleChat simpleChat;
|
||||
private final ChannelRegistry registry;
|
||||
private String defaultChannelKey = null;
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ChannelManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
@@ -12,11 +12,9 @@ import java.util.List;
|
||||
|
||||
public class CommandManager {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private BukkitCommandManager commandManager;
|
||||
private final BukkitCommandManager commandManager;
|
||||
|
||||
public CommandManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
commandManager = new BukkitCommandManager(simpleChat);
|
||||
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ import java.util.UUID;
|
||||
|
||||
public class PluginMessageManager implements PluginMessageListener {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private BungeeChannelApi api;
|
||||
private final SimpleChat simpleChat;
|
||||
private final BungeeChannelApi api;
|
||||
|
||||
public PluginMessageManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
@@ -16,17 +16,14 @@ import java.util.UUID;
|
||||
|
||||
public class RedisManager {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private final RedisClient client;
|
||||
private final StatefulRedisPubSubConnection<String, String> connection;
|
||||
private final RedisPubSubCommands<String, String> sync;
|
||||
|
||||
private RedisClient client;
|
||||
private StatefulRedisPubSubConnection<String, String> connection;
|
||||
private RedisPubSubCommands<String, String> sync;
|
||||
|
||||
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private Type userType = new TypeToken<SimpleChatUser>() {}.getType();
|
||||
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private final Type userType = new TypeToken<SimpleChatUser>() {}.getType();
|
||||
|
||||
public RedisManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
String host = simpleChat.getConfig().getString("redis.host");
|
||||
int port = simpleChat.getConfig().getInt("redis.port");
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ public class JSONUserService extends UserService {
|
||||
.removalListener(this::saveUser)
|
||||
.build(CacheLoader.from(this::loadUser));
|
||||
|
||||
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private Type userType = new TypeToken<SimpleChatUser>() {}.getType();
|
||||
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private final Type userType = new TypeToken<SimpleChatUser>() {}.getType();
|
||||
|
||||
public JSONUserService(SimpleChat simpleChat) {
|
||||
this.simpleChat =simpleChat;
|
||||
|
||||
+2
-4
@@ -30,10 +30,8 @@ public class MySQLUserService extends UserService {
|
||||
.removalListener(this::saveUser)
|
||||
.build(CacheLoader.from(this::loadUser));
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
private Database database;
|
||||
|
||||
private MySQLUserService() { }
|
||||
private final SimpleChat simpleChat;
|
||||
private final Database database;
|
||||
|
||||
public MySQLUserService(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
+3
-3
@@ -21,13 +21,13 @@ import java.util.*;
|
||||
|
||||
public class SimpleChatUser implements ChatUser, ForwardingAudience {
|
||||
|
||||
private transient SimpleChat simpleChat;
|
||||
private final transient SimpleChat simpleChat;
|
||||
|
||||
private UUID uuid;
|
||||
|
||||
private String selectedChannel = null;
|
||||
private Map<String, SimpleUserChannelSettings> channelSettings = new HashMap<>();
|
||||
private List<UUID> ignoredUsers = new ArrayList<>();
|
||||
private final Map<String, SimpleUserChannelSettings> channelSettings = new HashMap<>();
|
||||
private final List<UUID> ignoredUsers = new ArrayList<>();
|
||||
private boolean muted = false;
|
||||
private boolean shadowMuted = false;
|
||||
private boolean spyingWhispers = false;
|
||||
|
||||
Reference in new issue
Block a user