From 3d4a779514f2b24f3bf3793beb8699e8e1b86970 Mon Sep 17 00:00:00 2001 From: Sobki Date: Wed, 28 Sep 2016 17:18:48 +1000 Subject: [PATCH] Updates for Acrobat & Warrior Stance (#584) --- .../projectkorra/GeneralMethods.java | 124 ++++++++++-------- .../chiblocking/AcrobatStance.java | 8 +- .../chiblocking/WarriorStance.java | 14 +- 3 files changed, 83 insertions(+), 63 deletions(-) diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java index 44de079a..f60cc48a 100644 --- a/src/com/projectkorra/projectkorra/GeneralMethods.java +++ b/src/com/projectkorra/projectkorra/GeneralMethods.java @@ -1,9 +1,57 @@ package com.projectkorra.projectkorra; -import me.ryanhamshire.GriefPrevention.Claim; -import me.ryanhamshire.GriefPrevention.GriefPrevention; -import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag; -import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.FallingSand; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; import com.bekvon.bukkit.residence.Residence; import com.bekvon.bukkit.residence.protection.ClaimedResidence; @@ -44,6 +92,8 @@ import com.projectkorra.projectkorra.airbending.AirShield; import com.projectkorra.projectkorra.airbending.AirSpout; import com.projectkorra.projectkorra.airbending.AirSuction; import com.projectkorra.projectkorra.airbending.AirSwipe; +import com.projectkorra.projectkorra.chiblocking.AcrobatStance; +import com.projectkorra.projectkorra.chiblocking.WarriorStance; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.earthbending.EarthBlast; import com.projectkorra.projectkorra.earthbending.EarthPassive; @@ -66,58 +116,10 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.protection.flags.DefaultFlag; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.FallingSand; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.Vector; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.lang.reflect.Field; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; +import me.ryanhamshire.GriefPrevention.Claim; +import me.ryanhamshire.GriefPrevention.GriefPrevention; +import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag; +import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones; @SuppressWarnings("deprecation") public class GeneralMethods { @@ -566,10 +568,16 @@ public class GeneralMethods { if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingPreview") == true) { if (ability != null) { + if (bPlayer.isOnCooldown(ability)) { displayedMessage = ability.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + ability.getName(); } else { - displayedMessage = ability.getElement().getColor() + ability.getName(); + if (bPlayer.getStance() instanceof AcrobatStance && ability.getName().equals("AcrobatStance") || + bPlayer.getStance() instanceof WarriorStance && ability.getName().equals("WarriorStance")) { + displayedMessage = ability.getElement().getColor() + "" + ChatColor.UNDERLINE + ability.getName(); + } else { + displayedMessage = ability.getElement().getColor() + ability.getName(); + } } } else { displayedMessage = ""; @@ -1819,4 +1827,4 @@ public class GeneralMethods { e.printStackTrace(); } } -} +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java index d2741c0f..bffe9efa 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java @@ -1,9 +1,11 @@ package com.projectkorra.projectkorra.chiblocking; import com.projectkorra.projectkorra.Element; +import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.ChiAbility; import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -31,11 +33,15 @@ public class AcrobatStance extends ChiAbility { stance.remove(); if (stance instanceof AcrobatStance) { bPlayer.setStance(null); + GeneralMethods.displayMovePreview(player, this); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_SHOOT, 0.5F, 2F); return; } } start(); bPlayer.setStance(this); + GeneralMethods.displayMovePreview(player, this); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 0.5F, 2F); } @Override @@ -110,4 +116,4 @@ public class AcrobatStance extends ChiAbility { this.paralyzeDodgeBoost = paralyzeDodgeBoost; } -} +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java index e9bced9f..c3fa3e04 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java @@ -1,13 +1,15 @@ package com.projectkorra.projectkorra.chiblocking; -import com.projectkorra.projectkorra.Element; -import com.projectkorra.projectkorra.ability.ChiAbility; - import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import com.projectkorra.projectkorra.Element; +import com.projectkorra.projectkorra.GeneralMethods; +import com.projectkorra.projectkorra.ability.ChiAbility; + public class WarriorStance extends ChiAbility { private int strength; @@ -26,11 +28,15 @@ public class WarriorStance extends ChiAbility { stance.remove(); if (stance instanceof WarriorStance) { bPlayer.setStance(null); + GeneralMethods.displayMovePreview(player, this); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_SHOOT, 0.5F, 2F); return; } } start(); bPlayer.setStance(this); + GeneralMethods.displayMovePreview(player, this); + player.playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 0.5F, 2F); } @Override @@ -89,4 +95,4 @@ public class WarriorStance extends ChiAbility { this.resistance = resistance; } -} +} \ No newline at end of file