From 9c00dd8c09fb3cf04a27b552b8f8dddb6f8efcbf Mon Sep 17 00:00:00 2001 From: StrangeOne101 Date: Sat, 15 Oct 2016 15:17:05 +1300 Subject: [PATCH] Colored EarthArmor + Combo Fix (#608) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Re-enabled colored EarthArmor, since it works now • Combos are now created 1 tick later then before. Reason for this is because if a combo requires the player to be shifting but the last combo trigger was a shift trigger, the combo would be created BEFORE the player actually changes shift states. --- .../ability/util/ComboManager.java | 39 ++++++++----- .../configuration/ConfigManager.java | 2 +- .../projectkorra/earthbending/EarthArmor.java | 56 +++++++++++-------- 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java index 249d74b2..613c30c0 100644 --- a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java @@ -170,7 +170,7 @@ public class ComboManager { startCleanupTask(); } - public static void addComboAbility(Player player, ClickType type) { + public static void addComboAbility(final Player player, ClickType type) { BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return; @@ -183,27 +183,36 @@ public class ComboManager { AbilityInformation info = new AbilityInformation(abilityName, type, System.currentTimeMillis()); addRecentAbility(player, info); - ComboAbilityInfo comboAbil = checkForValidCombo(player); + final ComboAbilityInfo comboAbil = checkForValidCombo(player); if (comboAbil == null) { return; } else if (!player.hasPermission("bending.ability." + comboAbil.getName())) { return; } - if (comboAbil.getComboType().equals(FireCombo.class)) { - new FireCombo(player, comboAbil.getName()); - } else if (comboAbil.getComboType().equals(AirCombo.class)) { - new AirCombo(player, comboAbil.getName()); - } else if (comboAbil.getComboType().equals(WaterCombo.class)) { - new WaterCombo(player, comboAbil.getName()); - } else if (comboAbil.getComboType().equals(ChiCombo.class)) { - new ChiCombo(player, comboAbil.getName()); - } else { - if (comboAbil.getComboType() instanceof ComboAbility) { - ((ComboAbility) comboAbil.getComboType()).createNewComboInstance(player); - return; + new BukkitRunnable() { + + @Override + public void run() { + if (comboAbil.getComboType().equals(FireCombo.class)) { + new FireCombo(player, comboAbil.getName()); + } else if (comboAbil.getComboType().equals(AirCombo.class)) { + new AirCombo(player, comboAbil.getName()); + } else if (comboAbil.getComboType().equals(WaterCombo.class)) { + new WaterCombo(player, comboAbil.getName()); + } else if (comboAbil.getComboType().equals(ChiCombo.class)) { + new ChiCombo(player, comboAbil.getName()); + } else { + if (comboAbil.getComboType() instanceof ComboAbility) { + ((ComboAbility) comboAbil.getComboType()).createNewComboInstance(player); + return; + } + } } - } + + }.runTaskLater(ProjectKorra.plugin, 1L); + + } /** diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 1a6fd61c..8a9075b1 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -280,7 +280,7 @@ public class ConfigManager { config.addDefault("Abilities.Earth.Catapult.Description", "To use, left-click while looking in the direction you want to be launched. " + "A pillar of earth will jut up from under you and launch you in that direction - " + "if and only if there is enough earth behind where you're looking to launch you. " + "Skillful use of this ability takes much time and work, and it does result in the " + "death of certain gung-ho earthbenders. If you plan to use this ability, be sure " + "you've read about your passive ability you innately have as an earthbender."); config.addDefault("Abilities.Earth.Collapse.Description", " To use, simply left-click on an earthbendable block. " + "That block and the earthbendable blocks above it will be shoved " + "back into the earth below them, if they can. " + "This ability does have the capacity to trap something inside of it, " + "although it is incredibly difficult to do so. " + "Additionally, press sneak with this ability to affect an area around your targetted location - " + "all earth that can be moved downwards will be moved downwards. " + "This ability is especially risky or deadly in caves, depending on the " + "earthbender's goal and technique."); config.addDefault("Abilities.Earth.Collapse.DeathMessage", "{victim} was suffocated by {attacker}'s {ability}"); - config.addDefault("Abilities.Earth.EarthArmor.Description", "This ability encases the Earthbender in temporary armor. To use, hold shift while looking at an earthbendable block and that block will travel towards you and grant you temporary armor and resistance. Shift click while on the move's slot to manually remove it."); + config.addDefault("Abilities.Earth.EarthArmor.Description", "This ability encases the Earthbender in temporary armor. To use, hold shift while looking at an earthbendable block and that block will travel towards you and grant you temporary armor and resistance. Shift and click while on the move's slot to manually remove it."); config.addDefault("Abilities.Earth.EarthBlast.Description", "To use, place your cursor over an earthbendable object (dirt, rock, ores, etc) " + "and tap sneak (default: shift). The object will temporarily turn to stone, " + "indicating that you have it focused as the source for your ability. " + "After you have selected an origin (you no longer need to be sneaking), " + "simply left-click in any direction and you will see your object launch " + "off in that direction, smashing into any creature in its path. If you look " + "towards a creature when you use this ability, it will target that creature. " + "A collision from Earth Blast both knocks the target back and deals some damage. " + "You cannot have multiple of these abilities flying at the same time."); config.addDefault("Abilities.Earth.EarthBlast.DeathMessage", "{victim} was broken apart by {attacker}'s {ability}"); config.addDefault("Abilities.Earth.EarthGrab.Description", "To use, simply hold shift and left click while targeting an entity. This ability will erect a circle of earth to trap the entity in. Alternatively, click the block below you to encase yourself."); diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java index b6e22de2..50287d75 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java @@ -8,6 +8,7 @@ import com.projectkorra.projectkorra.util.TempArmor; import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.waterbending.PlantArmor; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -15,6 +16,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.material.MaterialData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -87,6 +89,7 @@ public class EarthArmor extends EarthAbility { } } + @SuppressWarnings("deprecation") private void formArmor() { if (TempBlock.isTempBlock(headBlock)) { TempBlock.revertBlock(headBlock, Material.AIR); @@ -102,16 +105,20 @@ public class EarthArmor extends EarthAbility { //Color disabled for now since the colors are all weird... - /*LeatherArmorMeta metaHead = (LeatherArmorMeta) head.getItemMeta(); + LeatherArmorMeta metaHead = (LeatherArmorMeta) head.getItemMeta(); + LeatherArmorMeta metaChest = (LeatherArmorMeta) head.getItemMeta(); + LeatherArmorMeta metaLegs = (LeatherArmorMeta) leggings.getItemMeta(); LeatherArmorMeta metaBottom = (LeatherArmorMeta) leggings.getItemMeta(); - metaHead.setColor(Color.fromBGR(getColor(headType, headData))); - metaBottom.setColor(Color.fromBGR(getColor(legsType, legsData))); + metaHead.setColor(Color.fromRGB(getColor(headData.getItemType(), headData.getData()))); + metaChest.setColor(Color.fromRGB(getColor(headData.getItemType(), headData.getData()))); + metaLegs.setColor(Color.fromRGB(getColor(legsData.getItemType(), legsData.getData()))); + metaBottom.setColor(Color.fromRGB(getColor(legsData.getItemType(), legsData.getData()))); head.setItemMeta(metaHead); - chestplate.setItemMeta(metaHead); - leggings.setItemMeta(metaBottom); - boots.setItemMeta(metaBottom);*/ + chestplate.setItemMeta(metaChest); + leggings.setItemMeta(metaLegs); + boots.setItemMeta(metaBottom); ItemStack armors[] = { boots, leggings, chestplate, head }; TempArmor armor = new TempArmor(player, 72000000L, this, armors); //Duration of 2 hours @@ -295,34 +302,35 @@ public class EarthArmor extends EarthAbility { return getColor(material, (byte) 0x0); } + /**Returns the color for the specified material.*/ public static int getColor(Material material, byte damage) { - if (material == Material.GRASS) return 0x4D8400; //Dark dull green - if (material == Material.CLAY) return 0xD1C2BA; //Dull gray-brown + if (material == Material.GRASS) return 0x29932C; //Dark dull green - Needs to be darker + if (material == Material.CLAY) return 0xBAC2D1; //Dull gray-brown - PERFECT if (material == Material.STONE && damage == 0x0) return 0xCCCCCC; //Gray - if (material == Material.STONE && (damage == 0x1 || damage == 0x2)) return 0xCCCCCC; //Dark dull green - if (material == Material.STONE && (damage == 0x3 || damage == 0x4)) return 0xFCF8F7; //White - if (material == Material.STONE && (damage == 0x5 || damage == 0x6)) return 0xCECECE; //Gray + if (material == Material.STONE && (damage == 0x1 || damage == 0x2)) return 0xC9705C; //Pink - Needs to be richer + if (material == Material.STONE && (damage == 0x3 || damage == 0x4)) return 0xF8F7FC; //White + if (material == Material.STONE && (damage == 0x5 || damage == 0x6)) return 0xBFBFBF; //Gray - fine for now if (material == Material.COBBLESTONE) return 0x6B6B6B; //Dark Gray - if (material == Material.SAND && damage == 0x0) return 0xFFFFCC; //Sand yellow - if (material == Material.SAND && damage == 0x1) return 0xFFA723; //Sand orange // - if (material == Material.SANDSTONE) return 0xF2E9BA; //Sand - if (material == Material.RED_SANDSTONE) return 0xB85F25; //Sand + if (material == Material.SAND && damage == 0x0) return 0xFFFFCC; //Sand yellow - PERFECT + if (material == Material.SAND && damage == 0x1) return 0xB85F25; //Sand orange - Needs more red -------------- + if (material == Material.SANDSTONE) return 0xFFF372; //Sand - Could be darker/more vibrant + if (material == Material.RED_SANDSTONE) return 0xB85F25; //Red sandstone - PERFECT if (material == Material.GRAVEL) return 0xEDE4DC; //Dark Gray - if (material == Material.GOLD_ORE) return 0xEDE4DC; //Gray with gold tint - if (material == Material.GOLD_BLOCK) return 0xf2f204; //Gold - if (material == Material.IRON_ORE) return 0xDBBFA0; //Gray with iron tint + if (material == Material.GOLD_ORE) return 0xF2F204; + if (material == Material.GOLD_BLOCK) return 0xF2F204; //Gold - Could be a tiny bit darker + if (material == Material.IRON_ORE) return 0xf4f4f4; if (material == Material.IRON_BLOCK) return 0xf4f4f4; //Silver/Gray if (material == Material.COAL_ORE) return 0x999999; //Stone gray - if (material == Material.DIRT) return 0xA34401; //Default dirt brown - if (material == Material.LAPIS_ORE) return 0x7A8899; //Stone gray with blue tint - if (material == Material.LAPIS_BLOCK) return 0x1C4475; //Dark blue - if (material == Material.NETHERRACK) return 0x9A1313; //Pinkish-red - if (material == Material.QUARTZ_ORE) return 0x9A1313; //Pinkish-red + if (material == Material.DIRT) return 0x843700; //Default dirt brown - NEEDS SERIOUS CHANGING + if (material == Material.LAPIS_ORE) return 0x0060BA; + if (material == Material.LAPIS_BLOCK) return 0x0060BA; //Dark blue + if (material == Material.NETHERRACK) return 0x13139A; //Pinkish-red - PERFECT + if (material == Material.QUARTZ_ORE) return 0x13139A; //Pinkish-red if (material == Material.QUARTZ_BLOCK) return 0xFDFDFD; //White - return 0x999999; //Default dirt brown + return 0xCCCCCC; //Stone } @SuppressWarnings("deprecation")