From c8493dedaacbcb4fcdbc3722a9103323d7f000be Mon Sep 17 00:00:00 2001 From: MetallicGoat Date: Sun, 6 Mar 2022 15:09:28 -0500 Subject: [PATCH] Configure Icon Names --- pom.xml | 4 ++-- .../java/me/metallicgoat/specialItems/config/Config.java | 7 +++++++ .../me/metallicgoat/specialItems/config/ConfigValue.java | 7 +++++++ .../specialItems/items/CustomSpecialItem.java | 8 ++++---- .../specialItems/items/popuptower/TowerBlockPlacer.java | 7 +++++++ src/main/resources/config.yml | 6 ++++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index b503083..db3adf6 100644 --- a/pom.xml +++ b/pom.xml @@ -23,14 +23,14 @@ org.spigotmc spigot-api - 1.18.1-R0.1-SNAPSHOT + 1.18.2-R0.1-SNAPSHOT provided de.marcely.bedwars API - 5.0.7 + 5.0.8 diff --git a/src/main/java/me/metallicgoat/specialItems/config/Config.java b/src/main/java/me/metallicgoat/specialItems/config/Config.java index 690f853..d5aa0ba 100644 --- a/src/main/java/me/metallicgoat/specialItems/config/Config.java +++ b/src/main/java/me/metallicgoat/specialItems/config/Config.java @@ -69,7 +69,11 @@ public static void load(){ final FileConfiguration mainConfig = getConfig(); + // SPECIAL + ConfigValue.dye_tower_ukraine = mainConfig.getBoolean("Dye-Tower-Ukraine"); + // POP UP TOWER + ConfigValue.tower_icon_name = mainConfig.getString("PopUpTower.Icon-Name"); ConfigValue.tower_icon_material = parseConfigMaterial(mainConfig, "PopUpTower.Icon-Type", ConfigValue.tower_icon_material); ConfigValue.tower_block_material = parseConfigMaterial(mainConfig, "PopUpTower.Block-Type", ConfigValue.tower_block_material); ConfigValue.tower_block_place_interval = mainConfig.getInt("PopUpTower.Block-Place-Interval", ConfigValue.tower_block_place_interval); @@ -77,11 +81,13 @@ public static void load(){ ConfigValue.tower_place_place_sound = parseConfigSound(mainConfig, "PopUpTower.Sound", ConfigValue.tower_place_place_sound); // SILVERFISH + ConfigValue.silverfish_icon_name = mainConfig.getString("Silverfish.Icon-Name"); ConfigValue.silverfish_icon_material = parseConfigMaterial(mainConfig, "Silverfish.Icon-Type", ConfigValue.silverfish_icon_material); ConfigValue.silverfish_life_duration = mainConfig.getInt("Silverfish.Life-Duration", ConfigValue.silverfish_life_duration); ConfigValue.silverfish_life_display_name = mainConfig.getConfigurationSection("Silverfish.Display-Name"); // EGG BRIDGER + ConfigValue.egg_bridger_icon_name = mainConfig.getString("Egg-Bridger.Icon-Name"); ConfigValue.egg_bridger_icon_material = parseConfigMaterial(mainConfig, "Egg-Bridger.Icon-Type", ConfigValue.egg_bridger_icon_material); ConfigValue.egg_bridger_block_material = parseConfigMaterial(mainConfig, "Egg-Bridger.Block-Type", ConfigValue.egg_bridger_block_material); ConfigValue.egg_bridger_max_length = mainConfig.getInt("Egg-Bridger.Max-Length", ConfigValue.egg_bridger_max_length); @@ -89,6 +95,7 @@ public static void load(){ ConfigValue.egg_bridger_place_sound = parseConfigSound(mainConfig, "Egg-Bridger.Sound", ConfigValue.egg_bridger_place_sound); // ICE BRIDGER + ConfigValue.ice_bridger_icon_name = mainConfig.getString("Ice-Bridger.Icon-Name"); ConfigValue.ice_bridger_icon_material = parseConfigMaterial(mainConfig, "Ice-Bridger.Icon-Type", ConfigValue.ice_bridger_material); ConfigValue.ice_bridger_material = parseConfigMaterial(mainConfig, "Ice-Bridger.Block-Type", ConfigValue.ice_bridger_material); ConfigValue.ice_bridger_max_distance = mainConfig.getInt("Ice-Bridger.Max-Distance", ConfigValue.ice_bridger_max_distance); diff --git a/src/main/java/me/metallicgoat/specialItems/config/ConfigValue.java b/src/main/java/me/metallicgoat/specialItems/config/ConfigValue.java index 7fa81fc..2d588f3 100644 --- a/src/main/java/me/metallicgoat/specialItems/config/ConfigValue.java +++ b/src/main/java/me/metallicgoat/specialItems/config/ConfigValue.java @@ -11,22 +11,29 @@ public class ConfigValue { + //Special + public static boolean dye_tower_ukraine = false; + + public static String tower_icon_name = "PopUpTower"; public static Material tower_icon_material = Helper.get().getMaterialByName("CHEST"); public static Material tower_block_material = Helper.get().getMaterialByName("WOOL"); public static int tower_block_place_interval = 1; public static int tower_block_placed_per_interval = 2; public static Sound tower_place_place_sound = XSound.ENTITY_CHICKEN_EGG.parseSound(); + public static String silverfish_icon_name = "Silverfish"; public static Material silverfish_icon_material = Helper.get().getMaterialByName("SNOWBALL"); public static int silverfish_life_duration = 400; public static ConfigurationSection silverfish_life_display_name = null; + public static String egg_bridger_icon_name = "EggBridger"; public static Material egg_bridger_icon_material = Helper.get().getMaterialByName("EGG"); public static Material egg_bridger_block_material = Helper.get().getMaterialByName("WOOL"); public static int egg_bridger_max_length = 30; public static int egg_bridger_max_y_variation = 18; public static Sound egg_bridger_place_sound = XSound.ENTITY_CHICKEN_EGG.parseSound(); + public static String ice_bridger_icon_name = "IceBridger"; public static Material ice_bridger_icon_material = Helper.get().getMaterialByName("ICE"); public static Material ice_bridger_material = Helper.get().getMaterialByName("ICE"); public static int ice_bridger_max_distance = 37; diff --git a/src/main/java/me/metallicgoat/specialItems/items/CustomSpecialItem.java b/src/main/java/me/metallicgoat/specialItems/items/CustomSpecialItem.java index 2dbed5d..e88fdc9 100644 --- a/src/main/java/me/metallicgoat/specialItems/items/CustomSpecialItem.java +++ b/src/main/java/me/metallicgoat/specialItems/items/CustomSpecialItem.java @@ -53,25 +53,25 @@ public static void registerAll(){ register(new CustomSpecialItem( EggBridgerHandler.getEggBridgeHandler(), "egg-bridger", - "%EggBridgerItem%", + ConfigValue.egg_bridger_icon_name, new ItemStack(ConfigValue.egg_bridger_icon_material))); register(new CustomSpecialItem( IceBridgerHandler.getIceBridgeHandler(), "ice-bridger", - "%IceBridgerItem%", + ConfigValue.ice_bridger_icon_name, new ItemStack(ConfigValue.ice_bridger_icon_material))); register(new CustomSpecialItem( TowerHandler.getPopUpTowerHandler(), "tower", - "%TowerItem%", + ConfigValue.tower_icon_name, new ItemStack(ConfigValue.tower_icon_material))); register(new CustomSpecialItem( SilverfishHandler.getSilverfishHandler(), "silverfish", - "%SilverFishItem%", + ConfigValue.silverfish_icon_name, new ItemStack(ConfigValue.silverfish_icon_material))); if(ConfigValue.command_item_enabled){ diff --git a/src/main/java/me/metallicgoat/specialItems/items/popuptower/TowerBlockPlacer.java b/src/main/java/me/metallicgoat/specialItems/items/popuptower/TowerBlockPlacer.java index 896ddd9..0876331 100644 --- a/src/main/java/me/metallicgoat/specialItems/items/popuptower/TowerBlockPlacer.java +++ b/src/main/java/me/metallicgoat/specialItems/items/popuptower/TowerBlockPlacer.java @@ -67,6 +67,13 @@ public TowerBlockPlacer(Queue> towerBlock, SpecialItemUseSe private void PlaceBlock(Arena arena, boolean isLadder, Block b, BlockFace face, DyeColor color){ + if(ConfigValue.dye_tower_ukraine){ + if(((int) b.getLocation().getY()) % 2 != 0) + color = DyeColor.BLUE; + else + color = DyeColor.YELLOW; + } + if (!isLadder) { final PersistentBlockData data = PersistentBlockData.fromMaterial(ConfigValue.tower_block_material).getDyedData(color); data.place(b, true); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6ea5717..ee14193 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -7,10 +7,13 @@ # Ice-Bridger - ice-bridger # Custom-Command-Items - You Choose! +#Speacial Configs (May be removed in the future) +Dye-Tower-Ukraine: false #Automaticlly builds you a tower #Note: Block-Place-Interval in ticks (20 ticks = 1 second) PopUpTower: + Icon-Name: PopUpTower Icon-Type: CHEST Block-Type: WOOL Block-Place-Interval: 1 @@ -21,6 +24,7 @@ PopUpTower: #Note: Life-Duration in ticks (20 ticks = 1 second) #Display-Name Placeholders: {team-name} {team-color} Silverfish: + Icon-Name: BedBug Icon-Type: SNOWBALL Life-Duration: 400 Display-Name: @@ -32,6 +36,7 @@ Silverfish: #Construct a bridger following the path of an egg Egg-Bridger: + Icon-Name: EggBridger Icon-Type: EGG Block-Type: WOOL Max-Length: 30 @@ -40,6 +45,7 @@ Egg-Bridger: #Builds a flat bridge that only lasts for a few seconds Ice-Bridger: + Icon-Name: IceBridger Icon-Type: ICE Block-Type: ICE Max-Distance: 37