mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +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)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.affect(entity);
|
this.affect(entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,10 +192,8 @@ public class AirSuction extends AirAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final Vector velocity = entity.getVelocity();
|
final Vector velocity = entity.getVelocity();
|
||||||
final double max = this.speed;
|
final double max = this.speed;
|
||||||
|
|
|
@ -164,10 +164,8 @@ public class AirStream extends AirAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Entity entity : this.affectedEntities) {
|
for (final Entity entity : this.affectedEntities) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final Vector force = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc);
|
final Vector force = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc);
|
||||||
entity.setVelocity(force.clone().normalize().multiply(this.speed));
|
entity.setVelocity(force.clone().normalize().multiply(this.speed));
|
||||||
|
@ -194,7 +192,7 @@ public class AirStream extends AirAbility implements ComboAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHarmlessAbility() {
|
public boolean isHarmlessAbility() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package com.projectkorra.projectkorra.airbending.combo;
|
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.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ComboAbility;
|
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.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
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 {
|
public class Twister extends AirAbility implements ComboAbility {
|
||||||
|
|
||||||
|
@ -142,12 +141,10 @@ public class Twister extends AirAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Entity entity : this.affectedEntities) {
|
for (final Entity entity : this.affectedEntities) {
|
||||||
final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0));
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (entity instanceof Player) {
|
continue;
|
||||||
if (Commands.invincible.contains(((Player) entity).getName())) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0));
|
||||||
entity.setVelocity(forceDir.clone().normalize().multiply(0.3));
|
entity.setVelocity(forceDir.clone().normalize().multiply(0.3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,10 +274,8 @@ public class Ripple extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void affect(final Entity entity) {
|
private void affect(final Entity entity) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
DamageHandler.damageEntity(entity, this.damage, this);
|
DamageHandler.damageEntity(entity, this.damage, this);
|
||||||
|
|
|
@ -337,10 +337,8 @@ public class SurgeWave extends WaterAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (knockback) {
|
if (knockback) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final Vector dir = direction.clone();
|
final Vector dir = direction.clone();
|
||||||
dir.setY(dir.getY() * this.knockup);
|
dir.setY(dir.getY() * this.knockup);
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package com.projectkorra.projectkorra.waterbending;
|
package com.projectkorra.projectkorra.waterbending;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import java.util.HashMap;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import java.util.List;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import java.util.Map;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import java.util.Random;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
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.apache.commons.lang3.tuple.Pair;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -16,20 +19,8 @@ import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import java.util.*;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
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;
|
|
||||||
|
|
||||||
public class Torrent extends WaterAbility {
|
public class Torrent extends WaterAbility {
|
||||||
|
|
||||||
|
@ -551,10 +542,8 @@ public class Torrent extends WaterAbility {
|
||||||
if (entity.getEntityId() == this.player.getEntityId()) {
|
if (entity.getEntityId() == this.player.getEntityId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
double x, z, vx, vz, mag;
|
double x, z, vx, vz, mag;
|
||||||
double angle = 50;
|
double angle = 50;
|
||||||
|
@ -592,6 +581,9 @@ public class Torrent extends WaterAbility {
|
||||||
if (entity.getEntityId() == this.player.getEntityId()) {
|
if (entity.getEntityId() == this.player.getEntityId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || (entity instanceof Player && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (direction.getY() > this.knockup) {
|
if (direction.getY() > this.knockup) {
|
||||||
direction.setY(this.knockup);
|
direction.setY(this.knockup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,10 +150,8 @@ public class TorrentWave extends WaterAbility {
|
||||||
for (final Entity entity : indexList) {
|
for (final Entity entity : indexList) {
|
||||||
if (!this.affectedEntities.contains(entity)) {
|
if (!this.affectedEntities.contains(entity)) {
|
||||||
if (entity.getLocation().distanceSquared(location) <= 4) {
|
if (entity.getLocation().distanceSquared(location) <= 4) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.affectedEntities.add(entity);
|
this.affectedEntities.add(entity);
|
||||||
this.affect(entity);
|
this.affect(entity);
|
||||||
|
|
|
@ -293,10 +293,8 @@ public class WaterArmsWhip extends WaterAbility {
|
||||||
switch (this.ability) {
|
switch (this.ability) {
|
||||||
case PULL:
|
case PULL:
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final Vector vector = endOfArm.toVector().subtract(entity.getLocation().toVector());
|
final Vector vector = endOfArm.toVector().subtract(entity.getLocation().toVector());
|
||||||
entity.setVelocity(vector.multiply(this.pullMultiplier));
|
entity.setVelocity(vector.multiply(this.pullMultiplier));
|
||||||
|
@ -304,10 +302,8 @@ public class WaterArmsWhip extends WaterAbility {
|
||||||
break;
|
break;
|
||||||
case PUNCH:
|
case PUNCH:
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Vector vector = entity.getLocation().toVector().subtract(endOfArm.toVector());
|
final Vector vector = entity.getLocation().toVector().subtract(endOfArm.toVector());
|
||||||
|
@ -327,10 +323,8 @@ public class WaterArmsWhip extends WaterAbility {
|
||||||
if (this.grabbedEntity == null) {
|
if (this.grabbedEntity == null) {
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2)) {
|
||||||
if (entity instanceof LivingEntity && entity.getEntityId() != this.player.getEntityId() && !GRABBED_ENTITIES.containsKey(entity)) {
|
if (entity instanceof LivingEntity && entity.getEntityId() != this.player.getEntityId() && !GRABBED_ENTITIES.containsKey(entity)) {
|
||||||
if (entity instanceof Player) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || Commands.invincible.contains(((Player) entity).getName())){
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GRABBED_ENTITIES.put((LivingEntity) entity, this);
|
GRABBED_ENTITIES.put((LivingEntity) entity, this);
|
||||||
this.grabbedEntity = (LivingEntity) entity;
|
this.grabbedEntity = (LivingEntity) entity;
|
||||||
|
|
Loading…
Reference in a new issue