mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Switch to ACF Dependency Injection for SimpleChat field
This commit is contained in:
1 parent
a5da40fee5
commit
64af66aaac
11 files changed
+24
-46
No files matched your search
+1
-1
@@ -13,8 +13,8 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.switch")
|
||||
public class AliasedChannelCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
private ChatChannel chatChannel;
|
||||
|
||||
private final ChatChannel chatChannel;
|
||||
|
||||
|
||||
@@ -13,12 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.switch")
|
||||
public class ChannelCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ChannelCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@chatchannel")
|
||||
public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel, @Optional String[] args) {
|
||||
|
||||
+2
-4
@@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,12 +13,9 @@ import org.bukkit.command.CommandSender;
|
||||
@CommandPermission("simplechat.reload")
|
||||
public class ChatReloadCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ChatReloadCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(CommandSender sender) {
|
||||
simpleChat.reloadConfig();
|
||||
|
||||
@@ -5,6 +5,7 @@ import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@@ -14,12 +15,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.ignore")
|
||||
public class IgnoreCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public IgnoreCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@players")
|
||||
public void baseCommand(Player player, ChatUser targetUser) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
@@ -15,12 +16,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.me")
|
||||
public class MeCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public MeCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(Player player, String... args) {
|
||||
String message = String.join(" ", args).replace("</pre>", "");
|
||||
|
||||
@@ -5,6 +5,7 @@ import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -13,12 +14,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.message")
|
||||
public class MessageCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public MessageCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@players")
|
||||
public void baseCommand(Player player, ChatUser targetUser, String... args) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -13,12 +14,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.reply")
|
||||
public class ReplyCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ReplyCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(Player player, String... args) {
|
||||
if (args.length == 0) {
|
||||
|
||||
@@ -14,12 +14,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.setcolor")
|
||||
public class SetColorCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public SetColorCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@chatchannel")
|
||||
public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel, String color) {
|
||||
|
||||
+1
-4
@@ -12,12 +12,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.spy")
|
||||
public class SpyChannelCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public SpyChannelCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@channel")
|
||||
public void baseCommand(Player player, @Conditions("exists:true") ChatChannel channel) {
|
||||
|
||||
@@ -13,12 +13,9 @@ import org.bukkit.entity.Player;
|
||||
@CommandPermission("simplechat.toggle")
|
||||
public class ToggleCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ToggleCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@chatchannel @players")
|
||||
public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel) {
|
||||
|
||||
@@ -82,15 +82,15 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
private void setupCommands(BukkitCommandManager manager) {
|
||||
manager.registerCommand(new ToggleCommand(simpleChat));
|
||||
manager.registerCommand(new ChannelCommand(simpleChat));
|
||||
manager.registerCommand(new IgnoreCommand(simpleChat));
|
||||
manager.registerCommand(new ChatReloadCommand(simpleChat));
|
||||
manager.registerCommand(new MeCommand(simpleChat));
|
||||
manager.registerCommand(new MessageCommand(simpleChat));
|
||||
manager.registerCommand(new ReplyCommand(simpleChat));
|
||||
manager.registerCommand(new SetColorCommand(simpleChat));
|
||||
manager.registerCommand(new SpyChannelCommand(simpleChat));
|
||||
manager.registerCommand(new ToggleCommand());
|
||||
manager.registerCommand(new ChannelCommand());
|
||||
manager.registerCommand(new IgnoreCommand());
|
||||
manager.registerCommand(new ChatReloadCommand());
|
||||
manager.registerCommand(new MeCommand());
|
||||
manager.registerCommand(new MessageCommand());
|
||||
manager.registerCommand(new ReplyCommand());
|
||||
manager.registerCommand(new SetColorCommand());
|
||||
manager.registerCommand(new SpyChannelCommand());
|
||||
}
|
||||
|
||||
public co.aikar.commands.CommandManager getCommandManager() {
|
||||
|
||||
Reference in new issue
Block a user