mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add reply command and system
This commit is contained in:
1 parent
fe70cf82bc
commit
97355f0ce2
5 files changed
+85
-22
No files matched your search
@@ -0,0 +1,40 @@
|
||||
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.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@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) {
|
||||
UUID target = simpleChat.getPlayerReply(player.getUniqueId());
|
||||
|
||||
if (target == null) {
|
||||
String message = simpleChat.getConfig().getString("language.no-reply-target");
|
||||
Component component = MiniMessage.instance().parse(message);
|
||||
simpleChat.getAudiences().player(player).sendMessage(component);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
simpleChat.sendPlayerPrivateMessage(player, Bukkit.getOfflinePlayer(target), String.join(" ", args));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user