Formatting Fixes

This commit is contained in:
Navoei
2024-06-12 15:37:37 -05:00
parent 7796e8d0d6
commit a4c3ab8531
4 changed files with 16 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ import me.Navoei.customdiscsplugin.language.Lang;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -41,18 +42,13 @@ public class HopperManager implements Listener {
Component songNameComponent = Objects.requireNonNull(event.getItem().getItemMeta().lore()).get(0).asComponent();
String songName = PlainTextComponentSerializer.plainText().serialize(songNameComponent);
String content = Lang.NOW_PLAYING.toString().replace("%song_name%", songName);
TextComponent customActionBarSongPlaying = Component.text()
.content(content)
.color(NamedTextColor.GOLD)
.build();
Component customActionBarSongPlaying = LegacyComponentSerializer.legacyAmpersand().deserialize(Lang.NOW_PLAYING.toString().replace("%song_name%", songName));
String soundFileName = event.getItem().getItemMeta().getPersistentDataContainer().get(new NamespacedKey(customDiscs, "customdisc"), PersistentDataType.STRING);
Path soundFilePath = Path.of(customDiscs.getDataFolder().getPath(), "musicdata", soundFileName);
assert VoicePlugin.voicechatServerApi != null;
playerManager.playLocationalAudio(VoicePlugin.voicechatServerApi, soundFilePath, event.getDestination().getLocation().getBlock(), customActionBarSongPlaying.asComponent());
playerManager.playLocationalAudio(VoicePlugin.voicechatServerApi, soundFilePath, event.getDestination().getLocation().getBlock(), customActionBarSongPlaying);
}

View File

@@ -47,7 +47,7 @@ public class DownloadCommand extends SubCommand {
}
if (args.length!=3) {
Component textComponent = LegacyComponentSerializer.legacyAmpersand().deserialize(Lang.PREFIX + Lang.INVALID_ARGUMENTS.toString().replace("%command_syntax", getSyntax()));
Component textComponent = LegacyComponentSerializer.legacyAmpersand().deserialize(Lang.PREFIX + Lang.INVALID_ARGUMENTS.toString().replace("%command_syntax%", getSyntax()));
player.sendMessage(textComponent);
return;
}

View File

@@ -8,6 +8,7 @@ import me.Navoei.customdiscsplugin.language.Lang;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -54,15 +55,10 @@ public class JukeBox implements Listener{
Component songNameComponent = Objects.requireNonNull(event.getItem().getItemMeta().lore()).get(0).asComponent();
String songName = PlainTextComponentSerializer.plainText().serialize(songNameComponent);
String content = Lang.NOW_PLAYING.toString().replace("%song_name%", songName);
TextComponent customActionBarSongPlaying = Component.text()
.content(content)
.color(NamedTextColor.GOLD)
.build();
Component customActionBarSongPlaying = LegacyComponentSerializer.legacyAmpersand().deserialize(Lang.NOW_PLAYING.toString().replace("%song_name%", songName));
assert VoicePlugin.voicechatServerApi != null;
playerManager.playLocationalAudio(VoicePlugin.voicechatServerApi, soundFilePath, block, customActionBarSongPlaying.asComponent());
playerManager.playLocationalAudio(VoicePlugin.voicechatServerApi, soundFilePath, block, customActionBarSongPlaying);
} else {
player.sendMessage(ChatColor.RED + "Sound file not found.");
event.setCancelled(true);

View File

@@ -1,16 +1,16 @@
prefix: "&8[&6CustomDiscs&8]&r"
no-permission: "&rYou do not have permission to execute this command."
invalid-filename: "&rThis is an invalid filename!"
no-disc-name-provided: "&rYou must provide a name for your disc."
invalid-format: "&rFile must be in wav, flac, or mp3 format!"
file-not-found: "&rFile not found!"
invalid-arguments: "&rInvalid arguments. &7(&a%command_syntax%&7)"
not-holding-disc: "&rYou must hold a disc in your main hand."
no-permission: "&cYou do not have permission to execute this command."
invalid-filename: "&cThis is an invalid filename!"
no-disc-name-provided: "&cYou must provide a name for your disc."
invalid-format: "&cFile must be in wav, flac, or mp3 format!"
file-not-found: "&cFile not found!"
invalid-arguments: "&cInvalid arguments. &7(&a%command_syntax%&7)"
not-holding-disc: "&cYou must hold a disc in your main hand."
create-filename: "&7Your filename is: &a\"%filename%\"."
create-custom-name: "&7Your custom name is: &a\"%custom_name%\"."
downloading-file: "&7Downloading file..."
file-too-large: "&rThe file is larger than %max_download_size%MB."
file-too-large: "&cThe file is larger than %max_download_size%MB."
successful-download: "&aFile successfully downloaded to &7%file_path%&a."
create-disc: "&aCreate a disc by doing &7/cd create %filename% \"Custom Lore\"&a."
download-error: "&rAn error has occurred while downloading."
download-error: "&cAn error has occurred while downloading."
now-playing: "&6Now playing: %song_name%"