mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Water and AirBubble
This commit is contained in:
parent
83f6f51874
commit
ab9d048080
5 changed files with 219 additions and 0 deletions
|
@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
||||||
|
import com.projectkorra.ProjectKorra.airbending.AirBubble;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirBurst;
|
import com.projectkorra.ProjectKorra.airbending.AirBurst;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirPassive;
|
import com.projectkorra.ProjectKorra.airbending.AirPassive;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirScooter;
|
import com.projectkorra.ProjectKorra.airbending.AirScooter;
|
||||||
|
@ -81,6 +82,7 @@ public class BendingManager implements Runnable {
|
||||||
Cook.progressAll();
|
Cook.progressAll();
|
||||||
FreezeMelt.handleFrozenBlocks();
|
FreezeMelt.handleFrozenBlocks();
|
||||||
OctopusForm.progressAll();
|
OctopusForm.progressAll();
|
||||||
|
AirBubble.handleBubbles(Bukkit.getServer());
|
||||||
for (int ID: Tornado.instances.keySet()) {
|
for (int ID: Tornado.instances.keySet()) {
|
||||||
Tornado.progress(ID);
|
Tornado.progress(ID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Air.AirBlast.Radius", 2);
|
config.addDefault("Abilities.Air.AirBlast.Radius", 2);
|
||||||
config.addDefault("Abilities.Air.AirBlast.Push", 3.5);
|
config.addDefault("Abilities.Air.AirBlast.Push", 3.5);
|
||||||
|
|
||||||
|
config.addDefault("Abilities.Air.AirBubble.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Air.AirBubble.Description", "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
|
||||||
|
config.addDefault("Abilities.Air.AirBubble.Radius", 7);
|
||||||
config.addDefault("Abilities.Air.AirBurst.Enabled", true);
|
config.addDefault("Abilities.Air.AirBurst.Enabled", true);
|
||||||
config.addDefault("Abilities.Air.AirBurst.Description", "AirBurst is one of the most powerful abilities in the airbender's arsenal. "
|
config.addDefault("Abilities.Air.AirBurst.Description", "AirBurst is one of the most powerful abilities in the airbender's arsenal. "
|
||||||
+ "To use, press and hold sneak to charge your burst. "
|
+ "To use, press and hold sneak to charge your burst. "
|
||||||
|
@ -126,6 +129,13 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.Bloodbending.ThrowFactor", 2);
|
config.addDefault("Abilities.Water.Bloodbending.ThrowFactor", 2);
|
||||||
config.addDefault("Abilities.Water.Bloodbending.Range", 10);
|
config.addDefault("Abilities.Water.Bloodbending.Range", 10);
|
||||||
|
|
||||||
|
config.addDefault("Abilities.Water.OctopusForm.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Water.OctopusForm.Description", "This ability allows the waterbender to manipulate a large quantity of water into a form resembling that of an octopus. "
|
||||||
|
+ "To use, click to select a water source. Then, hold sneak to channel this ability. "
|
||||||
|
+ "While channeling, the water will form itself around you and has a chance to block incoming attacks. "
|
||||||
|
+ "Additionally, you can click while channeling to attack things near you, dealing damage and knocking them back. "
|
||||||
|
+ "Releasing shift at any time will dissipate the form.");
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.PhaseChange.Enabled", true);
|
config.addDefault("Abilities.Water.PhaseChange.Enabled", true);
|
||||||
config.addDefault("Abilities.Water.PhaseChange.Description", "To use, simply left-click. "
|
config.addDefault("Abilities.Water.PhaseChange.Description", "To use, simply left-click. "
|
||||||
+ "Any water you are looking at within range will instantly freeze over into solid ice. "
|
+ "Any water you are looking at within range will instantly freeze over into solid ice. "
|
||||||
|
@ -141,6 +151,10 @@ public class ConfigManager {
|
||||||
|
|
||||||
plugin.getConfig().addDefault("Abilities.Water.Plantbending.RegrowTime", 180000);
|
plugin.getConfig().addDefault("Abilities.Water.Plantbending.RegrowTime", 180000);
|
||||||
|
|
||||||
|
config.addDefault("Abilities.Water.WaterBubble.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Water.WaterBubble.Description","To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
|
||||||
|
config.addDefault("Abilities.Water.WaterBubble.Radius", 7);
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.WaterSpout.Enabled", true);
|
config.addDefault("Abilities.Water.WaterSpout.Enabled", true);
|
||||||
config.addDefault("Abilities.Water.WaterSpout.Description", "To use this ability, click while over or in water. "
|
config.addDefault("Abilities.Water.WaterSpout.Description", "To use this ability, click while over or in water. "
|
||||||
+ "You will spout water up from beneath you to experience controlled levitation. "
|
+ "You will spout water up from beneath you to experience controlled levitation. "
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.kitteh.tag.AsyncPlayerReceiveNameTagEvent;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
||||||
|
import com.projectkorra.ProjectKorra.airbending.AirBubble;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirBurst;
|
import com.projectkorra.ProjectKorra.airbending.AirBurst;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirScooter;
|
import com.projectkorra.ProjectKorra.airbending.AirScooter;
|
||||||
import com.projectkorra.ProjectKorra.airbending.AirSpout;
|
import com.projectkorra.ProjectKorra.airbending.AirSpout;
|
||||||
|
|
194
src/com/projectkorra/ProjectKorra/airbending/AirBubble.java
Normal file
194
src/com/projectkorra/ProjectKorra/airbending/AirBubble.java
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
package com.projectkorra.ProjectKorra.airbending;
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.ProjectKorra.Element;
|
||||||
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
|
import com.projectkorra.ProjectKorra.waterbending.WaterManipulation;
|
||||||
|
|
||||||
|
public class AirBubble {
|
||||||
|
|
||||||
|
public static ConcurrentHashMap<Integer, AirBubble> instances = new ConcurrentHashMap<Integer, AirBubble>();
|
||||||
|
|
||||||
|
private static double defaultAirRadius = ProjectKorra.plugin.getConfig().getDouble("Abilities.Air.AirBubble.Radius");
|
||||||
|
private static double defaultWaterRadius = ProjectKorra.plugin.getConfig().getDouble("Abilities.Water.WaterBubble.Radius");
|
||||||
|
// private static byte full = AirBlast.full;
|
||||||
|
|
||||||
|
// private static final byte full = 0x0;
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private double radius;
|
||||||
|
// private ConcurrentHashMap<Block, Byte> waterorigins;
|
||||||
|
private ConcurrentHashMap<Block, BlockState> waterorigins;
|
||||||
|
|
||||||
|
public AirBubble(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
// waterorigins = new ConcurrentHashMap<Block, Byte>();
|
||||||
|
waterorigins = new ConcurrentHashMap<Block, BlockState>();
|
||||||
|
instances.put(player.getEntityId(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pushWater() {
|
||||||
|
if (Methods.isBender(player.getName(), Element.Air)) {
|
||||||
|
radius = defaultAirRadius;
|
||||||
|
} else {
|
||||||
|
radius = defaultWaterRadius;
|
||||||
|
}
|
||||||
|
if (Methods.isBender(player.getName(), Element.Water)
|
||||||
|
&& Methods.isNight(player.getWorld())) {
|
||||||
|
radius = Methods.waterbendingNightAugment(defaultWaterRadius,
|
||||||
|
player.getWorld());
|
||||||
|
}
|
||||||
|
if (defaultAirRadius > radius
|
||||||
|
&& Methods.isBender(player.getName(), Element.Air))
|
||||||
|
radius = defaultAirRadius;
|
||||||
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
for (Block block : waterorigins.keySet()) {
|
||||||
|
if (block.getWorld() != location.getWorld()) {
|
||||||
|
if (block.getType() == Material.AIR || Methods.isWater(block))
|
||||||
|
waterorigins.get(block).update(true);
|
||||||
|
// byte data = full;
|
||||||
|
// block = block.getLocation().getBlock();
|
||||||
|
// if (block.getType() == Material.AIR) {
|
||||||
|
// block.setType(Material.WATER);
|
||||||
|
// block.setData(data);
|
||||||
|
// }
|
||||||
|
waterorigins.remove(block);
|
||||||
|
} else if (block.getLocation().distance(location) > radius) {
|
||||||
|
if (block.getType() == Material.AIR || Methods.isWater(block))
|
||||||
|
waterorigins.get(block).update(true);
|
||||||
|
// byte data = full;
|
||||||
|
// block = block.getLocation().getBlock();
|
||||||
|
// if (block.getType() == Material.AIR) {
|
||||||
|
// block.setType(Material.WATER);
|
||||||
|
// block.setData(data);
|
||||||
|
// }
|
||||||
|
waterorigins.remove(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Block block : Methods.getBlocksAroundPoint(location, radius)) {
|
||||||
|
if (waterorigins.containsKey(block))
|
||||||
|
continue;
|
||||||
|
// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirBubble,
|
||||||
|
// block.getLocation()))
|
||||||
|
// continue;
|
||||||
|
if (block.getType() == Material.STATIONARY_WATER
|
||||||
|
|| block.getType() == Material.WATER) {
|
||||||
|
if (WaterManipulation.canBubbleWater(block)) {
|
||||||
|
// if (block.getData() == full)
|
||||||
|
waterorigins.put(block, block.getState());
|
||||||
|
// waterorigins.put(block, block.getData());
|
||||||
|
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean progress() {
|
||||||
|
if (player.isDead() || !player.isOnline()) {
|
||||||
|
removeBubble();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Methods.getBoundAbility(player) != null) {
|
||||||
|
if (Methods.getBoundAbility(player).equalsIgnoreCase("AirBubble") && Methods.canBend(player.getName(), "AirBubble")) {
|
||||||
|
pushWater();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Methods.getBoundAbility(player).equalsIgnoreCase("WaterBubble") && Methods.canBend(player.getName(), "WaterBubble")) {
|
||||||
|
pushWater();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removeBubble();
|
||||||
|
return false;
|
||||||
|
// if ((Methods.getBendingAbility(player) != Abilities.AirBubble && Methods
|
||||||
|
// .getBendingAbility(player) != Abilities.WaterBubble)) {
|
||||||
|
// removeBubble();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// pushWater();
|
||||||
|
// return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleBubbles(Server server) {
|
||||||
|
|
||||||
|
for (Player player : server.getOnlinePlayers()) {
|
||||||
|
if (Methods.getBoundAbility(player) != null) {
|
||||||
|
if (Methods.getBoundAbility(player).equalsIgnoreCase("AirBubble") || Methods.getBoundAbility(player).equalsIgnoreCase("WaterBubble")) {
|
||||||
|
if (!instances.containsKey(player.getEntityId())) {
|
||||||
|
new AirBubble(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ID : instances.keySet()) {
|
||||||
|
progress(ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeBubble() {
|
||||||
|
for (Block block : waterorigins.keySet()) {
|
||||||
|
// byte data = waterorigins.get(block);
|
||||||
|
// byte data = 0x0;
|
||||||
|
// block = block.getLocation().getBlock();
|
||||||
|
// if (block.getType() == Material.AIR) {
|
||||||
|
// block.setType(Material.WATER);
|
||||||
|
// block.setData(data);
|
||||||
|
// }
|
||||||
|
if (block.getType() == Material.AIR || block.isLiquid())
|
||||||
|
waterorigins.get(block).update(true);
|
||||||
|
}
|
||||||
|
instances.remove(player.getEntityId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean progress(int ID) {
|
||||||
|
return instances.get(ID).progress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean blockInBubble(Block block) {
|
||||||
|
if (block.getWorld() != player.getWorld()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (block.getLocation().distance(player.getLocation()) <= radius) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean canFlowTo(Block block) {
|
||||||
|
for (int ID : instances.keySet()) {
|
||||||
|
if (instances.get(ID).blockInBubble(block)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeAll() {
|
||||||
|
for (int id : instances.keySet()) {
|
||||||
|
instances.get(id).removeBubble();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDescription() {
|
||||||
|
return "To use, the bender must merely have the ability selected."
|
||||||
|
+ " All water around the user in a small bubble will vanish,"
|
||||||
|
+ " replacing itself once the user either gets too far away or selects a different ability.";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -51,6 +51,10 @@ Abilities:
|
||||||
Range: 20
|
Range: 20
|
||||||
Radius: 2
|
Radius: 2
|
||||||
Push: 3.5
|
Push: 3.5
|
||||||
|
AirBubble:
|
||||||
|
Enabled: true
|
||||||
|
Description: "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability."
|
||||||
|
Radius: 7
|
||||||
AirBurst:
|
AirBurst:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Description: "AirBurst is one of the most powerful abilities in an airbender's arsenal. To use, press and hold sneak to charge your burst. Once charged, you can either release sneak to launch a cone-shaped burst of air in front of you, or click to release theb urst in a sphere around you. Additionally, having this ability selected when you land on the ground from a large enough fall will create a burst of air around you."
|
Description: "AirBurst is one of the most powerful abilities in an airbender's arsenal. To use, press and hold sneak to charge your burst. Once charged, you can either release sneak to launch a cone-shaped burst of air in front of you, or click to release theb urst in a sphere around you. Additionally, having this ability selected when you land on the ground from a large enough fall will create a burst of air around you."
|
||||||
|
@ -88,6 +92,10 @@ Abilities:
|
||||||
Radius: 5
|
Radius: 5
|
||||||
Plantbending:
|
Plantbending:
|
||||||
RegrowTime: 180000
|
RegrowTime: 180000
|
||||||
|
WaterBubble:
|
||||||
|
Enabled: true
|
||||||
|
Description: "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability."
|
||||||
|
Radius: 7
|
||||||
WaterManipulation:
|
WaterManipulation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Description: "To use, place your cursor over a waterbendable object and tap sneak (default: shift). Smoke will appear where you've selected, indicating the origin of your ability. After you have selected an origin, simply left-click in any direction and you will see your water spout off in that direction, slicing any creature in its path. If you look towards a creature when you use this ability, it will target that creature. A collision from Water Manipulation both knocks the target back and deals some damage. Alternatively, if you have the source selected and tap shift again, you will be able to control the water more directly."
|
Description: "To use, place your cursor over a waterbendable object and tap sneak (default: shift). Smoke will appear where you've selected, indicating the origin of your ability. After you have selected an origin, simply left-click in any direction and you will see your water spout off in that direction, slicing any creature in its path. If you look towards a creature when you use this ability, it will target that creature. A collision from Water Manipulation both knocks the target back and deals some damage. Alternatively, if you have the source selected and tap shift again, you will be able to control the water more directly."
|
||||||
|
|
Loading…
Reference in a new issue