diff --git a/api/src/main/java/us/crazycrew/crazycrates/api/enums/Properties.java b/api/src/main/java/us/crazycrew/crazycrates/api/enums/Properties.java index 28e2abc0a..b66a40328 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/api/enums/Properties.java +++ b/api/src/main/java/us/crazycrew/crazycrates/api/enums/Properties.java @@ -259,6 +259,6 @@ private String colors(String message) { .replaceAll("&f", "") .replaceAll("&k", "").replaceAll("&l", "") .replaceAll("&m", "").replaceAll("&n", "") - .replaceAll("&o", "").replaceAll("&r", ""); + .replaceAll("&o", "").replaceAll("", ""); } } \ No newline at end of file diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/ConfigKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/ConfigKeys.java index b14056179..7cf3f9e03 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/ConfigKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/ConfigKeys.java @@ -64,21 +64,21 @@ public void registerComments(CommentsConfiguration conf) { @Comment("This option will let you test a different way of picking random numbers. If you have any issues, You can set it back to false.") public static final Property use_different_random = newProperty("root.use-different-random", false); - @Comment({ - "Sends anonymous statistics about how the plugin is used to bstats.org.", - "bstats is a service for plugin developers to find out how the plugin being used,", - "This information helps us figure out how to better improve the plugin." - }) - public static final Property toggle_metrics = newProperty("root.toggle_metrics", true); + //@Comment({ + // "Sends anonymous statistics about how the plugin is used to bstats.org.", + // "bstats is a service for plugin developers to find out how the plugin being used,", + // "This information helps us figure out how to better improve the plugin." + //}) + //public static final Property toggle_metrics = newProperty("root.toggle_metrics", true); @Comment("This will wipe the example folder on /crazycrates reload or plugin startup so you always have fresh examples to look at.") public static final Property update_examples_folder = newProperty("root.update-examples-folder", true); @Comment("The prefix used in commands") - public static final Property command_prefix = newProperty("root.command_prefix", "&8[&bCrazyCrates&8]: "); + public static final Property command_prefix = newProperty("root.command_prefix", "[CrazyCrates]: "); @Comment("The prefix used in console") - public static final Property console_prefix = newProperty("root.console_prefix", "&8[&bCrazyCrates&8] "); + public static final Property console_prefix = newProperty("root.console_prefix", "[CrazyCrates] "); @Comment("If /crates should open the main menu. Warning: This will remove the menu button from crate previews.") public static final Property enable_crate_menu = newProperty("gui.toggle", true); @@ -89,6 +89,9 @@ public void registerComments(CommentsConfiguration conf) { //@Comment("Logs all crate actions to a .txt file if enabled. It is recommended to delete the file occasionally.") //public static final Property log_to_file = newProperty("crate.log-file", false); + //@Comment("Logs all crate actions to console if enabled.") + //public static final Property log_to_console = newProperty("crate.log-console", false); + @Comment({ "This option is unsupported and not recommended for use.", "It is not very performant and is recommended to keep false", @@ -98,11 +101,8 @@ public void registerComments(CommentsConfiguration conf) { }) public static final Property use_old_key_checks = newProperty("crate.unsupported-settings.old-key-checks", false); - //@Comment("Logs all crate actions to console if enabled.") - //public static final Property log_to_console = newProperty("crate.log-console", false); - @Comment("The name of the gui.") - public static final Property inventory_name = newProperty("gui.inventory.name", "&b&lCrazy &4&lCrates"); + public static final Property inventory_name = newProperty("gui.inventory.name", "Crazy Crates"); @Comment("The size of the gui. Valid sizes are 9,18,27,36,45") public static final Property inventory_size = newProperty("gui.inventory.size", 45); @@ -167,33 +167,33 @@ public void registerComments(CommentsConfiguration conf) { public static final Property> menu_button_command_list = newListProperty("gui.inventory.buttons.menu.override.list", List.of("see {player}")); @Comment("The name of the item.") - public static final Property menu_button_name = newProperty("gui.inventory.buttons.menu.name", "&7&l>> &c&lMenu &7&l<<"); + public static final Property menu_button_name = newProperty("gui.inventory.buttons.menu.name", "» Menu «"); @Comment("The lore of the item.") public static final Property> menu_button_lore = newListProperty("gui.inventory.buttons.menu.lore", List.of( - "&7Return to the menu." + "Return to the menu." )); @Comment("The item the button should be.") public static final Property next_button_item = newProperty("gui.inventory.buttons.next.item", "FEATHER"); @Comment("The name of the item.") - public static final Property next_button_name = newProperty("gui.inventory.buttons.next.name", "&6&lNext >>"); + public static final Property next_button_name = newProperty("gui.inventory.buttons.next.name", "Next »"); @Comment("The lore of the item.") public static final Property> next_button_lore = newListProperty("gui.inventory.buttons.next.lore", List.of( - "&7&lPage: &b{page}" + "Page: {page}" )); @Comment("The item the button should be.") public static final Property back_button_item = newProperty("gui.inventory.buttons.back.item", "FEATHER"); @Comment("The name of the item.") - public static final Property back_button_name = newProperty("gui.inventory.buttons.back.name", "&6&l<< Back"); + public static final Property back_button_name = newProperty("gui.inventory.buttons.back.name", "« Back"); @Comment("The lore of the item.") public static final Property> back_button_lore = newListProperty("gui.inventory.buttons.back.lore", List.of( - "&7&lPage: &b{page}" + "Page: {page}" )); @Comment("Should the menu should be filled with one type of item?") diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CommandKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CommandKeys.java index baa281610..68fc24f43 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CommandKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CommandKeys.java @@ -20,108 +20,108 @@ public void registerComments(CommentsConfiguration conf) { } @Comment("A list of available placeholders: {prefix}, {crate}, {player}") - public static final Property opened_a_crate = newProperty("command.open.opened-a-crate", "{prefix}&7You have opened the &6{crate} for &6{player}."); + public static final Property opened_a_crate = newProperty("command.open.opened-a-crate", "{prefix}You have opened the {crate} for {player}."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}") - public static final Property gave_a_player_keys = newProperty("command.give.given-player-keys", "{prefix}&7You have given &6{player} {amount} &7key(s)."); + public static final Property gave_a_player_keys = newProperty("command.give.given-player-keys", "{prefix}You have given {player} {amount} key(s)."); @Comment("A list of available placeholders: {prefix}, {amount}, {amount}, {keytype}") - public static final Property cannot_give_player_keys = newProperty("command.give.full-inventory", "{prefix}&7You have been given &6{amount} {key} &7virtual key(s) because your inventory was full."); + public static final Property cannot_give_player_keys = newProperty("command.give.full-inventory", "{prefix}You have been given {amount} {key} virtual key(s) because your inventory was full."); @Comment("A list of available placeholders: {prefix}, {amount}, {keytype}") - public static final Property given_everyone_keys = newProperty("command.give.given-everyone-keys", "{prefix}&7You have given everyone &6{amount} &7key(s)."); + public static final Property given_everyone_keys = newProperty("command.give.given-everyone-keys", "{prefix}You have given everyone {amount} key(s)."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}") - public static final Property given_offline_player_keys = newProperty("command.give.given-offline-player-keys", "{prefix}&7You have given &6{amount} &7key(s) to the offline player &6{player}."); + public static final Property given_offline_player_keys = newProperty("command.give.given-offline-player-keys", "{prefix}You have given {amount} key(s) to the offline player {player}."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}") - public static final Property take_players_keys = newProperty("command.take.take-player-keys", "{prefix}&7You have taken &6{amount} &7key(s) from &6{player}."); + public static final Property take_players_keys = newProperty("command.take.take-player-keys", "{prefix}You have taken {amount} key(s) from {player}."); @Comment("A list of available placeholders: {prefix}, {player}") - public static final Property cannot_take_keys = newProperty("command.take.cannot-take-keys", "{prefix}&7You cannot take key(s) from &6{player} &7as they are poor."); + public static final Property cannot_take_keys = newProperty("command.take.cannot-take-keys", "{prefix}You cannot take key(s) from {player} as they are poor."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}") - public static final Property take_offline_player_keys = newProperty("command.take.take-offline-player-keys", "{prefix}&7You have taken &6{amount} &7key(s) from the offline player &6{player}."); + public static final Property take_offline_player_keys = newProperty("command.take.take-offline-player-keys", "{prefix}You have taken {amount} key(s) from the offline player {player}."); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property no_item_in_hand = newProperty("command.additem.no-item-in-hand", "{prefix}&cYou need to have an item in your hand to add it {crate}."); + public static final Property no_item_in_hand = newProperty("command.additem.no-item-in-hand", "{prefix}You need to have an item in your hand to add it {crate}."); @Comment("A list of available placeholders: {prefix}, {crate}, {prize}") - public static final Property added_item_with_editor = newProperty("command.additem.add-item-from-hand", "{prefix}&7The item has been added to the {crate} in prize #{prize}."); + public static final Property added_item_with_editor = newProperty("command.additem.add-item-from-hand", "{prefix}The item has been added to the {crate} in prize #{prize}."); - public static final Property no_files_to_convert = newProperty("command.convert.no-files-to-convert", "&cNo available plugins to convert files."); + public static final Property no_files_to_convert = newProperty("command.convert.no-files-to-convert", "No available plugins to convert files."); - public static final Property error_converting_files = newProperty("command.convert.error-converting-files", "&cAn error has occurred while trying to convert files. We could not convert &a{file} &cso please check the console."); + public static final Property error_converting_files = newProperty("command.convert.error-converting-files", "An error has occurred while trying to convert files. We could not convert {file} so please check the console."); - public static final Property successfully_converted_files = newProperty("command.successfully-converted-files", "&aPlugin Conversion has succeeded!"); + public static final Property successfully_converted_files = newProperty("command.successfully-converted-files", "Plugin Conversion has succeeded!"); @Comment("A list of available placeholders: {prefix}") - public static final Property reloaded_plugin = newProperty("command.reload.completed", "{prefix}&3You have reloaded the Config and Data Files."); + public static final Property reloaded_plugin = newProperty("command.reload.completed", "{prefix}You have reloaded the Config and Data Files."); @Comment("A list of available placeholders: {prefix}") - public static final Property transfer_not_enough_keys = newProperty("command.transfer.not-enough-keys", "{prefix}&cYou do not have enough keys to transfer."); + public static final Property transfer_not_enough_keys = newProperty("command.transfer.not-enough-keys", "{prefix}You do not have enough keys to transfer."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}, {crate}") - public static final Property transfer_sent_keys = newProperty("command.transfer.transferred-keys", "{prefix}&7You have transferred {amount} {crate} keys to {player}."); + public static final Property transfer_sent_keys = newProperty("command.transfer.transferred-keys", "{prefix}You have transferred {amount} {crate} keys to {player}."); @Comment("A list of available placeholders: {prefix}, {amount}, {player}, {keytype}, {crate}") - public static final Property transfer_received_keys = newProperty("command.transfer.transferred-keys-received", "{prefix}&7You have received {amount} {crate} keys from {player}."); + public static final Property transfer_received_keys = newProperty("command.transfer.transferred-keys-received", "{prefix}You have received {amount} {crate} keys from {player}."); @Comment("A list of available placeholders: {prefix}") - public static final Property no_virtual_keys = newProperty("command.keys.personal.no-virtual-keys", "{prefix}&8&l(&4&l!&8&l) &7You currently do not have any virtual keys."); + public static final Property no_virtual_keys = newProperty("command.keys.personal.no-virtual-keys", "{prefix}(!) You currently do not have any virtual keys."); @Comment("A list of available placeholders: {crates_opened}") public static final Property> virtual_keys_header = newListProperty("command.keys.personal.virtual-keys-header", List.of( - "&8&l(&6&l!&8&l) &7List of your current number of keys.", - " &e -> Total Crates Opened: &c{crates_opened}" + "(!) List of your current number of keys.", + " -> Total Crates Opened: {crates_opened}" )); @Comment("A list of available placeholders: {prefix}, {player}") - public static final Property other_player_no_keys = newProperty("command.keys.other-player.no-virtual-keys", "{prefix}&8&l(&4&l!&8&l) &7The player {player} does not have any keys."); + public static final Property other_player_no_keys = newProperty("command.keys.other-player.no-virtual-keys", "{prefix}(!) The player {player} does not have any keys."); @Comment("A list of available placeholders: {player}, {crates_opened}") public static final Property> other_player_header = newListProperty("command.keys.other-player.virtual-keys-header", List.of( - "&8&l(&6&l!&8&l) &7List of {player}''s current number of keys.", - " &e -> Total Crates Opened: &c{crates_opened}" + "(!) List of {player}''s current number of keys.", + " -> Total Crates Opened: {crates_opened}" )); @Comment("A list of available placeholders: {crate}, {keys}, {crate_opened}") - public static final Property per_crate = newProperty("command.keys.crate-format", "{crate} &7&l>&8&l> &6{keys} keys &7: Opened &6{crate_opened} times"); + public static final Property per_crate = newProperty("command.keys.crate-format", "{crate} >> {keys} keys : Opened {crate_opened} times"); @Comment("This requires crazycrates.command.help") public static final Property> help = newListProperty("command.player-help", List.of( - "&e&lCrazy Crates Player Help", - "&6/keys view [player] &7- &eCheck the number of keys a player has.", - "&6/keys &7- &eShows how many keys you have.", - "&6/cc &7- &eOpens the menu." + "Crazy Crates Player Help", + "/keys view [player] - Check the number of keys a player has.", + "/keys - Shows how many keys you have.", + "/cc - Opens the menu." )); @Comment("This requires crazycrates.command.admin.help") public static final Property> admin_help = newListProperty("command.admin-help", List.of( - "&c&lCrazy Crates Admin Help", + "Crazy Crates Admin Help", "", - "&6/cc additem [tier] &7- &eAdd items in-game to a prize in a crate including Cosmic/Casino.", - "&6/cc preview [player] &7- &eOpens the preview of a crate for a player.", - "&6/cc list &7- &eLists all crates.", - "&6/cc open &7- &eTries to open a crate for you if you have a key.", - "&6/cc open-others [player] &7- &eTries to open a crate for a player if they have a key.", - "&6/cc transfer [player] [amount &7- &eTransfers keys to players you chose.", - "&6/cc debug &7- &eDebugs crates", - "&6/cc admin &7- &eShows admin menu", - "&6/cc forceopen [player] &7- &eOpens a crate for a player for free.", - "&6/cc mass-open [amount] &7- &eMass opens a set amount of crates.", - "&6/cc tp &7- &eTeleport to a Crate.", - "&6/cc give [amount] [player] &7- &eAllows you to take keys from a player.", - "&6/cc set &7- &eSet the block you are looking at as a crate.", - "&6/cc set Menu &7- &eSet the block you are looking at to open the /cc menu.", - "&6/cc reload &7- &eReloads the config/data files.", - "&6/cc set1/set2 &7- &eSets position &c#1 &eor &c#2 for when making a new schematic for QuadCrates.", - "&6/cc save &7- &eCreate a new nbt file in the schematics folder.", + "/cc additem [tier] - Add items in-game to a prize in a crate including Cosmic/Casino.", + "/cc preview [player] - Opens the preview of a crate for a player.", + "/cc list - Lists all crates.", + "/cc open - Tries to open a crate for you if you have a key.", + "/cc open-others [player] - Tries to open a crate for a player if they have a key.", + "/cc transfer [player] [amount - Transfers keys to players you chose.", + "/cc debug - Debugs crates", + "/cc admin - Shows admin menu", + "/cc forceopen [player] - Opens a crate for a player for free.", + "/cc mass-open [amount] - Mass opens a set amount of crates.", + "/cc tp - Teleport to a Crate.", + "/cc give [amount] [player] - Allows you to take keys from a player.", + "/cc set - Set the block you are looking at as a crate.", + "/cc set Menu - Set the block you are looking at to open the /cc menu.", + "/cc reload - Reloads the config/data files.", + "/cc set1/set2 - Sets position #1 or #2 for when making a new schematic for QuadCrates.", + "/cc save - Create a new nbt file in the schematics folder.", "", - "&6/keys view [player] &7- &eCheck the number of keys a player has.", - "&6/keys &7- &eShows how many keys you have.", - "&6/cc &7- &eOpens the menu.", + "/keys view [player] - Check the number of keys a player has.", + "/keys - Shows how many keys you have.", + "/cc - Opens the menu.", "", - "&7You can find a list of permissions @ &ehttps://docs.crazycrew.us/crazycrates/info/commands/permissions" + "You can find a list of permissions @ https://docs.crazycrew.us/crazycrates/info/commands/permissions" )); } \ No newline at end of file diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CrateKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CrateKeys.java index ba56ce5f0..02443eb5c 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CrateKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/CrateKeys.java @@ -20,53 +20,56 @@ public void registerComments(CommentsConfiguration conf) { } @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property not_a_crate = newProperty("crates.requirements.not-a-crate", "{prefix}&cThere is no crate called &6{crate}."); + public static final Property not_a_crate = newProperty("crates.requirements.not-a-crate", "{prefix}There is no crate called {crate}."); + + @Comment("A list of available placeholders: {prefix}, {key}") + public static final Property not_a_key = newProperty("crates.requirements.not-a-key", "{prefix}There is no key called {key}."); @Comment("A list of available placeholders: {prefix}, {number}") - public static final Property not_a_number = newProperty("crates.requirements.not-a-number", "{prefix}&6{number} &cis not a number."); + public static final Property not_a_number = newProperty("crates.requirements.not-a-number", "{prefix}{number} is not a number."); @Comment("A list of available placeholders: {prefix}, {amount}, {key_amount}, {crate}") - public static final Property required_keys = newProperty("crates.requirements.not-enough-keys", "{prefix}&7You need &c{key_amount} &7keys to open &c{crate}. &7You have &c{amount}."); + public static final Property required_keys = newProperty("crates.requirements.not-enough-keys", "{prefix}You need {key_amount} keys to open {crate}. You have {amount}."); @Comment("A list of available placeholders: {prefix}") - public static final Property not_on_block = newProperty("crates.not-a-block", "{prefix}&cYou must be standing on a block to use &6{crate}."); + public static final Property not_on_block = newProperty("crates.not-a-block", "{prefix}You must be standing on a block to use {crate}."); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property out_of_time = newProperty("crates.out-of-time", "{prefix}&cYou took &65 minutes &cto open &6{crate} &cso it closed."); + public static final Property out_of_time = newProperty("crates.out-of-time", "{prefix}You took 5 minutes to open {crate} so it closed."); @Comment("A list of available placeholders: {prefix}") - public static final Property reloaded_forced_out_of_preview = newProperty("crates.forced-out-of-preview", "{prefix}&cA reload has forced you out of the preview."); + public static final Property reloaded_forced_out_of_preview = newProperty("crates.forced-out-of-preview", "{prefix}A reload has forced you out of the preview."); @Comment("A list of available placeholders: {prefix}") - public static final Property cannot_set_type = newProperty("crates.cannot-set-menu-type", "{prefix}&cYou cannot set the Menu to a block because the crate menu is disabled"); + public static final Property cannot_set_type = newProperty("crates.cannot-set-menu-type", "{prefix}You cannot set the Menu to a block because the crate menu is disabled"); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property no_crate_permission = newProperty("crates.crate-no-permission", "{prefix}&cYou do not have permission to use that {crate}."); + public static final Property no_crate_permission = newProperty("crates.crate-no-permission", "{prefix}You do not have permission to use that {crate}."); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property preview_disabled = newProperty("crates.crate-preview-disabled", "{prefix}&cThe preview for &6{crate} &cis currently disabled."); + public static final Property preview_disabled = newProperty("crates.crate-preview-disabled", "{prefix}The preview for {crate} is currently disabled."); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property already_opening_crate = newProperty("crates.crate-already-open", "{prefix}&cYou are already opening &6{crate}."); + public static final Property already_opening_crate = newProperty("crates.crate-already-open", "{prefix}You are already opening {crate}."); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property crate_in_use = newProperty("crates.crate-in-use", "{prefix}&c{crate} is already in use. Please wait until it finishes."); + public static final Property crate_in_use = newProperty("crates.crate-in-use", "{prefix}{crate} is already in use. Please wait until it finishes."); @Comment("A list of available placeholders: {prefix}, {crate}, {cratetype}") - public static final Property cant_be_a_virtual_crate = newProperty("crates.cannot-be-a-virtual-crate", "{prefix}&6{crate} &ccannot be used as a Virtual Crate."); + public static final Property cant_be_a_virtual_crate = newProperty("crates.cannot-be-a-virtual-crate", "{prefix}{crate} cannot be used as a Virtual Crate."); @Comment("QuadCrate schematics need a fair bit of room so make sure you check the surroundings.") - public static final Property needs_more_room = newProperty("crates.need-more-room", "{prefix}&cThere is not enough space to open that here"); + public static final Property needs_more_room = newProperty("crates.need-more-room", "{prefix}There is not enough space to open that here"); @Comment("A list of available placeholders: {prefix}, {world}") - public static final Property world_disabled = newProperty("crates.world-disabled", "{prefix}&cI am sorry but Crates are disabled in {world}."); + public static final Property world_disabled = newProperty("crates.world-disabled", "{prefix}I am sorry but Crates are disabled in {world}."); @Comment("A list of available placeholders: {prefix}, {crate}") public static final Property> created_physical_crate = newListProperty("crates.physical-crate.created", List.of( - "{prefix}&7You have set that block to {crate}.", - "&7To remove the crate shift break in creative to remove." + "{prefix}You have set that block to {crate}.", + "To remove the crate shift break in creative to remove." )); @Comment("A list of available placeholders: {prefix}, {id}") - public static final Property removed_physical_crate = newProperty("crates.physical-crate.removed", "{prefix}&7You have removed &6{id}."); + public static final Property removed_physical_crate = newProperty("crates.physical-crate.removed", "{prefix}You have removed {id}."); } \ No newline at end of file diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/ErrorKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/ErrorKeys.java index bdb428174..3fbf0f00f 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/ErrorKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/ErrorKeys.java @@ -18,14 +18,14 @@ public void registerComments(CommentsConfiguration conf) { } @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property no_prizes_found = newProperty("errors.no-prizes-found", "{prefix}&cThis crate contains no prizes that you can win."); + public static final Property no_prizes_found = newProperty("errors.no-prizes-found", "{prefix}This crate contains no prizes that you can win."); @Comment("A list of available placeholders: {prefix}") - public static final Property no_schematics_found = newProperty("errors.no-schematics-found", "{prefix}&cNo schematics were found. Please make sure files ending in .nbt exist in the schematics folder. If not delete the folder so they regenerate."); + public static final Property no_schematics_found = newProperty("errors.no-schematics-found", "{prefix}No schematics were found. Please make sure files ending in .nbt exist in the schematics folder. If not delete the folder so they regenerate."); @Comment("A list of available placeholders: {prefix}") - public static final Property internal_error = newProperty("errors.internal-error", "{prefix}&cAn internal error has occurred. Please check the console for the full error."); + public static final Property internal_error = newProperty("errors.internal-error", "{prefix}An internal error has occurred. Please check the console for the full error."); @Comment("A list of available placeholders: {prefix}, {crate}, {prize}") - public static final Property prize_error = newProperty("errors.prize-error", "{prefix}&cAn error has occurred while trying to give you the prize called &6{prize}&c in crate called &6{crate}&c. Please contact the server owner and show them this error."); + public static final Property prize_error = newProperty("errors.prize-error", "{prefix}An error has occurred while trying to give you the prize called {prize} in crate called {crate}. Please contact the server owner and show them this error."); } \ No newline at end of file diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/MiscKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/MiscKeys.java index 7e7c821fc..192188f5f 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/MiscKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/MiscKeys.java @@ -22,24 +22,24 @@ public void registerComments(CommentsConfiguration conf) { conf.setComment("misc", header); } - @Comment("A list of available placeholders: {prefix}") - public static final Property unknown_command = newProperty("misc.unknown-command", "{prefix}&cThis command is not known."); + @Comment("A list of available placeholders: {prefix}, {command}") + public static final Property unknown_command = newProperty("misc.unknown-command", "{prefix}{command} is not a known command."); @Comment("Only activates when you try to use an ender pearl while opening a crate.") - public static final Property no_teleporting = newProperty("misc.no-teleporting", "{prefix}&cYou may not teleport away while opening a crate."); + public static final Property no_teleporting = newProperty("misc.no-teleporting", "{prefix}You may not teleport away while opening a crate."); @Comment("A list of available placeholders: {prefix}") - public static final Property no_commands_while_using_crate = newProperty("misc.no-commands", "{prefix}&cYou are not allowed to use commands while opening crates."); + public static final Property no_commands_while_using_crate = newProperty("misc.no-commands", "{prefix}You are not allowed to use commands while opening crates."); @Comment("A list of available placeholders: {prefix}, {key}, {crate}") - public static final Property no_keys = newProperty("misc.no-keys", "{prefix}&cYou must have a {key} &cto use &6{crate}."); + public static final Property no_keys = newProperty("misc.no-keys", "{prefix}You must have a {key} in your hand to use {crate}."); - @Comment("A list of available placeholders: {prefix}, {key}, {crate}") - public static final Property no_virtual_key = newProperty("misc.no-virtual-keys", "{prefix}&cYou need a virtual key to open &6{crate}."); + @Comment("A list of available placeholders: {prefix}, {crate}") + public static final Property no_virtual_key = newProperty("misc.no-virtual-keys", "{prefix}You need a virtual key to open {crate}."); @Comment("A list of available placeholders: {prefix}, {usage}") - public static final Property correct_usage = newProperty("misc.correct-usage", "{prefix}&cThe correct usage for this command is &e{usage}"); + public static final Property correct_usage = newProperty("misc.correct-usage", "{prefix}The correct usage for this command is {usage}"); @Comment("A list of available placeholders: {prefix}") - public static final Property feature_disabled = newProperty("misc.feature-disabled", "{prefix}&cThis feature is disabled."); + public static final Property feature_disabled = newProperty("misc.feature-disabled", "{prefix}This feature is disabled."); } \ No newline at end of file diff --git a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/PlayerKeys.java b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/PlayerKeys.java index 29dffcd88..186d15f19 100644 --- a/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/PlayerKeys.java +++ b/api/src/main/java/us/crazycrew/crazycrates/platform/config/impl/messages/PlayerKeys.java @@ -18,29 +18,29 @@ public void registerComments(CommentsConfiguration conf) { } @Comment("A list of available placeholders: {prefix}") - public static final Property must_be_a_player = newProperty("player.requirements.must-be-player", "{prefix}&cYou must be a player to use this command."); + public static final Property must_be_a_player = newProperty("player.requirements.must-be-player", "{prefix}You must be a player to use this command."); @Comment("A list of available placeholders: {prefix}") - public static final Property must_be_console_sender = newProperty("player.requirements.must-be-console-sender", "{prefix}&cYou must be using console to use this command."); + public static final Property must_be_console_sender = newProperty("player.requirements.must-be-console-sender", "{prefix}You must be using console to use this command."); @Comment("A list of available placeholders: {prefix}") - public static final Property must_be_looking_at_block = newProperty("player.requirements.must-be-looking-at-block", "{prefix}&cYou must be looking at a block."); + public static final Property must_be_looking_at_block = newProperty("player.requirements.must-be-looking-at-block", "{prefix}You must be looking at a block."); @Comment("A list of available placeholders: {prefix}, {player}") - public static final Property not_online = newProperty("player.target-not-online", "{prefix}&c{player} &7is not online."); + public static final Property not_online = newProperty("player.target-not-online", "{prefix}{player} is not online."); @Comment("A list of available placeholders: {prefix}") - public static final Property same_player = newProperty("player.target-same-player", "{prefix}&cYou can''t use this command on yourself."); + public static final Property same_player = newProperty("player.target-same-player", "{prefix}You can''t use this command on yourself."); @Comment("A list of available placeholders: {prefix}") - public static final Property no_permission = newProperty("player.no-permission", "{prefix}&cYou do not have permission to use that command/menu!"); + public static final Property no_permission = newProperty("player.no-permission", "{prefix}You do not have permission to use that command/menu!"); @Comment("A list of available placeholders: {prefix}, {crate}") - public static final Property inventory_not_empty = newProperty("player.inventory-not-empty", "{prefix}&cInventory is not empty, Please make room before opening &6{crate}."); + public static final Property inventory_not_empty = newProperty("player.inventory-not-empty", "{prefix}Inventory is not empty, Please make room before opening {crate}."); @Comment("A list of available placeholders: {prefix}, {amount}, {keytype}, {key}") - public static final Property obtaining_keys = newProperty("player.obtaining-keys", "{prefix}&7You have been given &6{amount} {key} &7key(s)."); + public static final Property obtaining_keys = newProperty("player.obtaining-keys", "{prefix}You have been given {amount} {key} key(s)."); @Comment("A list of available placeholders: {prefix}, {player}") - public static final Property too_close_to_another_player = newProperty("player.too-close-to-another-player", "{prefix}&cYou are too close to a player that is opening a crate."); + public static final Property too_close_to_another_player = newProperty("player.too-close-to-another-player", "{prefix}You are too close to a player that is opening a crate."); } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 17cabca1c..d7c30d712 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,11 @@ val isSnapshot = true val content: String = if (isSnapshot) { formatLog(latestCommitHash(), latestCommitMessage(), rootProject.name) + "Warning, I did not include a migrator for MiniMessage so when you do update, It will be raw legacy color codes." + + "CMI/DecentHolograms do not support MiniMessage so you still have to use legacy color codes for that." + + "Added support for FancyHolograms by Oliver" } else { rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8) } diff --git a/buildSrc/src/main/kotlin/root-plugin.gradle.kts b/buildSrc/src/main/kotlin/root-plugin.gradle.kts index 314fcea5f..07eb7e224 100644 --- a/buildSrc/src/main/kotlin/root-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/root-plugin.gradle.kts @@ -17,6 +17,8 @@ repositories { maven("https://repo.triumphteam.dev/snapshots/") + maven("https://repo.crazycrew.us/snapshots/") + maven("https://repo.crazycrew.us/releases/") maven("https://repo.oraxen.com/releases/") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ee61004e2..9a57a7569 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,9 +10,10 @@ oraxen-api = { group = "io.th0rgal", name = "oraxen", version = "1.171.0" } placeholder-api = { group = "me.clip", name = "placeholderapi", version = "2.11.5" } head-database-api = { group = "com.arcaniax", name = "HeadDatabase-API", version = "1.3.1" } -vital = { group = "com.ryderbelserion.vital", name = "paper", version = "1.1" } +vital = { group = "com.ryderbelserion.vital", name = "paper", version = "1.0-snapshot" } decent-holograms = { group = "com.github.decentsoftware-eu", name = "decentholograms", version = "2.8.6" } +fancy-holograms = { group = "de.oliver", name = "FancyHolograms", version = "2.0.6" } triumph-cmds = { group = "dev.triumphteam", name = "triumph-cmd-bukkit", version = "2.0.0-SNAPSHOT" } triumph-gui = { group = "dev.triumphteam", name = "triumph-gui", version = "3.1.7" } diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index 47b8aabb9..82bf908ac 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -6,6 +6,10 @@ plugins { `paper-plugin` } +repositories { + maven("https://repo.fancyplugins.de/releases") +} + dependencies { compileOnly(fileTree("$rootDir/libs/compile").include("*.jar")) @@ -23,6 +27,8 @@ dependencies { compileOnly(libs.decent.holograms) + compileOnly(libs.fancy.holograms) + compileOnly(libs.placeholder.api) compileOnly(libs.itemsadder.api) diff --git a/paper/run/server.properties b/paper/run/server.properties index 4fe40aec9..f67511812 100644 --- a/paper/run/server.properties +++ b/paper/run/server.properties @@ -1,5 +1,5 @@ #Minecraft server properties -#Thu Apr 25 13:00:51 EDT 2024 +#Thu Apr 25 18:23:54 EDT 2024 enable-jmx-monitoring=false rcon.port=25575 level-seed= diff --git a/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java b/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java index 0da440382..0f41138dc 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java +++ b/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java @@ -111,9 +111,9 @@ public void onEnable() { // Print dependency garbage for (Support value : Support.values()) { if (value.isEnabled()) { - getServer().getConsoleSender().sendMessage(MsgUtils.color(prefix + "&6&l" + value.getName() + " &a&lFOUND")); + getServer().getConsoleSender().sendRichMessage(prefix + "" + value.getName() + " FOUND"); } else { - getServer().getConsoleSender().sendMessage(MsgUtils.color(prefix + "&6&l" + value.getName() + " &c&lNOT FOUND")); + getServer().getConsoleSender().sendRichMessage(prefix + "" + value.getName() + " NOT FOUND"); } } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/EventManager.java b/paper/src/main/java/com/badbones69/crazycrates/api/EventManager.java deleted file mode 100644 index 94fdd92b1..000000000 --- a/paper/src/main/java/com/badbones69/crazycrates/api/EventManager.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.badbones69.crazycrates.api; - -import com.badbones69.crazycrates.CrazyCrates; -import com.badbones69.crazycrates.api.objects.Crate; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.jetbrains.annotations.NotNull; -import us.crazycrew.crazycrates.api.enums.types.KeyType; -import com.badbones69.crazycrates.api.utils.MsgUtils; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.logging.Level; - -/** - * //TODO() To the moon! - * A few goals in mind in revamp. - *

- * 1) Try not to crash the server when the writes get to big. - * 2) User friendly enum names - * 3) Allow admins or players with permissions to view the logs of all players through a gui. - * 4) Allow players to have some type of /crazycrates profile to see everything they've done. ( I do have "crates opened" stuff added which might make this useless )" - * 5) No one else touch this class. - */ -public class EventManager { - - private final static @NotNull CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class); - - //private final static @NotNull String fileName = Files.LOGS.getFileName(); - - public static void logCrateEvent(Player player, Crate crate, KeyType keyType, boolean logFile, boolean logConsole) { - if (logFile) { - log(setEntryData("Player: %player% | Crate Name: %crate_name% | Crate Type: %crate_type% | Key Name: %key_name% | Key Type: %key_type% | Key Item: %key_item%", player, player, crate, keyType), CrateEventType.CRATE_EVENT.getName()); - } - - if (logConsole) { - plugin.getLogger().info(setEntryData(MsgUtils.color("Player: %player% | Crate Name: %crate_name% | Crate Type: %crate_type% | Key Name: %key_name%&r | Key Type: %key_type% | Key Item: %key_item%"), player, player, crate, keyType)); - } - } - - public static void logKeyEvent(Player target, CommandSender sender, Crate crate, KeyType keyType, KeyEventType keyEventType, boolean logFile, boolean logConsole) { - if (logFile) { - log(setEntryData("Player: %player% | Sender: %sender% | Key Name: %key_name% | Key Type: %key_type%", target, sender, crate, keyType), keyEventType.getName()); - } - - if (logConsole) { - plugin.getLogger().info(setEntryData(MsgUtils.color("Player: %player% | Sender: %sender% | Key Name: %key_name%&r | Key Type: %key_type%"), target, sender, crate, keyType)); - } - } - - public static void logCrateEvent(OfflinePlayer target, CommandSender sender, Crate crate, KeyType keyType, boolean logFile, boolean logConsole) { - if (logFile) { - log(setEntryData("Player: %player% | Crate Name: %crate_name% | Crate Type: %crate_type% | Key Name: %key_name% | Key Type: %key_type% | Key Item: %key_item%", target, sender, crate, keyType), CrateEventType.CRATE_EVENT.getName()); - } - - if (logConsole) { - plugin.getLogger().info(setEntryData(MsgUtils.color("Player: %player% | Crate Name: %crate_name% | Crate Type: %crate_type% | Key Name: %key_name%&r | Key Type: %key_type% | Key Item: %key_item%"), target, sender, crate, keyType)); - } - } - - public static void logKeyEvent(OfflinePlayer target, CommandSender sender, Crate crate, KeyType keyType, KeyEventType keyEventType, boolean logFile, boolean logConsole) { - if (logFile) { - log(setEntryData("Player: %player% | Sender: %sender% | Key Name: %key_name% | Key Type: %key_type%", target, sender, crate, keyType), keyEventType.getName()); - } - - if (logConsole) { - plugin.getLogger().info(setEntryData(MsgUtils.color("Player: %player% | Sender: %sender% | Key Name: %key_name%&r | Key Type: %key_type%"), target, sender, crate, keyType)); - } - } - - public static void logCommandEvent(CommandEventType commandEventType) { - log("", commandEventType.getName()); - } - - private static void log(String toLog, String eventType) { - BufferedWriter bufferedWriter = null; - - /*try { - //bufferedWriter = new BufferedWriter(new FileWriter(plugin.getDataFolder() + "/" + fileName, true)); - - //bufferedWriter.write("[" + getDateTime() + " " + eventType + "]: " + toLog + System.lineSeparator()); - bufferedWriter.flush(); - } catch (IOException exception) { - plugin.getLogger().log(Level.WARNING, "Failed to write to " + fileName, exception); - } finally { - try { - if (bufferedWriter != null) bufferedWriter.close(); - } catch (IOException exception) { - plugin.getLogger().log(Level.WARNING, "Failed to close buffer for " + fileName, exception); - } - }*/ - } - - private static String getDateTime() { - SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss z"); - Date date = new Date(System.currentTimeMillis()); - return dateFormat.format(date); - } - - @SuppressWarnings("DEPRECATIONS") - private static String setEntryData(String string, Player player, CommandSender sender, Crate crate, KeyType keyType) { - return string.replace("%player%", player.getName()).replace("%crate_name%", crate.getName()).replace("%sender%", sender.getName()) - .replace("%crate_type%", crate.getCrateType().getName()).replace("%key_name%", crate.getKeyName()) - .replace("%key_type%", keyType.getName()).replace("%key_item%", crate.getKey().getType().toString()); - } - - private static String setEntryData(String string, OfflinePlayer player, CommandSender sender, Crate crate, KeyType keyType) { - return string.replace("%player%", player.getName()).replace("%crate_name%", crate.getName()).replace("%sender%", sender.getName()) - .replace("%crate_type%", crate.getCrateType().getName()).replace("%key_name%", crate.getKeyName()) - .replace("%key_type%", keyType.getName()).replace("%key_item%", crate.getKey().getType().toString()); - } - - public enum KeyEventType { - KEY_EVENT_GIVEN("key_event_given"), - KEY_EVENT_SENT("key_event_sent"), - KEY_EVENT_RECEIVED("key_event_received"), - KEY_EVENT_REMOVED("key_event_removed"); - - private final String keyEventName; - - KeyEventType(String name) { - this.keyEventName = name; - } - - public String getName() { - return keyEventName; - } - } - - public enum CrateEventType { - CRATE_EVENT("crate_event"); - - private final String crateEventName; - - CrateEventType(String name) { - this.crateEventName = name; - } - - public String getName() { - return crateEventName; - } - } - - public enum CommandEventType { - COMMAND_SUCCESS("command_event_success"), - COMMAND_FAIL("command_event_fail"); - - private final String commandEventName; - - CommandEventType(String name) { - this.commandEventName = name; - } - - public String getName() { - return commandEventName; - } - } -} \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java b/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java index 18da52b91..649a175af 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java @@ -3,6 +3,8 @@ import com.badbones69.crazycrates.api.objects.Tier; import com.badbones69.crazycrates.api.builders.ItemBuilder; import com.ryderbelserion.vital.enums.Support; +import com.ryderbelserion.vital.util.MiscUtil; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.apache.commons.lang.WordUtils; import com.badbones69.crazycrates.CrazyCrates; import com.badbones69.crazycrates.api.events.PlayerPrizeEvent; @@ -43,32 +45,36 @@ public static void givePrize(Player player, Prize prize, Crate crate) { prize = prize.hasPermission(player) ? prize.getAlternativePrize() : prize; - for (ItemStack item : prize.getItems()) { - if (item == null) { - Map placeholders = new HashMap<>(); + if (!prize.getItems().isEmpty()) { + for (ItemStack item : prize.getItems()) { + if (item == null) { + Map placeholders = new HashMap<>(); - placeholders.put("{crate}", prize.getCrateName()); - placeholders.put("{prize}", prize.getPrizeName()); + placeholders.put("{crate}", prize.getCrateName()); + placeholders.put("{prize}", prize.getPrizeName()); - player.sendMessage(Messages.prize_error.getMessage(placeholders, player)); + player.sendRichMessage(Messages.prize_error.getMessage(player, placeholders)); - continue; - } + continue; + } - if (!MiscUtils.isInventoryFull(player)) { - player.getInventory().addItem(item); - } else { - player.getWorld().dropItemNaturally(player.getLocation(), item); + if (!MiscUtils.isInventoryFull(player)) { + player.getInventory().addItem(item); + } else { + player.getWorld().dropItemNaturally(player.getLocation(), item); + } } } - for (ItemBuilder item : prize.getItemBuilders()) { - ItemBuilder clone = new ItemBuilder(item).setTarget(player); + if (!prize.getItemBuilders().isEmpty()) { + for (ItemBuilder item : prize.getItemBuilders()) { + ItemBuilder clone = new ItemBuilder(item).setTarget(player); - if (!MiscUtils.isInventoryFull(player)) { - player.getInventory().addItem(clone.build()); - } else { - player.getWorld().dropItemNaturally(player.getLocation(), clone.build()); + if (!MiscUtils.isInventoryFull(player)) { + player.getInventory().addItem(clone.build()); + } else { + player.getWorld().dropItemNaturally(player.getLocation(), clone.build()); + } } } @@ -126,24 +132,24 @@ private static void runCommands(Player player, Prize prize, Crate crate, String String display = prize.getDisplayItemBuilder().getName(); - String name = display == null || display.isEmpty() ? MsgUtils.color(WordUtils.capitalizeFully(prize.getDisplayItemBuilder().getMaterial().getKey().getKey().replaceAll("_", " "))) : display; + String name = display == null || display.isEmpty() ? WordUtils.capitalizeFully(prize.getDisplayItemBuilder().getMaterial().getKey().getKey().replaceAll("_", " ")) : display; MiscUtils.sendCommand(command .replaceAll("%player%", quoteReplacement(player.getName())) .replaceAll("%reward%", quoteReplacement(name)) - .replaceAll("%reward_stripped%", quoteReplacement(MsgUtils.stripColor(name))) + .replaceAll("%reward_stripped%", quoteReplacement(PlainTextComponentSerializer.plainText().serialize(MiscUtil.parse(name)))) .replaceAll("%crate%", quoteReplacement(crate.getCrateInventoryName()))); } private static void sendMessage(Player player, Prize prize, Crate crate, String message) { String display = prize.getDisplayItemBuilder().getName(); - String name = display == null || display.isEmpty() ? MsgUtils.color(WordUtils.capitalizeFully(prize.getDisplayItemBuilder().getMaterial().getKey().getKey().replaceAll("_", " "))) : display; + String name = display == null || display.isEmpty() ? WordUtils.capitalizeFully(prize.getDisplayItemBuilder().getMaterial().getKey().getKey().replaceAll("_", " ")) : display; String defaultMessage = message .replaceAll("%player%", quoteReplacement(player.getName())) .replaceAll("%reward%", quoteReplacement(name)) - .replaceAll("%reward_stripped%", quoteReplacement(MsgUtils.stripColor(name))) + .replaceAll("%reward_stripped%", quoteReplacement(PlainTextComponentSerializer.plainText().serialize(MiscUtil.parse(name)))) .replaceAll("%crate%", quoteReplacement(crate.getCrateInventoryName())); MsgUtils.sendMessage(player, Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(player, defaultMessage) : defaultMessage, false); @@ -164,7 +170,7 @@ public static void givePrize(Player player, Crate crate, Prize prize) { plugin.getServer().getPluginManager().callEvent(new PlayerPrizeEvent(player, crate, crate.getName(), prize)); } else { - player.sendMessage(MsgUtils.getPrefix("&cNo prize was found, please report this issue if you think this is an error.")); + player.sendRichMessage(MsgUtils.getPrefix("No prize was found, please report this issue if you think this is an error.")); } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java index ca00cb2e7..b15db8557 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java @@ -6,6 +6,16 @@ import com.badbones69.crazycrates.api.objects.Tier; import com.badbones69.crazycrates.api.utils.MiscUtils; import com.ryderbelserion.vital.enums.Support; +import com.ryderbelserion.vital.util.MiscUtil; +import io.papermc.paper.adventure.AdventureComponent; +import net.kyori.adventure.text.serializer.json.JSONComponentSerializer; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.inventory.MenuType; +import org.bukkit.craftbukkit.v1_20_R3.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftContainer; +import org.bukkit.craftbukkit.v1_20_R3.util.CraftChatMessage; import org.bukkit.plugin.java.JavaPlugin; import us.crazycrew.crazycrates.platform.config.ConfigManager; import us.crazycrew.crazycrates.platform.config.impl.ConfigKeys; @@ -15,7 +25,6 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryView; import org.jetbrains.annotations.NotNull; -import com.badbones69.crazycrates.api.utils.MsgUtils; import java.util.List; import static java.util.regex.Matcher.quoteReplacement; @@ -37,9 +46,9 @@ public InventoryBuilder(Player player, int size, String title) { this.player = player; this.size = size; - String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), MsgUtils.color(this.title)) : MsgUtils.color(this.title); + String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), this.title) : this.title; - this.inventory = this.plugin.getServer().createInventory(this, this.size, inventoryTitle); + this.inventory = this.plugin.getServer().createInventory(this, this.size, MiscUtil.parse(inventoryTitle)); } public InventoryBuilder(Crate crate, Player player, int size, String title) { @@ -49,9 +58,9 @@ public InventoryBuilder(Crate crate, Player player, int size, String title) { this.crate = crate; - String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), MsgUtils.color(this.title)) : MsgUtils.color(this.title); + String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), this.title) : this.title; - this.inventory = this.plugin.getServer().createInventory(this, this.size, inventoryTitle); + this.inventory = this.plugin.getServer().createInventory(this, this.size, MiscUtil.parse(inventoryTitle)); } public InventoryBuilder(Crate crate, Player player, int size, int page, String title) { @@ -62,9 +71,9 @@ public InventoryBuilder(Crate crate, Player player, int size, int page, String t this.crate = crate; - String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), MsgUtils.color(this.title)) : MsgUtils.color(this.title); + String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), this.title) : this.title; - this.inventory = this.plugin.getServer().createInventory(this, this.size, inventoryTitle); + this.inventory = this.plugin.getServer().createInventory(this, this.size, MiscUtil.parse(inventoryTitle)); } public InventoryBuilder(List tiers, Crate crate, Player player, int size, String title) { @@ -76,9 +85,9 @@ public InventoryBuilder(List tiers, Crate crate, Player player, int size, this.tiers = tiers; - String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), MsgUtils.color(this.title)) : MsgUtils.color(this.title); + String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), this.title) : this.title; - this.inventory = this.plugin.getServer().createInventory(this, this.size, inventoryTitle); + this.inventory = this.plugin.getServer().createInventory(this, this.size, MiscUtil.parse(inventoryTitle)); } public boolean overrideMenu() { @@ -148,6 +157,14 @@ public InventoryView getView() { return getPlayer().getOpenInventory(); } + public void sendTitleChange() { + ServerPlayer entityPlayer = (ServerPlayer) ((CraftHumanEntity) getView().getPlayer()).getHandle(); + int containerId = entityPlayer.containerMenu.containerId; + MenuType windowType = CraftContainer.getNotchInventoryType(getView().getTopInventory()); + entityPlayer.connection.send(new ClientboundOpenScreenPacket(containerId, windowType, CraftChatMessage.fromJSON(JSONComponentSerializer.json().serialize(MiscUtil.parse(this.title))))); + getPlayer().updateInventory(); + } + @Override @NotNull public Inventory getInventory() { diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/ItemBuilder.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/ItemBuilder.java index 68325c862..bd19070c3 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/ItemBuilder.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/ItemBuilder.java @@ -8,9 +8,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.ryderbelserion.vital.enums.Support; import com.ryderbelserion.vital.util.DyeUtil; +import com.ryderbelserion.vital.util.MiscUtil; import io.th0rgal.oraxen.api.OraxenItems; import me.clip.placeholderapi.PlaceholderAPI; +import net.kyori.adventure.text.Component; import net.minecraft.nbt.TagParser; +import org.apache.commons.lang.WordUtils; import org.bukkit.*; import org.bukkit.block.Banner; import org.bukkit.block.banner.Pattern; @@ -153,7 +156,14 @@ public ItemBuilder(ItemBuilder itemBuilder) { this.itemAmount = itemBuilder.itemAmount; this.itemData = itemBuilder.itemData; - this.displayName = itemBuilder.displayName; + if (!itemBuilder.displayName.isBlank()) { + this.displayName = itemBuilder.displayName; + } else { + String material = WordUtils.capitalizeFully(this.material.getKey().getKey().replaceAll("_", " ")); + + this.displayName = material; + } + this.displayLore = itemBuilder.displayLore; this.itemDamage = itemBuilder.itemDamage; @@ -230,17 +240,17 @@ public ItemBuilder(ItemStack itemStack) { case ENCHANTED_BOOK -> this.isBook = true; } - this.itemStack.editMeta(itemMeta -> { + /*this.itemStack.editMeta(itemMeta -> { if (itemMeta.hasDisplayName()) this.displayName = itemMeta.getDisplayName(); if (itemMeta.hasLore()) this.displayLore = itemMeta.getLore(); - }); + });*/ String name = this.material.name(); - this.isArmor = name.endsWith("_HELMET") || name.endsWith("_CHESTPLATE") || name.endsWith("_LEGGINGS") || name.endsWith("_BOOTS"); + this.isArmor = name.endsWith("_helmet") || name.endsWith("_chestplate") || name.endsWith("_leggings") || name.endsWith("_boots"); - this.isBanner = name.endsWith("BANNER"); + this.isBanner = name.endsWith("banner"); } public ItemBuilder(ItemStack itemStack, Player target) { @@ -263,27 +273,27 @@ public ItemBuilder(ItemStack itemStack, Player target) { case ENCHANTED_BOOK -> this.isBook = true; } - this.itemStack.editMeta(itemMeta -> { + /*this.itemStack.editMeta(itemMeta -> { if (itemMeta.hasDisplayName()) this.displayName = itemMeta.getDisplayName(); if (itemMeta.hasLore()) this.displayLore = itemMeta.getLore(); - }); + });*/ String name = this.material.name(); - this.isArmor = name.endsWith("_HELMET") || name.endsWith("_CHESTPLATE") || name.endsWith("_LEGGINGS") || name.endsWith("_BOOTS"); + this.isArmor = name.endsWith("_helmet") || name.endsWith("_chestplate") || name.endsWith("_leggings") || name.endsWith("_boots"); - this.isBanner = name.endsWith("BANNER"); + this.isBanner = name.endsWith("banner"); } public ItemBuilder() {} - private String parse(String message) { - if (Support.placeholder_api.isEnabled() && this.target != null) { - return MsgUtils.color(PlaceholderAPI.setPlaceholders(this.target, message)); + private Component parse(String message) { + if (Support.placeholder_api.isEnabled() && this.target != null) { + return MiscUtil.parse(PlaceholderAPI.setPlaceholders(this.target, message)); } - return MsgUtils.color(message); + return MiscUtil.parse(message); } /** @@ -427,8 +437,8 @@ public ItemStack build() { } } - itemMeta.setDisplayName(getUpdatedName()); - itemMeta.setLore(getUpdatedLore()); + itemMeta.displayName(getUpdatedName()); + itemMeta.lore(getUpdatedLore()); if (!this.crateName.isBlank() || !this.crateName.isEmpty()) { PersistentDataContainer container = itemMeta.getPersistentDataContainer(); @@ -480,7 +490,7 @@ public ItemBuilder setTarget(Player target) { * * @return The name with all the placeholders in it. */ - public String getUpdatedName() { + public Component getUpdatedName() { String newName = this.displayName; for (String placeholder : this.namePlaceholders.keySet()) { @@ -550,7 +560,7 @@ public ItemBuilder setMaterial(String type) { }); this.itemStack = new ItemStack(Material.STONE); - this.itemStack.editMeta(itemMeta -> itemMeta.setDisplayName(parse("&cAn error has occurred with the item builder."))); + this.itemStack.editMeta(itemMeta -> itemMeta.displayName(MiscUtil.parse("An error has occurred with the item builder."))); this.material = this.itemStack.getType(); @@ -695,8 +705,12 @@ public int getDamage() { * @return the ItemBuilder with an updated name. */ public ItemBuilder setName(String itemName) { - if (itemName != null) { + if (!itemName.isBlank()) { this.displayName = itemName; + } else { + String material = WordUtils.capitalizeFully(this.material.getKey().getKey().replaceAll("_", " ")); + + this.displayName = material; } return this; @@ -738,7 +752,7 @@ public ItemBuilder removeNamePlaceholder(String placeholder) { } /** - * Set the lore of the item in the builder. This will auto force color in all the lores that contains color code. (&a, &c, &7, etc...) + * Set the lore of the item in the builder. This will auto force color in all the lores that contains color code. (, , , etc...) * * @param lore the lore of the item in the builder. * @return the ItemBuilder with updated info. @@ -746,17 +760,14 @@ public ItemBuilder removeNamePlaceholder(String placeholder) { public ItemBuilder setLore(List lore) { if (lore != null) { this.displayLore.clear(); - - for (String line : lore) { - this.displayLore.add(MsgUtils.color(line)); - } + this.displayLore.addAll(lore); } return this; } /** - * Set the lore of the item with papi support in the builder. This will auto force color in all the lores that contains color code. (&a, &c, &7, etc...) + * Set the lore of the item with papi support in the builder. This will auto force color in all the lores that contains color code. (, , , etc...) * * @param player the player viewing the button. * @param lore the lore of the item in the builder. @@ -767,7 +778,7 @@ public ItemBuilder setLore(Player player, List lore) { this.displayLore.clear(); for (String line : lore) { - this.displayLore.add(PlaceholderAPI.setPlaceholders(player, MsgUtils.color(line))); + this.displayLore.add(PlaceholderAPI.setPlaceholders(player, line)); } } @@ -775,13 +786,13 @@ public ItemBuilder setLore(Player player, List lore) { } /** - * Add a line to the current lore of the item. This will auto force color in the lore that contains color code. (&a, &c, &7, etc...) + * Add a line to the current lore of the item. This will auto force color in the lore that contains color code. (, , , etc...) * - * @param lore the new line you wish to add. + * @param line the new line you wish to add. * @return the ItemBuilder with updated info. */ - public ItemBuilder addLore(String lore) { - if (lore != null) this.displayLore.add(MsgUtils.color(lore)); + public ItemBuilder addLore(String line) { + if (line != null) this.displayLore.add(line); return this; } @@ -816,8 +827,8 @@ public ItemBuilder addLorePlaceholder(String placeholder, String argument) { * * @return the lore with all placeholders in it. */ - public List getUpdatedLore() { - List newLore = new ArrayList<>(); + public List getUpdatedLore() { + List newLore = new ArrayList<>(); for (String item : this.displayLore) { for (String placeholder : this.lorePlaceholders.keySet()) { @@ -886,7 +897,7 @@ public ItemBuilder setPattern(List patterns) { * @param amount the amount of the item stack. * @return the ItemBuilder with an updated item count. */ - public ItemBuilder setAmount(Integer amount) { + public ItemBuilder setAmount(int amount) { this.itemAmount = amount; return this; @@ -1172,7 +1183,7 @@ public static ItemBuilder convertString(String itemString, String placeHolder) { } } } catch (Exception exception) { - itemBuilder.setMaterial(Material.RED_TERRACOTTA).setName("&c&lERROR").setLore(Arrays.asList("&cThere is an error", "&cFor : &c" + (placeHolder != null ? placeHolder : ""))); + itemBuilder.setMaterial(Material.RED_TERRACOTTA).setName("ERROR").setLore(Arrays.asList("There is an error", "For : " + (placeHolder != null ? placeHolder : ""))); CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class); plugin.getLogger().log(Level.WARNING, "An error has occurred with the item builder: ", exception); diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateAdminMenu.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateAdminMenu.java index 84ecaf98f..7f893a31f 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateAdminMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateAdminMenu.java @@ -7,6 +7,7 @@ import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.tasks.BukkitUserManager; import com.badbones69.crazycrates.tasks.crates.CrateManager; +import com.ryderbelserion.vital.util.MiscUtil; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -36,11 +37,14 @@ public InventoryBuilder build() { Inventory inventory = getInventory(); inventory.setItem(49, new ItemBuilder().setMaterial(Material.CHEST) - .setName("&cWhat is this menu?") + .setName("What is this menu?") .addLore("") - .addLore("&dA cheat cheat menu of all your available keys.") - .addLore("&7&lRight click to get virtual keys.") - .addLore("&7&lLeft click to get physical keys.").build()); + .addLore("A cheat cheat menu of all your available keys.") + .addLore("Right click to get virtual keys.") + .addLore("Shift right click to get 8 virtual keys.") + .addLore("Left click to get physical keys.") + .addLore("Shift left click to get 8 physical keys.") + .build()); for (Crate crate : this.plugin.getCrateManager().getUsableCrates()) { if (inventory.firstEmpty() >= 0) inventory.setItem(inventory.firstEmpty(), crate.getKey(1, getPlayer())); @@ -73,7 +77,7 @@ public void onInventoryClick(InventoryClickEvent event) { if (!Permissions.CRAZYCRATES_ACCESS.hasPermission(player)) { player.closeInventory(InventoryCloseEvent.Reason.CANT_USE); - player.sendMessage(Messages.no_permission.getMessage(player)); + player.sendRichMessage(Messages.no_permission.getMessage(player)); return; } @@ -103,7 +107,20 @@ public void onInventoryClick(InventoryClickEvent event) { placeholders.put("{keytype}", KeyType.physical_key.getFriendlyName()); - player.sendActionBar(Messages.obtaining_keys.getMessage(placeholders, player)); + player.sendActionBar(MiscUtil.parse(Messages.obtaining_keys.getMessage(player, placeholders))); + } + + case SHIFT_LEFT -> { + ItemStack key = crate.getKey(8, player); + + player.getInventory().addItem(key); + + player.playSound(player.getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, 1f); + + placeholders.put("{keytype}", KeyType.physical_key.getFriendlyName()); + placeholders.put("{amount}", "8"); + + player.sendActionBar(MiscUtil.parse(Messages.obtaining_keys.getMessage(player, placeholders))); } case RIGHT -> { @@ -113,7 +130,18 @@ public void onInventoryClick(InventoryClickEvent event) { placeholders.put("{keytype}", KeyType.physical_key.getFriendlyName()); - player.sendActionBar(Messages.obtaining_keys.getMessage(placeholders, player)); + player.sendActionBar(MiscUtil.parse(Messages.obtaining_keys.getMessage(player, placeholders))); + } + + case SHIFT_RIGHT -> { + this.userManager.addKeys(8, player.getUniqueId(), crate.getName(), KeyType.virtual_key); + + player.playSound(player.getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, 1f); + + placeholders.put("{keytype}", KeyType.physical_key.getFriendlyName()); + placeholders.put("{amount}", "8"); + + player.sendActionBar(MiscUtil.parse(Messages.obtaining_keys.getMessage(player, placeholders))); } } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateMainMenu.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateMainMenu.java index 17f2c3fdb..e4e26e9cf 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateMainMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/CrateMainMenu.java @@ -198,14 +198,14 @@ public void onInventoryClick(InventoryClickEvent event) { this.inventoryManager.addViewer(player); this.inventoryManager.openNewCratePreview(player, crate); } else { - player.sendMessage(Messages.preview_disabled.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.preview_disabled.getMessage(player, "{crate}", crate.getName())); } return; } if (this.crateManager.isInOpeningList(player)) { - player.sendMessage(Messages.already_opening_crate.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.already_opening_crate.getMessage(player, "{crate}", crate.getName())); return; } @@ -227,21 +227,21 @@ public void onInventoryClick(InventoryClickEvent event) { player.playSound(player.getLocation(), Sound.valueOf(this.config.getProperty(ConfigKeys.need_key_sound)), SoundCategory.PLAYERS, 1f, 1f); } - player.sendMessage(Messages.no_virtual_key.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.no_virtual_key.getMessage(player, "{crate}", crate.getName())); return; } for (String world : this.config.getProperty(ConfigKeys.disabled_worlds)) { if (world.equalsIgnoreCase(player.getWorld().getName())) { - player.sendMessage(Messages.world_disabled.getMessage("{world}", player.getWorld().getName(), player)); + player.sendRichMessage(Messages.world_disabled.getMessage(player, "{world}", player.getWorld().getName())); return; } } if (MiscUtils.isInventoryFull(player)) { - player.sendMessage(Messages.inventory_not_empty.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.inventory_not_empty.getMessage(player, "{crate}", crate.getName())); return; } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java b/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java index 9e73218b5..94e66eb53 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java @@ -15,7 +15,6 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import us.crazycrew.crazycrates.platform.config.impl.ConfigKeys; -import com.badbones69.crazycrates.api.utils.MsgUtils; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -54,6 +53,7 @@ public enum Messages { needs_more_room(CrateKeys.needs_more_room), out_of_time(CrateKeys.out_of_time), not_a_crate(CrateKeys.not_a_crate), + not_a_key(CrateKeys.not_a_key), not_a_number(CrateKeys.not_a_number), preview_disabled(CrateKeys.preview_disabled), required_keys(CrateKeys.required_keys), @@ -80,88 +80,99 @@ public enum Messages { other_player_no_keys(CommandKeys.other_player_no_keys), other_player_no_keys_header(CommandKeys.other_player_header, true), per_crate(CommandKeys.per_crate), + help(CommandKeys.help, true), admin_help(CommandKeys.admin_help, true); private Property property; - private Property> listProperty; - - private String message; - + private Property> properties; private boolean isList = false; - /** - * Used for strings - * - * @param property the property - */ Messages(Property property) { this.property = property; } - /** - * Used for string lists - * - * @param listProperty the list property - * @param isList Defines if it's a list or not. - */ - Messages(Property> listProperty, boolean isList) { - this.listProperty = listProperty; - + Messages(Property> properties, boolean isList) { + this.properties = properties; this.isList = isList; } - @NotNull - private final SettingsManager configuration = ConfigManager.getMessages(); + private final @NotNull SettingsManager config = ConfigManager.getConfig(); + + private final @NotNull SettingsManager messages = ConfigManager.getMessages(); private boolean isList() { return this.isList; } - private @NotNull List getPropertyList(Property> properties) { - return this.configuration.getProperty(properties); + public @NotNull String getString() { + return this.messages.getProperty(this.property); } - private @NotNull String getProperty(Property property) { - return this.configuration.getProperty(property); + public @NotNull List getList() { + return this.messages.getProperty(this.properties); } - public String getMessage(Map placeholders) { - return getMessage(placeholders, null); + public String getMessage() { + return getMessage(null, new HashMap<>()); } public String getMessage(CommandSender sender) { if (sender instanceof Player player) { - return getMessage(new HashMap<>(), player); + return getMessage(player, new HashMap<>()); } - return getMessage(new HashMap<>(), null); + return getMessage(null, new HashMap<>()); + } + + public String getMessage(Map placeholders) { + return getMessage(null, placeholders); + } + + public String getMessage(String placeholder, String replacement) { + return getMessage(null, placeholder, replacement); } - public String getMessage(String placeholder, String replacement, CommandSender sender) { - Map placeholders = new HashMap<>(); - placeholders.put(placeholder, replacement); + public String getMessage(CommandSender sender, String placeholder, String replacement) { + Map placeholders = new HashMap<>() {{ + put(placeholder, replacement); + }}; if (sender instanceof Player player) { - return getMessage(placeholders, player); + return getMessage(player, placeholders); } - return getMessage(placeholders, null); + return getMessage(null, placeholders); } - public String getMessage(String placeholder, String replacement) { - return getMessage(placeholder, replacement, null); + public String getMessage(CommandSender sender, Map placeholders) { + if (sender instanceof Player player) { + return getMessage(player, placeholders); + } + + return getMessage(null, placeholders); } - public String getMessage(Map placeholders, CommandSender sender) { - // Get the string first. + public String getMessage(Player player, Map placeholders) { + String prefix = this.config.getProperty(ConfigKeys.command_prefix); + + String message = parse(placeholders); + + if (Support.placeholder_api.isEnabled() && player != null) { + return PlaceholderAPI.setPlaceholders(player, message.replaceAll("\\{prefix}", prefix)); + } + + return message.replaceAll("\\{prefix}", prefix); + } + + private String parse(Map placeholders) { String message; if (isList()) { - message = StringUtil.convertList(getPropertyList(this.listProperty)); + message = StringUtil.convertList(getList()); } else { - message = getProperty(this.property); + message = getString(); } if (!placeholders.isEmpty()) { @@ -170,22 +181,6 @@ public String getMessage(Map placeholders, CommandSender sender) } } - this.message = message; - - return asString(sender); - } - - private String asString(CommandSender sender) { - String prefix = ConfigManager.getConfig().getProperty(ConfigKeys.command_prefix); - - String message = this.message.replaceAll("\\{prefix}", prefix); - - if (sender instanceof Player player) { - if (Support.placeholder_api.isEnabled()) { - return PlaceholderAPI.setPlaceholders(player, MsgUtils.color(message)); - } - } - - return MsgUtils.color(message); + return message; } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java index 721c992d7..51cb61c32 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java @@ -96,9 +96,9 @@ public class Crate { * @param file The crate file. */ public Crate(String name, String previewName, CrateType crateType, ItemStack key, String keyName, List prizes, FileConfiguration file, int newPlayerKeys, List tiers, int maxMassOpen, int requiredKeys, List prizeMessage, List prizeCommands, CrateHologram hologram) { - this.emptyKey = ItemBuilder.convertItemStack(key); - this.keyBuilder = ItemBuilder.convertItemStack(key).setCrateName(name); - this.keyName = keyName != null ? keyName : "Crate.PhysicalKey.Name is not in the " + name + ".yml"; + this.emptyKey = ItemBuilder.convertItemStack(key).setName(keyName); + this.keyBuilder = ItemBuilder.convertItemStack(key).setName(keyName).setCrateName(name); + this.keyName = keyName; this.file = file; this.name = name; @@ -117,7 +117,7 @@ public Crate(String name, String previewName, CrateType crateType, ItemStack key this.previewTierBorderToggle = file != null && file.getBoolean("Crate.tier-preview.glass.toggle", false); setPreviewChestLines(file != null ? file.getInt("Crate.Preview.ChestLines", 6) : 6); - this.previewName = MsgUtils.sanitizeColor(previewName); + this.previewName = previewName; this.newPlayerKeys = newPlayerKeys; this.giveNewPlayerKeys = newPlayerKeys > 0; @@ -125,14 +125,14 @@ public Crate(String name, String previewName, CrateType crateType, ItemStack key for (int amount = this.preview.size(); amount > this.maxSlots - (this.borderToggle ? 18 : this.maxSlots >= this.preview.size() ? 0 : this.maxSlots != 9 ? 9 : 0); amount -= this.maxSlots - (this.borderToggle ? 18 : this.maxSlots >= this.preview.size() ? 0 : this.maxSlots != 9 ? 9 : 0), this.maxPage++) ; - this.crateInventoryName = file != null ? MsgUtils.sanitizeColor(file.getString("Crate.CrateName")) : ""; + this.crateInventoryName = file != null ? file.getString("Crate.CrateName") : ""; - String borderName = file != null && file.contains("Crate.Preview.Glass.Name") ? MsgUtils.color(file.getString("Crate.Preview.Glass.Name")) : " "; + String borderName = file != null && file.contains("Crate.Preview.Glass.Name") ? file.getString("Crate.Preview.Glass.Name") : " "; this.borderItem = file != null && file.contains("Crate.Preview.Glass.Item") ? new ItemBuilder().setMaterial(file.getString("Crate.Preview.Glass.Item", "GRAY_STAINED_GLASS_PANE")) .hideItemFlags(file.getBoolean("Crate.Preview.Glass.HideItemFlags", false)) .setName(borderName) : new ItemBuilder().setMaterial(Material.AIR).setName(borderName); - String previewTierBorderName = file != null ? MsgUtils.color(file.getString("Crate.tier-preview.glass.name", " ")) : " "; + String previewTierBorderName = file != null ? file.getString("Crate.tier-preview.glass.name", " ") : " "; this.previewTierBorderItem = file != null ? new ItemBuilder().setMaterial(file.getString("Crate.tier-preview.glass.item", "GRAY_STAINED_GLASS_PANE")).hideItemFlags(file.getBoolean("Crate.tier-preview.glass.hideitemflags", false)) .setName(previewTierBorderName) : new ItemBuilder().setMaterial(Material.AIR).setName(previewTierBorderName); diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java index cf8a454a1..40245e379 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java @@ -313,13 +313,13 @@ private ItemBuilder display() { return builder; } catch (Exception exception) { List list = new ArrayList<>() {{ - add("&cThere was an error with one of your prizes!"); - add("&cThe reward in question is labeled: &e" + section.getName() + " &cin crate: &e" + crateName); - add("&cName of the reward is " + section.getString("DisplayName")); - add("&cIf you are confused, Stop by our discord for support!"); + add("There was an error with one of your prizes!"); + add("The reward in question is labeled: " + section.getName() + " in crate: " + crateName); + add("Name of the reward is " + section.getString("DisplayName")); + add("If you are confused, Stop by our discord for support!"); }}; - return new ItemBuilder(new ItemStack(Material.RED_TERRACOTTA)).setName("&c&lERROR").setLore(list); + return new ItemBuilder(new ItemStack(Material.RED_TERRACOTTA)).setName("ERROR").setLore(list); } } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/utils/MiscUtils.java b/paper/src/main/java/com/badbones69/crazycrates/api/utils/MiscUtils.java index caeedb019..8e6bbe752 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/utils/MiscUtils.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/utils/MiscUtils.java @@ -171,21 +171,20 @@ public static void failedToTakeKey(CommandSender player, String crateName) { ).forEach(plugin.getLogger()::warning); List.of( - "&cAn issue has occurred when trying to take a key.", - "&cA list of potential reasons", + "An issue has occurred when trying to take a key.", + "A list of potential reasons", "", - " &e-> &dNot enough keys.", - " &e-> &dKey is in off hand." - ).forEach(line -> player.sendMessage(MsgUtils.getPrefix(line))); + " -> Not enough keys.", + " -> Key is in off hand." + ).forEach(line -> player.sendRichMessage(MsgUtils.getPrefix(line))); } public static long pickNumber(long min, long max) { max++; try { - // new Random() does not have a nextLong(long bound) method. return min + ThreadLocalRandom.current().nextLong(max - min); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException exception) { return min; } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/utils/MsgUtils.java b/paper/src/main/java/com/badbones69/crazycrates/api/utils/MsgUtils.java index 1679fd237..c6d6b7cff 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/utils/MsgUtils.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/utils/MsgUtils.java @@ -1,68 +1,32 @@ package com.badbones69.crazycrates.api.utils; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import us.crazycrew.crazycrates.platform.config.ConfigManager; import us.crazycrew.crazycrates.platform.config.impl.ConfigKeys; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import static java.util.regex.Matcher.quoteReplacement; -@SuppressWarnings("ALL") public class MsgUtils { - public static String color(String message) { - Matcher matcher = Pattern.compile("#[a-fA-F\\d]{6}").matcher(message); - StringBuilder buffer = new StringBuilder(); - - while (matcher.find()) { - matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString()); - } - - return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(buffer).toString()); - } - public static void sendMessage(CommandSender commandSender, String message, boolean prefixToggle) { if (message == null || message.isEmpty()) return; String prefix = getPrefix(); if (commandSender instanceof Player player) { - if (!prefix.isEmpty() && prefixToggle) player.sendMessage(color(message.replaceAll("%prefix%", quoteReplacement(prefix))).replaceAll("%Prefix%", quoteReplacement(prefix))); else player.sendMessage(color(message)); + if (!prefix.isEmpty() && prefixToggle) player.sendRichMessage(message.replaceAll("%prefix%", quoteReplacement(prefix)).replaceAll("%Prefix%", quoteReplacement(prefix))); else player.sendRichMessage(message); return; } - if (!prefix.isEmpty() && prefixToggle) commandSender.sendMessage(color(message.replaceAll("%prefix%", quoteReplacement(prefix))).replaceAll("%Prefix%", quoteReplacement(prefix))); else commandSender.sendMessage(color(message)); + if (!prefix.isEmpty() && prefixToggle) commandSender.sendRichMessage(message.replaceAll("%prefix%", quoteReplacement(prefix)).replaceAll("%Prefix%", quoteReplacement(prefix))); else commandSender.sendRichMessage(message); } public static String getPrefix() { - return color(ConfigManager.getConfig().getProperty(ConfigKeys.command_prefix)); + return ConfigManager.getConfig().getProperty(ConfigKeys.command_prefix); } public static String getPrefix(String msg) { - return color(getPrefix() + msg); - } - - public static String sanitizeColor(String msg) { - return sanitizeFormat(color(msg)); - } - - public static String sanitizeFormat(String string) { - return TextComponent.toLegacyText(TextComponent.fromLegacyText(string)); - } - - public static final Pattern STRIP_PATTERN = Pattern.compile("(?:(? { diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/MessageManager.java b/paper/src/main/java/com/badbones69/crazycrates/commands/MessageManager.java index dca811473..c7a0ebc1a 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/MessageManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/MessageManager.java @@ -12,6 +12,4 @@ public abstract class MessageManager { public abstract void send(@NotNull CommandSender sender, @NotNull String component); - public abstract String parse(@NotNull String message); - } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/relations/ArgumentRelations.java b/paper/src/main/java/com/badbones69/crazycrates/commands/relations/ArgumentRelations.java index 099d1d803..4451ba28c 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/relations/ArgumentRelations.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/relations/ArgumentRelations.java @@ -1,11 +1,11 @@ package com.badbones69.crazycrates.commands.relations; import com.badbones69.crazycrates.commands.MessageManager; +import dev.triumphteam.cmd.bukkit.message.BukkitMessageKey; import dev.triumphteam.cmd.core.message.MessageKey; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; import com.badbones69.crazycrates.api.enums.Messages; -import com.badbones69.crazycrates.api.utils.MsgUtils; public class ArgumentRelations extends MessageManager { @@ -46,7 +46,7 @@ public void build() { } if (correctUsage != null) { - send(sender, Messages.correct_usage.getMessage("{usage}", correctUsage, sender)); + send(sender, Messages.correct_usage.getMessage(sender, "{usage}", correctUsage)); } }); @@ -66,20 +66,23 @@ public void build() { } if (correctUsage != null) { - send(sender, Messages.correct_usage.getMessage("{usage}", correctUsage, sender)); + send(sender, Messages.correct_usage.getMessage(sender, "{usage}", correctUsage)); } }); commandManager.registerMessage(MessageKey.UNKNOWN_COMMAND, (sender, context) -> send(sender, Messages.unknown_command.getMessage(sender))); - } - @Override - public void send(@NotNull CommandSender sender, @NotNull String component) { - sender.sendMessage(parse(component)); + commandManager.registerMessage(MessageKey.INVALID_ARGUMENT, (sender, context) -> send(sender, Messages.correct_usage.getMessage(sender, "{usage}", context.getTypedArgument()))); + + commandManager.registerMessage(BukkitMessageKey.NO_PERMISSION, (sender, context) -> send(sender, Messages.no_permission.getMessage(sender))); + + commandManager.registerMessage(BukkitMessageKey.PLAYER_ONLY, (sender, context) -> send(sender, Messages.must_be_a_player.getMessage(sender))); + + commandManager.registerMessage(BukkitMessageKey.CONSOLE_ONLY, (sender, context) -> send(sender, Messages.must_be_console_sender.getMessage(sender))); } @Override - public String parse(@NotNull String message) { - return MsgUtils.color(message); + public void send(@NotNull CommandSender sender, @NotNull String component) { + sender.sendRichMessage(component); } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/relations/MiscRelations.java b/paper/src/main/java/com/badbones69/crazycrates/commands/relations/MiscRelations.java deleted file mode 100644 index e76438a11..000000000 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/relations/MiscRelations.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.badbones69.crazycrates.commands.relations; - -import com.badbones69.crazycrates.commands.MessageManager; -import dev.triumphteam.cmd.bukkit.message.BukkitMessageKey; -import dev.triumphteam.cmd.core.message.MessageKey; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; -import com.badbones69.crazycrates.api.enums.Messages; -import com.badbones69.crazycrates.api.utils.MsgUtils; - -public class MiscRelations extends MessageManager { - - @Override - public void build() { - commandManager.registerMessage(MessageKey.INVALID_ARGUMENT, (sender, context) -> send(sender, Messages.correct_usage.getMessage("{usage}", context.getTypedArgument(), sender))); - - commandManager.registerMessage(BukkitMessageKey.NO_PERMISSION, (sender, context) -> send(sender, Messages.no_permission.getMessage(sender))); - - commandManager.registerMessage(BukkitMessageKey.PLAYER_ONLY, (sender, context) -> send(sender, Messages.must_be_a_player.getMessage(sender))); - - commandManager.registerMessage(BukkitMessageKey.CONSOLE_ONLY, (sender, context) -> send(sender, Messages.must_be_console_sender.getMessage(sender))); - } - - @Override - public void send(@NotNull CommandSender sender, @NotNull String component) { - sender.sendMessage(parse(component)); - } - - @Override - public String parse(@NotNull String message) { - return MsgUtils.color(message); - } -} \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/subs/BaseKeyCommand.java b/paper/src/main/java/com/badbones69/crazycrates/commands/subs/BaseKeyCommand.java index 0f09ae023..cd4bde562 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/subs/BaseKeyCommand.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/subs/BaseKeyCommand.java @@ -33,7 +33,7 @@ public void viewPersonal(Player player) { placeholders.put("{crates_opened}", String.valueOf(this.userManager.getTotalCratesOpened(player.getUniqueId()))); - getKeys(player, player, Messages.virtual_keys_header.getMessage(placeholders, player), Messages.no_virtual_keys.getMessage(player)); + getKeys(player, player, Messages.virtual_keys_header.getMessage(player, placeholders), Messages.no_virtual_keys.getMessage(player)); } @SubCommand("view") @@ -50,11 +50,11 @@ public void viewOthers(CommandSender sender, @Suggestion ("online-players") Play placeholders.put("{player}", target.getName()); placeholders.put("{crates_opened}", String.valueOf(this.userManager.getTotalCratesOpened(target.getUniqueId()))); - String header = Messages.other_player_no_keys_header.getMessage(placeholders, sender); + String header = Messages.other_player_no_keys_header.getMessage(null, placeholders); - String otherPlayer = Messages.other_player_no_keys.getMessage("{player}", target.getName(), sender); + String content = Messages.other_player_no_keys.getMessage(null, "{player}", target.getName()); - getKeys(target, sender, header, otherPlayer); + getKeys(target, sender, header, content); } /** @@ -63,9 +63,9 @@ public void viewOthers(CommandSender sender, @Suggestion ("online-players") Play * @param player player to get keys. * @param sender sender to send message to. * @param header header of the message. - * @param messageContent content of the message. + * @param content content of the message. */ - private void getKeys(Player player, CommandSender sender, String header, String messageContent) { + private void getKeys(Player player, CommandSender sender, String header, String content) { List message = Lists.newArrayList(); message.add(header); @@ -88,19 +88,19 @@ private void getKeys(Player player, CommandSender sender, String header, String placeholders.put("{keys}", String.valueOf(amount)); placeholders.put("{crate_opened}", String.valueOf(this.userManager.getCrateOpened(player.getUniqueId(), crate.getName()))); - message.add(Messages.per_crate.getMessage(placeholders, player)); + message.add(Messages.per_crate.getMessage(player, placeholders)); } } if (Support.placeholder_api.isEnabled() ) { if (sender instanceof Player person) { if (hasKeys) { - message.forEach(line -> person.sendMessage(PlaceholderAPI.setPlaceholders(person, line))); + message.forEach(line -> person.sendRichMessage(PlaceholderAPI.setPlaceholders(person, line))); return; } - sender.sendMessage(PlaceholderAPI.setPlaceholders(person, messageContent)); + sender.sendRichMessage(PlaceholderAPI.setPlaceholders(person, content)); return; } @@ -109,11 +109,11 @@ private void getKeys(Player player, CommandSender sender, String header, String } if (hasKeys) { - message.forEach(sender::sendMessage); + message.forEach(sender::sendRichMessage); return; } - sender.sendMessage(messageContent); + sender.sendRichMessage(content); } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/subs/CrateBaseCommand.java b/paper/src/main/java/com/badbones69/crazycrates/commands/subs/CrateBaseCommand.java index 3d62d6efe..c1af35631 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/subs/CrateBaseCommand.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/subs/CrateBaseCommand.java @@ -90,7 +90,7 @@ public void onDefaultMenu(Player player) { public void onHelp(CommandSender sender) { String message = sender.hasPermission("crazycrates.admin-access") ? Messages.admin_help.getMessage(sender) : Messages.help.getMessage(sender); - sender.sendMessage(message); + sender.sendRichMessage(message); } @SubCommand("transfer") @@ -100,21 +100,21 @@ public void onPlayerTransferKeys(Player sender, @Suggestion("crates") String cra // If the crate is menu or null. we return if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } // If it's the same player, we return. if (player.getUniqueId().toString().equalsIgnoreCase(sender.getUniqueId().toString())) { - sender.sendMessage(Messages.same_player.getMessage(sender)); + sender.sendRichMessage(Messages.same_player.getMessage(sender)); return; } // If they don't have enough keys, we return. if (this.userManager.getVirtualKeys(sender.getUniqueId(), crate.getName()) <= amount) { - sender.sendMessage(Messages.transfer_not_enough_keys.getMessage("{crate}", crate.getName(), sender)); + sender.sendRichMessage(Messages.transfer_not_enough_keys.getMessage(sender, "{crate}", crate.getName())); return; } @@ -135,9 +135,9 @@ public void onPlayerTransferKeys(Player sender, @Suggestion("crates") String cra placeholders.put("{keytype}", KeyType.virtual_key.getFriendlyName()); placeholders.put("{player}", player.getName()); - sender.sendMessage(Messages.transfer_sent_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.transfer_sent_keys.getMessage(sender, placeholders)); - player.sendMessage(Messages.transfer_received_keys.getMessage("{player}", sender.getName(), player)); + player.sendRichMessage(Messages.transfer_received_keys.getMessage(sender, "{player}", sender.getName())); } @SubCommand("reload") @@ -175,7 +175,7 @@ public void onReload(CommandSender sender) { this.inventoryManager.closeCratePreview(player); if (this.config.getProperty(ConfigKeys.send_preview_taken_out_message)) { - player.sendMessage(Messages.reloaded_forced_out_of_preview.getMessage(player)); + player.sendRichMessage(Messages.reloaded_forced_out_of_preview.getMessage(player)); } } }); @@ -185,7 +185,7 @@ public void onReload(CommandSender sender) { this.crateManager.loadCrates(); - sender.sendMessage(Messages.reloaded_plugin.getMessage(sender)); + sender.sendRichMessage(Messages.reloaded_plugin.getMessage(sender)); } @SubCommand("debug") @@ -194,7 +194,7 @@ public void onDebug(Player player, @Suggestion("crates") String crateName) { Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null) { - player.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.not_a_crate.getMessage(player, "{crate}", crateName)); return; } @@ -205,13 +205,13 @@ public void onDebug(Player player, @Suggestion("crates") String crateName) { @SubCommand("save") @Permission(value = "crazycrates.save", def = PermissionDefault.OP) public void onSchematicSave(Player player) { - player.sendMessage(MsgUtils.color("&cThis feature is not yet developed internally by &eRyder Belserion.")); + player.sendRichMessage("This feature is not yet developed internally by Ryder Belserion."); } @SubCommand("admin") @Permission(value = "crazycrates.command.admin.access", def = PermissionDefault.OP) public void onAdminMenu(Player player) { - CrateAdminMenu inventory = new CrateAdminMenu(player, 54, "&c&lAdmin Keys"); + CrateAdminMenu inventory = new CrateAdminMenu(player, 54, "Admin Keys"); player.openInventory(inventory.build().getInventory()); } @@ -222,20 +222,20 @@ public void onAdminList(CommandSender sender) { StringBuilder crates = new StringBuilder(); String brokeCrates; - this.crateManager.getUsableCrates().forEach(crate -> crates.append("&a").append(crate.getName()).append("&8, ")); + this.crateManager.getUsableCrates().forEach(crate -> crates.append("").append(crate.getName()).append(", ")); StringBuilder brokeCratesBuilder = new StringBuilder(); - this.crateManager.getBrokeCrates().forEach(crate -> brokeCratesBuilder.append("&c").append(crate).append(".yml&8,")); + this.crateManager.getBrokeCrates().forEach(crate -> brokeCratesBuilder.append("").append(crate).append(".yml,")); brokeCrates = brokeCratesBuilder.toString(); - sender.sendMessage(MsgUtils.color("&e&lCrates:&f " + crates)); + sender.sendRichMessage("Crates: " + crates); - if (!brokeCrates.isEmpty()) sender.sendMessage(MsgUtils.color("&6&lBroken Crates:&f " + brokeCrates.substring(0, brokeCrates.length() - 2))); + if (!brokeCrates.isEmpty()) sender.sendRichMessage("Broken Crates: " + brokeCrates.substring(0, brokeCrates.length() - 2)); - sender.sendMessage(MsgUtils.color("&e&lAll Crate Locations:")); - sender.sendMessage(MsgUtils.color("&c[ID]&8, &c[Crate]&8, &c[World]&8, &c[X]&8, &c[Y]&8, &c[Z]")); + sender.sendRichMessage("All Crate Locations:"); + sender.sendRichMessage("[ID], [Crate], [World], [X], [Y], [Z]"); int line = 1; for (CrateLocation loc : this.crateManager.getCrateLocations()) { @@ -246,7 +246,7 @@ public void onAdminList(CommandSender sender) { int y = loc.getLocation().getBlockY(); int z = loc.getLocation().getBlockZ(); - sender.sendMessage(MsgUtils.color("&8[&b" + line + "&8]: " + "&c" + loc.getID() + "&8, &c" + crate.getName() + "&8, &c" + world + "&8, &c" + x + "&8, &c" + y + "&8, &c" + z)); + sender.sendRichMessage("[" + line + "]: " + "" + loc.getID() + ", " + crate.getName() + ", " + world + ", " + x + ", " + y + ", " + z); line++; } @@ -272,13 +272,13 @@ public void onAdminTeleport(Player player, @Suggestion("locations") String id) { Location loc = new Location(world, x, y, z); player.teleportAsync(loc.add(.5, 0, .5)); - player.sendMessage(MsgUtils.getPrefix("&7You have been teleported to &6" + name + "&7.")); + player.sendRichMessage(MsgUtils.getPrefix("You have been teleported to " + name + ".")); return; } } - player.sendMessage(MsgUtils.getPrefix("&cThere is no location called &6" + id + "&c.")); + player.sendRichMessage(MsgUtils.getPrefix("There is no location called " + id + ".")); } @SubCommand("additem") @@ -287,7 +287,7 @@ public void onAdminCrateAddItem(Player player, @Suggestion("crates") String crat ItemStack item = player.getInventory().getItemInMainHand(); if (item.getType() == Material.AIR) { - player.sendMessage(Messages.no_item_in_hand.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.no_item_in_hand.getMessage(player, "{crate}", crateName)); return; } @@ -295,7 +295,7 @@ public void onAdminCrateAddItem(Player player, @Suggestion("crates") String crat Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null) { - player.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.not_a_crate.getMessage(player, "{crate}", crateName)); return; } @@ -317,7 +317,7 @@ public void onAdminCrateAddItem(Player player, @Suggestion("crates") String crat placeholders.put("{crate}", crate.getName()); placeholders.put("{prize}", prize); - player.sendMessage(Messages.added_item_with_editor.getMessage(placeholders, player)); + player.sendRichMessage(Messages.added_item_with_editor.getMessage(player, placeholders)); } @SubCommand("preview") @@ -326,13 +326,13 @@ public void onAdminCratePreview(CommandSender sender, @Suggestion("crates") Stri Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } if (!crate.isPreviewEnabled()) { - sender.sendMessage(Messages.preview_disabled.getMessage("{crate}", crate.getName(), sender)); + sender.sendRichMessage(Messages.preview_disabled.getMessage(sender, "{crate}", crate.getName())); return; } @@ -345,7 +345,7 @@ public void onAdminCratePreview(CommandSender sender, @Suggestion("crates") Stri @Permission(value = "crazycrates.command.admin.open.others", def = PermissionDefault.OP) public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") String crateName, @Suggestion("online-players") Player player, @Optional @Suggestion("key-types") KeyType keyType) { if (player == null) { - sender.sendMessage(Messages.not_online.getMessage(sender)); + sender.sendRichMessage(Messages.not_online.getMessage(sender)); return; } @@ -359,7 +359,7 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } @@ -370,13 +370,13 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - sender.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(sender, placeholders)); return; } if (this.crateManager.isInOpeningList(player)) { - sender.sendMessage(Messages.already_opening_crate.getMessage("{crate}", crate.getName(), sender)); + sender.sendRichMessage(Messages.already_opening_crate.getMessage(sender, "{crate}", crate.getName())); return; } @@ -384,7 +384,7 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S CrateType crateType = crate.getCrateType(); if (crateType == null) { - sender.sendMessage(Messages.internal_error.getMessage(sender)); + sender.sendRichMessage(Messages.internal_error.getMessage(sender)); this.plugin.getLogger().severe("An error has occurred: The crate type is null for the crate named " + crate.getName()); @@ -402,7 +402,7 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S placeholders.put("{crate}", crate.getName()); placeholders.put("{player}", player.getName()); - player.sendMessage(Messages.opened_a_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.opened_a_crate.getMessage(player, placeholders)); return; } @@ -423,13 +423,13 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S player.playSound(player.getLocation(), Sound.valueOf(this.config.getProperty(ConfigKeys.need_key_sound)), SoundCategory.PLAYERS, 1f, 1f); } - sender.sendMessage(Messages.no_virtual_key.getMessage("{crate}", crate.getName(), sender)); + sender.sendRichMessage(Messages.no_virtual_key.getMessage(sender, "{crate}", crate.getName())); return; } if (MiscUtils.isInventoryFull(player)) { - sender.sendMessage(Messages.inventory_not_empty.getMessage("{crate}", crate.getName(), sender)); + sender.sendRichMessage(Messages.inventory_not_empty.getMessage(sender, "{crate}", crate.getName())); return; } @@ -441,7 +441,7 @@ public void onAdminCrateOpenOthers(CommandSender sender, @Suggestion("crates") S placeholders.put("{crate}", crate.getName()); placeholders.put("{player}", player.getName()); - player.sendMessage(Messages.opened_a_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.opened_a_crate.getMessage(player, placeholders)); } @SubCommand("open") @@ -450,13 +450,13 @@ public void onAdminCrateOpen(Player player, @Suggestion("crates") String crateNa Crate crate = this.crateManager.getCrateFromName(crateName); if (MiscUtils.isInventoryFull(player)) { - player.sendMessage(Messages.inventory_not_empty.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.inventory_not_empty.getMessage(player, "{crate}", crate.getName())); return; } if (crate == null || crate.getCrateType() == CrateType.menu) { - player.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.not_a_crate.getMessage(player, "{crate}", crateName)); return; } @@ -467,13 +467,13 @@ public void onAdminCrateOpen(Player player, @Suggestion("crates") String crateNa placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); return; } if (this.crateManager.isInOpeningList(player)) { - player.sendMessage(Messages.already_opening_crate.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.already_opening_crate.getMessage(player, "{crate}", crate.getName())); return; } @@ -481,7 +481,7 @@ public void onAdminCrateOpen(Player player, @Suggestion("crates") String crateNa CrateType type = crate.getCrateType(); if (type == null) { - player.sendMessage(Messages.internal_error.getMessage(player)); + player.sendRichMessage(Messages.internal_error.getMessage(player)); this.plugin.getLogger().severe("An error has occurred: The crate type is null for the crate named " + crate.getName()); @@ -512,7 +512,7 @@ public void onAdminCrateOpen(Player player, @Suggestion("crates") String crateNa placeholders.put("{crate}", crate.getName()); placeholders.put("{key}", crate.getKeyName()); - player.sendMessage(Messages.no_keys.getMessage(placeholders, player)); + player.sendRichMessage(Messages.no_keys.getMessage(player, placeholders)); return; } @@ -526,7 +526,7 @@ public void onAdminCrateMassOpen(Player player, @Suggestion("crates") String cra KeyType type = KeyType.getFromName(keyType); if (type == null || type == KeyType.free_key) { - player.sendMessage(MsgUtils.color(MsgUtils.getPrefix() + "&cPlease use Virtual/V or Physical/P for a Key type.")); + player.sendRichMessage(MsgUtils.getPrefix() + "Please use Virtual/V or Physical/P for a Key type."); return; } @@ -534,7 +534,7 @@ public void onAdminCrateMassOpen(Player player, @Suggestion("crates") String cra Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null || crate.getCrateType() == CrateType.menu) { - player.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.not_a_crate.getMessage(player, "{crate}", crateName)); return; } @@ -545,7 +545,7 @@ public void onAdminCrateMassOpen(Player player, @Suggestion("crates") String cra placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); return; } @@ -554,7 +554,7 @@ public void onAdminCrateMassOpen(Player player, @Suggestion("crates") String cra int keysUsed = 0; if (keys == 0) { - player.sendMessage(Messages.no_virtual_key.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.no_virtual_key.getMessage(player, "{crate}", crateName)); return; } @@ -601,13 +601,13 @@ public void onAdminCrateSet(Player player, @Suggestion("crates") String crateNam Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null) { - player.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, player)); + player.sendRichMessage(Messages.not_a_crate.getMessage(player, "{crate}", crateName)); return; } if (crate.getCrateType() == CrateType.menu && !this.config.getProperty(ConfigKeys.enable_crate_menu)) { - player.sendMessage(Messages.cannot_set_type.getMessage(player)); + player.sendRichMessage(Messages.cannot_set_type.getMessage(player)); return; } @@ -615,7 +615,7 @@ public void onAdminCrateSet(Player player, @Suggestion("crates") String crateNam Block block = player.getTargetBlock(null, 5); if (block.isEmpty()) { - player.sendMessage(Messages.must_be_looking_at_block.getMessage(player)); + player.sendRichMessage(Messages.must_be_looking_at_block.getMessage(player)); return; } @@ -627,7 +627,7 @@ public void onAdminCrateSet(Player player, @Suggestion("crates") String crateNam placeholders.put("{crate}", crate.getName()); placeholders.put("{prefix}", MsgUtils.getPrefix()); - player.sendMessage(Messages.created_physical_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.created_physical_crate.getMessage(player, placeholders)); } @SubCommand("give-random") @@ -659,19 +659,19 @@ public void onAdminCrateGive(CommandSender sender, @Suggestion("key-types") Stri Crate crate = this.crateManager.getCrateFromName(crateName); if (type == null || type == KeyType.free_key) { - sender.sendMessage(MsgUtils.color(MsgUtils.getPrefix() + "&cPlease use Virtual/V or Physical/P for a Key type.")); + sender.sendRichMessage(MsgUtils.getPrefix() + "Please use Virtual/V or Physical/P for a Key type."); return; } if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } if (amount <= 0) { - sender.sendMessage(Messages.not_a_number.getMessage("{number}", String.valueOf(amount), sender)); + sender.sendRichMessage(Messages.not_a_number.getMessage(sender, "{number}", String.valueOf(amount))); return; } @@ -713,15 +713,15 @@ private void addKey(CommandSender sender, Player player, OfflinePlayer offlinePl boolean fullMessage = this.config.getProperty(ConfigKeys.notify_player_when_inventory_full); boolean inventoryCheck = this.config.getProperty(ConfigKeys.give_virtual_keys_when_inventory_full); - sender.sendMessage(Messages.gave_a_player_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.gave_a_player_keys.getMessage(sender, placeholders)); - if (!inventoryCheck || !fullMessage && !MiscUtils.isInventoryFull(player) && player.isOnline()) player.sendMessage(Messages.obtaining_keys.getMessage(placeholders, player)); + if (!inventoryCheck || !fullMessage && !MiscUtils.isInventoryFull(player) && player.isOnline()) player.sendRichMessage(Messages.obtaining_keys.getMessage(player, placeholders)); return; } if (!this.userManager.addOfflineKeys(offlinePlayer.getUniqueId(), crate.getName(), amount, type)) { - sender.sendMessage(Messages.internal_error.getMessage(sender)); + sender.sendRichMessage(Messages.internal_error.getMessage(sender)); } else { Map placeholders = new HashMap<>(); @@ -729,7 +729,7 @@ private void addKey(CommandSender sender, Player player, OfflinePlayer offlinePl placeholders.put("{keytype}", type.getFriendlyName()); placeholders.put("{player}", offlinePlayer.getName()); - sender.sendMessage(Messages.given_offline_player_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.given_offline_player_keys.getMessage(sender, placeholders)); } } @@ -741,19 +741,19 @@ public void onAdminCrateTake(CommandSender sender, @Suggestion("key-types") Stri Crate crate = this.crateManager.getCrateFromName(crateName); if (type == null || type == KeyType.free_key) { - sender.sendMessage(MsgUtils.color(MsgUtils.getPrefix() + "&cPlease use Virtual/V or Physical/P for a Key type.")); + sender.sendRichMessage(MsgUtils.getPrefix() + "Please use Virtual/V or Physical/P for a Key type."); return; } if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } if (amount <= 0) { - sender.sendMessage(Messages.not_a_number.getMessage("{number}", String.valueOf(amount), sender)); + sender.sendRichMessage(Messages.not_a_number.getMessage(sender, "{number}", String.valueOf(amount))); return; } @@ -786,7 +786,7 @@ private void takeKey(CommandSender sender, Player player, OfflinePlayer offlineP if (totalKeys < 1) { if (MiscUtils.isLogging()) this.plugin.getLogger().warning("The player " + player.getName() + " does not have enough keys to take."); - sender.sendMessage(Messages.cannot_take_keys.getMessage("{player}", player.getName(), sender)); + sender.sendRichMessage(Messages.cannot_take_keys.getMessage(sender, "{player}", player.getName())); return; } @@ -806,7 +806,7 @@ private void takeKey(CommandSender sender, Player player, OfflinePlayer offlineP placeholders.put("{keytype}", type.getFriendlyName()); placeholders.put("{player}", player.getName()); - sender.sendMessage(Messages.take_player_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.take_player_keys.getMessage(sender, placeholders)); return; } @@ -817,7 +817,7 @@ private void takeKey(CommandSender sender, Player player, OfflinePlayer offlineP placeholders.put("{keytype}", type.getFriendlyName()); placeholders.put("{player}", offlinePlayer.getName()); - sender.sendMessage(Messages.take_offline_player_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.take_offline_player_keys.getMessage(sender, placeholders)); this.userManager.takeOfflineKeys(offlinePlayer.getUniqueId(), crate.getName(), amount, type); } @@ -828,7 +828,7 @@ public void onAdminCrateGiveAllKeys(CommandSender sender, @Suggestion("key-types KeyType type = KeyType.getFromName(keyType); if (type == null || type == KeyType.free_key) { - sender.sendMessage(MsgUtils.color(MsgUtils.getPrefix() + "&cPlease use Virtual/V or Physical/P for a Key type.")); + sender.sendRichMessage(MsgUtils.getPrefix() + "Please use Virtual/V or Physical/P for a Key type."); return; } @@ -836,7 +836,7 @@ public void onAdminCrateGiveAllKeys(CommandSender sender, @Suggestion("key-types Crate crate = this.crateManager.getCrateFromName(crateName); if (crate == null || crate.getCrateType() == CrateType.menu) { - sender.sendMessage(Messages.not_a_crate.getMessage("{crate}", crateName, sender)); + sender.sendRichMessage(Messages.not_a_crate.getMessage(sender, "{crate}", crateName)); return; } @@ -847,7 +847,7 @@ public void onAdminCrateGiveAllKeys(CommandSender sender, @Suggestion("key-types placeholders.put("{keytype}", type.getFriendlyName()); placeholders.put("{key}", crate.getKeyName()); - sender.sendMessage(Messages.given_everyone_keys.getMessage(placeholders, sender)); + sender.sendRichMessage(Messages.given_everyone_keys.getMessage(sender, placeholders)); for (Player onlinePlayer : this.plugin.getServer().getOnlinePlayers()) { if (Permissions.CRAZYCRATES_PLAYER_EXCLUDE.hasPermission(onlinePlayer)) continue; @@ -857,7 +857,7 @@ public void onAdminCrateGiveAllKeys(CommandSender sender, @Suggestion("key-types if (event.isCancelled()) return; - onlinePlayer.sendMessage(Messages.obtaining_keys.getMessage(placeholders, onlinePlayer)); + onlinePlayer.sendRichMessage(Messages.obtaining_keys.getMessage(onlinePlayer, placeholders)); if (crate.getCrateType() == CrateType.crate_on_the_go) { onlinePlayer.getInventory().addItem(crate.getKey(amount, onlinePlayer)); diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/CrateControlListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/CrateControlListener.java index 06abd6e8e..8f905da8f 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/listeners/CrateControlListener.java +++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/CrateControlListener.java @@ -77,7 +77,7 @@ public void onLeftClickCrate(PlayerInteractEvent event) { if (crateLocation.getLocation().equals(clickedBlock.getLocation())) { this.crateManager.removeCrateLocation(crateLocation.getID()); - player.sendMessage(Messages.removed_physical_crate.getMessage("{id}", crateLocation.getID(), player)); + player.sendRichMessage(Messages.removed_physical_crate.getMessage(player, "{id}", crateLocation.getID())); } return; @@ -91,7 +91,7 @@ public void onLeftClickCrate(PlayerInteractEvent event) { this.inventoryManager.addViewer(player); this.inventoryManager.openNewCratePreview(player, crateLocation.getCrate()); } else { - player.sendMessage(Messages.preview_disabled.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.preview_disabled.getMessage(player, "{crate}", crate.getName())); } } @@ -134,7 +134,7 @@ public void onRightClick(PlayerInteractEvent event) { player.openInventory(crateMainMenu.build().getInventory()); } else { - player.sendMessage(Messages.feature_disabled.getMessage(player)); + player.sendRichMessage(Messages.feature_disabled.getMessage(player)); } return; @@ -162,7 +162,7 @@ public void onRightClick(PlayerInteractEvent event) { placeholders.put("{crate}", crate.getPreviewName()); placeholders.put("{amount}", String.valueOf(totalKeys)); - player.sendMessage(Messages.required_keys.getMessage(placeholders, player)); + player.sendRichMessage(Messages.required_keys.getMessage(player, placeholders)); return; } @@ -189,20 +189,20 @@ public void onRightClick(PlayerInteractEvent event) { if (!useQuickCrateAgain) { if (this.crateManager.isInOpeningList(player)) { - player.sendMessage(Messages.already_opening_crate.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.already_opening_crate.getMessage(player, "{crate}", crate.getName())); return; } if (this.crateManager.getCratesInUse().containsValue(crateLocation.getLocation())) { - player.sendMessage(Messages.crate_in_use.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.crate_in_use.getMessage(player, "{crate}", crate.getName())); return; } } if (MiscUtils.isInventoryFull(player)) { - player.sendMessage(Messages.inventory_not_empty.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.inventory_not_empty.getMessage(player, "{crate}", crate.getName())); return; } @@ -228,7 +228,7 @@ public void onRightClick(PlayerInteractEvent event) { player.playSound(player.getLocation(), Sound.valueOf(this.config.getProperty(ConfigKeys.need_key_sound)), SoundCategory.PLAYERS, 1f, 1f); } - player.sendMessage(Messages.no_keys.getMessage(placeholders, player)); + player.sendRichMessage(Messages.no_keys.getMessage(player, placeholders)); } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java index 892d7a9cd..c2873619a 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java +++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java @@ -3,6 +3,10 @@ import com.badbones69.crazycrates.api.events.PlayerPrizeEvent; import com.badbones69.crazycrates.api.events.PlayerReceiveKeyEvent; import com.badbones69.crazycrates.api.builders.ItemBuilder; +import com.ryderbelserion.vital.enums.Support; +import com.ryderbelserion.vital.util.MiscUtil; +import me.clip.placeholderapi.PlaceholderAPI; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.java.JavaPlugin; import us.crazycrew.crazycrates.platform.config.ConfigManager; import us.crazycrew.crazycrates.platform.config.impl.ConfigKeys; @@ -299,7 +303,7 @@ public void onInventoryClick(InventoryClickEvent event) { placeholders.put("{key}", crate.getKeyName()); // Send no keys message. - player.sendMessage(Messages.no_keys.getMessage(placeholders, player)); + player.sendRichMessage(Messages.no_keys.getMessage(player, placeholders)); // Remove opening stuff. this.crateManager.removePlayerFromOpeningList(player); @@ -318,9 +322,9 @@ public void onInventoryClick(InventoryClickEvent event) { return; } - boolean hasKey = this.crateManager.hasPlayerKeyType(player) && !this.userManager.takeKeys(1, uuid, crateName, type, this.crateManager.getHand(player)); + boolean cannotTakeKey = this.crateManager.hasPlayerKeyType(player) && !this.userManager.takeKeys(1, uuid, crateName, type, this.crateManager.getHand(player)); - if (hasKey) { + if (cannotTakeKey) { // Notify player/console. MiscUtils.failedToTakeKey(player, crateName); @@ -345,13 +349,24 @@ public void onInventoryClick(InventoryClickEvent event) { // Update the cosmic name. holder.title(shufflingName); - - // Set the new title. - view.setTitle(MsgUtils.color(shufflingName)); + holder.sendTitleChange(); // Clear the top inventory. view.getTopInventory().clear(); + FileConfiguration configuration = crate.getFile(); + + String broadcastMessage = configuration.getString("Crate.BroadCast", ""); + boolean broadcastToggle = configuration.contains("Crate.OpeningBroadCast") && configuration.getBoolean("Crate.OpeningBroadCast"); + + if (broadcastToggle) { + if (!broadcastMessage.isBlank()) { + String builder = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(player, broadcastMessage) : broadcastMessage; + + this.plugin.getServer().broadcast(MiscUtil.parse(builder.replaceAll("%prefix%", MsgUtils.getPrefix()).replaceAll("%player%", player.getName()))); + } + } + this.crateManager.addRepeatingCrateTask(player, new TimerTask() { int time = 0; @@ -383,7 +398,7 @@ public void run() { cosmicCrateManager.removePickedPlayer(player); // Send refund notices. - player.sendMessage(MsgUtils.getPrefix("&cAn issue has occurred and so a key refund was given.")); + player.sendRichMessage(MsgUtils.getPrefix("An issue has occurred and so a key refund was given.")); plugin.getLogger().log(Level.SEVERE, "An issue occurred when the user " + player.getName() + " was using the " + crate.getName() + " crate and so they were issued a key refund.", exception); // Play a sound @@ -434,8 +449,7 @@ private void showRewards(Player player, InventoryView view, CratePrizeMenu cosmi String rewardsName = cosmic.getCrate().getCrateInventoryName() + " - Prizes"; cosmic.title(rewardsName); - - view.setTitle(MsgUtils.color(rewardsName)); + cosmic.sendTitleChange(); view.getTopInventory().clear(); diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CrateOpenListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CrateOpenListener.java index 417cc6808..874e461f3 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CrateOpenListener.java +++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CrateOpenListener.java @@ -7,6 +7,7 @@ import com.badbones69.crazycrates.api.events.CrateOpenEvent; import com.badbones69.crazycrates.api.objects.Crate; import com.ryderbelserion.vital.enums.Support; +import com.ryderbelserion.vital.util.MiscUtil; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -33,7 +34,7 @@ public void onCrateOpen(CrateOpenEvent event) { if (crate.getCrateType() != CrateType.menu) { if (!crate.canWinPrizes(player)) { - player.sendMessage(Messages.no_prizes_found.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.no_prizes_found.getMessage(player, "{crate}", crate.getName())); this.crateManager.removePlayerFromOpeningList(player); this.crateManager.removePlayerKeyType(player); @@ -45,7 +46,7 @@ public void onCrateOpen(CrateOpenEvent event) { } if (!player.hasPermission("crazycrates.open." + crate.getName()) || !player.hasPermission("crazycrates.open." + crate.getName().toLowerCase())) { - player.sendMessage(Messages.no_crate_permission.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.no_crate_permission.getMessage(player, "{crate}", crate.getName())); this.crateManager.removePlayerFromOpeningList(player); this.crateManager.removeCrateInUse(player); @@ -64,11 +65,11 @@ public void onCrateOpen(CrateOpenEvent event) { String broadcastMessage = configuration.getString("Crate.BroadCast", ""); boolean broadcastToggle = configuration.contains("Crate.OpeningBroadCast") && configuration.getBoolean("Crate.OpeningBroadCast"); - if (broadcastToggle) { + if (broadcastToggle && crate.getCrateType() != CrateType.cosmic) { if (!broadcastMessage.isBlank()) { String builder = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(player, broadcastMessage) : broadcastMessage; - this.plugin.getServer().broadcastMessage(MsgUtils.color(builder.replaceAll("%prefix%", MsgUtils.getPrefix())).replaceAll("%player%", player.getName())); + this.plugin.getServer().broadcast(MiscUtil.parse(builder.replaceAll("%prefix%", MsgUtils.getPrefix()).replaceAll("%player%", player.getName()))); } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/QuadCrateListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/QuadCrateListener.java index e2b386625..39114f2ab 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/QuadCrateListener.java +++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/QuadCrateListener.java @@ -179,7 +179,7 @@ public void onCommandProcess(PlayerCommandPreprocessEvent event) { placeholders.put("{player}", player.getName()); - player.sendMessage(Messages.no_commands_while_in_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.no_commands_while_in_crate.getMessage(player, placeholders)); } } @@ -198,7 +198,7 @@ public void onPlayerTeleport(PlayerTeleportEvent event) { placeholders.put("{player}", player.getName()); - player.sendMessage(Messages.no_teleporting.getMessage(placeholders, player)); + player.sendRichMessage(Messages.no_teleporting.getMessage(player, placeholders)); } } diff --git a/paper/src/main/java/com/badbones69/crazycrates/scheduler/FoliaRunnable.java b/paper/src/main/java/com/badbones69/crazycrates/scheduler/FoliaRunnable.java index 4af940741..eeccdadba 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/scheduler/FoliaRunnable.java +++ b/paper/src/main/java/com/badbones69/crazycrates/scheduler/FoliaRunnable.java @@ -6,7 +6,6 @@ import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; - import java.util.concurrent.TimeUnit; public abstract class FoliaRunnable implements Runnable { @@ -23,7 +22,6 @@ public abstract class FoliaRunnable implements Runnable { private int chunkX; private int chunkZ; - public FoliaRunnable(@NotNull AsyncScheduler scheduler, @Nullable TimeUnit timeUnit) { this.asyncScheduler = scheduler; this.timeUnit = timeUnit; @@ -76,7 +74,7 @@ public ScheduledTask run(@NotNull Plugin plugin) throws IllegalArgumentException } else { throw new UnsupportedOperationException("The region type is not supported."); } - } else if (this.asyncScheduler != null){ + } else if (this.asyncScheduler != null) { return setupTask(this.asyncScheduler.runNow(plugin, scheduledTask -> this.run())); } else { throw new UnsupportedOperationException("The task type is not supported."); @@ -181,6 +179,7 @@ private void checkNotYetScheduled() { @NotNull private ScheduledTask setupTask(final ScheduledTask task) { this.task = task; + return task; } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/HologramManager.java b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/HologramManager.java index 93e9591ec..c57d01078 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/HologramManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/HologramManager.java @@ -1,11 +1,18 @@ package com.badbones69.crazycrates.support.holograms; +import com.badbones69.crazycrates.CrazyCrates; import com.badbones69.crazycrates.api.objects.Crate; +import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public abstract class HologramManager { + + protected CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class); public abstract void createHologram(Location location, Crate crate); @@ -22,4 +29,15 @@ protected String name() { protected Vector getVector(Crate crate) { return new Vector(0.5, crate.getHologram().getHeight(), 0.5); } + + protected String color(String message) { + Matcher matcher = Pattern.compile("#[a-fA-F\\d]{6}").matcher(message); + StringBuilder buffer = new StringBuilder(); + + while (matcher.find()) { + matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString()); + } + + return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(buffer).toString()); + } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/CMIHologramsSupport.java b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/CMIHologramsSupport.java index af5cf9362..92128c773 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/CMIHologramsSupport.java +++ b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/CMIHologramsSupport.java @@ -9,7 +9,9 @@ import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.support.holograms.HologramManager; import us.crazycrew.crazycrates.api.enums.types.CrateType; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public class CMIHologramsSupport extends HologramManager { @@ -26,7 +28,11 @@ public void createHologram(Location location, Crate crate) { CMIHologram hologram = new CMIHologram(name(), new CMILocation(location.clone().add(getVector(crate)))); - hologram.setLines(crateHologram.getMessages()); + List lines = new ArrayList<>(); + + crateHologram.getMessages().forEach(line -> lines.add(color(line))); + + hologram.setLines(lines); hologram.setShowRange(crateHologram.getRange()); CMI.getInstance().getHologramManager().addHologram(hologram); diff --git a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/DecentHologramsSupport.java b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/DecentHologramsSupport.java index c39cea4ea..473580787 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/DecentHologramsSupport.java +++ b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/DecentHologramsSupport.java @@ -2,7 +2,6 @@ import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.api.utils.MiscUtils; -import com.badbones69.crazycrates.api.utils.MsgUtils; import eu.decentsoftware.holograms.api.DHAPI; import org.bukkit.Location; import eu.decentsoftware.holograms.api.holograms.Hologram; @@ -26,7 +25,7 @@ public void createHologram(Location location, Crate crate) { Hologram hologram = DHAPI.createHologram(name(), location.clone().add(getVector(crate))); - crateHologram.getMessages().forEach(line -> DHAPI.addHologramLine(hologram, MsgUtils.color(line))); + crateHologram.getMessages().forEach(line -> DHAPI.addHologramLine(hologram, color(line))); hologram.setDisplayRange(crateHologram.getRange()); diff --git a/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/FancyHologramsSupport.java b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/FancyHologramsSupport.java new file mode 100644 index 000000000..f813fa03e --- /dev/null +++ b/paper/src/main/java/com/badbones69/crazycrates/support/holograms/types/FancyHologramsSupport.java @@ -0,0 +1,79 @@ +package com.badbones69.crazycrates.support.holograms.types; + +import com.badbones69.crazycrates.api.objects.Crate; +import com.badbones69.crazycrates.api.utils.MiscUtils; +import com.badbones69.crazycrates.scheduler.FoliaRunnable; +import com.badbones69.crazycrates.support.holograms.HologramManager; +import de.oliver.fancyholograms.api.FancyHologramsPlugin; +import de.oliver.fancyholograms.api.Hologram; +import de.oliver.fancyholograms.api.HologramType; +import de.oliver.fancyholograms.api.data.DisplayHologramData; +import de.oliver.fancyholograms.api.data.HologramData; +import de.oliver.fancyholograms.api.data.TextHologramData; +import org.bukkit.Location; +import org.bukkit.entity.Display; +import us.crazycrew.crazycrates.api.crates.CrateHologram; +import us.crazycrew.crazycrates.api.enums.types.CrateType; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +public class FancyHologramsSupport extends HologramManager { + + private final Map holograms = new HashMap<>(); + + private final de.oliver.fancyholograms.api.HologramManager manager = FancyHologramsPlugin.get().getHologramManager(); + + @Override + public void createHologram(Location location, Crate crate) { + if (crate.getCrateType() == CrateType.menu) return; + + CrateHologram crateHologram = crate.getHologram(); + + if (!crateHologram.isEnabled()) return; + + DisplayHologramData displayData = DisplayHologramData.getDefault(location.clone().add(getVector(crate))).setBillboard(Display.Billboard.CENTER).setVisibilityDistance(crateHologram.getRange()); + + TextHologramData textData = TextHologramData.getDefault(name()); + textData.setText(crateHologram.getMessages()); + + HologramData hologramData = new HologramData(name(), displayData, HologramType.TEXT, textData); + + Hologram hologram = this.manager.create(hologramData); + + this.manager.addHologram(hologram); + + new FoliaRunnable(this.plugin.getServer().getAsyncScheduler(), TimeUnit.SECONDS) { + @Override + public void run() { + hologram.showHologram(plugin.getServer().getOnlinePlayers()); + } + }.run(this.plugin); + + this.holograms.put(MiscUtils.location(location), hologram); + this.manager.saveHolograms(); + } + + @Override + public void removeHologram(Location location) { + Hologram hologram = this.holograms.remove(MiscUtils.location(location)); + + if (hologram != null) { + this.manager.removeHologram(hologram); + this.manager.saveHolograms(); + } + } + + @Override + public void removeAllHolograms() { + this.holograms.forEach((key, value) -> this.manager.removeHologram(value)); + this.holograms.clear(); + + this.manager.reloadHolograms(); + } + + @Override + public boolean isEmpty() { + return this.holograms.isEmpty(); + } +} \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/BukkitUserManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/BukkitUserManager.java index 9df4a7cd2..833f0c29d 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/BukkitUserManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/BukkitUserManager.java @@ -142,7 +142,7 @@ public void addKeys(int amount, UUID uuid, String crateName, KeyType keyType) { placeholders.put("{keytype}", keyType.getFriendlyName()); placeholders.put("{key}", crate.getKeyName()); - player.sendMessage(Messages.cannot_give_player_keys.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cannot_give_player_keys.getMessage(player, placeholders)); } return; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java index e840d6594..d9554a457 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java @@ -7,6 +7,7 @@ import com.badbones69.crazycrates.api.ChestManager; import com.badbones69.crazycrates.api.builders.ItemBuilder; import com.badbones69.crazycrates.api.utils.MiscUtils; +import com.badbones69.crazycrates.support.holograms.types.FancyHologramsSupport; import com.badbones69.crazycrates.tasks.InventoryManager; import com.badbones69.crazycrates.tasks.crates.types.*; import com.badbones69.crazycrates.tasks.crates.types.CasinoCrate; @@ -171,6 +172,10 @@ public void loadHolograms() { this.holograms = new CMIHologramsSupport(); if (MiscUtils.isLogging()) this.plugin.getLogger().info("CMI Hologram support has been enabled."); + } else if (Support.fancy_holograms.isEnabled()) { + this.holograms = new FancyHologramsSupport(); + + if (MiscUtils.isLogging()) this.plugin.getLogger().info("FancyHolograms support has been enabled."); } else { if (MiscUtils.isLogging()) { List.of( @@ -309,7 +314,7 @@ public void loadCrates() { List prizeCommands = file.contains("Crate.Prize-Commands") ? file.getStringList("Crate.Prize-Commands") : Collections.emptyList(); CrateHologram holo = new CrateHologram(file.getBoolean("Crate.Hologram.Toggle"), file.getDouble("Crate.Hologram.Height", 0.0), file.getInt("Crate.Hologram.Range", 8), file.getStringList("Crate.Hologram.Message")); - addCrate(new Crate(crateName, previewName, crateType, getKey(file), file.getString("Crate.PhysicalKey.Name"), prizes, file, newPlayersKeys, tiers, maxMassOpen, requiredKeys, prizeMessage, prizeCommands, holo)); + addCrate(new Crate(crateName, previewName, crateType, getKey(file), file.getString("Crate.PhysicalKey.Name", "Crate.PhysicalKey.Name is missing from " + crateName + ".yml"), prizes, file, newPlayersKeys, tiers, maxMassOpen, requiredKeys, prizeMessage, prizeCommands, holo)); Permission doesExist = this.plugin.getServer().getPluginManager().getPermission("crazycrates.open." + crateName); @@ -447,7 +452,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca return; } - player.sendMessage(Messages.feature_disabled.getMessage(player)); + player.sendRichMessage(Messages.feature_disabled.getMessage(player)); return; } @@ -469,7 +474,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); removePlayerFromOpeningList(player); @@ -481,7 +486,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca case fire_cracker -> { if (this.cratesInUse.containsValue(location)) { - player.sendMessage(Messages.crate_in_use.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.crate_in_use.getMessage(player, "{crate}", crate.getName())); removePlayerFromOpeningList(player); @@ -494,7 +499,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); removePlayerFromOpeningList(player); @@ -511,7 +516,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); removePlayerFromOpeningList(player); @@ -523,7 +528,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca case quick_crate -> { if (this.cratesInUse.containsValue(location)) { - player.sendMessage(Messages.crate_in_use.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.crate_in_use.getMessage(player, "{crate}", crate.getName())); removePlayerFromOpeningList(player); @@ -536,7 +541,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca placeholders.put("{cratetype}", crate.getCrateType().getName()); placeholders.put("{crate}", crate.getName()); - player.sendMessage(Messages.cant_be_a_virtual_crate.getMessage(placeholders, player)); + player.sendRichMessage(Messages.cant_be_a_virtual_crate.getMessage(player, placeholders)); removePlayerFromOpeningList(player); @@ -551,7 +556,7 @@ public void openCrate(Player player, Crate crate, KeyType keyType, Location loca if (MiscUtils.isLogging()) { List.of( - crate.getCrateInventoryName() + " has an invalid crate type. Your Value: " + crate.getFile().getString("Crate.CrateType"), + crate.getName() + " has an invalid crate type. Your Value: " + crate.getFile().getString("Crate.CrateType", "CSGO"), "We will use " + CrateType.csgo.getName() + " until you change the crate type.", "Valid Crate Types: CSGO/Casino/Cosmic/QuadCrate/QuickCrate/Roulette/CrateOnTheGo/FireCracker/Wonder/Wheel/War" ).forEach(line -> this.plugin.getLogger().warning(line)); diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/CosmicCrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/CosmicCrateManager.java index bd4726458..dc712bf4c 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/CosmicCrateManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/CosmicCrateManager.java @@ -40,9 +40,9 @@ public CosmicCrateManager(FileConfiguration file) { this.mysteryCrate = new ItemBuilder() .setMaterial(file.getString(path + "Mystery-Crate.Item", "CHEST")) - .setName(file.getString(path + "Mystery-Crate.Name", "&f&l???")) + .setName(file.getString(path + "Mystery-Crate.Name", "???")) .hideItemFlags(file.getBoolean(path + "Mystery-Crate.HideItemFlags", false)) - .setLore(file.contains(path + "Mystery-Crate.Lore") ? file.getStringList(path + "Mystery-Crate.Lore") : Collections.singletonList("&7You may choose 4 crates.")); + .setLore(file.contains(path + "Mystery-Crate.Lore") ? file.getStringList(path + "Mystery-Crate.Lore") : Collections.singletonList("You may choose 4 crates.")); ItemMeta mysteryItemMeta = this.mysteryCrate.getItemMeta(); @@ -56,9 +56,9 @@ public CosmicCrateManager(FileConfiguration file) { this.pickedCrate = new ItemBuilder() .setMaterial(file.getString(path + "Picked-Crate.Item", Material.GLASS_PANE.toString())) - .setName(file.getString(path + "Picked-Crate.Name", "&f&l???")) + .setName(file.getString(path + "Picked-Crate.Name", "???")) .hideItemFlags(file.getBoolean(path + "Picked-Crate.HideItemFlags", false)) - .setLore(file.contains(path + "Picked-Crate.Lore") ? file.getStringList(path + "Picked-Crate.Lore") : Collections.singletonList("&7You have chosen #%slot%.")); + .setLore(file.contains(path + "Picked-Crate.Lore") ? file.getStringList(path + "Picked-Crate.Lore") : Collections.singletonList("You have chosen #%slot%.")); ItemMeta pickedCrateMeta = this.pickedCrate.getItemMeta(); diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java index 979d5ea7c..c62726549 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java @@ -119,7 +119,7 @@ public QuadCrateManager(Player player, Crate crate, KeyType keyType, Location sp public void startCrate() { // Check if it is on a block. if (this.spawnLocation.clone().subtract(0, 1, 0).getBlock().getType() == Material.AIR) { - this.player.sendMessage(Messages.not_on_block.getMessage(player)); + this.player.sendRichMessage(Messages.not_on_block.getMessage(player)); this.crateManager.removePlayerFromOpeningList(player); @@ -130,7 +130,7 @@ public void startCrate() { // Check if schematic folder is empty. if (this.crateManager.getCrateSchematics().isEmpty()) { - this.player.sendMessage(Messages.no_schematics_found.getMessage(player)); + this.player.sendRichMessage(Messages.no_schematics_found.getMessage(player)); this.crateManager.removePlayerFromOpeningList(this.player); @@ -150,7 +150,7 @@ public void startCrate() { for (Location loc : structureLocations) { if (this.handler.getBlockBlackList().contains(loc.getBlock().getType())) { - this.player.sendMessage(Messages.needs_more_room.getMessage(player)); + this.player.sendRichMessage(Messages.needs_more_room.getMessage(player)); this.crateManager.removePlayerFromOpeningList(this.player); @@ -168,7 +168,7 @@ public void startCrate() { if (entity instanceof Player) { for (QuadCrateManager ongoingCrate : crateSessions) { if (entity.getUniqueId() == ongoingCrate.player.getUniqueId()) { - this.player.sendMessage(Messages.too_close_to_another_player.getMessage("{player}", entity.getName(), player)); + this.player.sendRichMessage(Messages.too_close_to_another_player.getMessage(player, "{player}", entity.getName())); this.crateManager.removePlayerFromOpeningList(this.player); @@ -258,7 +258,7 @@ public void run() { public void run() { endCrate(true); - player.sendMessage(Messages.out_of_time.getMessage("{crate}", crate.getName(), player)); + player.sendRichMessage(Messages.out_of_time.getMessage(player, "{crate}", crate.getName())); crate.playSound(player, player.getLocation(), "stop-sound", "ENTITY_PLAYER_LEVELUP", SoundCategory.PLAYERS); } diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/WarCrate.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/WarCrate.java index 66a505bca..276735d25 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/WarCrate.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/WarCrate.java @@ -99,7 +99,7 @@ private void setRandomGlass() { if (this.colorCodes.isEmpty()) getColorCode(); ItemBuilder builder = MiscUtils.getRandomPaneColor(); - builder.setName("&" + this.colorCodes.get(builder.build()) + "&l???"); + builder.setName("<" + this.colorCodes.get(builder.build()) + ">???"); ItemStack item = builder.build(); for (int index = 0; index < 9; index++) { @@ -108,22 +108,22 @@ private void setRandomGlass() { } private void getColorCode() { - this.colorCodes.put(new ItemBuilder().setMaterial(Material.WHITE_STAINED_GLASS_PANE).build(), "f"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.ORANGE_STAINED_GLASS_PANE).build(), "6"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.MAGENTA_STAINED_GLASS_PANE).build(), "d"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIGHT_BLUE_STAINED_GLASS_PANE).build(), "3"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.YELLOW_STAINED_GLASS_PANE).build(), "e"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIME_STAINED_GLASS_PANE).build(), "a"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.PINK_STAINED_GLASS_PANE).build(), "c"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.GRAY_STAINED_GLASS_PANE).build(), "7"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIGHT_GRAY_STAINED_GLASS_PANE).build(), "7"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.CYAN_STAINED_GLASS_PANE).build(), "3"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.PURPLE_STAINED_GLASS_PANE).build(), "5"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.BLUE_STAINED_GLASS_PANE).build(), "9"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.BROWN_STAINED_GLASS_PANE).build(), "6"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.GREEN_STAINED_GLASS_PANE).build(), "2"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.RED_STAINED_GLASS_PANE).build(), "4"); - this.colorCodes.put(new ItemBuilder().setMaterial(Material.BLACK_STAINED_GLASS_PANE).build(), "8"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.WHITE_STAINED_GLASS_PANE).build(), "white"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.ORANGE_STAINED_GLASS_PANE).build(), "gold"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.MAGENTA_STAINED_GLASS_PANE).build(), "light_purple"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIGHT_BLUE_STAINED_GLASS_PANE).build(), "dark_aqua"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.YELLOW_STAINED_GLASS_PANE).build(), "yellow"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIME_STAINED_GLASS_PANE).build(), "green"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.PINK_STAINED_GLASS_PANE).build(), "red"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.GRAY_STAINED_GLASS_PANE).build(), "dark_gray"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.LIGHT_GRAY_STAINED_GLASS_PANE).build(), "gray"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.CYAN_STAINED_GLASS_PANE).build(), "aqua"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.PURPLE_STAINED_GLASS_PANE).build(), "dark_purple"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.BLUE_STAINED_GLASS_PANE).build(), "dark_blue"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.BROWN_STAINED_GLASS_PANE).build(), "gold"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.GREEN_STAINED_GLASS_PANE).build(), "green"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.RED_STAINED_GLASS_PANE).build(), "dark_red"); + this.colorCodes.put(new ItemBuilder().setMaterial(Material.BLACK_STAINED_GLASS_PANE).build(), "black"); } @Override diff --git a/paper/src/main/resources/config.yml b/paper/src/main/resources/config.yml index 6e589a59f..4a7a0ebeb 100644 --- a/paper/src/main/resources/config.yml +++ b/paper/src/main/resources/config.yml @@ -11,14 +11,12 @@ root: verbose_logging: true # This option will let you test a different way of picking random numbers. If you have any issues, You can set it back to false. use-different-random: false - # Sends anonymous statistics about how the plugin is used to bstats.org. - # bstats is a service for plugin developers to find out how the plugin being used, - # This information helps us figure out how to better improve the plugin. - toggle_metrics: true + # This will wipe the example folder on /crazycrates reload or plugin startup so you always have fresh examples to look at. + update-examples-folder: true # The prefix used in commands - command_prefix: '&8[&bCrazyCrates&8]: ' + command_prefix: "[CrazyCrates]: " # The prefix used in console - console_prefix: '&8[&bCrazyCrates&8] ' + console_prefix: "[CrazyCrates] " # Settings related to guis. gui: # If /crates should open the main menu. Warning: This will remove the menu button from crate previews. @@ -26,7 +24,7 @@ gui: # Inventory settings like size. inventory: # The name of the gui. - name: '&b&lCrazy &4&lCrates' + name: "Crazy Crates" # The size of the gui. Valid sizes are 9,18,27,36,45 size: 45 # The buttons in the gui. @@ -34,44 +32,44 @@ gui: # The main menu button. menu: # The item the button should be. - item: COMPASS + item: "COMPASS" override: # This will disable our current functionality of our main menu button in crate previews. # It allows you to override and use a menu of your choice from your plugin using a command. toggle: false # A list of commands to run when the main menu button is clicked. The override option above has to be set to true. list: - - see {player} + - "see {player}" # The name of the item. - name: '&7&l>> &c&lMenu &7&l<<' + name: "» Menu «" # The lore of the item. lore: - - '&7Return to the menu.' + - "Return to the menu." # The next button. next: # The item the button should be. - item: FEATHER + item: "FEATHER" # The name of the item. - name: '&6&lNext >>' + name: "Next »" # The lore of the item. lore: - - '&7&lPage: &b{page}' + - "Page: {page}" # The back button. back: # The item the button should be. - item: FEATHER + item: "FEATHER" # The name of the item. - name: '&6&l<< Back' + name: "« Back" # The lore of the item. lore: - - '&7&lPage: &b{page}' + - "Page: {page}" filler: # Should the menu should be filled with one type of item? toggle: false # The item to fill the menu with. - item: BLACK_STAINED_GLASS_PANE + item: "BLACK_STAINED_GLASS_PANE" # The name of the item. - name: ' ' + name: " " # The lore of the item. lore: [] customizer: @@ -79,48 +77,48 @@ gui: toggle: true # The items to set to the gui. items: - - 'slot:1, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:2, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:3, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:4, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:5, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:6, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:7, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:8, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:9, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:37, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:38, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:39, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:40, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:41, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:42, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:43, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:44, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:45, item:RED_STAINED_GLASS_PANE, name: ' - - 'slot:10, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:19, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:28, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:18, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:27, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:36, item:BLUE_STAINED_GLASS_PANE, name: ' - - 'slot:11, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:13, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:15, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:25, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:17, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:20, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:21, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:22, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:23, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:24, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:25, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:26, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:29, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:31, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:32, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:33, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:34, item:CYAN_STAINED_GLASS_PANE, name: ' - - 'slot:35, item:CYAN_STAINED_GLASS_PANE, name: ' + - "slot:1, item:RED_STAINED_GLASS_PANE, name: " + - "slot:2, item:RED_STAINED_GLASS_PANE, name: " + - "slot:3, item:RED_STAINED_GLASS_PANE, name: " + - "slot:4, item:RED_STAINED_GLASS_PANE, name: " + - "slot:5, item:RED_STAINED_GLASS_PANE, name: " + - "slot:6, item:RED_STAINED_GLASS_PANE, name: " + - "slot:7, item:RED_STAINED_GLASS_PANE, name: " + - "slot:8, item:RED_STAINED_GLASS_PANE, name: " + - "slot:9, item:RED_STAINED_GLASS_PANE, name: " + - "slot:37, item:RED_STAINED_GLASS_PANE, name: " + - "slot:38, item:RED_STAINED_GLASS_PANE, name: " + - "slot:39, item:RED_STAINED_GLASS_PANE, name: " + - "slot:40, item:RED_STAINED_GLASS_PANE, name: " + - "slot:41, item:RED_STAINED_GLASS_PANE, name: " + - "slot:42, item:RED_STAINED_GLASS_PANE, name: " + - "slot:43, item:RED_STAINED_GLASS_PANE, name: " + - "slot:44, item:RED_STAINED_GLASS_PANE, name: " + - "slot:45, item:RED_STAINED_GLASS_PANE, name: " + - "slot:10, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:19, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:28, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:18, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:27, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:36, item:BLUE_STAINED_GLASS_PANE, name: " + - "slot:11, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:13, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:15, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:25, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:17, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:20, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:21, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:22, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:23, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:24, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:25, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:26, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:29, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:31, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:32, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:33, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:34, item:CYAN_STAINED_GLASS_PANE, name: " + - "slot:35, item:CYAN_STAINED_GLASS_PANE, name: " # Settings related to crates. crate: # Whether to show the display item when opening QuickCrate @@ -142,7 +140,7 @@ crate: # Send a message if they were forced out of the preview. send-message: false # If a player gets to the menu related to the Prizes gui, Should they be timed out? - # + # # It will wait 10 seconds and if they already collected 3 prizes, It will only give one prize. cosmic-crate-timeout: true # Settings related to how keys function. @@ -153,7 +151,7 @@ crate: physical-crate-accepts-physical-keys: true # Should a physical crate accept physical keys? virtual-crate-accepts-physical-keys: true - # Settings related to a player's inventory is not empty. + # Settings related to a player"s inventory is not empty. inventory-settings: # Should the player should be given virtual keys if inventory is not empty? If you leave it as false, All keys will be dropped on the ground. give-virtual-keys: false @@ -163,11 +161,11 @@ crate: # Should a sound should be played if they have no key? toggle: true # The sound to play. - name: ENTITY_VILLAGER_NO + name: "ENTITY_VILLAGER_NO" # Settings related to QuadCrate quad-crate: # How long should the quad crate be active? timer: 300 # What worlds do you want Crates to be disabled in? disabled-worlds: - - world_nether + - "world_nether" \ No newline at end of file diff --git a/paper/src/main/resources/crates/CasinoExample.yml b/paper/src/main/resources/crates/CasinoExample.yml index 8ce2bbee1..c75b73bd7 100644 --- a/paper/src/main/resources/crates/CasinoExample.yml +++ b/paper/src/main/resources/crates/CasinoExample.yml @@ -7,14 +7,14 @@ Crate: # See CosmicCrateExample.yml to see how the Cosmic CrateType works. CrateType: Casino # Name of the Inventory if a GUI crate. - CrateName: "&9Casino Crate" + CrateName: "Casino Crate" # The name of the inventory that will be in the preview GUI. - Preview-Name: "&9Casino Crate Preview" + Preview-Name: "Casino Crate Preview" # Starting amount of keys when the player 1st joins. StartingKeys: 0 # The amount of keys required to use the crate. RequiredKeys: 0 - #Max amount of crates that can be opened at once using /cc mass-open + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 # If the crate shows in the /cc GUI. # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. @@ -24,7 +24,7 @@ Crate: # Enables/Disables the Broadcasts message when they open a crate. OpeningBroadCast: true # Message that is broadcast when opening the crate. - BroadCast: "%prefix%&6&l%player%&r &7is opening a &9&lCasino Crate." + BroadCast: "%prefix%%player% is opening a Casino Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -71,7 +71,7 @@ Crate: # A default message if the prize doesn't have any Messages # i.e. Messages: [] or the value isn't there. Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." + - "You have won %reward% from %crate%." # A default command if the prize doesn't have any commands # i.e. Commands: [] or the value isn't there. Prize-Commands: [] @@ -80,13 +80,13 @@ Crate: # If the crate in the main /cc GUI is glowing or not. Glowing: false # Name of the item in the GUI. - Name: "&9&lCasino Crate" + Name: "Casino Crate" # The lore of the item in the GUI. Lore: - - "&7This crate contains strange objects." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: # Turn on and off the preview for this crate. Toggle: true @@ -129,10 +129,10 @@ Crate: # The Config Name for the Crate Basic: # The in-game name of the tier. - Name: "&8Basic Tier" + Name: "Basic Tier" # The in-game lore of the tier. Lore: - - "&7A basic tier." + - "A basic tier." # The item used for the secondary gui when you right-click for the preview. Item: "CHEST" # Chance of that item getting picked. It would be 80/100 chance because MaxRange is 100. @@ -142,57 +142,58 @@ Crate: # The slot this item will be in the secondary gui. Slot: 20 UnCommon: - Name: "&aUncommon Tier" + Name: "Uncommon Tier" Lore: - - "&aAn uncommon tier." + - "An uncommon tier." Item: "CHEST" Chance: 35 MaxRange: 100 Slot: 22 Rare: - Name: "&4Rare Tier" + Name: "Rare Tier" Lore: - - "&cA rare tier." + - "A rare tier." Item: "ENDER_CHEST" Chance: 25 MaxRange: 100 Slot: 24 PhysicalKey: # Name of the Key. - Name: "&9&lCasino Crate Key" + Name: "Casino Crate Key" # Lore of the Key. Lore: - - "&7A special Key" - - "&7For a special Crate." + - "A special Key" + - "For a special Crate." # The item the key is. Item: "TRIPWIRE_HOOK" # Makes the key look enchanted. Glowing: true - # Settings for the holograms. + # Settings for the holograms. Hologram: # Toggle on and off the holograms for the crates. Toggle: true # The height of the hologram above the crate. Height: 1.5 - # The distance the hologram can be seen. Only works with CMI and DecentHolograms + # The distance the hologram can be seen. Range: 8 - # The message that will be displayed. + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. Message: - - "&9&lCasino Crate" + - "Casino Crate" # All the prizes that can be gotten in the Crate. Prizes: 1: # Name of the item shown by the crate. - DisplayName: "&cAn example of a Player Head!" - # ITem shown by the crate. + DisplayName: "An example of a Player Head!" + # Item shown by the crate. DisplayItem: "PLAYER_HEAD" # The amount displayed. DisplayAmount: 1 # The lore in the crate preview Lore: - - "&7Want a player head?" + - "Want a player head?" - "" - - "&cChance: &e25%" + - "Chance: 25%" # Tiers are available in Cosmic and Casino crate types. # The Tiers the rewards can be found in. Tiers: @@ -219,12 +220,12 @@ Crate: # Items: [] Commands: # You can run any plugin command here. - - "broadcast &6&l%player%&r &7won %reward%! WOW" + - "broadcast %player% won %reward%! WOW" # If you do not want to send commands, Set the "Commands:" to look like the line below. # Commands: [] Messages: # Send any message you want to the player. - - "&cYou won a &r%reward%!" + - "You won a %reward%!" # If you do not want to send messages, Set the "Messages:" to look like the line below. # Messages: [] @@ -238,7 +239,7 @@ Crate: Commands: [] Items: [] 2: - DisplayName: "&b&lCheap Helmet" + DisplayName: "Cheap Helmet" DisplayItem: "GOLDEN_HELMET" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 50. @@ -251,8 +252,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win a cheap helmet." - - "&6&lChance: &c&l60%" + - "Win a cheap helmet." + - "Chance: 60%" # Tiers are available in Cosmic and Casino crate types. # The Tiers the rewards can be found in. Tiers: @@ -260,14 +261,14 @@ Crate: MaxRange: 100 Chance: 15 Items: - - "Item:GOLDEN_HELMET, Amount:1, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Name:&bCheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" + - "Item:GOLDEN_HELMET, Amount:1, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Name:Cheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" 3: - DisplayName: "&e&l$1,000" + DisplayName: "$1,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain Money." - - "&6&lChance: &c&l20%" + - "Make it rain Money." + - "Chance: 20%" # Tiers are available in Cosmic and Casino crate types. # The Tiers the rewards can be found in. Tiers: @@ -279,17 +280,17 @@ Crate: - "eco give %player% 1000" # - "lp user %player% permission set crazycrates.blacklist.basic.3" -> This is the line where you would give the user the permission. Messages: - - "&7You just won &r%reward%." + - "You just won %reward%." BlackListed-Permissions: - "crazycrates.blacklist.basic.3" Alternative-Prize: Toggle: true Messages: - - "&r &8[&bCrazyCrates&8]: &7You have already won that prize, so enjoy some gold nuggets." + - " [CrazyCrates]: You have already won that prize, so enjoy some gold nuggets." Commands: - "give %player% gold_nugget 16" 4: - DisplayName: "&4&lWarlord's Helmet" + DisplayName: "Warlord's Helmet" DisplayItem: "NETHERITE_HELMET" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -298,8 +299,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's helmet." - - "&6&lChance: &c&l40%" + - "Win the warlord's helmet." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" @@ -308,9 +309,9 @@ Crate: MaxRange: 100 Chance: 10 Items: - - "Item:NETHERITE_HELMET, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Helmet, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_HELMET, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Helmet, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 5: - DisplayName: "&4&lWarlord's Chestplate" + DisplayName: "Warlord's Chestplate" DisplayItem: "NETHERITE_CHESTPLATE" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -322,8 +323,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's chestplate." - - "&6&lChance: &c&l40%" + - "Win the warlord's chestplate." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" @@ -332,9 +333,9 @@ Crate: MaxRange: 100 Chance: 3 Items: - - "Item:NETHERITE_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Chestplate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Chestplate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 6: - DisplayName: "&4&lWarlord's Leggings" + DisplayName: "Warlord's Leggings" DisplayItem: "NETHERITE_LEGGINGS" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -343,8 +344,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's leggings." - - "&6&lChance: &c&l40%" + - "Win the warlord's leggings." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" @@ -353,9 +354,9 @@ Crate: MaxRange: 100 Chance: 3 Items: - - "Item:NETHERITE_LEGGINGS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Leggings, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_LEGGINGS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Leggings, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 7: - DisplayName: "&4&lWarlord's Boots" + DisplayName: "Warlord's Boots" DisplayItem: "NETHERITE_BOOTS" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -364,8 +365,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's boots." - - "&6&lChance: &c&l40%" + - "Win the warlord's boots." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" @@ -374,4 +375,4 @@ Crate: MaxRange: 100 Chance: 3 Items: - - "Item:NETHERITE_BOOTS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Boots, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" \ No newline at end of file + - "Item:NETHERITE_BOOTS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Boots, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" \ No newline at end of file diff --git a/paper/src/main/resources/crates/CosmicCrateExample.yml b/paper/src/main/resources/crates/CosmicCrateExample.yml index e42136190..e7c2526b7 100644 --- a/paper/src/main/resources/crates/CosmicCrateExample.yml +++ b/paper/src/main/resources/crates/CosmicCrateExample.yml @@ -3,19 +3,28 @@ Crate: # Make sure to check out the wiki for anything not explained here. # https://docs.crazycrew.us/crazycrates/home + + # See CasinoExample.yml to see how the Casino CrateType works. CrateType: Cosmic - CrateName: "&dCosmic Crate" - Preview-Name: "&dCosmic Crate Preview" + # Name of the Inventory if a GUI crate. + CrateName: "Cosmic Crate" + # The name of the inventory that will be in the preview GUI. + Preview-Name: "Cosmic Crate Preview" + # Starting amount of keys when the player 1st joins. StartingKeys: 0 + # The amount of keys required to use the crate. RequiredKeys: 0 - Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." - Prize-Commands: [] + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 + # If the crate shows in the /cc GUI. + # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. InGUI: true - Slot: 14 - OpeningBroadCast: false - BroadCast: "" + # Slot the item is in the GUI. + Slot: 34 + # Enables/Disables the Broadcasts message when they open a crate. + OpeningBroadCast: true + # Message that is broadcast when opening the crate. + BroadCast: "%prefix%%player% is opening a Cosmic Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -54,45 +63,30 @@ Crate: toggle: true # The type of sound to use. # https://jd.papermc.io/paper/1.20/org/bukkit/Sound.html - value: "BLOCK_ANVIL_PLACE" + value: "ENTITY_PLAYER_LEVELUP" # The volume of the pitch. volume: 1.0 # The speed of the sound. pitch: 1.0 + # A default message if the prize doesn't have any Messages + # i.e. Messages: [] or the value isn't there. + Prize-Message: + - "You have won %reward% from %crate%." + # A default command if the prize doesn't have any commands + # i.e. Commands: [] or the value isn't there. + Prize-Commands: [] + # Item the crate is in the GUI Item: "ENDER_CHEST" + # If the crate in the main /cc GUI is glowing or not. Glowing: false - Name: "&d&lCosmic Crate" + # Name of the item in the GUI. + Name: "Cosmic Crate" + # The lore of the item in the GUI. Lore: - - "&7This crate contains strange objects," - - "&7from somewhere beyond this planet." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." - Crate-Type-Settings: - Total-Prize-Amount: 4 - Mystery-Crate: - Item: "CHEST" - Name: "&f&l???" - Lore: - - "&7You may choose 4 crates." - Picked-Crate: - Item: "GLASS_PANE" - Name: "&f&l???" - Lore: - - "&7You have chosen #%slot%." - PhysicalKey: - Name: "&d&lGalactic Crate &b&lKey" - Lore: - - "&7A special Key" - - "&7For a special Crate." - Item: "TRIPWIRE_HOOK" - Glowing: true - Hologram: - Toggle: true - Height: 1.5 - Range: 8 - Message: - - "&d&lCosmic Crate" + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: # Turn on and off the preview for this crate. Toggle: true @@ -117,62 +111,127 @@ Crate: name: " " # The item that shows in the border. Can be glass or any other item. item: "RED_STAINED_GLASS_PANE" + # Tier related settings only for Casino. + random: + # If the tiers should be random. + toggle: false + # The rows with pre-defined tiers. + types: + # Row 1 + row-1: Basic + # Row 2 + row-2: UnCommon + # Row 3 + row-3: Rare # Tiers are available in Cosmic and Casino crate types. # The Tiers the rewards can be found in. Tiers: # The Config Name for the Crate Basic: # The in-game name of the tier. - Name: "&8Basic Tier" + Name: "Basic Tier" # The in-game lore of the tier. Lore: - - "&7A basic tier." + - "A basic tier." # The item used for the secondary gui when you right-click for the preview. Item: "CHEST" # Chance of that item getting picked. It would be 80/100 chance because MaxRange is 100. - Chance: 80 + Chance: 50 # The max range that the chance will go though. MaxRange: 100 # The slot this item will be in the secondary gui. Slot: 20 UnCommon: - Name: "&aUncommon Tier" + Name: "Uncommon Tier" Lore: - - "&aAn uncommon tier." + - "An uncommon tier." Item: "CHEST" - Chance: 55 + Chance: 35 MaxRange: 100 Slot: 22 Rare: - Name: "&4Rare Tier" + Name: "Rare Tier" Lore: - - "&cA rare tier." + - "A rare tier." Item: "ENDER_CHEST" - Chance: 20 + Chance: 25 MaxRange: 100 Slot: 24 + PhysicalKey: + # Name of the Key. + Name: "Cosmic Crate Key" + # Lore of the Key. + Lore: + - "A special Key" + - "For a special Crate." + # The item the key is. + Item: "TRIPWIRE_HOOK" + # Makes the key look enchanted. + Glowing: true + # Settings for the holograms. + Hologram: + # Toggle on and off the holograms for the crates. + Toggle: true + # The height of the hologram above the crate. + Height: 1.5 + # The distance the hologram can be seen. + Range: 8 + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. + Message: + - "Cosmic Crate" + Crate-Type-Settings: + # The total amount of prizes to pick. + Total-Prize-Amount: 4 + Mystery-Crate: + # The item of the mystery crate. + Item: "CHEST" + # The name of the mystery crate. + Name: "???" + # The lore of the mystery crate. + Lore: + - "You may choose 4 crates." + Picked-Crate: + # The item of the picked crate. + Item: "GLASS_PANE" + # The name of the picked crate. + Name: "???" + # The lore of the picked crate. + Lore: + - "You have chosen #%slot%." + # All the prizes that can be gotten in the Crate. Prizes: 1: - DisplayName: "&d&lCosmic Grass" + # Name of the item shown by the crate. + DisplayName: "Cosmic Grass" + # Item shown by the crate. DisplayItem: "GRASS_BLOCK" + # The amount displayed. DisplayAmount: 1 + # The lore in the crate preview + # If you do not want a lore, Set the "Lore:" to look like the line below. + # Lore: [] Lore: - - "&7Win some grass for your fields." - - "&6&lChance: &c&l40%" - MaxRange: 100 - Chance: 40 + - "Win some grass for your fields." + - "Chance: 40%" # Tiers are available in Cosmic and Casino crate types. # The Tiers the rewards can be found in. Tiers: - "Basic" - "UnCommon" - "Rare" - Items: - - "Item:GRASS_BLOCK, Amount:32, Name:&d&lGalactic Grass" - Commands: - - "broadcast &6&l%player%&r &7has just won some &r%reward%." + MaxRange: 100 # Available values: 100, 1000, 10000, 100000, 1000000, 10000000 + # + # 25 is 25% if Max Range is 100 + # Read more on "Chance" @ https://github.com/Crazy-Crew/Crazy-Crates/wiki/Chance-System + # + Chance: 40 # The chance out of MaxRange to win an item. + Items: # Give any item you want + - "Item:GRASS_BLOCK, Amount:32, Name:Galactic Grass" + Commands: # Run any command you want + - "broadcast %player% has just won some %reward%." 2: - DisplayName: "&b&lCheap Helmet" + DisplayName: "Cheap Helmet" DisplayItem: "GOLDEN_HELMET" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 5. @@ -185,8 +244,8 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win a cheap helmet." - - "&6&lChance: &c&l60%" + - "Win a cheap helmet." + - "Chance: 60%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:1" - "OXYGEN:1" @@ -197,14 +256,14 @@ Crate: - "UnCommon" - "Rare" Items: - - "Item:GOLDEN_HELMET, Amount:1, Damage:5, Trim-Pattern:SENTRY, Trim-Material:DIAMOND, Name:&bCheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" + - "Item:GOLDEN_HELMET, Amount:1, Damage:5, Trim-Pattern:SENTRY, Trim-Material:DIAMOND, Name:Cheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" 3: - DisplayName: "&e&l$1,000" + DisplayName: "$1,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain Money." - - "&6&lChance: &c&l20%" + - "Make it rain Money." + - "Chance: 20%" MaxRange: 100 Chance: 20 Firework: true @@ -215,15 +274,15 @@ Crate: Commands: - "eco give %player% 1000" 4: - DisplayName: "&b&lCrazy &4&lSword" + DisplayName: "Crazy Sword" DisplayItem: "GOLDEN_SWORD" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 12. DisplayDamage: 12 DisplayAmount: 1 Lore: - - "&7Win a crazy cool sword." - - "&6&lChance: &c&l10%" + - "Win a crazy cool sword." + - "Chance: 10%" DisplayEnchantments: - "DAMAGE_ALL:5" - "FIRE_ASPECT:1" @@ -232,14 +291,14 @@ Crate: Tiers: - "Rare" Items: - - "Item:GOLDEN_SWORD, Amount:1, Damage:12, Name:&b&lCrazy &4&lSword, DAMAGE_ALL:5, FIRE_ASPECT:1" + - "Item:GOLDEN_SWORD, Amount:1, Damage:12, Name:Crazy Sword, DAMAGE_ALL:5, FIRE_ASPECT:1" 5: - DisplayName: "&e&l$1,000,000" + DisplayName: "$1,000,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain a butt load of Money." - - "&6&lChance: &c&l20%" + - "Make it rain a butt load of Money." + - "Chance: 20%" MaxRange: 100 Chance: 20 Firework: true @@ -248,13 +307,13 @@ Crate: Commands: - "eco give %player% 1000000" 6: - DisplayName: "&b&lCrazy Crate &6&lKey &7(x2)" + DisplayName: "Crazy Crate Key (x2)" DisplayItem: "TRIPWIRE_HOOK" - DisplayAmount: 1 + DisplayAmount: 2 Lore: - - "&7A special Key" - - "&7For a special Crate." - - "&6&lChance: &c&l10%" + - "A special Key" + - "For a special Crate." + - "Chance: 10%" MaxRange: 100 Chance: 10 Firework: true diff --git a/paper/src/main/resources/crates/CrateExample.yml b/paper/src/main/resources/crates/CrateExample.yml index e4149bdf1..c29a0b580 100644 --- a/paper/src/main/resources/crates/CrateExample.yml +++ b/paper/src/main/resources/crates/CrateExample.yml @@ -4,17 +4,17 @@ Crate: # Make sure to check out the wiki for anything not explained here. # https://docs.crazycrew.us/crazycrates/home - # See CosmicCrateExample.yml to see how the Cosmic CrateType works. + # See CosmicCrateExample.yml or CasinoExample.yml to see how the Cosmic/Casino CrateType works. CrateType: CSGO # Name of the Inventory if a GUI crate. - CrateName: "&aBasic Crate" + CrateName: "Basic Crate" # The name of the inventory that will be in the preview GUI. - Preview-Name: "&aBasic Crate Preview" + Preview-Name: "Basic Crate Preview" # Starting amount of keys when the player 1st joins. StartingKeys: 0 # The amount of keys required to use the crate. RequiredKeys: 0 - #Max amount of crates that can be opened at once using /cc mass-open + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 # If the crate shows in the /cc GUI. # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. @@ -24,7 +24,7 @@ Crate: # Enables/Disables the Broadcasts message when they open a crate. OpeningBroadCast: true # Message that is broadcast when opening the crate. - BroadCast: "%prefix%&6&l%player%&r &7is opening a &7&lBasic Crate." + BroadCast: "%prefix%%player% is opening a Basic Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -68,25 +68,25 @@ Crate: volume: 1.0 # The speed of the sound. pitch: 1.0 - # A default message if the prize doesn"t have any Messages - # i.e. Messages: [] or the value isn"t there. + # A default message if the prize doesn't have any Messages + # i.e. Messages: [] or the value isn't there. Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." - # A default command if the prize doesn"t have any commands - # i.e. Commands: [] or the value isn"t there. + - "You have won %reward% from %crate%." + # A default command if the prize doesn't have any commands + # i.e. Commands: [] or the value isn't there. Prize-Commands: [] # Item the crate is in the GUI Item: "DIAMOND" # If the crate in the main /cc GUI is glowing or not. Glowing: false # Name of the item in the GUI. - Name: "&a&lBasic Crate" + Name: "Basic Crate" # The lore of the item in the GUI. Lore: - - "&7This crate contains strange objects." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: # Turn on and off the preview for this crate. Toggle: true @@ -101,40 +101,41 @@ Crate: Item: "GRAY_STAINED_GLASS_PANE" PhysicalKey: # Name of the Key. - Name: "&7&lBasic Crate &b&lKey" + Name: "Basic Crate Key" # Lore of the Key. Lore: - - "&7A special Key" - - "&7For a special Crate." + - "A special Key" + - "For a special Crate." # The item the key is. Item: "TRIPWIRE_HOOK" # Makes the key look enchanted. Glowing: true - # Settings for the holograms. + # Settings for the holograms. Hologram: # Toggle on and off the holograms for the crates. Toggle: true # The height of the hologram above the crate. Height: 1.5 - # The distance the hologram can be seen. Only works with CMI and DecentHolograms + # The distance the hologram can be seen. Range: 8 - # The message that will be displayed. + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. Message: - - "&7&lBasic Crate" + - "Basic Crate" # All the prizes that can be gotten in the Crate. Prizes: 1: # Name of the item shown by the crate. - DisplayName: "&cAn example of a Player Head!" + DisplayName: "An example of a Player Head!" # ITem shown by the crate. DisplayItem: "PLAYER_HEAD" # The amount displayed. DisplayAmount: 1 # The lore in the crate preview Lore: - - "&7Want a player head?" + - "Want a player head?" - "" - - "&cChance: &e25%" + - "Chance: 25%" # If you do not want a lore, Set the "Lore:" to look like the line below. # Lore: [] @@ -157,12 +158,12 @@ Crate: # Items: [] Commands: # You can run any plugin command here. - - "broadcast &6&l%player%&r &7won %reward%! WOW" + - "broadcast %player% won %reward%! WOW" # If you do not want to send commands, Set the "Commands:" to look like the line below. # Commands: [] Messages: # Send any message you want to the player. - - "&cYou won a &r%reward%!" + - "You won a %reward%!" # If you do not want to send messages, Set the "Messages:" to look like the line below. # Messages: [] @@ -176,7 +177,7 @@ Crate: Commands: [] Items: [] 2: - DisplayName: "&b&lCheap Helmet" + DisplayName: "Cheap Helmet" DisplayItem: "GOLDEN_HELMET" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 50. @@ -189,19 +190,19 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win a cheap helmet." - - "&6&lChance: &c&l60%" + - "Win a cheap helmet." + - "Chance: 60%" MaxRange: 100 Chance: 60 Items: - - "Item:GOLDEN_HELMET, Amount:1, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Name:&bCheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" + - "Item:GOLDEN_HELMET, Amount:1, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Name:Cheap Helmet, PROTECTION_ENVIRONMENTAL:1, OXYGEN:1" 3: - DisplayName: "&e&l$1,000" + DisplayName: "$1,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain Money." - - "&6&lChance: &c&l20%" + - "Make it rain Money." + - "Chance: 20%" MaxRange: 100 Chance: 20 Firework: true @@ -209,29 +210,29 @@ Crate: - "eco give %player% 1000" # - "lp user %player% permission set crazycrates.blacklist.basic.3" -> This is the line where you would give the user the permission. Messages: - - "&7You just won &r%reward%." + - "You just won %reward%." BlackListed-Permissions: - "crazycrates.blacklist.basic.3" Alternative-Prize: Toggle: true Messages: - - "&r &8[&bCrazyCrates&8]: &7You have already won that prize, so enjoy some gold nuggets." + - " [CrazyCrates]: You have already won that prize, so enjoy some gold nuggets." Commands: - "give %player% gold_nugget 16" 4: - DisplayName: "&d&lSharpness 5 / Looting 3" + DisplayName: "Sharpness 5 / Looting 3" DisplayItem: "ENCHANTED_BOOK" DisplayAmount: 1 DisplayEnchantments: - "SHARPNESS:5" - "LOOTING:3" Lore: - - "&7A sharp enchantment book." - - "&6&lChance: &c&l25%" + - "A sharp enchantment book." + - "Chance: 25%" MaxRange: 100 Chance: 25 Firework: true Messages: - - "&7You just won &r%reward%." + - "You just won %reward%." Items: - "Item:ENCHANTED_BOOK, Amount:1, DAMAGE_ALL:5, LOOTING:3" \ No newline at end of file diff --git a/paper/src/main/resources/crates/QuadCrateExample.yml b/paper/src/main/resources/crates/QuadCrateExample.yml index 68c55d77d..0337209cb 100644 --- a/paper/src/main/resources/crates/QuadCrateExample.yml +++ b/paper/src/main/resources/crates/QuadCrateExample.yml @@ -4,24 +4,27 @@ Crate: # Make sure to check out the wiki for anything not explained here. # https://docs.crazycrew.us/crazycrates/home - # See CosmicCrateExample.yml to see how the Cosmic CrateType works. - # Spawns 4 chests and a custom structure. + # See CosmicCrateExample.yml or CasinoExample.yml to see how the Cosmic/Casino CrateType works. CrateType: QuadCrate - CrateName: "&bQuad Crate Preview" - Preview-Name: "&bQuad Crate Preview" + # Name of the Inventory if a GUI crate. + CrateName: "Quad Crate" + # The name of the inventory that will be in the preview GUI. + Preview-Name: "Quad Crate Preview" + # Starting amount of keys when the player 1st joins. StartingKeys: 0 + # The amount of keys required to use the crate. RequiredKeys: 0 + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 + # If the crate shows in the /cc GUI. + # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. InGUI: true + # Slot the item is in the GUI. Slot: 16 + # Enables/Disables the Broadcasts message when they open a crate. OpeningBroadCast: true - BroadCast: "%prefix%&6&l%player%&r &7is opening a &b&lCrazy Crate." - # This section is related to .nbt files. - structure: - # If it should randomly use an .nbt file. - random: true - # The file to use inside schematic"s folder. - file: "classic.nbt" + # Message that is broadcast when opening the crate. + BroadCast: "%prefix%%player% is opening a Quad Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -38,7 +41,7 @@ Crate: toggle: true # The type of sound to use. # https://jd.papermc.io/paper/1.20/org/bukkit/Sound.html - value: "BLOCK_STONE_STEP" + value: "BLOCK_NOTE_BLOCK_XYLOPHONE" # The volume of the pitch. volume: 1.0 # The speed of the sound. @@ -60,52 +63,74 @@ Crate: toggle: true # The type of sound to use. # https://jd.papermc.io/paper/1.20/org/bukkit/Sound.html - value: "BLOCK_ANVIL_LAND" + value: "ENTITY_PLAYER_LEVELUP" # The volume of the pitch. volume: 1.0 # The speed of the sound. pitch: 1.0 - # Only used for quadcrates - particles: - # Only used for "dust" particle - color: "235,64,52" - # https://minecraft.wiki/w/Particles_(Java_Edition) - type: "crimson_spore" + # A default message if the prize doesn't have any Messages + # i.e. Messages: [] or the value isn't there. Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." + - "You have won %reward% from %crate%." + # A default command if the prize doesn't have any commands + # i.e. Commands: [] or the value isn't there. Prize-Commands: [] + # Item the crate is in the GUI Item: "BREWING_STAND" + # If the crate in the main /cc GUI is glowing or not. Glowing: false - Name: "&b&lQuad Crate" + # Name of the item in the GUI. + Name: "Quad Crate" + # The lore of the item in the GUI. Lore: - - "&7This crate contains crazy things." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: + # Turn on and off the preview for this crate. Toggle: true + # How many lines the Crate Preview should have. Including Header and Bottom (Between 3 and 6) ChestLines: 6 Glass: + # Turn the glass border in the preview on and off. Toggle: true # The name of the border item. Name: " " - Item: "BLACK_STAINED_GLASS_PANE" + # The item that shows in the border. Can be glass or any other item. + Item: "GRAY_STAINED_GLASS_PANE" + # This section is related to .nbt files. + structure: + # If it should randomly use an .nbt file. + random: true + # The file to use inside schematic"s folder. + file: "classic.nbt" PhysicalKey: - Name: "&b&lQuad Crate &6&lKey" + # Name of the Key. + Name: "Quad Crate Key" + # Lore of the Key. Lore: - - "&7A special Key" - - "&7For a special Crate." + - "A special Key" + - "For a special Crate." + # The item the key is. Item: "TRIPWIRE_HOOK" - Glowing: True + # Makes the key look enchanted. + Glowing: true + # Settings for the holograms. Hologram: + # Toggle on and off the holograms for the crates. Toggle: true + # The height of the hologram above the crate. Height: 1.5 + # The distance the hologram can be seen. Range: 8 + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. Message: - - "&b&lCrazy Crate" + - "Quad Crate" Prizes: 1: - DisplayName: "&3&lRare ChestPlate" + DisplayName: "Rare ChestPlate" DisplayItem: "DIAMOND_CHESTPLATE" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 25. @@ -118,45 +143,45 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win a very rare chest plate." - - "&6&lChance: &c&l40%" + - "Win a very rare chest plate." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" MaxRange: 100 Chance: 40 Items: - - "Item:DIAMOND_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:EMERALD, Name:&3Rare ChestPlate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:DIAMOND_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:EMERALD, Name:Rare ChestPlate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 2: - DisplayName: "&b&lCrazy &4&lSword" + DisplayName: "Crazy Sword" DisplayItem: "GOLDEN_SWORD" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 13. DisplayDamage: 13 DisplayAmount: 1 Lore: - - "&7Win a crazy cool sword." - - "&6&lChance: &c&l35%" + - "Win a crazy cool sword." + - "Chance: 35%" DisplayEnchantments: - "DAMAGE_ALL:5" - "FIRE_ASPECT:1" MaxRange: 100 Chance: 35 Items: - - "Item:GOLDEN_SWORD, Amount:1, Damage:13, Name:&b&lCrazy &4&lSword, DAMAGE_ALL:5, FIRE_ASPECT:1" + - "Item:GOLDEN_SWORD, Amount:1, Damage:13, Name:Crazy Sword, DAMAGE_ALL:5, FIRE_ASPECT:1" Messages: - - "&7You just won &r%reward%." + - "You just won %reward%." 3: - DisplayName: "&e&l$1,000,000" + DisplayName: "$1,000,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain a butt load of Money." - - "&6&lChance: &c&l20%" + - "Make it rain a butt load of Money." + - "Chance: 20%" MaxRange: 100 Chance: 20 Firework: true Commands: - "eco give %player% 1000000" Messages: - - "&7You just won &r%reward%." \ No newline at end of file + - "You just won %reward%." \ No newline at end of file diff --git a/paper/src/main/resources/crates/QuickCrateExample.yml b/paper/src/main/resources/crates/QuickCrateExample.yml index b5c4f55a8..25a4fae41 100644 --- a/paper/src/main/resources/crates/QuickCrateExample.yml +++ b/paper/src/main/resources/crates/QuickCrateExample.yml @@ -4,19 +4,29 @@ Crate: # Make sure to check out the wiki for anything not explained here. # https://docs.crazycrew.us/crazycrates/home - # See CosmicCrateExample.yml to see how the Cosmic CrateType works. + # See CosmicCrateExample.yml or CasinoExample.yml to see how the Cosmic/Casino CrateType works. # QuickCrate simply allows you to speed open crates. CrateType: QuickCrate - CrateName: "&eClassic Crate" - Preview-Name: "&eClassic Crate Preview" + # Name of the Inventory if a GUI crate. + CrateName: "Classic Crate" + # The name of the inventory that will be in the preview GUI. + Preview-Name: "Classic Crate Preview" + # Starting amount of keys when the player 1st joins. StartingKeys: 0 + # The amount of keys required to use the crate. RequiredKeys: 0 + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 - InGUI: false + # If the crate shows in the /cc GUI. + # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. + InGUI: true + # Slot the item is in the GUI. Slot: 14 + # Enables/Disables the Broadcasts message when they open a crate. OpeningBroadCast: true - BroadCast: "%prefix%&6&l%player%&r &7is opening a &e&lClassic Crate&7." + # Message that is broadcast when opening the crate. + BroadCast: "%prefix%%player% is opening a Classic Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -60,41 +70,63 @@ Crate: volume: 1.0 # The speed of the sound. pitch: 1.0 + # A default message if the prize doesn't have any Messages + # i.e. Messages: [] or the value isn't there. Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." + - "You have won %reward% from %crate%." + # A default command if the prize doesn't have any commands + # i.e. Commands: [] or the value isn't there. Prize-Commands: [] + # Item the crate is in the GUI Item: "CHEST" + # If the crate in the main /cc GUI is glowing or not. Glowing: false - Name: "&e&lClassic Crate" + # Name of the item in the GUI. + Name: "Classic Crate" + # The lore of the item in the GUI. Lore: - - "&7This crate contains classic items." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: + # Turn on and off the preview for this crate. Toggle: true + # How many lines the Crate Preview should have. Including Header and Bottom (Between 3 and 6) ChestLines: 6 Glass: + # Turn the glass border in the preview on and off. Toggle: true # The name of the border item. Name: " " - Item: "YELLOW_STAINED_GLASS_PANE" + # The item that shows in the border. Can be glass or any other item. + Item: "GRAY_STAINED_GLASS_PANE" PhysicalKey: - Name: "&e&lClassic Crate &c&lKey" + # Name of the Key. + Name: "Classic Crate Key" + # Lore of the Key. Lore: - - "&7A special Key" - - "&7For a special Crate." + - "A special Key" + - "For a special Crate." + # The item the key is. Item: "TRIPWIRE_HOOK" - Glowing: True + # Makes the key look enchanted. + Glowing: true + # Settings for the holograms. Hologram: + # Toggle on and off the holograms for the crates. Toggle: true + # The height of the hologram above the crate. Height: 1.5 + # The distance the hologram can be seen. Range: 8 + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. Message: - - "&e&lClassic Crate" + - "Classic Crate" Prizes: 1: - DisplayName: "&a&lFancy Pants" + DisplayName: "Fancy Pants" DisplayItem: "CHAINMAIL_LEGGINGS" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 75. @@ -107,18 +139,18 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win a fancy pair of pants." - - "&6&lChance: &c&l40%" + - "Win a fancy pair of pants." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:2" MaxRange: 100 Chance: 40 Items: - - "Item:CHAINMAIL_LEGGINGS, Amount:1, Damage:75, Trim-Pattern:SENTRY, Trim-Material:LAPIS, Name:&aFancy Pants, PROTECTION_ENVIRONMENTAL:2" + - "Item:CHAINMAIL_LEGGINGS, Amount:1, Damage:75, Trim-Pattern:SENTRY, Trim-Material:LAPIS, Name:Fancy Pants, PROTECTION_ENVIRONMENTAL:2" Messages: - - "&7You just won a &r%reward%." + - "You just won a %reward%." 2: - DisplayName: "&b&lClassic Sword" + DisplayName: "Classic Sword" DisplayItem: "DIAMOND_SWORD" # Only works on items with durability. This will make the item appear more damaged. # It does not set the durability but subtracts this number from the durability is 100, It subtracts 7. @@ -126,28 +158,28 @@ Crate: DisplayDamage: 7 DisplayAmount: 1 Lore: - - "&7Win a old classic sword." - - "&6&lChance: &c&l35%" + - "Win a old classic sword." + - "Chance: 35%" DisplayEnchantments: - "DAMAGE_ALL:2" - "FIRE_ASPECT:1" MaxRange: 100 Chance: 35 Items: - - "Item:DIAMOND_SWORD, Amount:1, Damage:7, Name:&bClassic Sword, DAMAGE_ALL:2, FIRE_ASPECT:1" + - "Item:DIAMOND_SWORD, Amount:1, Damage:7, Name:Classic Sword, DAMAGE_ALL:2, FIRE_ASPECT:1" Messages: - - "&7You just won &r%reward%." + - "You just won %reward%." 3: - DisplayName: "&e&l$100,000" + DisplayName: "$100,000" DisplayItem: "SUNFLOWER" DisplayAmount: 1 Lore: - - "&7Make it rain a lot of Money." - - "&6&lChance: &c&l20%" + - "Make it rain a lot of Money." + - "Chance: 20%" MaxRange: 100 Chance: 20 Firework: true Commands: - "eco give %player% 100000" Messages: - - "&7You just won &r%reward%." \ No newline at end of file + - "You just won %reward%." \ No newline at end of file diff --git a/paper/src/main/resources/crates/WarCrateExample.yml b/paper/src/main/resources/crates/WarCrateExample.yml index 20cefd7b2..fda654686 100644 --- a/paper/src/main/resources/crates/WarCrateExample.yml +++ b/paper/src/main/resources/crates/WarCrateExample.yml @@ -4,17 +4,17 @@ Crate: # Make sure to check out the wiki for anything not explained here. # https://docs.crazycrew.us/crazycrates/home - # See CosmicCrateExample.yml to see how the Cosmic CrateType works. + # See CosmicCrateExample.yml or CasinoExample.yml to see how the Cosmic/Casino CrateType works. CrateType: War # Name of the Inventory if a GUI crate. - CrateName: "&4War Crate" + CrateName: "War Crate" # The name of the inventory that will be in the preview GUI. - Preview-Name: "&4War Crate Preview" + Preview-Name: "War Crate Preview" # Starting amount of keys when the player 1st joins. StartingKeys: 0 # The amount of keys required to use the crate. RequiredKeys: 0 - #Max amount of crates that can be opened at once using /cc mass-open + # Max amount of crates that can be opened at once using /cc mass-open Max-Mass-Open: 10 # If the crate shows in the /cc GUI. # If the type is QuickCrate/CrateOnTheGo/FireCracker, They will not work as they require a Physical Crate. @@ -24,7 +24,7 @@ Crate: # Enables/Disables the Broadcasts message when they open a crate. OpeningBroadCast: true # Message that is broadcast when opening the crate. - BroadCast: "%prefix%&6&l%player%&r &7is opening a &4&lWar Crate&7." + BroadCast: "%prefix%%player% is opening a War Crate." # This section is related to commands opening when a crate is opened. opening-command: # If the commands should be sent or not. @@ -41,7 +41,7 @@ Crate: toggle: true # The type of sound to use. # https://jd.papermc.io/paper/1.20/org/bukkit/Sound.html - value: "BLOCK_LAVA_POP" + value: "BLOCK_NOTE_BLOCK_XYLOPHONE" # The volume of the pitch. volume: 1.0 # The speed of the sound. @@ -71,20 +71,22 @@ Crate: # A default message if the prize doesn't have any Messages # i.e. Messages: [] or the value isn't there. Prize-Message: - - "&7You have won &c%reward% &7from &c%crate%." + - "You have won %reward% from %crate%." + # A default command if the prize doesn't have any commands + # i.e. Commands: [] or the value isn't there. Prize-Commands: [] # Item the crate is in the GUI Item: "BEACON" # If the crate in the main /cc GUI is glowing or not. Glowing: false # Name of the item in the GUI. - Name: "&4&lWar Crate" + Name: "War Crate" # The lore of the item in the GUI. Lore: - - "&7This crate contains strange objects." - - "&7You have &6%keys% keys &7to open this crate with." - - "&7You have opened this crate: &6%crate_opened% times" - - "&7&l(&e&l!&7&l) Right click to view rewards." + - "This crate contains strange objects." + - "You have %keys% keys to open this crate with." + - "You have opened this crate: %crate_opened% times" + - "(!) Right click to view rewards." Preview: # Turn on and off the preview for this crate. Toggle: true @@ -99,30 +101,31 @@ Crate: Item: "GRAY_STAINED_GLASS_PANE" PhysicalKey: # Name of the Key. - Name: "&4&lWar Crate &b&lKey" + Name: "War Crate Key" # Lore of the Key. Lore: - - "&7A special Key" - - "&7For a special Crate." + - "A special Key" + - "For a special Crate." # The item the key is. Item: "TRIPWIRE_HOOK" # Makes the key look enchanted. Glowing: true - # Settings for the holograms. + # Settings for the holograms. Hologram: # Toggle on and off the holograms for the crates. Toggle: true # The height of the hologram above the crate. Height: 1.5 - # The distance the hologram can be seen. Only works with CMI and DecentHolograms + # The distance the hologram can be seen. Range: 8 - # The message that will be displayed. + # The message that will be displayed above the crate. + # Note: MiniMessage or Color Codes being supported is depending on the 'holograms' plugin. Message: - - "&4&lWar Crate" + - "War Crate" # All the prizes that can be gotten in the Crate. Prizes: 1: - DisplayName: "&4&lWarlord's Helmet" + DisplayName: "Warlord's Helmet" DisplayItem: "NETHERITE_HELMET" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -131,17 +134,17 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's helmet." - - "&6&lChance: &c&l40%" + - "Win the warlord's helmet." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" MaxRange: 100 Chance: 40 Items: - - "Item:NETHERITE_HELMET, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Helmet, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_HELMET, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Helmet, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 2: - DisplayName: "&4&lWarlord's Chestplate" + DisplayName: "Warlord's Chestplate" DisplayItem: "NETHERITE_CHESTPLATE" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -150,17 +153,17 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's chestplate." - - "&6&lChance: &c&l40%" + - "Win the warlord's chestplate." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" MaxRange: 100 Chance: 40 Items: - - "Item:NETHERITE_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Chestplate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_CHESTPLATE, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Chestplate, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 3: - DisplayName: "&4&lWarlord's Leggings" + DisplayName: "Warlord's Leggings" DisplayItem: "NETHERITE_LEGGINGS" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -169,17 +172,17 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's leggings." - - "&6&lChance: &c&l40%" + - "Win the warlord's leggings." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" MaxRange: 100 Chance: 40 Items: - - "Item:NETHERITE_LEGGINGS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Leggings, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" + - "Item:NETHERITE_LEGGINGS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Leggings, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" 4: - DisplayName: "&4&lWarlord's Boots" + DisplayName: "Warlord's Boots" DisplayItem: "NETHERITE_BOOTS" DisplayTrim: # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html @@ -188,12 +191,12 @@ Crate: Pattern: "SENTRY" DisplayAmount: 1 Lore: - - "&7Win the warlord's boots." - - "&6&lChance: &c&l40%" + - "Win the warlord's boots." + - "Chance: 40%" DisplayEnchantments: - "PROTECTION_ENVIRONMENTAL:5" - "DURABILITY:3" MaxRange: 100 Chance: 40 Items: - - "Item:NETHERITE_BOOTS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:&4&lWarlord's Boots, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" \ No newline at end of file + - "Item:NETHERITE_BOOTS, Amount:1, Damage:25, Trim-Pattern:SENTRY, Trim-Material:REDSTONE, Name:Warlord's Boots, PROTECTION_ENVIRONMENTAL:5, DURABILITY:3" \ No newline at end of file diff --git a/paper/src/main/resources/locations.yml b/paper/src/main/resources/locations.yml index 8c0698de3..0962e50ca 100644 --- a/paper/src/main/resources/locations.yml +++ b/paper/src/main/resources/locations.yml @@ -1 +1 @@ -Locations: { } \ No newline at end of file +Locations: {} \ No newline at end of file diff --git a/paper/src/main/resources/messages.yml b/paper/src/main/resources/messages.yml index 63dd1406d..e02c807de 100644 --- a/paper/src/main/resources/messages.yml +++ b/paper/src/main/resources/messages.yml @@ -5,201 +5,178 @@ # Features: https://github.com/Crazy-Crew/CrazyCrates/issues # misc: - # A list of available placeholders: {prefix} - unknown-command: '{prefix}&cThis command is not known.' + # A list of available placeholders: {prefix}, {command} + unknown-command: "{prefix}{command} is not a known command." # Only activates when you try to use an ender pearl while opening a crate. - no-teleporting: '{prefix}&cYou may not teleport away while opening a crate.' + no-teleporting: "{prefix}You may not teleport away while opening a crate." # A list of available placeholders: {prefix} - no-commands: '{prefix}&cYou are not allowed to use commands while opening crates.' - # A list of available placeholders: {prefix}, {key}, {crate} - no-keys: '{prefix}&cYou must have a {key} &cto use &6{crate}.' + no-commands: "{prefix}You are not allowed to use commands while opening crates." # A list of available placeholders: {prefix}, {key}, {crate} - no-virtual-keys: '{prefix}&cYou need a virtual key to open &6{crate}.' + no-keys: "{prefix}You must have a {key} in your hand to use {crate}." + # A list of available placeholders: {prefix}, {crate} + no-virtual-keys: "{prefix}You need a virtual key to open {crate}." # A list of available placeholders: {prefix}, {usage} - correct-usage: '{prefix}&cThe correct usage for this command is &e{usage}' + correct-usage: "{prefix}The correct usage for this command is {usage}" # A list of available placeholders: {prefix} - feature-disabled: '{prefix}&cThis feature is disabled.' + feature-disabled: "{prefix}This feature is disabled." # All messages related to errors. errors: # A list of available placeholders: {prefix}, {crate} - no-prizes-found: '{prefix}&cThis crate contains no prizes that you can win.' + no-prizes-found: "{prefix}This crate contains no prizes that you can win." # A list of available placeholders: {prefix} - no-schematics-found: '{prefix}&cNo schematics were found. Please make sure files - ending in .nbt exist in the schematics folder. If not delete the folder so they - regenerate.' + no-schematics-found: "{prefix}No schematics were found. Please make sure files ending in .nbt exist in the schematics folder. If not delete the folder so they regenerate." # A list of available placeholders: {prefix} - internal-error: '{prefix}&cAn internal error has occurred. Please check the console - for the full error.' + internal-error: "{prefix}An internal error has occurred. Please check the console for the full error." # A list of available placeholders: {prefix}, {crate}, {prize} - prize-error: '{prefix}&cAn error has occurred while trying to give you the prize - called &6{prize}&c in crate called &6{crate}&c. Please contact the server owner - and show them this error.' + prize-error: "{prefix}An error has occurred while trying to give you the prize called {prize} in crate called {crate}. Please contact the server owner and show them this error." # All messages related to players. player: requirements: # A list of available placeholders: {prefix} - must-be-player: '{prefix}&cYou must be a player to use this command.' + must-be-player: "{prefix}You must be a player to use this command." # A list of available placeholders: {prefix} - must-be-console-sender: '{prefix}&cYou must be using console to use this command.' + must-be-console-sender: "{prefix}You must be using console to use this command." # A list of available placeholders: {prefix} - must-be-looking-at-block: '{prefix}&cYou must be looking at a block.' + must-be-looking-at-block: "{prefix}You must be looking at a block." # A list of available placeholders: {prefix}, {player} - target-not-online: '{prefix}&c{player} &7is not online.' + target-not-online: "{prefix}{player} is not online." # A list of available placeholders: {prefix} - target-same-player: '{prefix}&cYou can''''t use this command on yourself.' + target-same-player: "{prefix}You cannot use this command on yourself." # A list of available placeholders: {prefix} - no-permission: '{prefix}&cYou do not have permission to use that command/menu!' + no-permission: "{prefix}You do not have permission to use that command/menu!" # A list of available placeholders: {prefix}, {crate} - inventory-not-empty: '{prefix}&cInventory is not empty, Please make room before - opening &6{crate}.' + inventory-not-empty: "{prefix}Inventory is not empty, Please make room before opening {crate}." # A list of available placeholders: {prefix}, {amount}, {keytype}, {key} - obtaining-keys: '{prefix}&7You have been given &6{amount} {key} &7key(s).' + obtaining-keys: "{prefix}You have been given {amount} {key} key(s)." # A list of available placeholders: {prefix}, {player} - too-close-to-another-player: '{prefix}&cYou are too close to a player that is opening - a crate.' + too-close-to-another-player: "{prefix}You are too close to a player that is opening a crate." # All messages related to crates. crates: requirements: # A list of available placeholders: {prefix}, {crate} - not-a-crate: '{prefix}&cThere is no crate called &6{crate}.' + not-a-crate: "{prefix}There is no crate called {crate}." + # A list of available placeholders: {prefix}, {key} + not-a-key: "{prefix}There is no key called {key}." # A list of available placeholders: {prefix}, {number} - not-a-number: '{prefix}&6{number} &cis not a number.' + not-a-number: "{prefix}{number} is not a number." # A list of available placeholders: {prefix}, {amount}, {key_amount}, {crate} - not-enough-keys: '{prefix}&7You need &c{key_amount} &7keys to open &c{crate}. - &7You have &c{amount}.' + not-enough-keys: "{prefix}You need {key_amount} keys to open {crate}. You have {amount}." # A list of available placeholders: {prefix} - not-a-block: '{prefix}&cYou must be standing on a block to use &6{crate}.' + not-a-block: "{prefix}You must be standing on a block to use {crate}." # A list of available placeholders: {prefix}, {crate} - out-of-time: '{prefix}&cYou took &65 minutes &cto open &6{crate} &cso it closed.' + out-of-time: "{prefix}You took 5 minutes to open {crate} so it closed." # A list of available placeholders: {prefix} - forced-out-of-preview: '{prefix}&cA reload has forced you out of the preview.' + forced-out-of-preview: "{prefix}A reload has forced you out of the preview." # A list of available placeholders: {prefix} - cannot-set-menu-type: '{prefix}&cYou cannot set the Menu to a block because the - crate menu is disabled' + cannot-set-menu-type: "{prefix}You cannot set the Menu to a block because the crate menu is disabled" # A list of available placeholders: {prefix}, {crate} - crate-no-permission: '{prefix}&cYou do not have permission to use that {crate}.' + crate-no-permission: "{prefix}You do not have permission to use that {crate}." # A list of available placeholders: {prefix}, {crate} - crate-preview-disabled: '{prefix}&cThe preview for &6{crate} &cis currently disabled.' + crate-preview-disabled: "{prefix}The preview for {crate} is currently disabled." # A list of available placeholders: {prefix}, {crate} - crate-already-open: '{prefix}&cYou are already opening &6{crate}.' + crate-already-open: "{prefix}You are already opening {crate}." # A list of available placeholders: {prefix}, {crate} - crate-in-use: '{prefix}&c{crate} is already in use. Please wait until it finishes.' + crate-in-use: "{prefix}{crate} is already in use. Please wait until it finishes." # A list of available placeholders: {prefix}, {crate}, {cratetype} - cannot-be-a-virtual-crate: '{prefix}&6{crate} &ccannot be used as a Virtual Crate.' + cannot-be-a-virtual-crate: "{prefix}{crate} cannot be used as a Virtual Crate." # QuadCrate schematics need a fair bit of room so make sure you check the surroundings. - need-more-room: '{prefix}&cThere is not enough space to open that here' + need-more-room: "{prefix}There is not enough space to open that here" # A list of available placeholders: {prefix}, {world} - world-disabled: '{prefix}&cI am sorry but Crates are disabled in {world}.' + world-disabled: "{prefix}I am sorry but Crates are disabled in {world}." physical-crate: # A list of available placeholders: {prefix}, {crate} created: - - '{prefix}&7You have set that block to {crate}.' - - '&7To remove the crate shift break in creative to remove.' + - "{prefix}You have set that block to {crate}." + - "To remove the crate shift break in creative to remove." # A list of available placeholders: {prefix}, {id} - removed: '{prefix}&7You have removed &6{id}.' + removed: "{prefix}You have removed {id}." # All messages related to commands. command: open: # A list of available placeholders: {prefix}, {crate}, {player} - opened-a-crate: '{prefix}&7You have opened the &6{crate} for &6{player}.' + opened-a-crate: "{prefix}You have opened the {crate} for {player}." give: # A list of available placeholders: {prefix}, {amount}, {player}, {keytype} - given-player-keys: '{prefix}&7You have given &6{player} {amount} &7key(s).' + given-player-keys: "{prefix}You have given {player} {amount} key(s)." # A list of available placeholders: {prefix}, {amount}, {amount}, {keytype} - full-inventory: '{prefix}&7You have been given &6{amount} {key} &7virtual key(s) - because your inventory was full.' + full-inventory: "{prefix}You have been given {amount} {key} virtual key(s) because your inventory was full." # A list of available placeholders: {prefix}, {amount}, {keytype} - given-everyone-keys: '{prefix}&7You have given everyone &6{amount} &7key(s).' + given-everyone-keys: "{prefix}You have given everyone {amount} key(s)." # A list of available placeholders: {prefix}, {amount}, {player}, {keytype} - given-offline-player-keys: '{prefix}&7You have given &6{amount} &7key(s) to the - offline player &6{player}.' + given-offline-player-keys: "{prefix}You have given {amount} key(s) to the offline player {player}." take: # A list of available placeholders: {prefix}, {amount}, {player}, {keytype} - take-player-keys: '{prefix}&7You have taken &6{amount} &7key(s) from &6{player}.' + take-player-keys: "{prefix}You have taken {amount} key(s) from {player}." # A list of available placeholders: {prefix}, {player} - cannot-take-keys: '{prefix}&7You cannot take key(s) from &6{player} &7as they - are poor.' + cannot-take-keys: "{prefix}You cannot take key(s) from {player} as they are poor." # A list of available placeholders: {prefix}, {amount}, {player}, {keytype} - take-offline-player-keys: '{prefix}&7You have taken &6{amount} &7key(s) from the - offline player &6{player}.' + take-offline-player-keys: "{prefix}You have taken {amount} key(s) from the offline player {player}." additem: # A list of available placeholders: {prefix}, {crate} - no-item-in-hand: '{prefix}&cYou need to have an item in your hand to add it {crate}.' + no-item-in-hand: "{prefix}You need to have an item in your hand to add it {crate}." # A list of available placeholders: {prefix}, {crate}, {prize} - add-item-from-hand: '{prefix}&7The item has been added to the {crate} in prize - #{prize}.' + add-item-from-hand: "{prefix}The item has been added to the {crate} in prize #{prize}." convert: - no-files-to-convert: '&cNo available plugins to convert files.' - error-converting-files: '&cAn error has occurred while trying to convert files. - We could not convert &a{file} &cso please check the console.' - successfully-converted-files: '&aPlugin Conversion has succeeded!' + no-files-to-convert: "No available plugins to convert files." + error-converting-files: "An error has occurred while trying to convert files. We could not convert {file} so please check the console." + successfully-converted-files: "Plugin Conversion has succeeded!" reload: # A list of available placeholders: {prefix} - completed: '{prefix}&3You have reloaded the Config and Data Files.' + completed: "{prefix}You have reloaded the Config and Data Files." transfer: # A list of available placeholders: {prefix} - not-enough-keys: '{prefix}&cYou do not have enough keys to transfer.' + not-enough-keys: "{prefix}You do not have enough keys to transfer." # A list of available placeholders: {prefix}, {amount}, {player}, {keytype}, {crate} - transferred-keys: '{prefix}&7You have transferred {amount} {crate} keys to {player}.' + transferred-keys: "{prefix}You have transferred {amount} {crate} keys to {player}." # A list of available placeholders: {prefix}, {amount}, {player}, {keytype}, {crate} - transferred-keys-received: '{prefix}&7You have received {amount} {crate} keys - from {player}.' + transferred-keys-received: "{prefix}You have received {amount} {crate} keys from {player}." keys: personal: # A list of available placeholders: {prefix} - no-virtual-keys: '{prefix}&8&l(&4&l!&8&l) &7You currently do not have any virtual - keys.' + no-virtual-keys: "{prefix}(!) You currently do not have any virtual keys." # A list of available placeholders: {crates_opened} virtual-keys-header: - - '&8&l(&6&l!&8&l) &7List of your current number of keys.' - - ' &e -> Total Crates Opened: &c{crates_opened}' + - "(!) List of your current number of keys." + - " -> Total Crates Opened: {crates_opened}" other-player: # A list of available placeholders: {prefix}, {player} - no-virtual-keys: '{prefix}&8&l(&4&l!&8&l) &7The player {player} does not have - any keys.' + no-virtual-keys: "{prefix}(!) The player {player} does not have any keys." # A list of available placeholders: {player}, {crates_opened} virtual-keys-header: - - '&8&l(&6&l!&8&l) &7List of {player}''''s current number of keys.' - - ' &e -> Total Crates Opened: &c{crates_opened}' + - "(!) List of {player}""s current number of keys." + - " -> Total Crates Opened: {crates_opened}" # A list of available placeholders: {crate}, {keys}, {crate_opened} - crate-format: '{crate} &7&l>&8&l> &6{keys} keys &7: Opened &6{crate_opened} times' + crate-format: "{crate} >> {keys} keys : Opened {crate_opened} times" # This requires crazycrates.command.help player-help: - - '&e&lCrazy Crates Player Help' - - '&6/keys view [player] &7- &eCheck the number of keys a player has.' - - '&6/keys &7- &eShows how many keys you have.' - - '&6/cc &7- &eOpens the menu.' + - "Crazy Crates Player Help" + - "/keys view [player] - Check the number of keys a player has." + - "/keys - Shows how many keys you have." + - "/cc - Opens the menu." # This requires crazycrates.command.admin.help admin-help: - - '&c&lCrazy Crates Admin Help' - - '' - - '&6/cc additem [tier] &7- &eAdd items in-game - to a prize in a crate including Cosmic/Casino.' - - '&6/cc preview [player] &7- &eOpens the preview of a crate for a - player.' - - '&6/cc list &7- &eLists all crates.' - - '&6/cc open &7- &eTries to open a crate for you if you have a key.' - - '&6/cc open-others [player] &7- &eTries to open a crate for a player - if they have a key.' - - '&6/cc transfer [player] [amount &7- &eTransfers keys to players - you chose.' - - '&6/cc debug &7- &eDebugs crates' - - '&6/cc admin &7- &eShows admin menu' - - '&6/cc forceopen [player] &7- &eOpens a crate for a player for free.' - - '&6/cc mass-open [amount] &7- &eMass opens a set - amount of crates.' - - '&6/cc tp &7- &eTeleport to a Crate.' - - '&6/cc give [amount] [player] &7- &eAllows you - to take keys from a player.' - - '&6/cc set &7- &eSet the block you are looking at as a crate.' - - '&6/cc set Menu &7- &eSet the block you are looking at to open the /cc menu.' - - '&6/cc reload &7- &eReloads the config/data files.' - - '&6/cc set1/set2 &7- &eSets position &c#1 &eor &c#2 for when making a new schematic - for QuadCrates.' - - '&6/cc save &7- &eCreate a new nbt file in the schematics folder.' - - '' - - '&6/keys view [player] &7- &eCheck the number of keys a player has.' - - '&6/keys &7- &eShows how many keys you have.' - - '&6/cc &7- &eOpens the menu.' - - '' - - '&7You can find a list of permissions @ &ehttps://docs.crazycrew.us/crazycrates/info/commands/permissions' + - "Crazy Crates Admin Help" + - "" + - "/cc additem [tier] - Add items in-game to a prize in a crate including Cosmic/Casino." + - "/cc preview [player] - Opens the preview of a crate for a player." + - "/cc list - Lists all crates." + - "/cc open - Tries to open a crate for you if you have a key." + - "/cc open-others [player] - Tries to open a crate for a player if they have a key." + - "/cc transfer [player] [amount - Transfers keys to players you chose." + - "/cc debug - Debugs crates" + - "/cc admin - Shows admin menu" + - "/cc forceopen [player] - Opens a crate for a player for free." + - "/cc mass-open [amount] - Mass opens a set amount of crates." + - "/cc tp - Teleport to a Crate." + - "/cc give [amount] [player] - Allows you to take keys from a player." + - "/cc set - Set the block you are looking at as a crate." + - "/cc set Menu - Set the block you are looking at to open the /cc menu." + - "/cc reload - Reloads the config/data files." + - "/cc set1/set2 - Sets position #1 or #2 for when making a new schematic for QuadCrates." + - "/cc save - Create a new nbt file in the schematics folder." + - "" + - "/keys view [player] - Check the number of keys a player has." + - "/keys - Shows how many keys you have." + - "/cc - Opens the menu." + - "" + - "You can find a list of permissions @ https://docs.crazycrew.us/crazycrates/info/commands/permissions" \ No newline at end of file diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml index cd4571c81..3002e6ac2 100644 --- a/paper/src/main/resources/paper-plugin.yml +++ b/paper/src/main/resources/paper-plugin.yml @@ -16,6 +16,10 @@ dependencies: load: BEFORE required: false join-classpath: true + FancyHolograms: + load: BEFORE + required: false + join-classpath: true PlaceholderAPI: load: BEFORE required: false