mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Begin (broken) modularization
This commit is contained in:
1 parent
b3a0d71ba8
commit
ad8089855c
56 files changed
+553
-369
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package net.draycia.simplechat.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandAlias("reply|r")
|
||||
@CommandPermission("simplechat.reply")
|
||||
public class ReplyCommand extends BaseCommand {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ReplyCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(Player player, String... args) {
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatUser user = simpleChat.getUserService().wrap(player);
|
||||
ChatUser targetUser = simpleChat.getUserService().wrap(user.getReplyTarget());
|
||||
|
||||
if (user.getReplyTarget() == null) {
|
||||
String message = simpleChat.getConfig().getString("language.no-reply-target");
|
||||
Component component = MiniMessage.get().parse(message, "br", "\n");
|
||||
user.sendMessage(component);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
targetUser.sendMessage(user, String.join(" ", args));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user