mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
1.9.0 Changes (#595)
* 1.9.0 Changes • Rewritten GeneralMethods.getEntitiesAroundPoint - Now more effecient and less draining on the server • Rewritten EarthArmor - Now gives gold hearts instead of resistance. • Added TempArmor class - Self explanitory • Changed bottlebending permission from bending.ability.WaterReturn to bending.ability.Bottlebending • Fixed syntax when removing elements from youself * More EarthArmor Changes • Made the amount of gold hearts that EarthArmor gives configurable • Changed default EarthArmor description • Removed EarthArmor config options that are no longer used • Converted more ConcurrentHashMaps to be generic map types
This commit is contained in:
parent
2b3ae10c2b
commit
41aa71aa2b
25 changed files with 721 additions and 396 deletions
|
@ -13,6 +13,7 @@ import java.io.InputStreamReader;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
|
@ -43,7 +44,6 @@ 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;
|
||||
|
@ -110,7 +110,10 @@ import com.projectkorra.projectkorra.util.ActionBar;
|
|||
import com.projectkorra.projectkorra.util.BlockCacheElement;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.ReflectionHandler;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
import com.projectkorra.projectkorra.util.ReflectionHandler.PackageType;
|
||||
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
@ -143,8 +146,19 @@ public class GeneralMethods {
|
|||
private static final ArrayList<Ability> INVINCIBLE = new ArrayList<>();
|
||||
private static ProjectKorra plugin;
|
||||
|
||||
private static Method getAbsorption;
|
||||
private static Method setAbsorption;
|
||||
|
||||
public GeneralMethods(ProjectKorra plugin) {
|
||||
GeneralMethods.plugin = plugin;
|
||||
|
||||
try {
|
||||
getAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
||||
setAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -587,6 +601,30 @@ public class GeneralMethods {
|
|||
}
|
||||
}
|
||||
|
||||
public static float getAbsorbationHealth(Player player) {
|
||||
|
||||
try {
|
||||
Object entityplayer = ActionBar.getHandle.invoke(player);
|
||||
Object hearts = getAbsorption.invoke(entityplayer);
|
||||
//player.sendMessage(hearts.toString());
|
||||
return (float) hearts;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setAbsorbationHealth(Player player, float hearts) {
|
||||
|
||||
try {
|
||||
Object entityplayer = ActionBar.getHandle.invoke(player);
|
||||
setAbsorption.invoke(entityplayer, hearts);
|
||||
//player.sendMessage(hearts.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) {
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
|
@ -789,19 +827,34 @@ public class GeneralMethods {
|
|||
* @return A list of entities around a point
|
||||
*/
|
||||
public static List<Entity> getEntitiesAroundPoint(Location location, double radius) {
|
||||
List<Entity> entities = location.getWorld().getEntities();
|
||||
List<Entity> list = location.getWorld().getEntities();
|
||||
List<Entity> entities = new ArrayList<Entity>();
|
||||
World world = location.getWorld();
|
||||
|
||||
for (Entity entity : entities) {
|
||||
if (entity.getWorld() != location.getWorld()) {
|
||||
list.remove(entity);
|
||||
} else if (entity instanceof Player && ((Player) entity).getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
list.remove(entity);
|
||||
} else if (entity.getLocation().distanceSquared(location) > radius * radius) {
|
||||
list.remove(entity);
|
||||
// To find chunks we use chunk coordinates (not block coordinates!)
|
||||
int smallX = (int) (location.getX() - radius) >> 4;
|
||||
int bigX = (int) (location.getX() + radius) >> 4;
|
||||
int smallZ = (int) (location.getZ() - radius) >> 4;
|
||||
int bigZ = (int) (location.getZ() + radius) >> 4;
|
||||
|
||||
for (int x = smallX; x <= bigX; x++) {
|
||||
for (int z = smallZ; z <= bigZ; z++) {
|
||||
if (world.isChunkLoaded(x, z)) {
|
||||
entities.addAll(Arrays.asList(world.getChunkAt(x, z).getEntities()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Iterator<Entity> entityIterator = entities.iterator();
|
||||
while (entityIterator.hasNext()) {
|
||||
Entity e = entityIterator.next();
|
||||
if (e.getLocation().distanceSquared(location) > radius * radius) {
|
||||
entityIterator.remove();
|
||||
} else if (e instanceof Player && ((Player)e).getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
entityIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
public static long getGlobalCooldown() {
|
||||
|
@ -1737,7 +1790,7 @@ public class GeneralMethods {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (entity instanceof FallingSand) {
|
||||
if (entity instanceof FallingBlock) {
|
||||
if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.Normal")) {
|
||||
entity.setVelocity(velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier")));
|
||||
}
|
||||
|
@ -1794,6 +1847,7 @@ public class GeneralMethods {
|
|||
|
||||
Flight.removeAll();
|
||||
TempBlock.removeAll();
|
||||
TempArmor.revertAll();
|
||||
MultiAbilityManager.removeAll();
|
||||
if (!INVINCIBLE.isEmpty()) {
|
||||
INVINCIBLE.clear();
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.bukkit.event.player.PlayerAnimationEvent;
|
|||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemDamageEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
|
@ -149,6 +150,7 @@ import com.projectkorra.projectkorra.util.ClickType;
|
|||
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import com.projectkorra.projectkorra.util.PassiveHandler;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
import com.projectkorra.projectkorra.waterbending.Bloodbending;
|
||||
import com.projectkorra.projectkorra.waterbending.IceBlast;
|
||||
|
@ -442,25 +444,17 @@ public class PKListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
if (MetalClips.getEntityClipsCount().containsKey(event.getEntity())) {
|
||||
List<ItemStack> drops = event.getDrops();
|
||||
List<ItemStack> newdrops = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < drops.size(); i++) {
|
||||
if (!(drops.get(i).getType() == Material.IRON_HELMET || drops.get(i).getType() == Material.IRON_CHESTPLATE || drops.get(i).getType() == Material.IRON_LEGGINGS || drops.get(i).getType() == Material.IRON_BOOTS || drops.get(i).getType() == Material.AIR)) {
|
||||
newdrops.add(drops.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
newdrops.add(new ItemStack(Material.IRON_INGOT, MetalClips.getEntityClipsCount().get(event.getEntity())));
|
||||
newdrops.add(MetalClips.getOriginalHelmet(event.getEntity()));
|
||||
newdrops.add(MetalClips.getOriginalChestplate(event.getEntity()));
|
||||
newdrops.add(MetalClips.getOriginalLeggings(event.getEntity()));
|
||||
newdrops.add(MetalClips.getOriginalBoots(event.getEntity()));
|
||||
if (TempArmor.hasTempArmor(event.getEntity())) {
|
||||
TempArmor armor = TempArmor.getTempArmor(event.getEntity());
|
||||
|
||||
List<ItemStack> newDrops = armor.filterArmor(event.getDrops());
|
||||
event.getDrops().clear();
|
||||
event.getDrops().addAll(newdrops);
|
||||
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
||||
event.getDrops().addAll(newDrops);
|
||||
|
||||
armor.revert();
|
||||
}
|
||||
|
||||
|
||||
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
|
||||
if (!fc.getAffectedEntities().contains(event.getEntity()))
|
||||
continue;
|
||||
|
@ -679,6 +673,10 @@ public class PKListener implements Listener {
|
|||
if (event.getSlotType() == SlotType.ARMOR && !PlantArmor.canRemoveArmor((Player) event.getWhoClicked())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (event.getSlotType() == SlotType.ARMOR && TempArmor.hasTempArmor((Player) event.getWhoClicked())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
|
@ -802,6 +800,11 @@ public class PKListener implements Listener {
|
|||
event.setDamage(0D);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (!event.isCancelled() && CoreAbility.getAbility(player, EarthArmor.class) != null) {
|
||||
EarthArmor eartharmor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||
eartharmor.updateAbsorbtion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,78 +885,12 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
Player player = event.getEntity();
|
||||
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
||||
|
||||
if (event.getKeepInventory()) {
|
||||
if (earthArmor != null && earthArmor.getOldArmor() != null) {
|
||||
player.getInventory().setArmorContents(earthArmor.getOldArmor());
|
||||
} else if (plantArmor != null && plantArmor.getOldArmor() != null) {
|
||||
player.getInventory().setArmorContents(plantArmor.getOldArmor());
|
||||
} else if (event.getEntity() instanceof LivingEntity && MetalClips.isControlled(event.getEntity()) && MetalClips.getOriginalArmor(player) != null) {
|
||||
player.getInventory().setArmorContents(MetalClips.getOriginalArmor(player));
|
||||
if (TempArmor.hasTempArmor(event.getEntity())) {
|
||||
TempArmor.getTempArmor(event.getEntity()).revert();
|
||||
}
|
||||
} else {
|
||||
if (earthArmor != null) {
|
||||
List<Material> earthArmorItems = Arrays.asList(new Material[] {Material.LEATHER_BOOTS, Material.LEATHER_LEGGINGS, Material.LEATHER_CHESTPLATE, Material.LEATHER_HELMET});
|
||||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
||||
if (earthArmor.getOldArmor() != null) {
|
||||
int size = event.getDrops().size();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
//Armor always drops last (items, boots, leggings, chestplate, helmet) so we got to get the last drop items
|
||||
ItemStack is = event.getDrops().get(size - i - 1);
|
||||
if (earthArmorItems.contains(is.getType())) {
|
||||
event.getDrops().remove(is);
|
||||
newDrops.add(earthArmor.getOldArmor()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getDrops().addAll(newDrops);
|
||||
earthArmor.remove();
|
||||
}
|
||||
|
||||
if (plantArmor != null) {
|
||||
List<Material> plantArmorItems = Arrays.asList(new Material[] {Material.LEATHER_BOOTS, Material.LEATHER_LEGGINGS, Material.LEATHER_CHESTPLATE, Material.LEAVES});
|
||||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
||||
if (plantArmor.getOldArmor() != null) {
|
||||
int size = event.getDrops().size();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack is = event.getDrops().get(size - i - 1);
|
||||
if (plantArmorItems.contains(is.getType())) {
|
||||
event.getDrops().remove(is);
|
||||
newDrops.add(plantArmor.getOldArmor()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.getDrops().addAll(newDrops);
|
||||
plantArmor.remove();
|
||||
}
|
||||
|
||||
if (event.getEntity() instanceof LivingEntity && MetalClips.isControlled(event.getEntity())) {
|
||||
|
||||
List<ItemStack> currentArmor = new ArrayList<ItemStack>();
|
||||
for (ItemStack is : Arrays.asList(event.getEntity().getInventory().getArmorContents())) {
|
||||
if (is.getType() != Material.AIR) { //Remove Air because it won't show in the drops
|
||||
currentArmor.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
List<ItemStack> oldArmor = new ArrayList<ItemStack>();
|
||||
for (ItemStack is : Arrays.asList(MetalClips.getOriginalArmor(player))) {
|
||||
if (is.getType() != Material.AIR) { //Shouldn't add air itemstacks to drop list
|
||||
oldArmor.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < currentArmor.size(); i++) { //Remove all armor drops completely, so we can then drop the correct armor.
|
||||
event.getDrops().remove(event.getDrops().size() - 1);
|
||||
}
|
||||
|
||||
event.getDrops().addAll(oldArmor);
|
||||
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
||||
}
|
||||
//Do nothing. TempArmor drops are handled by the EntityDeath event and not PlayerDeath
|
||||
}
|
||||
|
||||
if (event.getEntity().getKiller() != null) {
|
||||
|
@ -1046,6 +983,21 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerItemDamage(PlayerItemDamageEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (TempArmor.hasTempArmor(event.getPlayer())) {
|
||||
TempArmor armor = TempArmor.getTempArmor(event.getPlayer());
|
||||
for (ItemStack i : armor.getNewArmor()) {
|
||||
if (i != null && event.getItem().isSimilar(i)) {
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
@ -1188,18 +1140,8 @@ public class PKListener implements Listener {
|
|||
}
|
||||
Preset.unloadPreset(player);
|
||||
|
||||
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
||||
MetalClips metalClips = CoreAbility.getAbility(player, MetalClips.class);
|
||||
|
||||
if (earthArmor != null) {
|
||||
earthArmor.remove();
|
||||
}
|
||||
if (plantArmor != null) {
|
||||
plantArmor.remove();
|
||||
}
|
||||
if (metalClips != null) {
|
||||
metalClips.remove();
|
||||
if (TempArmor.hasTempArmor(player)) {
|
||||
TempArmor.getTempArmor(player).revert();
|
||||
}
|
||||
|
||||
if (MetalClips.isControlled(event.getPlayer())) {
|
||||
|
@ -1268,25 +1210,25 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Tornado")) {
|
||||
new Tornado(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirBlast")) {
|
||||
else if (abil.equalsIgnoreCase("AirBlast")) {
|
||||
AirBlast.setOrigin(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirBurst")) {
|
||||
else if (abil.equalsIgnoreCase("AirBurst")) {
|
||||
new AirBurst(player, false);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirSuction")) {
|
||||
else if (abil.equalsIgnoreCase("AirSuction")) {
|
||||
AirSuction.setOrigin(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirSwipe")) {
|
||||
else if (abil.equalsIgnoreCase("AirSwipe")) {
|
||||
new AirSwipe(player, true);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirShield")) {
|
||||
else if (abil.equalsIgnoreCase("AirShield")) {
|
||||
new AirShield(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Suffocate")) {
|
||||
else if (abil.equalsIgnoreCase("Suffocate")) {
|
||||
new Suffocate(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Flight")) {
|
||||
else if (abil.equalsIgnoreCase("Flight")) {
|
||||
if (player.isSneaking() || !bPlayer.canUseFlight()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1301,28 +1243,28 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Bloodbending")) {
|
||||
new Bloodbending(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("IceBlast")) {
|
||||
else if (abil.equalsIgnoreCase("IceBlast")) {
|
||||
new IceBlast(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("IceSpike")) {
|
||||
else if (abil.equalsIgnoreCase("IceSpike")) {
|
||||
new IceSpikeBlast(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("OctopusForm")) {
|
||||
else if (abil.equalsIgnoreCase("OctopusForm")) {
|
||||
OctopusForm.form(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("PhaseChange")) {
|
||||
else if (abil.equalsIgnoreCase("PhaseChange")) {
|
||||
new PhaseChangeMelt(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WaterManipulation")) {
|
||||
else if (abil.equalsIgnoreCase("WaterManipulation")) {
|
||||
new WaterManipulation(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Surge")) {
|
||||
else if (abil.equalsIgnoreCase("Surge")) {
|
||||
SurgeWall.form(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Torrent")) {
|
||||
else if (abil.equalsIgnoreCase("Torrent")) {
|
||||
Torrent.create(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WaterArms")) {
|
||||
else if (abil.equalsIgnoreCase("WaterArms")) {
|
||||
new WaterArms(player);
|
||||
}
|
||||
}
|
||||
|
@ -1334,28 +1276,31 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
new EarthBlast(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("RaiseEarth")) {
|
||||
else if (abil.equalsIgnoreCase("EarthArmor")) {
|
||||
new EarthArmor(player);
|
||||
}
|
||||
else if (abil.equalsIgnoreCase("RaiseEarth")) {
|
||||
new RaiseEarthWall(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Collapse")) {
|
||||
else if (abil.equalsIgnoreCase("Collapse")) {
|
||||
new CollapseWall(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Shockwave")) {
|
||||
else if (abil.equalsIgnoreCase("Shockwave")) {
|
||||
new Shockwave(player, false);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||
else if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||
new EarthGrab(player, false);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthTunnel")) {
|
||||
else if (abil.equalsIgnoreCase("EarthTunnel")) {
|
||||
new EarthTunnel(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Tremorsense")) {
|
||||
else if (abil.equalsIgnoreCase("Tremorsense")) {
|
||||
bPlayer.toggleTremorSense();
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Extraction")) {
|
||||
else if (abil.equalsIgnoreCase("Extraction")) {
|
||||
new Extraction(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("MetalClips")) {
|
||||
else if (abil.equalsIgnoreCase("MetalClips")) {
|
||||
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
|
||||
if (clips != null) {
|
||||
if (clips.getTargetEntity() == null) {
|
||||
|
@ -1368,10 +1313,10 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||
else if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||
new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||
else if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||
new EarthSmash(player, ClickType.SHIFT_DOWN);
|
||||
}
|
||||
}
|
||||
|
@ -1383,22 +1328,22 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Blaze")) {
|
||||
new BlazeRing(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBlast")) {
|
||||
else if (abil.equalsIgnoreCase("FireBlast")) {
|
||||
new FireBlastCharged(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("HeatControl")) {
|
||||
else if (abil.equalsIgnoreCase("HeatControl")) {
|
||||
new HeatControlSolidify(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
else if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
new FireBurst(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireShield")) {
|
||||
else if (abil.equalsIgnoreCase("FireShield")) {
|
||||
new FireShield(player, true);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Lightning")) {
|
||||
else if (abil.equalsIgnoreCase("Lightning")) {
|
||||
new Lightning(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Combustion")) {
|
||||
else if (abil.equalsIgnoreCase("Combustion")) {
|
||||
new Combustion(player);
|
||||
}
|
||||
}
|
||||
|
@ -1429,6 +1374,7 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
Player player = event.getPlayer();
|
||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if (bPlayer == null) {
|
||||
|
@ -1481,22 +1427,24 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("AirBlast")) {
|
||||
new AirBlast(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirSuction")) {
|
||||
else if (abil.equalsIgnoreCase("AirSuction")) {
|
||||
new AirSuction(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirBurst")) {
|
||||
else if (abil.equalsIgnoreCase("AirBurst")) {
|
||||
AirBurst.coneBurst(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirScooter")) {
|
||||
else if (abil.equalsIgnoreCase("AirScooter")) {
|
||||
new AirScooter(player);
|
||||
player.sendMessage("Pitch: " + player.getLocation().getPitch());
|
||||
player.sendMessage("Yaw: " + player.getLocation().getYaw());
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirSpout")) {
|
||||
else if (abil.equalsIgnoreCase("AirSpout")) {
|
||||
new AirSpout(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirSwipe")) {
|
||||
else if (abil.equalsIgnoreCase("AirSwipe")) {
|
||||
new AirSwipe(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Flight")) {
|
||||
else if (abil.equalsIgnoreCase("Flight")) {
|
||||
if (!ProjectKorra.plugin.getConfig().getBoolean("Abilities.Air.Flight.HoverEnabled") || !bPlayer.canUseFlight()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1518,31 +1466,31 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Bloodbending")) {
|
||||
Bloodbending.launch(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("IceBlast")) {
|
||||
else if (abil.equalsIgnoreCase("IceBlast")) {
|
||||
IceBlast.activate(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("IceSpike")) {
|
||||
else if (abil.equalsIgnoreCase("IceSpike")) {
|
||||
IceSpikeBlast.activate(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("OctopusForm")) {
|
||||
else if (abil.equalsIgnoreCase("OctopusForm")) {
|
||||
new OctopusForm(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("PhaseChange")) {
|
||||
else if (abil.equalsIgnoreCase("PhaseChange")) {
|
||||
new PhaseChangeFreeze(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("PlantArmor")) {
|
||||
else if (abil.equalsIgnoreCase("PlantArmor")) {
|
||||
new PlantArmor(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WaterSpout")) {
|
||||
else if (abil.equalsIgnoreCase("WaterSpout")) {
|
||||
new WaterSpout(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WaterManipulation")) {
|
||||
else if (abil.equalsIgnoreCase("WaterManipulation")) {
|
||||
WaterManipulation.moveWater(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Surge")) {
|
||||
else if (abil.equalsIgnoreCase("Surge")) {
|
||||
new SurgeWall(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Torrent")) {
|
||||
else if (abil.equalsIgnoreCase("Torrent")) {
|
||||
new Torrent(player);
|
||||
}
|
||||
}
|
||||
|
@ -1554,28 +1502,31 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Catapult")) {
|
||||
new Catapult(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
else if (abil.equalsIgnoreCase("EarthBlast")) {
|
||||
EarthBlast.throwEarth(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("RaiseEarth")) {
|
||||
else if (abil.equalsIgnoreCase("RaiseEarth")) {
|
||||
new RaiseEarth(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Collapse")) {
|
||||
else if (abil.equalsIgnoreCase("Collapse")) {
|
||||
new Collapse(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Shockwave")) {
|
||||
else if (abil.equalsIgnoreCase("Shockwave")) {
|
||||
Shockwave.coneShockwave(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthArmor")) {
|
||||
new EarthArmor(player);
|
||||
else if (abil.equalsIgnoreCase("EarthArmor")) {
|
||||
EarthArmor armor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||
if (armor != null && armor.isFormed()) {
|
||||
armor.click();
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||
}
|
||||
else if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||
new EarthGrab(player, true);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Tremorsense")) {
|
||||
else if (abil.equalsIgnoreCase("Tremorsense")) {
|
||||
new Tremorsense(player, true);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("MetalClips")) {
|
||||
else if (abil.equalsIgnoreCase("MetalClips")) {
|
||||
MetalClips clips = CoreAbility.getAbility(player, MetalClips.class);
|
||||
if (clips == null) {
|
||||
new MetalClips(player, 0);
|
||||
|
@ -1585,19 +1536,19 @@ public class PKListener implements Listener {
|
|||
clips.crush();
|
||||
}
|
||||
}
|
||||
if (abil.equalsIgnoreCase("LavaSurge")) {
|
||||
else if (abil.equalsIgnoreCase("LavaSurge")) {
|
||||
LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class);
|
||||
if (surge != null) {
|
||||
surge.launch();
|
||||
}
|
||||
}
|
||||
if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||
else if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||
new LavaFlow(player, AbilityType.CLICK);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||
else if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||
new EarthSmash(player, ClickType.LEFT_CLICK);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("SandSpout")) {
|
||||
else if (abil.equalsIgnoreCase("SandSpout")) {
|
||||
new SandSpout(player);
|
||||
}
|
||||
}
|
||||
|
@ -1609,16 +1560,16 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("Blaze")) {
|
||||
new Blaze(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBlast")) {
|
||||
else if (abil.equalsIgnoreCase("FireBlast")) {
|
||||
new FireBlast(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireJet")) {
|
||||
else if (abil.equalsIgnoreCase("FireJet")) {
|
||||
new FireJet(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("HeatControl")) {
|
||||
else if (abil.equalsIgnoreCase("HeatControl")) {
|
||||
new HeatControlExtinguish(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Illumination")) {
|
||||
else if (abil.equalsIgnoreCase("Illumination")) {
|
||||
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) {
|
||||
bPlayer.toggleIllumination();
|
||||
} else {
|
||||
|
@ -1626,16 +1577,16 @@ public class PKListener implements Listener {
|
|||
}
|
||||
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
else if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
FireBurst.coneBurst(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireShield")) {
|
||||
else if (abil.equalsIgnoreCase("FireShield")) {
|
||||
new FireShield(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WallOfFire")) {
|
||||
else if (abil.equalsIgnoreCase("WallOfFire")) {
|
||||
new WallOfFire(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Combustion")) {
|
||||
else if (abil.equalsIgnoreCase("Combustion")) {
|
||||
Combustion.explode(player);
|
||||
}
|
||||
}
|
||||
|
@ -1647,22 +1598,22 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("HighJump")) {
|
||||
new HighJump(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("RapidPunch")) {
|
||||
else if (abil.equalsIgnoreCase("RapidPunch")) {
|
||||
new RapidPunch(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Smokescreen")) {
|
||||
else if (abil.equalsIgnoreCase("Smokescreen")) {
|
||||
new Smokescreen(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("WarriorStance")) {
|
||||
else if (abil.equalsIgnoreCase("WarriorStance")) {
|
||||
new WarriorStance(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AcrobatStance")) {
|
||||
else if (abil.equalsIgnoreCase("AcrobatStance")) {
|
||||
new AcrobatStance(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("QuickStrike")) {
|
||||
else if (abil.equalsIgnoreCase("QuickStrike")) {
|
||||
new QuickStrike(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("SwiftKick")) {
|
||||
else if (abil.equalsIgnoreCase("SwiftKick")) {
|
||||
new SwiftKick(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class RemoveCommand extends PKCommand {
|
|||
GeneralMethods.saveElements(senderBPlayer);
|
||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
||||
|
||||
sender.sendMessage(e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName()));
|
||||
sender.sendMessage(e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending()));
|
||||
Bukkit.getServer().getPluginManager()
|
||||
.callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
|
||||
return;
|
||||
|
|
|
@ -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, click on a block that is earthbendable. If there is another block under it that is earthbendable, the block will fly to you and grant you temporary armor and damage reduction. This ability has a long cooldown.");
|
||||
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.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 left-click while targeting a creature within range. " + "This ability will erect a circle of earth to trap the creature in.");
|
||||
|
@ -829,8 +829,7 @@ public class ConfigManager {
|
|||
|
||||
config.addDefault("Abilities.Earth.EarthArmor.Enabled", true);
|
||||
config.addDefault("Abilities.Earth.EarthArmor.SelectRange", 10);
|
||||
config.addDefault("Abilities.Earth.EarthArmor.Duration", 10000);
|
||||
config.addDefault("Abilities.Earth.EarthArmor.Strength", 2);
|
||||
config.addDefault("Abilities.Earth.EarthArmor.GoldHearts", 4);
|
||||
config.addDefault("Abilities.Earth.EarthArmor.Cooldown", 17500);
|
||||
|
||||
config.addDefault("Abilities.Earth.EarthBlast.Enabled", true);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.projectkorra.projectkorra.earthbending;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -20,8 +21,8 @@ public class CollapseWall extends EarthAbility {
|
|||
private long cooldown;
|
||||
private double radius;
|
||||
private Location location;
|
||||
private ConcurrentHashMap<Block, Block> blocks;
|
||||
private ConcurrentHashMap<Block, Integer> baseBlocks;
|
||||
private Map<Block, Block> blocks;
|
||||
private Map<Block, Integer> baseBlocks;
|
||||
|
||||
public CollapseWall(Player player) {
|
||||
super(player);
|
||||
|
@ -133,11 +134,11 @@ public class CollapseWall extends EarthAbility {
|
|||
this.radius = radius;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, Block> getBlocks() {
|
||||
public Map<Block, Block> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, Integer> getBaseBlocks() {
|
||||
public Map<Block, Integer> getBaseBlocks() {
|
||||
return baseBlocks;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +1,43 @@
|
|||
package com.projectkorra.projectkorra.earthbending;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||
import com.projectkorra.projectkorra.util.PassiveHandler;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class EarthArmor extends EarthAbility {
|
||||
|
||||
private boolean formed;
|
||||
private boolean complete;
|
||||
private byte headData;
|
||||
private byte legsData;
|
||||
private int strength;
|
||||
private long time;
|
||||
private MaterialData headData;
|
||||
private MaterialData legsData;
|
||||
private long cooldown;
|
||||
private long interval;
|
||||
private long duration;
|
||||
private double selectRange;
|
||||
private Block headBlock;
|
||||
private Block legsBlock;
|
||||
private Material headType;
|
||||
private Material legsType;
|
||||
private Location headBlockLocation;
|
||||
private Location legsBlockLocation;
|
||||
private ItemStack[] oldArmor;
|
||||
private boolean active;
|
||||
private PotionEffect oldAbsorbtion = null;
|
||||
private float goldHearts;
|
||||
private int maxGoldHearts;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public EarthArmor(Player player) {
|
||||
super(player);
|
||||
if (hasAbility(player, EarthArmor.class) || !bPlayer.canBend(this)) {
|
||||
|
@ -47,21 +50,19 @@ public class EarthArmor extends EarthAbility {
|
|||
}
|
||||
|
||||
this.formed = false;
|
||||
this.complete = false;
|
||||
this.active = true;
|
||||
this.interval = 2000;
|
||||
this.goldHearts = 0;
|
||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthArmor.Cooldown");
|
||||
this.duration = getConfig().getLong("Abilities.Earth.EarthArmor.Duration");
|
||||
this.strength = getConfig().getInt("Abilities.Earth.EarthArmor.Strength");
|
||||
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthArmor.SelectRange");
|
||||
this.maxGoldHearts = getConfig().getInt("Abilities.Earth.EarthArmor.GoldHearts");
|
||||
|
||||
headBlock = getTargetEarthBlock((int) selectRange);
|
||||
if (!GeneralMethods.isRegionProtectedFromBuild(this, headBlock.getLocation())
|
||||
&& getEarthbendableBlocksLength(headBlock, new Vector(0, -1, 0), 2) >= 2) {
|
||||
this.legsBlock = headBlock.getRelative(BlockFace.DOWN);
|
||||
this.headType = headBlock.getType();
|
||||
this.legsType = legsBlock.getType();
|
||||
this.headData = headBlock.getData();
|
||||
this.legsData = legsBlock.getData();
|
||||
this.headData = headBlock.getState().getData();
|
||||
this.legsData = legsBlock.getState().getData();
|
||||
this.headBlockLocation = headBlock.getLocation();
|
||||
this.legsBlockLocation = legsBlock.getLocation();
|
||||
|
||||
|
@ -78,6 +79,10 @@ public class EarthArmor extends EarthAbility {
|
|||
GeneralMethods.removeBlock(oldHeadBlock);
|
||||
GeneralMethods.removeBlock(oldLegsBlock);
|
||||
}
|
||||
|
||||
playEarthbendingSound(headBlock.getLocation());
|
||||
bPlayer.addCooldown(this, getCooldown() / 2); //Prevents spamming of the move to remove blocks
|
||||
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
@ -90,19 +95,48 @@ public class EarthArmor extends EarthAbility {
|
|||
TempBlock.revertBlock(legsBlock, Material.AIR);
|
||||
}
|
||||
|
||||
this.oldArmor = player.getInventory().getArmorContents();
|
||||
ItemStack armors[] = { new ItemStack(Material.LEATHER_BOOTS, 1),
|
||||
new ItemStack(Material.LEATHER_LEGGINGS, 1),
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE, 1),
|
||||
new ItemStack(Material.LEATHER_HELMET, 1) };
|
||||
player.getInventory().setArmorContents(armors);
|
||||
ItemStack head = new ItemStack(Material.LEATHER_HELMET, 1);
|
||||
ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
|
||||
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS, 1);
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS, 1);
|
||||
|
||||
//Color disabled for now since the colors are all weird...
|
||||
|
||||
/*LeatherArmorMeta metaHead = (LeatherArmorMeta) head.getItemMeta();
|
||||
LeatherArmorMeta metaBottom = (LeatherArmorMeta) leggings.getItemMeta();
|
||||
|
||||
metaHead.setColor(Color.fromBGR(getColor(headType, headData)));
|
||||
metaBottom.setColor(Color.fromBGR(getColor(legsType, legsData)));
|
||||
|
||||
head.setItemMeta(metaHead);
|
||||
chestplate.setItemMeta(metaHead);
|
||||
leggings.setItemMeta(metaBottom);
|
||||
boots.setItemMeta(metaBottom);*/
|
||||
|
||||
ItemStack armors[] = { boots, leggings, chestplate, head };
|
||||
TempArmor armor = new TempArmor(player, 72000000L, this, armors); //Duration of 2 hours
|
||||
armor.setRemovesAbilityOnForceRevert(true);
|
||||
formed = true;
|
||||
|
||||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||
if (effect.getType() == PotionEffectType.ABSORPTION) {
|
||||
this.oldAbsorbtion = effect;
|
||||
player.removePotionEffect(PotionEffectType.ABSORPTION);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int level = (int) (maxGoldHearts / 2 - 1 + (maxGoldHearts % 2));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, Integer.MAX_VALUE, level, true, false));
|
||||
|
||||
this.goldHearts = maxGoldHearts * 2;
|
||||
GeneralMethods.setAbsorbationHealth(player, goldHearts);
|
||||
}
|
||||
|
||||
private boolean inPosition() {
|
||||
return headBlock.equals(player.getEyeLocation().getBlock()) && legsBlock.equals(player.getLocation().getBlock());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean moveBlocks() {
|
||||
if (!player.getWorld().equals(headBlock.getWorld())) {
|
||||
remove();
|
||||
|
@ -112,22 +146,35 @@ public class EarthArmor extends EarthAbility {
|
|||
Location headLocation = player.getEyeLocation();
|
||||
Location legsLocation = player.getLocation();
|
||||
Vector headDirection = headLocation.toVector().subtract(headBlockLocation.toVector()).normalize().multiply(.5);
|
||||
Vector legsDirection = legsLocation.toVector().subtract(legsBlockLocation.toVector()).normalize().multiply(.5);
|
||||
//Vector legsDirection = legsLocation.toVector().subtract(legsBlockLocation.toVector()).normalize().multiply(.5);
|
||||
Block newHeadBlock = headBlock;
|
||||
Block newLegsBlock = legsBlock;
|
||||
|
||||
int yDiff = player.getEyeLocation().getBlockY() - headBlock.getY();
|
||||
|
||||
if (yDiff != 0) {
|
||||
Block checkBlock = yDiff > 0 ? headBlock.getRelative(BlockFace.UP) : legsBlock.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (isTransparent(checkBlock) && !checkBlock.isLiquid()) {
|
||||
GeneralMethods.breakBlock(checkBlock); //Destroy any minor blocks that are in the way
|
||||
|
||||
headDirection = new Vector(0, yDiff > 0 ? 0.5 : -0.5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!headLocation.getBlock().equals(headBlock)) {
|
||||
headBlockLocation = headBlockLocation.clone().add(headDirection);
|
||||
newHeadBlock = headBlockLocation.getBlock();
|
||||
}
|
||||
if (!legsLocation.getBlock().equals(legsBlock)) {
|
||||
legsBlockLocation = legsBlockLocation.clone().add(legsDirection);
|
||||
newLegsBlock = legsBlockLocation.getBlock();
|
||||
legsBlockLocation = headBlockLocation.clone().add(0, -1, 0);
|
||||
newLegsBlock = newHeadBlock.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
if (isTransparent(newHeadBlock) && !newHeadBlock.isLiquid()) {
|
||||
GeneralMethods.breakBlock(newHeadBlock);
|
||||
} else if (!isEarthbendable(newHeadBlock) && !newHeadBlock.isLiquid() && newHeadBlock.getType() != Material.AIR) {
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(headData.getItemType(), headData.getData()), 0.5F, 0.5F, 0.5F, 1, 32, newLegsBlock.getLocation(), 128);
|
||||
remove();
|
||||
return false;
|
||||
}
|
||||
|
@ -135,25 +182,26 @@ public class EarthArmor extends EarthAbility {
|
|||
if (isTransparent(newLegsBlock) && !newLegsBlock.isLiquid()) {
|
||||
GeneralMethods.breakBlock(newLegsBlock);
|
||||
} else if (!isEarthbendable(newLegsBlock) && !newLegsBlock.isLiquid() && newLegsBlock.getType() != Material.AIR) {
|
||||
newLegsBlock.getLocation().getWorld().playSound(newLegsBlock.getLocation(), Sound.BLOCK_GRASS_BREAK, 1, 1);
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(legsData.getItemType(), legsData.getData()), 0.5F, 0.5F, 0.5F, 1, 32, newLegsBlock.getLocation(), 128);
|
||||
remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (headBlock.getLocation().distanceSquared(player.getEyeLocation()) > selectRange * selectRange
|
||||
|| legsBlock.getLocation().distanceSquared(player.getLocation()) > selectRange * selectRange) {
|
||||
if (headBlock.getLocation().distanceSquared(player.getEyeLocation()) > selectRange * selectRange) {
|
||||
remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!newHeadBlock.equals(headBlock)) {
|
||||
new TempBlock(newHeadBlock, headType, headData);
|
||||
new TempBlock(newHeadBlock, headData.getItemType(), headData.getData());
|
||||
if (TempBlock.isTempBlock(headBlock)) {
|
||||
TempBlock.revertBlock(headBlock, Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!newLegsBlock.equals(legsBlock)) {
|
||||
new TempBlock(newLegsBlock, legsType, legsData);
|
||||
new TempBlock(newLegsBlock, legsData.getItemType(), legsData.getData());
|
||||
if (TempBlock.isTempBlock(legsBlock)) {
|
||||
TempBlock.revertBlock(legsBlock, Material.AIR);
|
||||
}
|
||||
|
@ -166,18 +214,25 @@ public class EarthArmor extends EarthAbility {
|
|||
@Override
|
||||
public void progress() {
|
||||
if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (formed) {
|
||||
PassiveHandler.checkArmorPassives(player);
|
||||
if (System.currentTimeMillis() > startTime + duration && !complete) {
|
||||
complete = true;
|
||||
//PassiveHandler.checkArmorPassives(player);
|
||||
if (!player.hasPotionEffect(PotionEffectType.ABSORPTION)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, Integer.MAX_VALUE, 1, true, false));
|
||||
GeneralMethods.setAbsorbationHealth(player, goldHearts);
|
||||
}
|
||||
|
||||
if (!active) {
|
||||
bPlayer.addCooldown(this);
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
} else if (System.currentTimeMillis() > time + interval) {
|
||||
|
||||
player.setFireTicks(0);
|
||||
} else {
|
||||
if (!moveBlocks()) {
|
||||
return;
|
||||
}
|
||||
|
@ -202,9 +257,87 @@ public class EarthArmor extends EarthAbility {
|
|||
legsBlock.breakNaturally();
|
||||
}
|
||||
|
||||
if (oldArmor != null) {
|
||||
player.getInventory().setArmorContents(oldArmor);
|
||||
if (TempArmor.hasTempArmor(player) && TempArmor.getTempArmor(player).getAbility().equals(this)) {
|
||||
TempArmor.getTempArmor(player).revert();
|
||||
}
|
||||
|
||||
player.removePotionEffect(PotionEffectType.ABSORPTION);
|
||||
|
||||
if (oldAbsorbtion != null) {
|
||||
player.addPotionEffect(oldAbsorbtion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateAbsorbtion() {
|
||||
final EarthArmor abil = this;
|
||||
new BukkitRunnable() {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
goldHearts = GeneralMethods.getAbsorbationHealth(player);
|
||||
if (formed && goldHearts < 0.9F) {
|
||||
bPlayer.addCooldown(abil);
|
||||
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(headData.getItemType(), headData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getEyeLocation(), 128);
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(legsData.getItemType(), legsData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getLocation(), 128);
|
||||
|
||||
remove();
|
||||
}
|
||||
}
|
||||
}.runTaskLater(ProjectKorra.plugin, 1L);
|
||||
|
||||
}
|
||||
public static int getColor(Material material) {
|
||||
return getColor(material, (byte) 0x0);
|
||||
}
|
||||
|
||||
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.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.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.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.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.QUARTZ_BLOCK) return 0xFDFDFD; //White
|
||||
|
||||
|
||||
|
||||
return 0x999999; //Default dirt brown
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void click() {
|
||||
if (!this.player.isSneaking()) return;
|
||||
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
|
||||
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(headData.getItemType(), headData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getEyeLocation(), 128);
|
||||
ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(legsData.getItemType(), legsData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getLocation(), 128);
|
||||
|
||||
bPlayer.addCooldown(this);
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -240,36 +373,20 @@ public class EarthArmor extends EarthAbility {
|
|||
this.formed = formed;
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return complete;
|
||||
}
|
||||
|
||||
public void setComplete(boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
public byte getHeadData() {
|
||||
public MaterialData getHeadData() {
|
||||
return headData;
|
||||
}
|
||||
|
||||
public void setHeadData(byte headData) {
|
||||
this.headData = headData;
|
||||
public void setHeadData(MaterialData materialdata) {
|
||||
this.headData = materialdata;
|
||||
}
|
||||
|
||||
public byte getLegsData() {
|
||||
public MaterialData getLegsData() {
|
||||
return legsData;
|
||||
}
|
||||
|
||||
public void setLegsData(byte legsData) {
|
||||
this.legsData = legsData;
|
||||
}
|
||||
|
||||
public int getStrength() {
|
||||
return strength;
|
||||
}
|
||||
|
||||
public void setStrength(int strength) {
|
||||
this.strength = strength;
|
||||
public void setLegsData(MaterialData materialdata) {
|
||||
this.legsData = materialdata;
|
||||
}
|
||||
|
||||
public double getSelectRange() {
|
||||
|
@ -280,14 +397,6 @@ public class EarthArmor extends EarthAbility {
|
|||
this.selectRange = selectRange;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public long getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
@ -296,14 +405,6 @@ public class EarthArmor extends EarthAbility {
|
|||
this.interval = interval;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Block getHeadBlock() {
|
||||
return headBlock;
|
||||
}
|
||||
|
@ -336,32 +437,24 @@ public class EarthArmor extends EarthAbility {
|
|||
this.legsBlockLocation = legsBlockLocation;
|
||||
}
|
||||
|
||||
public Material getHeadType() {
|
||||
return headType;
|
||||
}
|
||||
|
||||
public void setHeadType(Material headType) {
|
||||
this.headType = headType;
|
||||
}
|
||||
|
||||
public Material getLegsType() {
|
||||
return legsType;
|
||||
}
|
||||
|
||||
public void setLegsType(Material legsType) {
|
||||
this.legsType = legsType;
|
||||
}
|
||||
|
||||
public ItemStack[] getOldArmor() {
|
||||
return oldArmor;
|
||||
}
|
||||
|
||||
public void setOldArmor(ItemStack[] oldArmor) {
|
||||
this.oldArmor = oldArmor;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
public float getGoldHearts() {
|
||||
return goldHearts;
|
||||
}
|
||||
|
||||
public int getMaxGoldHearts() {
|
||||
return maxGoldHearts;
|
||||
}
|
||||
|
||||
public void setGoldHearts(float goldHearts) {
|
||||
this.goldHearts = goldHearts;
|
||||
}
|
||||
|
||||
public void setMaxGoldHearts(int maxGoldHearts) {
|
||||
this.maxGoldHearts = maxGoldHearts;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,13 @@ import org.bukkit.util.Vector;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class LavaSurgeWall extends LavaAbility {
|
||||
|
||||
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
|
||||
private static final ConcurrentHashMap<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<Block, Player>();
|
||||
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
|
||||
private static final Map<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<Block, Player>();
|
||||
private static final int SURGE_WAVE_RANGE = 20; // TODO: remove this
|
||||
|
||||
private boolean progressing;
|
||||
|
@ -320,11 +321,11 @@ public class LavaSurgeWall extends LavaAbility {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Block> getAffectedBlocks() {
|
||||
public static Map<Block, Block> getAffectedBlocks() {
|
||||
return AFFECTED_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Player> getWallBlocks() {
|
||||
public static Map<Block, Player> getWallBlocks() {
|
||||
return WALL_BLOCKS;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
|
|||
import com.projectkorra.projectkorra.ability.MetalAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
|
||||
public class MetalClips extends MetalAbility {
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class MetalClips extends MetalAbility {
|
|||
private double crushDamage;
|
||||
private double damage;
|
||||
private LivingEntity targetEntity;
|
||||
private ItemStack[] oldArmor;
|
||||
//private ItemStack[] oldArmor;
|
||||
private List<Item> trackedIngots;
|
||||
|
||||
public MetalClips(Player player, int abilityType) {
|
||||
|
@ -98,7 +99,7 @@ public class MetalClips extends MetalAbility {
|
|||
start();
|
||||
}
|
||||
|
||||
public static ItemStack getOriginalHelmet(LivingEntity ent) {
|
||||
/*public static ItemStack getOriginalHelmet(LivingEntity ent) {
|
||||
MetalClips clips = TARGET_TO_ABILITY.get(ent);
|
||||
if (clips != null) {
|
||||
return clips.oldArmor[3];
|
||||
|
@ -136,7 +137,7 @@ public class MetalClips extends MetalAbility {
|
|||
return clips.oldArmor;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public void shootMetal() {
|
||||
if (bPlayer.isOnCooldown("MetalClips Shoot")) {
|
||||
|
@ -178,46 +179,44 @@ public class MetalClips extends MetalAbility {
|
|||
|
||||
if (targetEntity instanceof Player) {
|
||||
Player target = (Player) targetEntity;
|
||||
if (oldArmor == null) {
|
||||
oldArmor = target.getInventory().getArmorContents();
|
||||
}
|
||||
|
||||
ItemStack[] metalArmor = new ItemStack[4];
|
||||
|
||||
metalArmor[2] = (metalClipsCount >= 1) ? new ItemStack(Material.IRON_CHESTPLATE, 1) : oldArmor[2];
|
||||
metalArmor[0] = (metalClipsCount >= 2) ? new ItemStack(Material.IRON_BOOTS, 1) : oldArmor[0];
|
||||
metalArmor[1] = (metalClipsCount >= 3) ? new ItemStack(Material.IRON_LEGGINGS, 1) : oldArmor[1];
|
||||
metalArmor[3] = (metalClipsCount >= 4) ? new ItemStack(Material.IRON_HELMET, 1) : oldArmor[3];
|
||||
metalArmor[2] = (metalClipsCount >= 1) ? new ItemStack(Material.IRON_CHESTPLATE) : new ItemStack(Material.AIR);
|
||||
metalArmor[0] = (metalClipsCount >= 2) ? new ItemStack(Material.IRON_BOOTS) : new ItemStack(Material.AIR);
|
||||
metalArmor[1] = (metalClipsCount >= 3) ? new ItemStack(Material.IRON_LEGGINGS) : new ItemStack(Material.AIR);
|
||||
metalArmor[3] = (metalClipsCount >= 4) ? new ItemStack(Material.IRON_HELMET) : new ItemStack(Material.AIR);
|
||||
ENTITY_CLIPS_COUNT.put(target, metalClipsCount);
|
||||
target.getInventory().setArmorContents(metalArmor);
|
||||
|
||||
TempArmor armor = TempArmor.getTempArmor(target);
|
||||
if (armor != null) armor.revert();
|
||||
|
||||
new TempArmor(target, this, metalArmor);
|
||||
} else {
|
||||
if (oldArmor == null) {
|
||||
oldArmor = targetEntity.getEquipment().getArmorContents();
|
||||
}
|
||||
|
||||
ItemStack[] metalarmor = new ItemStack[4];
|
||||
|
||||
metalarmor[2] = (metalClipsCount >= 1) ? new ItemStack(Material.IRON_CHESTPLATE, 1) : oldArmor[2];
|
||||
metalarmor[0] = (metalClipsCount >= 2) ? new ItemStack(Material.IRON_BOOTS, 1) : oldArmor[0];
|
||||
metalarmor[1] = (metalClipsCount >= 3) ? new ItemStack(Material.IRON_LEGGINGS, 1) : oldArmor[1];
|
||||
metalarmor[3] = (metalClipsCount >= 4) ? new ItemStack(Material.IRON_HELMET, 1) : oldArmor[3];
|
||||
metalarmor[2] = (metalClipsCount >= 1) ? new ItemStack(Material.IRON_CHESTPLATE) : new ItemStack(Material.AIR);
|
||||
metalarmor[0] = (metalClipsCount >= 2) ? new ItemStack(Material.IRON_BOOTS) : new ItemStack(Material.AIR);
|
||||
metalarmor[1] = (metalClipsCount >= 3) ? new ItemStack(Material.IRON_LEGGINGS) : new ItemStack(Material.AIR);
|
||||
metalarmor[3] = (metalClipsCount >= 4) ? new ItemStack(Material.IRON_HELMET) : new ItemStack(Material.AIR);
|
||||
ENTITY_CLIPS_COUNT.put(targetEntity, metalClipsCount);
|
||||
targetEntity.getEquipment().setArmorContents(metalarmor);
|
||||
|
||||
TempArmor armor = TempArmor.getTempArmor(targetEntity);
|
||||
if (armor != null) armor.revert();
|
||||
|
||||
new TempArmor(targetEntity, this, metalarmor);
|
||||
}
|
||||
armorStartTime = System.currentTimeMillis();
|
||||
isBeingWorn = true;
|
||||
}
|
||||
|
||||
public void resetArmor() {
|
||||
if (targetEntity == null || oldArmor == null || targetEntity.isDead()) {
|
||||
if (targetEntity == null || !TempArmor.hasTempArmor(targetEntity) || targetEntity.isDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetEntity instanceof Player) {
|
||||
((Player) targetEntity).getInventory().setArmorContents(oldArmor);
|
||||
} else {
|
||||
targetEntity.getEquipment().setArmorContents(oldArmor);
|
||||
}
|
||||
TempArmor.getTempArmor(targetEntity).revert();
|
||||
|
||||
player.getWorld().dropItem(targetEntity.getLocation(), new ItemStack(Material.IRON_INGOT, metalClipsCount));
|
||||
isBeingWorn = false;
|
||||
|
@ -655,10 +654,6 @@ public class MetalClips extends MetalAbility {
|
|||
this.targetEntity = targetEntity;
|
||||
}
|
||||
|
||||
public ItemStack[] getOldArmor() {
|
||||
return oldArmor;
|
||||
}
|
||||
|
||||
public List<Item> getTrackedIngots() {
|
||||
return trackedIngots;
|
||||
}
|
||||
|
|
|
@ -13,11 +13,12 @@ import org.bukkit.block.BlockFace;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class RaiseEarth extends EarthAbility {
|
||||
|
||||
private static final ConcurrentHashMap<Block, Block> ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, Block> ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private int distance;
|
||||
private int height;
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.bukkit.material.MaterialData;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class BlazeArc extends FireAbility {
|
||||
|
@ -21,9 +22,9 @@ public class BlazeArc extends FireAbility {
|
|||
private static final Material[] OVERWRITABLE_MATERIALS = { Material.SAPLING, Material.LONG_GRASS, Material.DEAD_BUSH,
|
||||
Material.YELLOW_FLOWER, Material.RED_ROSE, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM,
|
||||
Material.FIRE, Material.SNOW, Material.TORCH };
|
||||
private static final ConcurrentHashMap<Block, Player> IGNITED_BLOCKS = new ConcurrentHashMap<Block, Player>();
|
||||
private static final ConcurrentHashMap<Block, Long> IGNITED_TIMES = new ConcurrentHashMap<Block, Long>();
|
||||
private static final ConcurrentHashMap<Location, MaterialData> REPLACED_BLOCKS = new ConcurrentHashMap<Location, MaterialData>();
|
||||
private static final Map<Block, Player> IGNITED_BLOCKS = new ConcurrentHashMap<Block, Player>();
|
||||
private static final Map<Block, Long> IGNITED_TIMES = new ConcurrentHashMap<Block, Long>();
|
||||
private static final Map<Location, MaterialData> REPLACED_BLOCKS = new ConcurrentHashMap<Location, MaterialData>();
|
||||
|
||||
private long time;
|
||||
private long interval;
|
||||
|
@ -254,15 +255,15 @@ public class BlazeArc extends FireAbility {
|
|||
return OVERWRITABLE_MATERIALS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Player> getIgnitedBlocks() {
|
||||
public static Map<Block, Player> getIgnitedBlocks() {
|
||||
return IGNITED_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Long> getIgnitedTimes() {
|
||||
public static Map<Block, Long> getIgnitedTimes() {
|
||||
return IGNITED_TIMES;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Location, MaterialData> getReplacedBlocks() {
|
||||
public static Map<Location, MaterialData> getReplacedBlocks() {
|
||||
return REPLACED_BLOCKS;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,13 @@ import org.bukkit.entity.TNTPrimed;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class FireBlastCharged extends FireAbility {
|
||||
|
||||
private static final ConcurrentHashMap<Entity, FireBlastCharged> EXPLOSIONS = new ConcurrentHashMap<>();
|
||||
private static final Map<Entity, FireBlastCharged> EXPLOSIONS = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean charged;
|
||||
private boolean launched;
|
||||
|
@ -450,7 +451,7 @@ public class FireBlastCharged extends FireAbility {
|
|||
this.direction = direction;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Entity, FireBlastCharged> getExplosions() {
|
||||
public static Map<Entity, FireBlastCharged> getExplosions() {
|
||||
return EXPLOSIONS;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Entity;
|
|||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class FireDamageTimer {
|
||||
|
@ -15,19 +16,16 @@ public class FireDamageTimer {
|
|||
private static final int MAX_TICKS = 90;
|
||||
private static final int DAMAGE = 1;
|
||||
private static final long BUFFER = 30;
|
||||
private static final ConcurrentHashMap<Entity, Player> INSTANCES = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<Entity, Long> TIMES = new ConcurrentHashMap<>();
|
||||
private static final Map<Entity, Player> INSTANCES = new ConcurrentHashMap<>();
|
||||
private static final Map<Entity, Long> TIMES = new ConcurrentHashMap<>();
|
||||
|
||||
public FireDamageTimer(Entity entity, Player source) {
|
||||
if (entity.getEntityId() == source.getEntityId()) {
|
||||
return;
|
||||
}
|
||||
if (INSTANCES.containsKey(entity)) {
|
||||
INSTANCES.replace(entity, source);
|
||||
} else {
|
||||
|
||||
INSTANCES.put(entity, source);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEnflamed(Entity entity) {
|
||||
if (INSTANCES.containsKey(entity)) {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ActionBar {
|
|||
private static boolean initialised = false;
|
||||
private static Constructor<?> chatSer;
|
||||
private static Constructor<?> packetChat;
|
||||
private static Method getHandle;
|
||||
public static Method getHandle;
|
||||
private static Field playerConnection;
|
||||
private static Method sendPacket;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
|||
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
||||
|
||||
|
@ -20,11 +19,12 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PassiveHandler implements Runnable {
|
||||
|
||||
private static final ConcurrentHashMap<Player, Float> FOOD = new ConcurrentHashMap<>();
|
||||
private static final Map<Player, Float> FOOD = new ConcurrentHashMap<>();
|
||||
|
||||
public static float getExhaustion(Player player, float level, double factor) {
|
||||
if (!FOOD.keySet().contains(player)) {
|
||||
|
@ -37,7 +37,7 @@ public class PassiveHandler implements Runnable {
|
|||
} else {
|
||||
level = (float) ((level - oldlevel) * factor + oldlevel);
|
||||
}
|
||||
FOOD.replace(player, level);
|
||||
FOOD.put(player, level);
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
@ -54,13 +54,13 @@ public class PassiveHandler implements Runnable {
|
|||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
|
||||
if (bPlayer == null) return;
|
||||
if (CoreAbility.hasAbility(player, EarthArmor.class)) {
|
||||
/*if (CoreAbility.hasAbility(player, EarthArmor.class)) {
|
||||
EarthArmor abil = CoreAbility.getAbility(player, EarthArmor.class);
|
||||
if (abil.isFormed()) {
|
||||
int strength = abil.getStrength();
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20, strength - 1), false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (CoreAbility.hasAbility(player, PlantArmor.class)) {
|
||||
PlantArmor abil = CoreAbility.getAbility(player, PlantArmor.class);
|
||||
if (abil.isFormed()) {
|
||||
|
|
235
src/com/projectkorra/projectkorra/util/TempArmor.java
Normal file
235
src/com/projectkorra/projectkorra/util/TempArmor.java
Normal file
|
@ -0,0 +1,235 @@
|
|||
package com.projectkorra.projectkorra.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||
|
||||
public class TempArmor {
|
||||
|
||||
private static Map<LivingEntity, TempArmor> INSTANCES = new ConcurrentHashMap<LivingEntity, TempArmor>();
|
||||
private static long defaultDuration = 30000L;
|
||||
|
||||
private LivingEntity entity;
|
||||
private long startTime;
|
||||
private long duration;
|
||||
private BukkitTask endTimer;
|
||||
private ItemStack[] oldArmor;
|
||||
private ItemStack[] newArmor;
|
||||
private CoreAbility ability;
|
||||
private boolean removeAbilOnForceRevert = false;
|
||||
|
||||
/**
|
||||
* Creates a set of temporary armor on the player. This armor cannot be tinkered with,
|
||||
* dropped, and will restore the player's old armor when the duration expires or when
|
||||
* {@link #revert()} is called.
|
||||
*
|
||||
* @param entity The player
|
||||
* @param armorItems The armor that should be set onto the player. Optional - can be set later.
|
||||
* */
|
||||
public TempArmor(LivingEntity entity, ItemStack[] armorItems) {
|
||||
this(entity, defaultDuration, null, armorItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a set of temporary armor on the player. This armor cannot be tinkered with,
|
||||
* dropped, and will restore the player's old armor when the duration expires or when
|
||||
* {@link #revert()} is called.
|
||||
*
|
||||
* @param entity The player
|
||||
* @param ability The ability that is creating the armor
|
||||
* @param armorItems The armor that should be set onto the player. Optional - can be set later.
|
||||
* */
|
||||
public TempArmor(LivingEntity entity, CoreAbility ability, ItemStack[] armorItems) {
|
||||
this(entity, defaultDuration, ability, armorItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a set of temporary armor on the player. This armor cannot be tinkered with,
|
||||
* dropped, and will restore the player's old armor when the duration expires or when
|
||||
* {@link #revert()} is called.
|
||||
*
|
||||
* @param entity The player
|
||||
* @param duration How long the armor is to last. In milliseconds.
|
||||
* @param ability The ability that is creating the armor
|
||||
* @param armorItems The armor that should be set onto the player. Optional - can be set later.
|
||||
* */
|
||||
public TempArmor(LivingEntity entity, long duration, CoreAbility ability, ItemStack[] armorItems) {
|
||||
if (duration <= 0) duration = defaultDuration;
|
||||
|
||||
this.entity = entity;
|
||||
this.startTime = System.currentTimeMillis();
|
||||
this.duration = duration;
|
||||
this.ability = ability;
|
||||
|
||||
this.oldArmor = new ItemStack[] {new ItemStack(Material.AIR), new ItemStack(Material.AIR),
|
||||
new ItemStack(Material.AIR), new ItemStack(Material.AIR)};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (this.entity.getEquipment().getArmorContents()[i] != null) {
|
||||
this.oldArmor[i] = this.entity.getEquipment().getArmorContents()[i].clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.newArmor = armorItems.clone();
|
||||
|
||||
ItemStack[] actualArmor = new ItemStack[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (armorItems[i] == null) {
|
||||
actualArmor[i] = this.oldArmor[i];
|
||||
} else {
|
||||
actualArmor[i] = armorItems[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.entity.getEquipment().setArmorContents(actualArmor);
|
||||
|
||||
//This auto reverts the armor after a certain amount of time. We're doing it
|
||||
//this way instead of checking if it should be reverted every tick in a runnable
|
||||
this.endTimer = new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
endTimer = null;
|
||||
revert();
|
||||
}
|
||||
}.runTaskLater(ProjectKorra.plugin, duration / 50);
|
||||
|
||||
INSTANCES.put(entity, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out any TempArmor from the drop list and replaces it with the
|
||||
* original armor. Used when the player/mob dies.
|
||||
*
|
||||
* @param drops The original item drop list
|
||||
* @return The drop list with the old armor added in place of the temp armor
|
||||
* */
|
||||
public List<ItemStack> filterArmor(List<ItemStack> drops) {
|
||||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
boolean match = false;
|
||||
for (ItemStack armorPiece : newArmor) {
|
||||
if (armorPiece.isSimilar(drop)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
} if (!match) {
|
||||
newDrops.add(drop);
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack armorPiece : oldArmor) {
|
||||
if (armorPiece != null && armorPiece.getType() != Material.AIR) {
|
||||
newDrops.add(armorPiece);
|
||||
}
|
||||
}
|
||||
return newDrops;
|
||||
}
|
||||
|
||||
public CoreAbility getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
public LivingEntity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public ItemStack[] getNewArmor() {
|
||||
return newArmor;
|
||||
}
|
||||
|
||||
public ItemStack[] getOldArmor() {
|
||||
return oldArmor;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setArmor(ItemStack[] armor) {
|
||||
this.newArmor = armor;
|
||||
|
||||
ItemStack[] actualArmor = new ItemStack[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (armor[i] == null) {
|
||||
actualArmor[i] = this.oldArmor[i];
|
||||
} else {
|
||||
actualArmor[i] = armor[i];
|
||||
}
|
||||
}
|
||||
|
||||
this.entity.getEquipment().setArmorContents(actualArmor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the ability that created the TempArmor should be
|
||||
* forcefully removed if the armor is forced to be reverted. Such
|
||||
* cases are things like on player death, etc.
|
||||
*
|
||||
* @param bool
|
||||
* */
|
||||
public void setRemovesAbilityOnForceRevert(boolean bool) {
|
||||
this.removeAbilOnForceRevert = bool;
|
||||
}
|
||||
|
||||
|
||||
/**Destroys the TempArmor instance and restores the player's old armor.*/
|
||||
public void revert() {
|
||||
if (this.endTimer != null) {
|
||||
this.endTimer.cancel();
|
||||
}
|
||||
|
||||
this.entity.getEquipment().setArmorContents(this.oldArmor);
|
||||
|
||||
if (this.removeAbilOnForceRevert && this.ability != null && !this.ability.isRemoved()) {
|
||||
this.ability.remove();
|
||||
}
|
||||
|
||||
INSTANCES.remove(this.entity);
|
||||
}
|
||||
|
||||
/**Reverts all TempArmor instances. <b>Should only be used on server shutdown!</b>*/
|
||||
public static void revertAll() {
|
||||
for (TempArmor armor : INSTANCES.values()) {
|
||||
armor.revert();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the player is currently wearing temporary armor
|
||||
*
|
||||
* @param player The player
|
||||
* @return If the player has temporary armor on
|
||||
* */
|
||||
public static boolean hasTempArmor(LivingEntity player) {
|
||||
return INSTANCES.containsKey(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the temporary armor the player is currently wearing
|
||||
*
|
||||
* @param player The player
|
||||
* @return The TempArmor the player is wearing, or <code>null</code> if they aren't wearing any.
|
||||
* */
|
||||
public static TempArmor getTempArmor(LivingEntity player) {
|
||||
return INSTANCES.get(player);
|
||||
}
|
||||
}
|
|
@ -19,13 +19,14 @@ import org.bukkit.util.Vector;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class IceSpikePillar extends IceAbility {
|
||||
|
||||
private static final ConcurrentHashMap<Block, Block> ALREADY_DONE_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<Block, Integer> BASE_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, Block> ALREADY_DONE_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, Integer> BASE_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private int height;
|
||||
private int progress;
|
||||
|
@ -423,11 +424,11 @@ public class IceSpikePillar extends IceAbility {
|
|||
this.direction = direction;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Block> getAlreadyDoneBlocks() {
|
||||
public static Map<Block, Block> getAlreadyDoneBlocks() {
|
||||
return ALREADY_DONE_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Integer> getBaseBlocks() {
|
||||
public static Map<Block, Integer> getBaseBlocks() {
|
||||
return BASE_BLOCKS;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
|||
import com.projectkorra.projectkorra.ability.PlantAbility;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
||||
import com.projectkorra.projectkorra.util.PassiveHandler;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
|
@ -27,7 +28,6 @@ public class PlantArmor extends PlantAbility {
|
|||
private Block block;
|
||||
private Location location;
|
||||
private PlantRegrowth plantbending;
|
||||
private ItemStack[] oldArmor;
|
||||
|
||||
public PlantArmor(Player player) {
|
||||
super(player);
|
||||
|
@ -82,7 +82,6 @@ public class PlantArmor extends PlantAbility {
|
|||
}
|
||||
|
||||
private void formArmor() {
|
||||
oldArmor = player.getInventory().getArmorContents();
|
||||
ItemStack helmet = new ItemStack(blockType);
|
||||
ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
|
||||
|
@ -95,10 +94,7 @@ public class PlantArmor extends PlantAbility {
|
|||
leggings.setItemMeta(itemMeta);
|
||||
boots.setItemMeta(itemMeta);
|
||||
|
||||
player.getInventory().setHelmet(helmet);
|
||||
player.getInventory().setChestplate(chestplate);
|
||||
player.getInventory().setLeggings(leggings);
|
||||
player.getInventory().setBoots(boots);
|
||||
new TempArmor(player, this, new ItemStack[] {boots, leggings, chestplate, helmet});
|
||||
|
||||
formed = true;
|
||||
startTime = System.currentTimeMillis();
|
||||
|
@ -148,8 +144,8 @@ public class PlantArmor extends PlantAbility {
|
|||
public void remove() {
|
||||
super.remove();
|
||||
|
||||
if (oldArmor != null) {
|
||||
player.getInventory().setArmorContents(oldArmor);
|
||||
if (TempArmor.hasTempArmor(player) && TempArmor.getTempArmor(player).getAbility().equals(this)) {
|
||||
TempArmor.getTempArmor(player).revert();
|
||||
}
|
||||
|
||||
if (plantbending != null) {
|
||||
|
@ -253,14 +249,6 @@ public class PlantArmor extends PlantAbility {
|
|||
this.plantbending = plantbending;
|
||||
}
|
||||
|
||||
public ItemStack[] getOldArmor() {
|
||||
return oldArmor;
|
||||
}
|
||||
|
||||
public void setOldArmor(ItemStack[] oldArmor) {
|
||||
this.oldArmor = oldArmor;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -25,8 +26,8 @@ public class SurgeWall extends WaterAbility {
|
|||
|
||||
private static final byte FULL = 0x0;
|
||||
private static final String RANGE_CONFIG = "Abilities.Water.Surge.Wall.Range";
|
||||
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean progressing;
|
||||
private boolean settingUp;
|
||||
|
@ -587,11 +588,11 @@ public class SurgeWall extends WaterAbility {
|
|||
this.targetDirection = targetDirection;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Block> getAffectedBlocks() {
|
||||
public static Map<Block, Block> getAffectedBlocks() {
|
||||
return AFFECTED_BLOCKS;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, Player> getWallBlocks() {
|
||||
public static Map<Block, Player> getWallBlocks() {
|
||||
return WALL_BLOCKS;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -43,8 +44,8 @@ public class SurgeWave extends WaterAbility {
|
|||
private Location targetDestination;
|
||||
private Location frozenLocation;
|
||||
private Vector targetDirection;
|
||||
private ConcurrentHashMap<Block, Block> waveBlocks;
|
||||
private ConcurrentHashMap<Block, Material> frozenBlocks;
|
||||
private Map<Block, Block> waveBlocks;
|
||||
private Map<Block, Material> frozenBlocks;
|
||||
|
||||
public SurgeWave(Player player) {
|
||||
super(player);
|
||||
|
@ -563,11 +564,11 @@ public class SurgeWave extends WaterAbility {
|
|||
this.targetDirection = targetDirection;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, Block> getWaveBlocks() {
|
||||
public Map<Block, Block> getWaveBlocks() {
|
||||
return waveBlocks;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, Material> getFrozenBlocks() {
|
||||
public Map<Block, Material> getFrozenBlocks() {
|
||||
return frozenBlocks;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -28,7 +29,7 @@ public class TorrentWave extends WaterAbility {
|
|||
private Location origin;
|
||||
private ArrayList<TempBlock> blocks;
|
||||
private ArrayList<Entity> affectedEntities;
|
||||
private ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, Double>> heights;
|
||||
private Map<Integer, ConcurrentHashMap<Integer, Double>> heights;
|
||||
|
||||
public TorrentWave(Player player, double radius) {
|
||||
this(player, player.getEyeLocation(), radius);
|
||||
|
@ -287,7 +288,7 @@ public class TorrentWave extends WaterAbility {
|
|||
return affectedEntities;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, Double>> getHeights() {
|
||||
public Map<Integer, ConcurrentHashMap<Integer, Double>> getHeights() {
|
||||
return heights;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -38,7 +39,7 @@ public class WaterCombo extends IceAbility implements ComboAbility {
|
|||
ICE_PILLAR_RISING, ICE_BULLET_FORMING
|
||||
}
|
||||
|
||||
private static final ConcurrentHashMap<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private int leftClicks;
|
||||
private int rightClicks;
|
||||
|
@ -525,11 +526,11 @@ public class WaterCombo extends IceAbility implements ComboAbility {
|
|||
return tasks;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, TempBlock> getFrozenBlocks() {
|
||||
public static Map<Block, TempBlock> getFrozenBlocks() {
|
||||
return FROZEN_BLOCKS;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, TempBlock> getAffectedBlocks() {
|
||||
public Map<Block, TempBlock> getAffectedBlocks() {
|
||||
return affectedBlocks;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public class WaterReturn extends WaterAbility {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "WaterReturn";
|
||||
return "Bottlebending";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,8 +10,9 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class WaterSourceGrabber {
|
||||
|
@ -30,7 +31,7 @@ public class WaterSourceGrabber {
|
|||
private AnimationState state;
|
||||
private Material material;
|
||||
private Location currentLoc;
|
||||
private ConcurrentHashMap<Block, TempBlock> affectedBlocks;
|
||||
private Map<Block, TempBlock> affectedBlocks;
|
||||
|
||||
public WaterSourceGrabber(Player player, Location origin) {
|
||||
this(player, origin, 1);
|
||||
|
@ -96,9 +97,9 @@ public class WaterSourceGrabber {
|
|||
}
|
||||
|
||||
public void revertBlocks() {
|
||||
Enumeration<Block> keys = affectedBlocks.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
Block block = keys.nextElement();
|
||||
Iterator<Block> keys = affectedBlocks.keySet().iterator();
|
||||
while (keys.hasNext()) {
|
||||
Block block = keys.next();
|
||||
affectedBlocks.get(block).revertBlock();
|
||||
affectedBlocks.remove(block);
|
||||
}
|
||||
|
@ -152,7 +153,7 @@ public class WaterSourceGrabber {
|
|||
this.currentLoc = currentLoc;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, TempBlock> getAffectedBlocks() {
|
||||
public Map<Block, TempBlock> getAffectedBlocks() {
|
||||
return affectedBlocks;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.waterbending;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -33,7 +34,7 @@ public class WaterSpoutWave extends WaterAbility {
|
|||
RISE, TOWARD_PLAYER, CIRCLE, SHRINK
|
||||
}
|
||||
|
||||
private static final ConcurrentHashMap<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
||||
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private double radius;
|
||||
private boolean charging;
|
||||
|
@ -621,7 +622,7 @@ public class WaterSpoutWave extends WaterAbility {
|
|||
this.origin = origin;
|
||||
}
|
||||
|
||||
public static ConcurrentHashMap<Block, TempBlock> getFrozenBlocks() {
|
||||
public static Map<Block, TempBlock> getFrozenBlocks() {
|
||||
return FROZEN_BLOCKS;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ permissions:
|
|||
bending.ability.WaterArms.Grab: true
|
||||
bending.ability.WaterArms.Freeze: true
|
||||
bending.ability.WaterArms.Spear: true
|
||||
bending.ability.WaterReturn: true
|
||||
bending.ability.Bottlebending: true
|
||||
bending.earth:
|
||||
default: true
|
||||
description: Grants access to all Earthbending abilities.
|
||||
|
|
Loading…
Reference in a new issue