mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Merge pull request #63 from nathank33/master
Bug Fixes, Config Options, Performance Improvements
This commit is contained in:
commit
9fa27b0504
14 changed files with 154 additions and 14 deletions
|
@ -117,6 +117,10 @@ public class BendingPlayer {
|
||||||
return blockedChi;
|
return blockedChi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isToggled() {
|
||||||
|
return isToggled;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAbilities(HashMap<Integer, String> abilities) {
|
public void setAbilities(HashMap<Integer, String> abilities) {
|
||||||
this.abilities = abilities;
|
this.abilities = abilities;
|
||||||
for (int i = 1; i <= 9; i++) {
|
for (int i = 1; i <= 9; i++) {
|
||||||
|
|
|
@ -231,6 +231,8 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Air.AirCombo.Twister.Radius", 3.5);
|
config.addDefault("Abilities.Air.AirCombo.Twister.Radius", 3.5);
|
||||||
config.addDefault("Abilities.Air.AirCombo.Twister.RemoveDelay", 1500);
|
config.addDefault("Abilities.Air.AirCombo.Twister.RemoveDelay", 1500);
|
||||||
config.addDefault("Abilities.Air.AirCombo.Twister.Cooldown", 10000);
|
config.addDefault("Abilities.Air.AirCombo.Twister.Cooldown", 10000);
|
||||||
|
config.addDefault("Abilities.Air.AirCombo.Twister.DegreesPerParticle", 7);
|
||||||
|
config.addDefault("Abilities.Air.AirCombo.Twister.HeightPerParticle", 1.25);
|
||||||
config.addDefault("Abilities.Air.AirCombo.AirStream.Speed", 0.5);
|
config.addDefault("Abilities.Air.AirCombo.AirStream.Speed", 0.5);
|
||||||
config.addDefault("Abilities.Air.AirCombo.AirStream.Range", 40);
|
config.addDefault("Abilities.Air.AirCombo.AirStream.Range", 40);
|
||||||
config.addDefault("Abilities.Air.AirCombo.AirStream.EntityDuration", 4000);
|
config.addDefault("Abilities.Air.AirCombo.AirStream.EntityDuration", 4000);
|
||||||
|
@ -255,6 +257,8 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs", true);
|
config.addDefault("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs", true);
|
||||||
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.Bloodbending.HoldTime", 0);
|
||||||
|
config.addDefault("Abilities.Water.Bloodbending.Cooldown", 0);
|
||||||
config.addDefault("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon", false);
|
config.addDefault("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon", false);
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.HealingWaters.Enabled", true);
|
config.addDefault("Abilities.Water.HealingWaters.Enabled", true);
|
||||||
|
|
|
@ -1114,10 +1114,10 @@ public class Methods {
|
||||||
&& WaterManipulation.canPhysicsChange(blocki))
|
&& WaterManipulation.canPhysicsChange(blocki))
|
||||||
sources++;
|
sources++;
|
||||||
if (FreezeMelt.frozenblocks.containsKey(blocki)) {
|
if (FreezeMelt.frozenblocks.containsKey(blocki)) {
|
||||||
if (FreezeMelt.frozenblocks.get(blocki) == full)
|
//if (FreezeMelt.frozenblocks.get(blocki) == full)
|
||||||
sources++;
|
//sources++;
|
||||||
} else if (blocki.getType() == Material.ICE) {
|
} else if (blocki.getType() == Material.ICE) {
|
||||||
sources++;
|
//sources++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sources >= 2)
|
if (sources >= 2)
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class Preset {
|
||||||
if (!presets.containsKey(player.getUniqueId())) return;
|
if (!presets.containsKey(player.getUniqueId())) return;
|
||||||
for (Preset preset: presets.get(player.getUniqueId())) {
|
for (Preset preset: presets.get(player.getUniqueId())) {
|
||||||
if (preset.name.equalsIgnoreCase(name)) { // We found it
|
if (preset.name.equalsIgnoreCase(name)) { // We found it
|
||||||
bPlayer.setAbilities(preset.abilities);
|
bPlayer.setAbilities((HashMap<Integer, String>) preset.abilities.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class AirBlast {
|
||||||
private double damage = 0;
|
private double damage = 0;
|
||||||
private boolean otherorigin = false;
|
private boolean otherorigin = false;
|
||||||
private int ticks = 0;
|
private int ticks = 0;
|
||||||
|
private boolean showParticles = true;
|
||||||
|
|
||||||
private ArrayList<Block> affectedlevers = new ArrayList<Block>();
|
private ArrayList<Block> affectedlevers = new ArrayList<Block>();
|
||||||
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
||||||
|
@ -205,7 +206,8 @@ public class AirBlast {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void advanceLocation() {
|
private void advanceLocation() {
|
||||||
Methods.playAirbendingParticles(location, 10);
|
if (showParticles)
|
||||||
|
Methods.playAirbendingParticles(location, 10);
|
||||||
if (Methods.rand.nextInt(4) == 0) {
|
if (Methods.rand.nextInt(4) == 0) {
|
||||||
Methods.playAirbendingSound(location);
|
Methods.playAirbendingSound(location);
|
||||||
}
|
}
|
||||||
|
@ -274,6 +276,14 @@ public class AirBlast {
|
||||||
this.damage = dmg;
|
this.damage = dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShowParticles(boolean show) {
|
||||||
|
this.showParticles = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getShowParticles() {
|
||||||
|
return this.showParticles;
|
||||||
|
}
|
||||||
|
|
||||||
public static void progressAll() {
|
public static void progressAll() {
|
||||||
for (int id : instances.keySet())
|
for (int id : instances.keySet())
|
||||||
instances.get(id).progress();
|
instances.get(id).progress();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.BendingPlayer;
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
|
@ -17,6 +18,7 @@ import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
public class AirBurst {
|
public class AirBurst {
|
||||||
|
|
||||||
private static ConcurrentHashMap<Player, AirBurst> instances = new ConcurrentHashMap<Player, AirBurst>();
|
private static ConcurrentHashMap<Player, AirBurst> instances = new ConcurrentHashMap<Player, AirBurst>();
|
||||||
|
private static double PARTICLES_PERCENTAGE = 50;
|
||||||
|
|
||||||
static FileConfiguration config = ProjectKorra.plugin.getConfig();
|
static FileConfiguration config = ProjectKorra.plugin.getConfig();
|
||||||
|
|
||||||
|
@ -30,7 +32,7 @@ public class AirBurst {
|
||||||
private long starttime;
|
private long starttime;
|
||||||
private long chargetime = config.getLong("Abilities.Air.AirBurst.ChargeTime");
|
private long chargetime = config.getLong("Abilities.Air.AirBurst.ChargeTime");
|
||||||
private boolean charged = false;
|
private boolean charged = false;
|
||||||
|
private ArrayList<AirBlast> blasts = new ArrayList<AirBlast>();
|
||||||
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
||||||
|
|
||||||
public AirBurst(Player player) {
|
public AirBurst(Player player) {
|
||||||
|
@ -98,11 +100,14 @@ public class AirBurst {
|
||||||
AirBlast blast = new AirBlast(location, direction.normalize(), player,
|
AirBlast blast = new AirBlast(location, direction.normalize(), player,
|
||||||
pushfactor, this);
|
pushfactor, this);
|
||||||
blast.setDamage(damage);
|
blast.setDamage(damage);
|
||||||
|
blast.setShowParticles(false);
|
||||||
|
blasts.add(blast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Methods.verbose("--" + AirBlast.instances.size() + "--");
|
// Methods.verbose("--" + AirBlast.instances.size() + "--");
|
||||||
instances.remove(player);
|
instances.remove(player);
|
||||||
|
handleSmoothParticles();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fallBurst(Player player) {
|
public static void fallBurst(Player player) {
|
||||||
|
@ -186,6 +191,20 @@ public class AirBurst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleSmoothParticles() {
|
||||||
|
for (int i = 0; i < blasts.size(); i++) {
|
||||||
|
final AirBlast blast = blasts.get(i);
|
||||||
|
int toggleTime = 0;
|
||||||
|
if (i % 4 != 0)
|
||||||
|
toggleTime = (int) (i % (100 / PARTICLES_PERCENTAGE)) + 3;
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
blast.setShowParticles(true);
|
||||||
|
}
|
||||||
|
}.runTaskLater(ProjectKorra.plugin, toggleTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void progressAll() {
|
public static void progressAll() {
|
||||||
for (Player player : instances.keySet())
|
for (Player player : instances.keySet())
|
||||||
instances.get(player).progress();
|
instances.get(player).progress();
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.BendingPlayer;
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
import com.projectkorra.ProjectKorra.ComboManager.ClickType;
|
import com.projectkorra.ProjectKorra.ComboManager.ClickType;
|
||||||
|
import com.projectkorra.ProjectKorra.Commands;
|
||||||
import com.projectkorra.ProjectKorra.Flight;
|
import com.projectkorra.ProjectKorra.Flight;
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
|
@ -38,6 +39,10 @@ public class AirCombo {
|
||||||
.getDouble("Abilities.Air.AirCombo.Twister.Height");
|
.getDouble("Abilities.Air.AirCombo.Twister.Height");
|
||||||
public static double TWISTER_RADIUS = ProjectKorra.plugin.getConfig()
|
public static double TWISTER_RADIUS = ProjectKorra.plugin.getConfig()
|
||||||
.getDouble("Abilities.Air.AirCombo.Twister.Radius");
|
.getDouble("Abilities.Air.AirCombo.Twister.Radius");
|
||||||
|
public static double TWISTER_DEGREE_PER_PARTICLE = ProjectKorra.plugin.getConfig()
|
||||||
|
.getDouble("Abilities.Air.AirCombo.Twister.DegreesPerParticle");
|
||||||
|
public static double TWISTER_HEIGHT_PER_PARTICLE = ProjectKorra.plugin.getConfig()
|
||||||
|
.getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle");
|
||||||
public static long TWISTER_REMOVE_DELAY = ProjectKorra.plugin.getConfig()
|
public static long TWISTER_REMOVE_DELAY = ProjectKorra.plugin.getConfig()
|
||||||
.getLong("Abilities.Air.AirCombo.Twister.RemoveDelay");
|
.getLong("Abilities.Air.AirCombo.Twister.RemoveDelay");
|
||||||
public static long TWISTER_COOLDOWN = ProjectKorra.plugin.getConfig()
|
public static long TWISTER_COOLDOWN = ProjectKorra.plugin.getConfig()
|
||||||
|
@ -101,6 +106,10 @@ public class AirCombo {
|
||||||
if (Methods.isRegionProtectedFromBuild(player, "AirBlast",
|
if (Methods.isRegionProtectedFromBuild(player, "AirBlast",
|
||||||
player.getLocation()))
|
player.getLocation()))
|
||||||
return;
|
return;
|
||||||
|
if (Commands.isToggledForAll)
|
||||||
|
return;
|
||||||
|
if (!Methods.getBendingPlayer(player.getName()).isToggled())
|
||||||
|
return;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
@ -192,9 +201,9 @@ public class AirCombo {
|
||||||
|
|
||||||
double height = TWISTER_HEIGHT;
|
double height = TWISTER_HEIGHT;
|
||||||
double radius = TWISTER_RADIUS;
|
double radius = TWISTER_RADIUS;
|
||||||
for (double y = 0; y < height; y += 1.25) {
|
for (double y = 0; y < height; y += TWISTER_HEIGHT_PER_PARTICLE) {
|
||||||
double animRadius = ((radius / height) * y);
|
double animRadius = ((radius / height) * y);
|
||||||
for (int i = -180; i <= 180; i += 7) {
|
for (double i = -180; i <= 180; i += TWISTER_DEGREE_PER_PARTICLE) {
|
||||||
Vector animDir = Methods.rotateXZ(new Vector(1, 0, 1), i);
|
Vector animDir = Methods.rotateXZ(new Vector(1, 0, 1), i);
|
||||||
Location animLoc = currentLoc.clone().add(
|
Location animLoc = currentLoc.clone().add(
|
||||||
animDir.multiply(animRadius));
|
animDir.multiply(animRadius));
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class FireBlast {
|
||||||
private int ticks = 0;
|
private int ticks = 0;
|
||||||
private double range = RANGE;
|
private double range = RANGE;
|
||||||
private double damage = DAMAGE;
|
private double damage = DAMAGE;
|
||||||
|
private boolean showParticles = true;
|
||||||
|
|
||||||
public FireBlast(Player player) {
|
public FireBlast(Player player) {
|
||||||
BendingPlayer bPlayer = Methods.getBendingPlayer(player.getName());
|
BendingPlayer bPlayer = Methods.getBendingPlayer(player.getName());
|
||||||
|
@ -168,7 +169,8 @@ public class FireBlast {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void advanceLocation() {
|
private void advanceLocation() {
|
||||||
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 0, (int) range);
|
if (showParticles)
|
||||||
|
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 0, (int) range);
|
||||||
location = location.add(direction.clone().multiply(speedfactor));
|
location = location.add(direction.clone().multiply(speedfactor));
|
||||||
if (rand.nextInt(4) == 0) {
|
if (rand.nextInt(4) == 0) {
|
||||||
Methods.playFirebendingSound(location);
|
Methods.playFirebendingSound(location);
|
||||||
|
@ -197,6 +199,10 @@ public class FireBlast {
|
||||||
this.range = range;
|
this.range = range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShowParticles(boolean show) {
|
||||||
|
this.showParticles = show;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean progress(int ID) {
|
public static boolean progress(int ID) {
|
||||||
if (instances.containsKey(ID))
|
if (instances.containsKey(ID))
|
||||||
return instances.get(ID).progress();
|
return instances.get(ID).progress();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.projectkorra.ProjectKorra.firebending;
|
package com.projectkorra.ProjectKorra.firebending;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@ import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.BendingPlayer;
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
|
@ -16,6 +18,7 @@ import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
|
|
||||||
public class FireBurst {
|
public class FireBurst {
|
||||||
private static ConcurrentHashMap<Player, FireBurst> instances = new ConcurrentHashMap<Player, FireBurst>();
|
private static ConcurrentHashMap<Player, FireBurst> instances = new ConcurrentHashMap<Player, FireBurst>();
|
||||||
|
private static double PARTICLES_PERCENTAGE = 5;
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private long starttime;
|
private long starttime;
|
||||||
|
@ -25,6 +28,7 @@ public class FireBurst {
|
||||||
private double deltheta = 10;
|
private double deltheta = 10;
|
||||||
private double delphi = 10;
|
private double delphi = 10;
|
||||||
private boolean charged = false;
|
private boolean charged = false;
|
||||||
|
private ArrayList<FireBlast> blasts = new ArrayList<FireBlast>();
|
||||||
|
|
||||||
public FireBurst(Player player) {
|
public FireBurst(Player player) {
|
||||||
BendingPlayer bPlayer = Methods.getBendingPlayer(player.getName());
|
BendingPlayer bPlayer = Methods.getBendingPlayer(player.getName());
|
||||||
|
@ -96,11 +100,14 @@ public class FireBurst {
|
||||||
Vector direction = new Vector(x, z, y);
|
Vector direction = new Vector(x, z, y);
|
||||||
FireBlast fblast = new FireBlast(location, direction.normalize(), player, damage, safeblocks);
|
FireBlast fblast = new FireBlast(location, direction.normalize(), player, damage, safeblocks);
|
||||||
fblast.setRange(this.range);
|
fblast.setRange(this.range);
|
||||||
|
fblast.setShowParticles(false);
|
||||||
|
blasts.add(fblast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Methods.verbose("--" + AirBlast.instances.size() + "--");
|
// Methods.verbose("--" + AirBlast.instances.size() + "--");
|
||||||
instances.remove(player);
|
instances.remove(player);
|
||||||
|
handleSmoothParticles();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void progress() {
|
private void progress() {
|
||||||
|
@ -135,6 +142,23 @@ public class FireBurst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleSmoothParticles() {
|
||||||
|
/*
|
||||||
|
* To combat the sphere FireBurst lag we are only going to show a certain
|
||||||
|
* percentage of FireBurst particles at a time per tick. As the bursts spread out
|
||||||
|
* then we can show more at a time.
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < blasts.size(); i++) {
|
||||||
|
final FireBlast fblast = blasts.get(i);
|
||||||
|
int toggleTime = (int) (i % (100 / PARTICLES_PERCENTAGE));
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
fblast.setShowParticles(true);
|
||||||
|
}
|
||||||
|
}.runTaskLater(ProjectKorra.plugin, toggleTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void progressAll() {
|
public static void progressAll() {
|
||||||
for (Player player : instances.keySet())
|
for (Player player : instances.keySet())
|
||||||
instances.get(player).progress();
|
instances.get(player).progress();
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.BendingPlayer;
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
import com.projectkorra.ProjectKorra.ComboManager.ClickType;
|
import com.projectkorra.ProjectKorra.ComboManager.ClickType;
|
||||||
|
import com.projectkorra.ProjectKorra.Commands;
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||||
|
@ -100,11 +101,16 @@ public class FireCombo {
|
||||||
private long cooldown = 0;
|
private long cooldown = 0;
|
||||||
|
|
||||||
public FireCombo(Player player, String ability) {
|
public FireCombo(Player player, String ability) {
|
||||||
|
// Dont' call Methods.canBind directly, it doesn't let you combo as fast
|
||||||
if (!enabled || !player.hasPermission("bending.ability.FireCombo"))
|
if (!enabled || !player.hasPermission("bending.ability.FireCombo"))
|
||||||
return;
|
return;
|
||||||
if (Methods.isRegionProtectedFromBuild(player, "Blaze",
|
if (Methods.isRegionProtectedFromBuild(player, "Blaze",
|
||||||
player.getLocation()))
|
player.getLocation()))
|
||||||
return;
|
return;
|
||||||
|
if (Commands.isToggledForAll)
|
||||||
|
return;
|
||||||
|
if (!Methods.getBendingPlayer(player.getName()).isToggled())
|
||||||
|
return;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
import com.projectkorra.ProjectKorra.TempPotionEffect;
|
import com.projectkorra.ProjectKorra.TempPotionEffect;
|
||||||
|
@ -29,8 +30,11 @@ public class Bloodbending {
|
||||||
private static boolean canBeUsedOnUndead = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs");
|
private static boolean canBeUsedOnUndead = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs");
|
||||||
private static final boolean onlyUsableDuringMoon = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon");
|
private static final boolean onlyUsableDuringMoon = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon");
|
||||||
private int range = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.Bloodbending.Range");
|
private int range = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.Bloodbending.Range");
|
||||||
|
private long HOLD_TIME = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.Bloodbending.HoldTime");
|
||||||
|
private long COOLDOWN = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.Bloodbending.Cooldown");
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
|
private long time;
|
||||||
|
|
||||||
public Bloodbending(Player player) {
|
public Bloodbending(Player player) {
|
||||||
if (instances.containsKey(player)) {
|
if (instances.containsKey(player)) {
|
||||||
|
@ -47,6 +51,11 @@ public class Bloodbending {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BendingPlayer bplayer = Methods.getBendingPlayer(player.getName());
|
||||||
|
if (bplayer.isOnCooldown("Bloodbending") && !AvatarState.isAvatarState(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
range = (int) Methods.waterbendingNightAugment(range, player.getWorld());
|
range = (int) Methods.waterbendingNightAugment(range, player.getWorld());
|
||||||
if (AvatarState.isAvatarState(player)) {
|
if (AvatarState.isAvatarState(player)) {
|
||||||
range = AvatarState.getValue(range);
|
range = AvatarState.getValue(range);
|
||||||
|
@ -83,7 +92,11 @@ public class Bloodbending {
|
||||||
Methods.breakBreathbendingHold(target);
|
Methods.breakBreathbendingHold(target);
|
||||||
targetentities.put(target, target.getLocation().clone());
|
targetentities.put(target, target.getLocation().clone());
|
||||||
}
|
}
|
||||||
|
if (targetentities.size() > 0) {
|
||||||
|
bplayer.addCooldown("Bloodbending", COOLDOWN);
|
||||||
|
}
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
this.time = System.currentTimeMillis();
|
||||||
instances.put(player, this);
|
instances.put(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +128,11 @@ public class Bloodbending {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HOLD_TIME > 0 && System.currentTimeMillis() - this.time > HOLD_TIME) {
|
||||||
|
remove(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!canBeUsedOnUndead) {
|
if (!canBeUsedOnUndead) {
|
||||||
for (Entity entity: targetentities.keySet()) {
|
for (Entity entity: targetentities.keySet()) {
|
||||||
if (isUndead(entity)) {
|
if (isUndead(entity)) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
|
@ -19,6 +20,11 @@ public class FreezeMelt {
|
||||||
public static final int defaultrange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.PhaseChange.Range");
|
public static final int defaultrange = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.PhaseChange.Range");
|
||||||
public static final int defaultradius = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.PhaseChange.Radius");
|
public static final int defaultradius = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.PhaseChange.Radius");
|
||||||
|
|
||||||
|
public static final int OVERLOADING_LIMIT = 1000;
|
||||||
|
public static boolean overloading = false;
|
||||||
|
public static int overloadCounter = 0;
|
||||||
|
|
||||||
|
|
||||||
public FreezeMelt(Player player) {
|
public FreezeMelt(Player player) {
|
||||||
|
|
||||||
int range = (int) Methods.waterbendingNightAugment(defaultrange, player.getWorld());
|
int range = (int) Methods.waterbendingNightAugment(defaultrange, player.getWorld());
|
||||||
|
@ -67,9 +73,34 @@ public class FreezeMelt {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleFrozenBlocks() {
|
public static void handleFrozenBlocks() {
|
||||||
for (Block block : frozenblocks.keySet()) {
|
int size = frozenblocks.keySet().size();
|
||||||
if (canThaw(block))
|
overloadCounter++;
|
||||||
thaw(block);
|
overloadCounter %= 10;
|
||||||
|
if (overloadCounter == 0)
|
||||||
|
overloading = size > OVERLOADING_LIMIT ? true : false;
|
||||||
|
|
||||||
|
// We only want to run this method once every 10 ticks if we are overloading.
|
||||||
|
if (overloading && overloadCounter != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (overloading) {
|
||||||
|
int i = 0;
|
||||||
|
for (Block block : frozenblocks.keySet()) {
|
||||||
|
final Block fblock = block;
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
if (canThaw(fblock))
|
||||||
|
thaw(fblock);
|
||||||
|
}
|
||||||
|
}.runTaskLater(ProjectKorra.plugin, i % 10);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (Block block : frozenblocks.keySet()) {
|
||||||
|
if (canThaw(block))
|
||||||
|
thaw(block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.ProjectKorra.BendingPlayer;
|
import com.projectkorra.ProjectKorra.BendingPlayer;
|
||||||
|
import com.projectkorra.ProjectKorra.Commands;
|
||||||
import com.projectkorra.ProjectKorra.Methods;
|
import com.projectkorra.ProjectKorra.Methods;
|
||||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
import com.projectkorra.ProjectKorra.TempBlock;
|
import com.projectkorra.ProjectKorra.TempBlock;
|
||||||
|
@ -83,6 +84,10 @@ public class WaterCombo {
|
||||||
if (Methods.isRegionProtectedFromBuild(player, "WaterManipulation",
|
if (Methods.isRegionProtectedFromBuild(player, "WaterManipulation",
|
||||||
player.getLocation()))
|
player.getLocation()))
|
||||||
return;
|
return;
|
||||||
|
if (Commands.isToggledForAll)
|
||||||
|
return;
|
||||||
|
if (!Methods.getBendingPlayer(player.getName()).isToggled())
|
||||||
|
return;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
|
|
@ -176,6 +176,8 @@ Abilities:
|
||||||
Radius: 3.5
|
Radius: 3.5
|
||||||
RemoveDelay: 1500
|
RemoveDelay: 1500
|
||||||
Cooldown: 10000
|
Cooldown: 10000
|
||||||
|
DegreesPerParticle: 9
|
||||||
|
HeightPerParticle: 2.0
|
||||||
AirStream:
|
AirStream:
|
||||||
Speed: 0.5
|
Speed: 0.5
|
||||||
Range: 40
|
Range: 40
|
||||||
|
@ -199,6 +201,8 @@ Abilities:
|
||||||
CanOnlyBeUsedDuringFullMoon: false
|
CanOnlyBeUsedDuringFullMoon: false
|
||||||
ThrowFactor: 2
|
ThrowFactor: 2
|
||||||
Range: 10
|
Range: 10
|
||||||
|
HoldTime: 2000
|
||||||
|
Cooldown: 4000
|
||||||
HealingWaters:
|
HealingWaters:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Description: "To use, the bender must be at least partially submerged in water. If the user is not sneaking, this ability will automatically begin working provided the user has it selected. If the user is sneaking, he/she is channeling the healing to their target in front of them. In order for this channel to be successful, the user and the target must be at least partially submerged in water."
|
Description: "To use, the bender must be at least partially submerged in water. If the user is not sneaking, this ability will automatically begin working provided the user has it selected. If the user is sneaking, he/she is channeling the healing to their target in front of them. In order for this channel to be successful, the user and the target must be at least partially submerged in water."
|
||||||
|
|
Loading…
Reference in a new issue