mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
Move more things to common
This commit is contained in:
1 parent
16d3589773
commit
74ebee707c
35 files changed
+264
-214
No files matched your search
@@ -18,23 +18,22 @@ import net.draycia.carbon.listeners.contexts.TownyContext;
|
||||
import net.draycia.carbon.listeners.contexts.WorldGuardContext;
|
||||
import net.draycia.carbon.listeners.contexts.mcMMOContext;
|
||||
import net.draycia.carbon.listeners.events.BukkitChatListener;
|
||||
import net.draycia.carbon.listeners.events.CapsHandler;
|
||||
import net.draycia.carbon.listeners.events.CustomPlaceholderHandler;
|
||||
import net.draycia.carbon.listeners.events.IgnoredPlayerHandler;
|
||||
import net.draycia.carbon.common.listeners.events.CapsHandler;
|
||||
import net.draycia.carbon.common.listeners.events.CustomPlaceholderHandler;
|
||||
import net.draycia.carbon.common.listeners.events.IgnoredPlayerHandler;
|
||||
import net.draycia.carbon.listeners.events.ItemLinkHandler;
|
||||
import net.draycia.carbon.listeners.events.LegacyFormatHandler;
|
||||
import net.draycia.carbon.listeners.events.MuteHandler;
|
||||
import net.draycia.carbon.listeners.events.OfflineNameHandler;
|
||||
import net.draycia.carbon.listeners.events.PingHandler;
|
||||
import net.draycia.carbon.common.listeners.events.LegacyFormatHandler;
|
||||
import net.draycia.carbon.common.listeners.events.MuteHandler;
|
||||
import net.draycia.carbon.common.listeners.events.PingHandler;
|
||||
import net.draycia.carbon.listeners.events.PlaceholderHandler;
|
||||
import net.draycia.carbon.listeners.events.PlayerJoinListener;
|
||||
import net.draycia.carbon.common.listeners.events.PlayerJoinListener;
|
||||
import net.draycia.carbon.listeners.events.RelationalPlaceholderHandler;
|
||||
import net.draycia.carbon.listeners.events.ShadowMuteHandler;
|
||||
import net.draycia.carbon.listeners.events.UrlLinkHandler;
|
||||
import net.draycia.carbon.listeners.events.UserFormattingHandler;
|
||||
import net.draycia.carbon.listeners.events.WhisperPingHandler;
|
||||
import net.draycia.carbon.common.listeners.events.ShadowMuteHandler;
|
||||
import net.draycia.carbon.common.listeners.events.UrlLinkHandler;
|
||||
import net.draycia.carbon.common.listeners.events.UserFormattingHandler;
|
||||
import net.draycia.carbon.common.listeners.events.WhisperPingHandler;
|
||||
import net.draycia.carbon.common.adventure.AdventureManager;
|
||||
import net.draycia.carbon.managers.CommandManager;
|
||||
import net.draycia.carbon.common.commands.misc.CommandRegistrar;
|
||||
import net.draycia.carbon.common.messaging.MessageManager;
|
||||
import net.draycia.carbon.api.users.UserService;
|
||||
import net.draycia.carbon.storage.impl.JSONUserService;
|
||||
@@ -65,8 +64,6 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
|
||||
private Permission permission;
|
||||
|
||||
private CommandManager commandManager;
|
||||
|
||||
private ChannelRegistry channelRegistry;
|
||||
private CommandSettingsRegistry commandSettings;
|
||||
private AdventureManager messageProcessor;
|
||||
@@ -118,7 +115,6 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
// Initialize managers
|
||||
this.channelRegistry = new ChannelRegistry();
|
||||
this.messageManager = new MessageManager(this, new EmptyMessageService()); // TODO: get message service from config
|
||||
this.commandManager = new CommandManager(this);
|
||||
|
||||
final String storageType = this.getConfig().getString("storage.type");
|
||||
|
||||
@@ -154,21 +150,21 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
|
||||
// Register chat listeners
|
||||
pluginManager.registerEvents(new BukkitChatListener(this), this);
|
||||
new CapsHandler(this);
|
||||
new CustomPlaceholderHandler(this);
|
||||
|
||||
new CapsHandler();
|
||||
new CustomPlaceholderHandler();
|
||||
new IgnoredPlayerHandler();
|
||||
new ItemLinkHandler();
|
||||
new LegacyFormatHandler();
|
||||
new MuteHandler();
|
||||
new OfflineNameHandler();
|
||||
new PingHandler(this);
|
||||
new PingHandler();
|
||||
new PlaceholderHandler();
|
||||
pluginManager.registerEvents(new PlayerJoinListener(this), this);
|
||||
new PlayerJoinListener();
|
||||
new RelationalPlaceholderHandler();
|
||||
new ShadowMuteHandler(this);
|
||||
new ShadowMuteHandler();
|
||||
new UrlLinkHandler();
|
||||
new UserFormattingHandler();
|
||||
new WhisperPingHandler(this);
|
||||
new WhisperPingHandler();
|
||||
}
|
||||
|
||||
private void setupCommands() {
|
||||
@@ -184,7 +180,7 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
CommandRegistrar.registerCommands(manager);
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -259,8 +255,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public CommandManager commandManager() {
|
||||
return this.commandManager;
|
||||
public CommandRegistrar commandManager() {
|
||||
return this.commandRegistrar;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class CapsHandler {
|
||||
|
||||
public CapsHandler(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
if (!carbonChat.moderationConfig().getBoolean("caps-protection.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.message().length() >= carbonChat.moderationConfig().getInt("caps-protection.minimum-length"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
int amountOfCaps = 0;
|
||||
|
||||
for (final char letter : event.message().toCharArray()) {
|
||||
if (Character.isUpperCase(letter)) {
|
||||
amountOfCaps++;
|
||||
}
|
||||
}
|
||||
|
||||
final double capsPercentage = (amountOfCaps * 100.0) / event.message().length();
|
||||
|
||||
if (!(capsPercentage >= carbonChat.moderationConfig().getDouble("caps-protection.percent-caps"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (carbonChat.moderationConfig().getBoolean("block-message")) {
|
||||
event.cancelled(true);
|
||||
} else {
|
||||
event.message(event.message().toLowerCase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class CustomPlaceholderHandler {
|
||||
|
||||
public CustomPlaceholderHandler(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
final ConfigurationSection placeholders = carbonChat.getConfig().getConfigurationSection("placeholders");
|
||||
|
||||
for (final String key : placeholders.getKeys(false)) {
|
||||
final String value = placeholders.getString(key);
|
||||
|
||||
event.format(event.format().replace("<" + key + ">", value));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.ChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
|
||||
public class IgnoredPlayerHandler {
|
||||
|
||||
public IgnoredPlayerHandler() {
|
||||
CarbonEvents.register(ChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
if (event.target() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target().ignoringUser(event.sender())) {
|
||||
event.cancelled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyFormat;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class LegacyFormatHandler {
|
||||
|
||||
private final @NonNull Pattern pattern =
|
||||
Pattern.compile("[§&]x[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])[§&]([0-9a-f])");
|
||||
|
||||
public LegacyFormatHandler() {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
// Legacy RGB
|
||||
event.format(this.pattern.matcher(event.format()).replaceAll("<#$1$2$3$4$5$6>"));
|
||||
|
||||
// Legacy Colors
|
||||
for (final char c : "0123456789abcdef".toCharArray()) {
|
||||
final LegacyFormat format = LegacyComponentSerializer.parseChar(c);
|
||||
final TextColor color = format.color();
|
||||
|
||||
event.format(event.format().replaceAll("[§&]" + c, "<" + color.asHexString() + ">"));
|
||||
}
|
||||
|
||||
// Legacy Formatting
|
||||
for (final char c : "klmno".toCharArray()) {
|
||||
final LegacyFormat format = LegacyComponentSerializer.parseChar(c);
|
||||
final TextDecoration decoration = format.decoration();
|
||||
|
||||
event.format(event.format().replaceAll("[§&]" + c, "<" + decoration.name() + ">"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PrivateMessageEvent;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
|
||||
public class MuteHandler {
|
||||
|
||||
public MuteHandler() {
|
||||
CarbonEvents.register(PrivateMessageEvent.class, event -> {
|
||||
if (event.sender().muted()) {
|
||||
event.cancelled(true);
|
||||
}
|
||||
});
|
||||
|
||||
CarbonEvents.register(PreChatFormatEvent.class, event -> {
|
||||
if (event.user().muted()) {
|
||||
event.cancelled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class OfflineNameHandler {
|
||||
|
||||
public OfflineNameHandler() {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.LATE, false, event -> {
|
||||
// If the player isn't online (cross server message), use their normal name
|
||||
if (Bukkit.getOfflinePlayer(event.user().uuid()) == null) {
|
||||
event.format(event.format().replace("%player_displayname%", "%player_name%"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.ChatComponentEvent;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class PingHandler {
|
||||
|
||||
public PingHandler(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
CarbonEvents.register(ChatComponentEvent.class, PostOrders.LAST, false, event -> {
|
||||
if (!carbonChat.getConfig().getBoolean("pings.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String targetName = Bukkit.getOfflinePlayer(event.target().uuid()).getName();
|
||||
final String prefix = carbonChat.getConfig().getString("pings.prefix", "");
|
||||
final boolean caseSensitive = carbonChat.getConfig().getBoolean("pings.case-sensitive", false);
|
||||
|
||||
if (targetName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (caseSensitive) {
|
||||
if (!event.originalMessage().contains(prefix + targetName)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!event.originalMessage().toLowerCase().contains((prefix + targetName).toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Key key = Key.of(carbonChat.getConfig().getString("pings.sound"));
|
||||
final Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("pings.source"));
|
||||
final float volume = (float) carbonChat.getConfig().getDouble("pings.volume");
|
||||
final float pitch = (float) carbonChat.getConfig().getDouble("pings.pitch");
|
||||
|
||||
event.target().playSound(Sound.of(key, source, volume, pitch));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.users.ChatUser;
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class PlayerJoinListener implements Listener {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
|
||||
public PlayerJoinListener(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||
final ChatUser user = this.carbonChat.userService().wrap(event.getPlayer().getUniqueId());
|
||||
|
||||
this.carbonChat.userService().validate(user);
|
||||
|
||||
if (user.nickname() != null) {
|
||||
user.nickname(user.nickname());
|
||||
}
|
||||
|
||||
final String channel = this.carbonChat.getConfig().getString("channel-on-join");
|
||||
|
||||
if (channel == null || channel.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel.equals("DEFAULT")) {
|
||||
user.selectedChannel(this.carbonChat.channelRegistry().defaultChannel());
|
||||
return;
|
||||
}
|
||||
|
||||
final ChatChannel chatChannel = this.carbonChat.channelRegistry().get(channel);
|
||||
|
||||
if (chatChannel != null) {
|
||||
user.selectedChannel(chatChannel);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(final PlayerQuitEvent event) {
|
||||
final ChatUser user = this.carbonChat.userService().wrapIfLoaded(event.getPlayer().getUniqueId());
|
||||
|
||||
if (user != null) {
|
||||
this.carbonChat.userService().invalidate(user);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.ChatComponentEvent;
|
||||
import net.draycia.carbon.api.events.ChatFormatEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ShadowMuteHandler {
|
||||
|
||||
public ShadowMuteHandler(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
CarbonEvents.register(ChatComponentEvent.class, PostOrders.FIRST, false, event -> {
|
||||
if (event.sender().shadowMuted() && event.sender().equals(event.target())) {
|
||||
event.cancelled(true);
|
||||
}
|
||||
});
|
||||
|
||||
CarbonEvents.register(ChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
if (event.target() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.sender().shadowMuted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String prefix = carbonChat.moderationConfig().getString("shadow-mute-prefix", "[SM] ");
|
||||
|
||||
event.format(prefix + event.format());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.ChatComponentEvent;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.event.PostOrders;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class UrlLinkHandler {
|
||||
|
||||
private static final Pattern URL_PATTERN = Pattern.compile("(?:(https?)://)?([-\\w_.]+\\.\\w{2,})(/\\S*)?");
|
||||
|
||||
public UrlLinkHandler() {
|
||||
CarbonEvents.register(ChatComponentEvent.class, PostOrders.NORMAL, true, event -> {
|
||||
final TextComponent newComponent = (TextComponent) event.component()
|
||||
.replaceText(URL_PATTERN, url -> url.clickEvent(ClickEvent.openUrl(url.content())));
|
||||
|
||||
event.component(newComponent);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PreChatFormatEvent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.event.PostOrders;
|
||||
|
||||
public class UserFormattingHandler {
|
||||
|
||||
public UserFormattingHandler() {
|
||||
CarbonEvents.register(PreChatFormatEvent.class, PostOrders.FIRST, false, event -> {
|
||||
if (!event.user().permissible()) {
|
||||
this.suppressFormatting(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.user().hasPermission("carbonchat.formatting") &&
|
||||
!event.user().hasPermission("carbonchat.channels." + event.channel().key() + ".formatting")) {
|
||||
this.suppressFormatting(event);
|
||||
} else {
|
||||
// Swap the &-style codes for minimessage-compatible strings
|
||||
event.message(MiniMessage.get().serialize(CarbonChatBukkit.LEGACY.deserialize(event.message())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void suppressFormatting(final PreChatFormatEvent event) {
|
||||
event.format(event.format().replace("<message>", "<pre><message></pre>"));
|
||||
}
|
||||
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package net.draycia.carbon.listeners.events;
|
||||
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.api.events.misc.CarbonEvents;
|
||||
import net.draycia.carbon.api.events.PrivateMessageEvent;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.event.PostOrders;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class WhisperPingHandler {
|
||||
|
||||
public WhisperPingHandler(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
|
||||
CarbonEvents.register(PrivateMessageEvent.class, PostOrders.LAST, false, event -> {
|
||||
if (event.sender().uuid().equals(event.target().uuid())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String senderName = Bukkit.getOfflinePlayer(event.sender().uuid()).getName();
|
||||
|
||||
if (senderName == null || !event.message().contains(senderName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!carbonChat.getConfig().getBoolean("whisper.pings.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Key key = Key.of(carbonChat.getConfig().getString("whisper.pings.sound"));
|
||||
final Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("whisper.pings.source"));
|
||||
final float volume = (float) carbonChat.getConfig().getDouble("whisper.pings.volume");
|
||||
final float pitch = (float) carbonChat.getConfig().getDouble("whisper.pings.pitch");
|
||||
|
||||
event.sender().playSound(Sound.of(key, source, volume, pitch));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package net.draycia.carbon.managers;
|
||||
|
||||
import net.draycia.carbon.common.commands.ChannelCommand;
|
||||
import net.draycia.carbon.common.commands.ChannelListCommand;
|
||||
import net.draycia.carbon.common.commands.ChatReloadCommand;
|
||||
import net.draycia.carbon.common.commands.ClearChatCommand;
|
||||
import net.draycia.carbon.common.commands.IgnoreCommand;
|
||||
import net.draycia.carbon.common.commands.MeCommand;
|
||||
import net.draycia.carbon.common.commands.MessageCommand;
|
||||
import net.draycia.carbon.common.commands.MuteCommand;
|
||||
import net.draycia.carbon.common.commands.NicknameCommand;
|
||||
import net.draycia.carbon.common.commands.ReplyCommand;
|
||||
import net.draycia.carbon.common.commands.SetColorCommand;
|
||||
import net.draycia.carbon.common.commands.SpyChannelCommand;
|
||||
import net.draycia.carbon.common.commands.SudoChannelCommand;
|
||||
import net.draycia.carbon.common.commands.ToggleCommand;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
||||
import net.draycia.carbon.CarbonChatBukkit;
|
||||
import net.draycia.carbon.common.commands.ShadowMuteCommand;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class CommandManager {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChatBukkit carbonChat;
|
||||
|
||||
public CommandManager(@NonNull final CarbonChatBukkit carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
this.reloadCommands();
|
||||
}
|
||||
|
||||
private void reloadCommands() {
|
||||
new ChannelCommand(this.carbonChat, this.commandSettings("channel"));
|
||||
new ChannelListCommand(this.carbonChat, this.commandSettings("channellist"));
|
||||
new ChatReloadCommand(this.carbonChat, this.commandSettings("chatreload"));
|
||||
new ClearChatCommand(this.carbonChat, this.commandSettings("clearchat"));
|
||||
new IgnoreCommand(this.carbonChat, this.commandSettings("ignore"));
|
||||
new MeCommand(this.carbonChat, this.commandSettings("me"));
|
||||
new MessageCommand(this.carbonChat, this.commandSettings("message"));
|
||||
new MuteCommand(this.carbonChat, this.commandSettings("mute"));
|
||||
new NicknameCommand(this.carbonChat, this.commandSettings("nickname"));
|
||||
new ReplyCommand(this.carbonChat, this.commandSettings("reply"));
|
||||
new SetColorCommand(this.carbonChat, this.commandSettings("setcolor"));
|
||||
new ShadowMuteCommand(this.carbonChat, this.commandSettings("shadowmute"));
|
||||
new SpyChannelCommand(this.carbonChat, this.commandSettings("spy"));
|
||||
new SudoChannelCommand(this.carbonChat, this.commandSettings("sudochannel"));
|
||||
new ToggleCommand(this.carbonChat, this.commandSettings("toggle"));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private CommandSettings commandSettings(@NonNull final String command) {
|
||||
return this.carbonChat.commandSettingsRegistry().get(command);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user