mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 03:30:10 +00:00
some more protection fixes, make airstream dangerous since you can affect other players, change to protect non player entities
This commit is contained in:
parent
4aa4e22833
commit
07632b62ef
9 changed files with 46 additions and 75 deletions
|
@ -425,10 +425,8 @@ public class AirBlast extends AirAbility {
|
|||
}
|
||||
|
||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
this.affect(entity);
|
||||
}
|
||||
|
|
|
@ -192,10 +192,8 @@ public class AirSuction extends AirAbility {
|
|||
}
|
||||
|
||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
final Vector velocity = entity.getVelocity();
|
||||
final double max = this.speed;
|
||||
|
|
|
@ -164,10 +164,8 @@ public class AirStream extends AirAbility implements ComboAbility {
|
|||
}
|
||||
|
||||
for (final Entity entity : this.affectedEntities) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
final Vector force = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc);
|
||||
entity.setVelocity(force.clone().normalize().multiply(this.speed));
|
||||
|
@ -194,7 +192,7 @@ public class AirStream extends AirAbility implements ComboAbility {
|
|||
|
||||
@Override
|
||||
public boolean isHarmlessAbility() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package com.projectkorra.projectkorra.airbending.combo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||
|
@ -15,6 +7,13 @@ import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformatio
|
|||
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.util.ClickType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Twister extends AirAbility implements ComboAbility {
|
||||
|
||||
|
@ -142,12 +141,10 @@ public class Twister extends AirAbility implements ComboAbility {
|
|||
}
|
||||
|
||||
for (final Entity entity : this.affectedEntities) {
|
||||
final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0));
|
||||
if (entity instanceof Player) {
|
||||
if (Commands.invincible.contains(((Player) entity).getName())) {
|
||||
break;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0));
|
||||
entity.setVelocity(forceDir.clone().normalize().multiply(0.3));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,10 +274,8 @@ public class Ripple extends EarthAbility {
|
|||
}
|
||||
|
||||
private void affect(final Entity entity) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
return;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
return;
|
||||
}
|
||||
if (entity instanceof LivingEntity) {
|
||||
DamageHandler.damageEntity(entity, this.damage, this);
|
||||
|
|
|
@ -337,10 +337,8 @@ public class SurgeWave extends WaterAbility {
|
|||
}
|
||||
}
|
||||
if (knockback) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
final Vector dir = direction.clone();
|
||||
dir.setY(dir.getY() * this.knockup);
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package com.projectkorra.projectkorra.waterbending;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.util.*;
|
||||
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
||||
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -16,20 +19,8 @@ import org.bukkit.entity.LivingEntity;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.util.BlockSource;
|
||||
import com.projectkorra.projectkorra.util.ClickType;
|
||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
||||
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Torrent extends WaterAbility {
|
||||
|
||||
|
@ -551,10 +542,8 @@ public class Torrent extends WaterAbility {
|
|||
if (entity.getEntityId() == this.player.getEntityId()) {
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
return;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
return;
|
||||
}
|
||||
double x, z, vx, vz, mag;
|
||||
double angle = 50;
|
||||
|
@ -592,6 +581,9 @@ public class Torrent extends WaterAbility {
|
|||
if (entity.getEntityId() == this.player.getEntityId()) {
|
||||
return;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || (entity instanceof Player && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
return;
|
||||
}
|
||||
if (direction.getY() > this.knockup) {
|
||||
direction.setY(this.knockup);
|
||||
}
|
||||
|
|
|
@ -150,10 +150,8 @@ public class TorrentWave extends WaterAbility {
|
|||
for (final Entity entity : indexList) {
|
||||
if (!this.affectedEntities.contains(entity)) {
|
||||
if (entity.getLocation().distanceSquared(location) <= 4) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
this.affectedEntities.add(entity);
|
||||
this.affect(entity);
|
||||
|
|
|
@ -293,10 +293,8 @@ public class WaterArmsWhip extends WaterAbility {
|
|||
switch (this.ability) {
|
||||
case PULL:
|
||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
final Vector vector = endOfArm.toVector().subtract(entity.getLocation().toVector());
|
||||
entity.setVelocity(vector.multiply(this.pullMultiplier));
|
||||
|
@ -304,10 +302,8 @@ public class WaterArmsWhip extends WaterAbility {
|
|||
break;
|
||||
case PUNCH:
|
||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
|
||||
final Vector vector = entity.getLocation().toVector().subtract(endOfArm.toVector());
|
||||
|
@ -327,10 +323,8 @@ public class WaterArmsWhip extends WaterAbility {
|
|||
if (this.grabbedEntity == null) {
|
||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||
if (entity instanceof LivingEntity && entity.getEntityId() != this.player.getEntityId() && !GRABBED_ENTITIES.containsKey(entity)) {
|
||||
if (entity instanceof Player) {
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
||||
continue;
|
||||
}
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||
continue;
|
||||
}
|
||||
GRABBED_ENTITIES.put((LivingEntity) entity, this);
|
||||
this.grabbedEntity = (LivingEntity) entity;
|
||||
|
|
Loading…
Reference in a new issue