Fix pings and chatreload

This commit is contained in:
Draycia committed 2020-09-04 00:31:50 -07:00
1 parent 05fa454bac
commit 398b8ce7b4
2 files changed
+5 -9

No files matched your search

@@ -22,11 +22,7 @@ public class ChatReloadCommand {
return; return;
} }
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
channelArguments.put("channel", CarbonUtils.channelArgument());
new CommandAPICommand(commandSettings.getName()) new CommandAPICommand(commandSettings.getName())
.withArguments(channelArguments)
.withAliases(commandSettings.getAliasesArray()) .withAliases(commandSettings.getAliasesArray())
.withPermission(CommandPermission.fromString("carbonchat.reload")) .withPermission(CommandPermission.fromString("carbonchat.reload"))
.executes(this::execute) .executes(this::execute)
@@ -18,6 +18,10 @@ public class PingHandler implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPing(ChatComponentEvent event) { public void onPing(ChatComponentEvent event) {
if (!carbonChat.getConfig().getBoolean("pings.enabled")) {
return;
}
if (event.getTarget() == null) { if (event.getTarget() == null) {
return; return;
} }
@@ -33,16 +37,12 @@ public class PingHandler implements Listener {
return; return;
} }
if (!carbonChat.getConfig().getBoolean("pings.enabled")) {
return;
}
Key key = Key.of(carbonChat.getConfig().getString("pings.sound")); Key key = Key.of(carbonChat.getConfig().getString("pings.sound"));
Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("pings.source")); Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("pings.source"));
float volume = (float) carbonChat.getConfig().getDouble("pings.volume"); float volume = (float) carbonChat.getConfig().getDouble("pings.volume");
float pitch = (float) carbonChat.getConfig().getDouble("pings.pitch"); float pitch = (float) carbonChat.getConfig().getDouble("pings.pitch");
event.getSender().playSound(Sound.of(key, source, volume, pitch)); event.getTarget().playSound(Sound.of(key, source, volume, pitch));
} }
} }