mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Single module setup
This commit is contained in:
1 parent
ad9a794156
commit
66217f6534
70 files changed
+92
-138
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package net.draycia.carbon.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandAlias("ignore")
|
||||
@CommandPermission("carbonchat.ignore")
|
||||
public class IgnoreCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private CarbonChat carbonChat;
|
||||
|
||||
@Default
|
||||
@CommandCompletion("@players")
|
||||
@Syntax("<player>")
|
||||
public void baseCommand(Player player, ChatUser targetUser) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
|
||||
if (user.isIgnoringUser(targetUser)) {
|
||||
user.setIgnoringUser(targetUser, false);
|
||||
user.sendMessage(processMessage(player, carbonChat.getConfig().getString("language.not-ignoring-user")));
|
||||
} else {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(carbonChat, () -> {
|
||||
Permission permission = carbonChat.getPermission();
|
||||
|
||||
if (permission.playerHas(null, targetUser.asOfflinePlayer(), "carbonchat.ignore.exempt")) {
|
||||
user.sendMessage(processMessage(player, carbonChat.getConfig().getString("language.ignore-exempt")));
|
||||
} else {
|
||||
user.setIgnoringUser(targetUser, true);
|
||||
user.sendMessage(processMessage(player, carbonChat.getConfig().getString("language.ignoring-user")));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Component processMessage(Player player, String message) {
|
||||
return carbonChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user