From 7bc803343993882afaba5662cd3d16fa8ef0afa1 Mon Sep 17 00:00:00 2001 From: itzCrih Date: Sat, 17 Feb 2024 21:08:42 +0100 Subject: [PATCH] Added a boolean to toggle santashovel command. --- pom.xml | 5 +---- .../coralwinter/commands/SantaShovelCommand.java | 3 +++ src/main/resources/META-INF/MANIFEST.MF | 1 - src/main/resources/messages.yml | 1 + src/main/resources/settings.yml | 14 ++++++++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 635b317..4de888a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.itzcrih CoralWinter - 1.3-SNAPSHOT + 1.4-SNAPSHOT jar CoralWinter @@ -66,7 +66,6 @@ - org.spigotmc @@ -74,7 +73,6 @@ 1.8.8-R0.1-SNAPSHOT provided - com.comphenix.protocol @@ -82,6 +80,5 @@ 5.1.0 provided - diff --git a/src/main/java/it/itzcrih/coralwinter/commands/SantaShovelCommand.java b/src/main/java/it/itzcrih/coralwinter/commands/SantaShovelCommand.java index 7e3e4ba..1e41fb8 100644 --- a/src/main/java/it/itzcrih/coralwinter/commands/SantaShovelCommand.java +++ b/src/main/java/it/itzcrih/coralwinter/commands/SantaShovelCommand.java @@ -20,6 +20,9 @@ public class SantaShovelCommand implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender instanceof Player) { Player player = (Player) sender; + if (!CoralWinter.getConfigLoader().getConfig().getBoolean("santashovel.enable_command")) { + player.sendMessage(ChatColor.translateAlternateColorCodes('&', CoralWinter.getConfigLoader().getMessages().getString("errors.command_disabled"))); + } if (player.hasPermission("coralwinter.command.santashovel")) { santaShovel.giveSantaShovel(player); } else { diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF index f496bd9..59499bc 100644 --- a/src/main/resources/META-INF/MANIFEST.MF +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -1,3 +1,2 @@ Manifest-Version: 1.0 -Main-Class: diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index c077814..e7117ae 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -4,6 +4,7 @@ errors: config_loading: "There was an error while loading the config!" no_perm: "&cSorry, but you don't have permission to use this command." + command_disabled: "&cThis command has been disabled from the configuration!" commands: reloaded_successfully: "&7The configuration has been &3reloaded &7successfully!" diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index 2fff0ef..c4ddb0e 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -4,16 +4,22 @@ # Diamond shovel settings santashovel: + # Please select an item for santashovel. (default: DIAMOND_SPADE) type: DIAMOND_SPADE # Please insert a valid material (STONE_SPADE, GOLD_SPADE, DIAMOND_SPADE, WOOD_SPADE, IRON_SPADE) + # Should we give santashovel whenever a player joins? give_on_join: true - display-name: "&c&lPala natalizia" + # Should we enable santashovel command? + enable_command: true + display-name: "&c&lChristmas shovel" lore: - - "&7Feryzz sara' sicuramente contento" - - "&7se dai una ripulita a questa lobby!" + - "&7Damn, the whole lobby is full of snow." + - "&7I would definitely be happy if you clean it!" + - "&7 " + - "&7(Hold &bLeft-click &7to clean the snow)" # Block protection settings block_protection: - # If enabled you can only break and place blocks if you have permission + # If enabled you can only break and place blocks if you have the following permission: # coralwinter.bypass.blockprotection block_place_enabled: true block_break_enabled: true \ No newline at end of file