FallingSand config!

Owners can now decide if bending affects fallingsand, there are 2 types
of fallingsand:
TNT and fallingsand, for both there are 2 config options if bending
should affect it, and if it affects it, than what should be the strength
multiplier be? 1.0 is the default strength and 0.1 is 1/10 of the normal
strength.

For developers:
new Methods, Methods.setVelocity(entity, vector)
This commit is contained in:
runefist 2014-09-23 12:33:53 +02:00
parent 03ee42a6a6
commit ab973bdc03
11 changed files with 31 additions and 11 deletions

View file

@ -49,6 +49,10 @@ public class ConfigManager {
config.addDefault("Properties.Chat.Colors.Chi", "GOLD");
config.addDefault("Properties.ImportEnabled", true);
config.addDefault("Properties.BendingAffectFallingSand.Normal", true);
config.addDefault("Properties.BendingAffectFallingSand.NormalStrengthMultiplier", 1.0);
config.addDefault("Properties.BendingAffectFallingSand.TNT", true);
config.addDefault("Properties.BendingAffectFallingSand.TNTStrengthMultiplier", 1.0);
config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.SeaLevel", 62);

View file

@ -119,6 +119,8 @@ import com.sk89q.worldguard.protection.flags.DefaultFlag;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import org.bukkit.entity.FallingSand;
import org.bukkit.entity.TNTPrimed;
public class Methods {
@ -1892,6 +1894,20 @@ public class Methods {
EarthPassive.removeAll();
}
public static void setVelocity(Entity entity, Vector velocity){
if (entity instanceof TNTPrimed){
if (plugin.getConfig().getBoolean("Properties.BendingAffectFallingSand.TNT"))
entity.setVelocity(velocity.multiply(plugin.getConfig().getDouble("Properties.BendingAffectFallingSand.TNTStrengthMultiplier")));
return;
}
if (entity instanceof FallingSand){
if (plugin.getConfig().getBoolean("Properties.BendingAffectFallingSand.Normal"))
entity.setVelocity(velocity.multiply(plugin.getConfig().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier")));
return;
}
entity.setVelocity(velocity);
}
public static double waterbendingNightAugment(double value, World world) {
if (isNight(world)) {

View file

@ -249,7 +249,7 @@ public class AirBlast {
if (Commands.invincible.contains(((Player) entity).getName())) return;
}
entity.setVelocity(velocity);
Methods.setVelocity(entity, velocity);
entity.setFallDistance(0);
if (!isUser && entity instanceof Player) {
new Flight((Player) entity, player);

View file

@ -92,7 +92,7 @@ public class AirShield {
}
velocity.multiply(radius / maxradius);
entity.setVelocity(velocity);
Methods.setVelocity(entity, velocity);
entity.setFallDistance(0);
}
}

View file

@ -192,7 +192,7 @@ public class AirSuction {
if (entity instanceof Player) {
if (Commands.invincible.contains(((Player) entity).getName())) continue;
}
entity.setVelocity(velocity);
Methods.setVelocity(entity, velocity);
entity.setFallDistance(0);
if (entity.getEntityId() != player.getEntityId()
&& entity instanceof Player) {

View file

@ -247,9 +247,9 @@ public class AirSwipe {
}
if(surroundingEntities.size() < MAX_AFFECTABLE_ENTITIES){
if (AvatarState.isAvatarState(player)) {
entity.setVelocity(fDirection.multiply(AvatarState.getValue(pushfactor)));
Methods.setVelocity(entity, fDirection.multiply(AvatarState.getValue(pushfactor)));
} else {
entity.setVelocity(fDirection.multiply(pushfactor));
Methods.setVelocity(entity, fDirection.multiply(pushfactor));
}
}
if (entity instanceof LivingEntity

View file

@ -157,7 +157,7 @@ public class Tornado {
velocity.setZ(vz);
velocity.setY(vy);
velocity.multiply(timefactor);
entity.setVelocity(velocity);
Methods.setVelocity(entity, velocity);
entity.setFallDistance(0);
Methods.breakBreathbendingHold(entity);

View file

@ -195,9 +195,9 @@ public class FireBlast {
private void affect(Entity entity) {
if (entity.getEntityId() != player.getEntityId()) {
if (AvatarState.isAvatarState(player)) {
entity.setVelocity(direction.clone().multiply(AvatarState.getValue(pushfactor)));
Methods.setVelocity(entity, direction.clone().multiply(AvatarState.getValue(pushfactor)));
} else {
entity.setVelocity(direction.clone().multiply(pushfactor));
Methods.setVelocity(entity, direction.clone().multiply(pushfactor));
}
if (entity instanceof LivingEntity) {
entity.setFireTicks(50);

View file

@ -175,7 +175,7 @@ public class WallOfFire {
private void affect(Entity entity) {
entity.setFireTicks(50);
entity.setVelocity(new Vector(0, 0, 0));
Methods.setVelocity(entity, new Vector(0, 0, 0));
if (entity instanceof LivingEntity) {
Methods.damageEntity(player, entity, damage);
new Enflamed(entity, player);

View file

@ -498,7 +498,7 @@ public class Torrent {
velocity.setZ(vec.getY());
}
entity.setVelocity(velocity);
Methods.setVelocity(entity, velocity);
entity.setFallDistance(0);
if (entity instanceof LivingEntity) {
World world = player.getWorld();

View file

@ -295,7 +295,7 @@ public class Wave {
if (knockback) {
Vector dir = direction.clone();
dir.setY(dir.getY() * upfactor);
entity.setVelocity(entity.getVelocity().clone()
Methods.setVelocity(entity, entity.getVelocity().clone()
.add(dir.clone().multiply(Methods.waterbendingNightAugment(factor, player.getWorld()))));
entity.setFallDistance(0);
if (entity.getFireTicks() > 0)