mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Reload and RP commands
This commit is contained in:
1 parent
191eaa1b3a
commit
68a40f9685
4 files changed
+69
No files matched your search
@@ -0,0 +1,30 @@
|
||||
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.command.CommandSender;
|
||||
|
||||
@CommandAlias("chatreload|creload")
|
||||
@CommandPermission("simplechat.reload")
|
||||
public class ChatReloadCommand extends BaseCommand {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public ChatReloadCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(CommandSender sender) {
|
||||
simpleChat.reloadConfig();
|
||||
|
||||
Component message = MiniMessage.instance().parse(simpleChat.getConfig().getString("language.reloaded"));
|
||||
simpleChat.getAudiences().audience(sender).sendMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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 me.clip.placeholderapi.PlaceholderAPI;
|
||||
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;
|
||||
|
||||
@CommandAlias("me|rp")
|
||||
@CommandPermission("simplechat.me")
|
||||
public class MeCommand extends BaseCommand {
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public MeCommand(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void baseCommand(Player player, String... args) {
|
||||
String message = String.join(" ", args);
|
||||
String format = PlaceholderAPI.setPlaceholders(player, simpleChat.getConfig().getString("language.me"));
|
||||
Component component = MiniMessage.instance().parse(format, "message", message);
|
||||
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
simpleChat.getAudiences().player(onlinePlayer).sendMessage(component);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,6 +56,8 @@ public class CommandManager {
|
||||
manager.registerCommand(new IgnoreCommand(simpleChat));
|
||||
manager.registerCommand(new CommandClearChat(simpleChat));
|
||||
manager.registerCommand(new ShadowMuteCommand(simpleChat));
|
||||
manager.registerCommand(new ChatReloadCommand(simpleChat));
|
||||
manager.registerCommand(new MeCommand(simpleChat));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user