Update nearly all PRs above 357

Ignored most PRs relating to presets.
This commit is contained in:
jedk1 2016-01-31 21:02:21 +00:00
parent 433ee0d700
commit fcc9caed38
20 changed files with 269 additions and 59 deletions

View file

@ -249,7 +249,10 @@ public class AirBlast extends AirAbility {
entity.setFireTicks(0);
breakBreathbendingHold(entity);
if (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity)) {
if (source != null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
GeneralMethods.damageEntity(player, entity, damage, "AirBurst");
affectedEntities.add(entity);
} else if (source == null && (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
GeneralMethods.damageEntity(this, entity, damage);
affectedEntities.add(entity);
}

View file

@ -24,6 +24,9 @@ public class AirScooter extends AirAbility {
private Block floorblock;
private Random random;
private ArrayList<Double> angles;
private boolean canFly;
private boolean hadFly;
public AirScooter(Player player) {
super(player);
@ -42,7 +45,9 @@ public class AirScooter extends AirAbility {
this.maxHeightFromGround = getConfig().getDouble("Abilities.Air.AirScooter.MaxHeightFromGround");
this.random = new Random();
this.angles = new ArrayList<>();
canFly = player.getAllowFlight();
hadFly = player.isFlying();
new Flight(player);
player.setAllowFlight(true);
player.setFlying(true);
@ -133,8 +138,8 @@ public class AirScooter extends AirAbility {
@Override
public void remove() {
super.remove();
player.setFlying(false);
player.setAllowFlight(false);
player.setFlying(hadFly);
player.setAllowFlight(canFly);
player.setSprinting(false);
}

View file

@ -108,8 +108,18 @@ public class Suffocate extends AirAbility {
}
}
} else {
Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
//Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
//List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List<Entity> entities = new ArrayList<Entity>();
for (int i = 0; i < 6; i++) {
Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
if (entities.contains(player))
entities.remove(player);
if (entities != null && !entities.isEmpty() && !entities.contains(player)) {
break;
}
}
if (entities == null || entities.isEmpty()) {
return;
}

View file

@ -26,14 +26,14 @@ public class BendingTabComplete implements TabCompleter {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
if (args.length == 0 || args[0].equals(""))
return getPossibleCompletionsForGivenArgs(args, getCommandsForUser(sender));
if (args.length >= 2) {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
if (args[0].equalsIgnoreCase("bind") || args[0].equalsIgnoreCase("b")) {
if (args.length > 3 || !sender.hasPermission("bending.command.bind") || !(sender instanceof Player))
return new ArrayList<String>();
List<String> abilities = new ArrayList<String>();
if (args.length == 2) {
if (bPlayer != null) {
@ -48,7 +48,7 @@ public class BendingTabComplete implements TabCompleter {
abilities.add("" + i);
}
}
Collections.sort(abilities);
return getPossibleCompletionsForGivenArgs(args, abilities);
} else if (args[0].equalsIgnoreCase("display") || args[0].equalsIgnoreCase("d")) {
@ -118,7 +118,7 @@ public class BendingTabComplete implements TabCompleter {
abils.add(coreAbil.getName());
}
}
Collections.sort(abils);
list.addAll(abils);
return getPossibleCompletionsForGivenArgs(args, list);
@ -131,7 +131,7 @@ public class BendingTabComplete implements TabCompleter {
}
return getPossibleCompletionsForGivenArgs(args, players);
} else if (args[0].equalsIgnoreCase("preset") || args[0].equalsIgnoreCase("presets") || args[0].equalsIgnoreCase("pre") || args[0].equalsIgnoreCase("set") || args[0].equalsIgnoreCase("p")) {
if (args.length > 3 || !sender.hasPermission("bending.command.preset") || !(sender instanceof Player))
if (args.length > 4 || !sender.hasPermission("bending.command.preset") || !(sender instanceof Player))
return new ArrayList<String>();
List<String> l = new ArrayList<String>();
if (args.length == 2) {
@ -147,10 +147,28 @@ public class BendingTabComplete implements TabCompleter {
for (Preset preset : presets) {
presetNames.add(preset.getName());
}
} else
}
if (sender.hasPermission("bending.command.preset.bind.external")) {
if (Preset.externalPresets.keySet().size() > 0) {
for (String externalPreset : Preset.externalPresets.keySet()) {
presetNames.add(externalPreset);
}
}
}
if (presetNames.size() == 0)
return new ArrayList<String>();
return getPossibleCompletionsForGivenArgs(args, presetNames);
} else if (args.length == 4 && Arrays.asList(new String[] {"bind", "b"}).contains(args[1].toLowerCase())) {
if (!sender.hasPermission("bending.command.preset.bind.assign") || (Preset.externalPresets.keySet().contains(args[2].toLowerCase())) && !sender.hasPermission("bending.command.preset.bind.external.other")) {
return new ArrayList<String>();
}
List<String> players = new ArrayList<String>();
for (Player p : Bukkit.getOnlinePlayers()) {
players.add(p.getName());
}
return getPossibleCompletionsForGivenArgs(args, players);
}
return new ArrayList<String>();
} else if (args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("rm")) {
if (args.length > 3 || !sender.hasPermission("bending.command.remove"))
return new ArrayList<String>();
@ -175,6 +193,15 @@ public class BendingTabComplete implements TabCompleter {
l.add(p.getName());
}
return getPossibleCompletionsForGivenArgs(args, l);
} else if (args[0].equalsIgnoreCase("copy") || args[0].equalsIgnoreCase("co")) {
//If they can't use the command, have over 3 args (copy <player> <player>), or if have over 2 args and can't assign to other players
if (!sender.hasPermission("bending.command.copy") || args.length > 3 || (args.length > 2 && !sender.hasPermission("bending.command.copy.assign")))
return new ArrayList<String>(); //Return nothing
List<String> l = new ArrayList<String>();
for (Player p : Bukkit.getOnlinePlayers()) {
l.add(p.getName());
}
return getPossibleCompletionsForGivenArgs(args, l);
} else if (!PKCommand.instances.keySet().contains(args[0].toLowerCase())) {
return new ArrayList<String>();
}

View file

@ -83,6 +83,7 @@ public class Commands {
new CheckCommand();
new ChooseCommand();
new ClearCommand();
new CopyCommand();
new DebugCommand();
new DisplayCommand();
new HelpCommand();

View file

@ -0,0 +1,102 @@
package com.projectkorra.projectkorra.command;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.List;
public class CopyCommand extends PKCommand {
public CopyCommand() {
super("copy", "/bending copy <Player> [Player]", "This command will allow the user to copy the binds of another player either for himself or assign them to <Player> if specified.", new String[] { "copy", "co" });
}
@Override
public void execute(CommandSender sender, List<String> args) {
if (!correctLength(sender, args.size(), 1, 2)) {
return;
} else if (args.size() == 1) {
if (!hasPermission(sender) || !isPlayer(sender)) {
return;
}
Player orig = Bukkit.getPlayer(args.get(0));
if (orig == null || !orig.isOnline()) {
sender.sendMessage(ChatColor.RED + "Player not found.");
return;
}
boolean boundAll = assignAbilities(sender, orig, (Player) sender, true);
sender.sendMessage(ChatColor.GREEN + "Your bound abilities have been made the same as " + ChatColor.YELLOW + orig.getName());
if (!boundAll) {
sender.sendMessage(ChatColor.RED + "Some abilities were not bound because you cannot bend the required element.");
}
} else if (args.size() == 2) {
if (!hasPermission(sender, "assign")) {
sender.sendMessage(ChatColor.RED + "You don't have permission to do that.");
return;
}
Player orig = ProjectKorra.plugin.getServer().getPlayer(args.get(0));
Player target = ProjectKorra.plugin.getServer().getPlayer(args.get(1));
if ((orig == null || !orig.isOnline()) || (target == null || !target.isOnline())) {
sender.sendMessage(ChatColor.RED + "That player is not online.");
return;
}
boolean boundAll = assignAbilities(sender, orig, target, false);
sender.sendMessage(ChatColor.GREEN + "The bound abilities of " + ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " have been been made the same as " + ChatColor.YELLOW + orig.getName());
target.sendMessage(ChatColor.GREEN + "Your bound abilities have been made the same as " + ChatColor.YELLOW + orig.getName());
if (!boundAll) {
sender.sendMessage(ChatColor.RED + "Some abilities were not bound because you cannot bend the required element.");
}
}
}
@SuppressWarnings("unchecked")
private boolean assignAbilities(CommandSender sender, Player player, Player player2, boolean self) {
BendingPlayer orig = BendingPlayer.getBendingPlayer(player);
BendingPlayer target = BendingPlayer.getBendingPlayer(player2);
if (orig == null) {
GeneralMethods.createBendingPlayer(((Player) player).getUniqueId(), player.getName());
orig = BendingPlayer.getBendingPlayer(player);
}
if (target == null) {
GeneralMethods.createBendingPlayer(((Player) player2).getUniqueId(), player2.getName());
target = BendingPlayer.getBendingPlayer(player2);
}
if (orig.isPermaRemoved()) {
if (self) {
player.sendMessage(ChatColor.RED + "Your bending was permanently removed.");
} else {
sender.sendMessage(ChatColor.RED + "That players bending was permanently removed.");
}
return false;
}
HashMap<Integer, String> abilities = (HashMap<Integer, String>) orig.getAbilities().clone();
boolean boundAll = true;
for (int i = 1; i <= 9; i++) {
if (!target.canBend(CoreAbility.getAbility(abilities.get(i)))) {
abilities.remove(i);
boundAll = false;
}
}
target.setAbilities(abilities);
return boundAll;
}
}

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bukkit.ChatColor;
@ -27,9 +28,15 @@ public class HelpCommand extends PKCommand {
else if (args.size() == 0) {
List<String> strings = new ArrayList<String>();
for (PKCommand command : instances.values()) {
strings.add(command.getProperUse());
if (!command.getName().equalsIgnoreCase("help") && sender.hasPermission("bending.command." + command.getName())) {
strings.add(command.getProperUse());
}
}
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", 1)) {
Collections.sort(strings);
Collections.reverse(strings);
strings.add(instances.get("help").getProperUse());
Collections.reverse(strings);
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", 1, false)) {
sender.sendMessage(ChatColor.YELLOW + s);
}
return;
@ -41,7 +48,7 @@ public class HelpCommand extends PKCommand {
for (PKCommand command : instances.values()) {
strings.add(command.getProperUse());
}
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", Integer.valueOf(arg))) {
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", Integer.valueOf(arg), true)) {
sender.sendMessage(ChatColor.YELLOW + s);
}
} else if (instances.keySet().contains(arg.toLowerCase())) {//bending help command

View file

@ -208,9 +208,11 @@ public abstract class PKCommand implements SubCommand {
* @param page
* @return
*/
protected List<String> getPage(List<String> entries, String title, int page) {
protected List<String> getPage(List<String> entries, String title, int page, boolean sort) {
List<String> strings = new ArrayList<String>();
Collections.sort(entries);
if (sort) {
Collections.sort(entries);
}
if (page < 1) {
page = 1;

View file

@ -29,6 +29,7 @@ public class PresetCommand extends PKCommand {
super("preset", "/bending preset create|bind|list|delete [name]", "This command manages Presets, which are saved bindings. Use /bending preset list to view your existing presets, use /bending [create|delete] [name] to manage your presets, and use /bending bind [name] to bind an existing preset.", new String[] { "preset", "presets", "pre", "set", "p" });
}
@SuppressWarnings("unchecked")
@Override
public void execute(CommandSender sender, List<String> args) {
if (!isPlayer(sender) || !correctLength(sender, args.size(), 1, 3)) {
@ -127,9 +128,10 @@ public class PresetCommand extends PKCommand {
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null)
if (bPlayer == null) {
return;
HashMap<Integer, String> abilities = bPlayer.getAbilities();
}
HashMap<Integer, String> abilities = (HashMap<Integer, String>) bPlayer.getAbilities().clone();
Preset preset = new Preset(player.getUniqueId(), name, abilities);
preset.save(player);
sender.sendMessage(ChatColor.GREEN + "Created preset with the name: " + ChatColor.YELLOW + name);

View file

@ -45,6 +45,7 @@ public class RemoveCommand extends PKCommand {
return;
}
sender.sendMessage(e.getColor() + "You have removed your " + e.toString().toLowerCase() + "bending.");
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
return;
} else {
sender.sendMessage(ChatColor.RED + "You do not have that element!");

View file

@ -76,7 +76,7 @@ public class WhoCommand extends PKCommand {
List<String> players = new ArrayList<String>();
for (Player player : Bukkit.getOnlinePlayers()) {
String playerName = player.getName();
String result = ChatColor.WHITE + playerName;
String result = "";
BendingPlayer bp = BendingPlayer.getBendingPlayer(playerName);
if (bp == null) {
@ -116,17 +116,20 @@ public class WhoCommand extends PKCommand {
}
if (staff.containsKey(player.getUniqueId().toString())) {
if (result == "") {
result = ChatColor.WHITE + playerName + staff.get(player.getUniqueId().toString());
result = ChatColor.WHITE + playerName + " | " + staff.get(player.getUniqueId().toString());
} else {
result = result + ChatColor.WHITE + " | " + staff.get(player.getUniqueId().toString());
}
}
if (result == "") {
result = ChatColor.WHITE + playerName;
}
players.add(result);
}
if (players.isEmpty()) {
sender.sendMessage(ChatColor.RED + "There is no one online.");
} else {
for (String s : getPage(players, ChatColor.GOLD + "Players:", page)) {
for (String s : getPage(players, ChatColor.GOLD + "Players:", page, true)) {
sender.sendMessage(s);
}
}

View file

@ -180,6 +180,7 @@ public class ConfigManager {
config.addDefault("Properties.Water.NightFactor", 1.5);
config.addDefault("Properties.Water.FullMoonFactor", 2.0);
config.addDefault("Properties.Water.CanBendPackedIce", true);
config.addDefault("Properties.Water.CanBendFromBentBlocks", false);
config.addDefault("Properties.Water.PlaySound", true);
config.addDefault("Properties.Water.NightMessage", "You feel the strength of the rising moon empowering your waterbending.");
config.addDefault("Properties.Water.DayMessage", "You feel the empowering of your waterbending subside as the moon sets.");
@ -379,6 +380,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.HealingWaters.Enabled", true);
config.addDefault("Abilities.Water.HealingWaters.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.");
config.addDefault("Abilities.Water.HealingWaters.ShiftRequired", true);
config.addDefault("Abilities.Water.HealingWaters.Radius", 5);
config.addDefault("Abilities.Water.HealingWaters.Interval", 750);
config.addDefault("Abilities.Water.HealingWaters.Power", 1);

View file

@ -523,6 +523,9 @@ public class EarthSmash extends EarthAbility {
for (EarthSmash smash : getAbilities(EarthSmash.class)) {
if (reqState == null || smash.state == reqState) {
for (Block block : blocks) {
if (block == null || smash.getLocation() == null) {
continue;
}
if (block.getLocation().getWorld() == smash.location.getWorld()
&& block.getLocation().distanceSquared(smash.location) <= Math.pow(grabDetectionRadius, 2)) {
return smash;

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -87,13 +88,17 @@ public class WallOfFire extends FireAbility {
}
private void affect(Entity entity) {
entity.setFireTicks((int) (fireTicks * 20));
GeneralMethods.setVelocity(entity, new Vector(0, 0, 0));
if (entity instanceof LivingEntity) {
Block block = ((LivingEntity) entity).getEyeLocation().getBlock();
if (TempBlock.isTempBlock(block) && isIce(block)) {
return;
}
GeneralMethods.damageEntity(this, entity, damage);
new FireDamageTimer(entity, player);
AirAbility.breakBreathbendingHold(entity);
}
entity.setFireTicks((int) (fireTicks * 20));
GeneralMethods.setVelocity(entity, new Vector(0, 0, 0));
new FireDamageTimer(entity, player);
}
private void damage() {
@ -122,6 +127,9 @@ public class WallOfFire extends FireAbility {
private void display() {
for (Block block : blocks) {
if (!isTransparent(block)) {
continue;
}
ParticleEffect.FLAME.display(block.getLocation(), 0.6F, 0.6F, 0.6F, 0, 3);
ParticleEffect.SMOKE.display(block.getLocation(), 0.6F, 0.6F, 0.6F, 0, 1);

View file

@ -41,9 +41,9 @@ public class Preset {
static String updateQuery1 = "UPDATE pk_presets SET slot";
static String updateQuery2 = " = ? WHERE uuid = ? AND name = ?";
public UUID uuid;
public HashMap<Integer, String> abilities;
public String name;
private UUID uuid;
private HashMap<Integer, String> abilities;
private String name;
/**
* Creates a new {@link Preset}
@ -137,7 +137,8 @@ public class Preset {
return false;
}
HashMap<Integer, String> abilities = preset.abilities;
@SuppressWarnings("unchecked")
HashMap<Integer, String> abilities = (HashMap<Integer, String>) preset.abilities.clone();
boolean boundAll = true;
for (int i = 1; i <= 9; i++) {
CoreAbility coreAbil = CoreAbility.getAbility(abilities.get(i));
@ -158,12 +159,14 @@ public class Preset {
* @return true if the Preset exists, false otherwise
*/
public static boolean presetExists(Player player, String name) {
if (!presets.containsKey(player.getUniqueId()))
if (!presets.containsKey(player.getUniqueId())) {
return false;
}
boolean exists = false;
for (Preset preset : presets.get(player.getUniqueId())) {
if (preset.name.equalsIgnoreCase(name))
if (preset.name.equalsIgnoreCase(name)) {
exists = true;
}
}
return exists;
}
@ -176,11 +179,13 @@ public class Preset {
* @return The Preset, if it exists, or null otherwise
*/
public static Preset getPreset(Player player, String name) {
if (!presets.containsKey(player.getUniqueId()))
if (!presets.containsKey(player.getUniqueId())) {
return null;
}
for (Preset preset : presets.get(player.getUniqueId())) {
if (preset.name.equalsIgnoreCase(name))
if (preset.name.equalsIgnoreCase(name)) {
return preset;
}
}
return null;
}

View file

@ -36,6 +36,7 @@ public class BlockSource {
private static FileConfiguration config = ConfigManager.defaultConfig.get();
// The player should never need to grab source blocks from farther than this.
private static double MAX_RANGE = config.getDouble("Abilities.Water.WaterManipulation.SelectRange");
private static boolean tempblock = config.getBoolean("Properties.Water.CanBendFromBentBlocks");
/**
* Updates all of the player's sources.
@ -246,6 +247,9 @@ public class BlockSource {
if (allowPlant && sourceBlock == null) {
sourceBlock = getSourceBlock(player, range, BlockSourceType.PLANT, clickType);
}
if(sourceBlock != null && TempBlock.isTempBlock(sourceBlock) && !tempblock) {
return null;
}
return sourceBlock;
}

View file

@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class Bloodbending extends BloodAbility {
private static final ConcurrentHashMap<Entity, Location> TARGETED_ENTITIES = new ConcurrentHashMap<Entity, Location>();
private boolean canOnlyBeUsedAtNight;
private boolean canBeUsedOnUndeadMobs;
private boolean onlyUsableDuringMoon;
@ -38,13 +38,13 @@ public class Bloodbending extends BloodAbility {
public Bloodbending(Player player) {
super(player);
Bloodbending ability = getAbility(player, getClass());
if (ability != null) {
ability.remove();
return;
}
this.canOnlyBeUsedAtNight = getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedAtNight");
this.canBeUsedOnUndeadMobs = getConfig().getBoolean("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs");
this.onlyUsableDuringMoon = getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon");
@ -84,13 +84,23 @@ public class Bloodbending extends BloodAbility {
}
}
} else {
Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
//Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
//List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
List<Entity> entities = new ArrayList<Entity>();
for (int i = 0; i < 6; i++) {
Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
if (entities.contains(player))
entities.remove(player);
if (entities != null && !entities.isEmpty() && !entities.contains(player)) {
break;
}
}
if (entities == null || entities.isEmpty()) {
return;
}
Entity target = entities.get(0);
if (target == null || !(target instanceof LivingEntity)
|| GeneralMethods.isRegionProtectedFromBuild(this, target.getLocation())
|| target.getEntityId() == player.getEntityId()) {
@ -107,13 +117,13 @@ public class Bloodbending extends BloodAbility {
} else if (!canBeUsedOnUndeadMobs && isUndead(target)) {
return;
}
GeneralMethods.damageEntity(this, target, 0);
HorizontalVelocityTracker.remove(target);
AirAbility.breakBreathbendingHold(target);
TARGETED_ENTITIES.put(target, target.getLocation().clone());
}
if (TARGETED_ENTITIES.size() > 0) {
bPlayer.addCooldown(this);
}
@ -174,7 +184,7 @@ public class Bloodbending extends BloodAbility {
if (bPlayer.isAvatarState()) {
ArrayList<Entity> entities = new ArrayList<>();
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), range)) {
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
continue;
@ -186,20 +196,20 @@ public class Bloodbending extends BloodAbility {
}
}
}
entities.add(entity);
if (!TARGETED_ENTITIES.containsKey(entity) && entity instanceof LivingEntity) {
GeneralMethods.damageEntity(this, entity, 0);
TARGETED_ENTITIES.put(entity, entity.getLocation().clone());
}
if (entity instanceof LivingEntity) {
Location newLocation = entity.getLocation();
if (player.getWorld() != newLocation.getWorld()) {
TARGETED_ENTITIES.remove(entity);
continue;
}
Location location = TARGETED_ENTITIES.get(entity);
double distance = location.distance(newLocation);
double dx, dy, dz;
@ -207,13 +217,13 @@ public class Bloodbending extends BloodAbility {
dy = location.getY() - newLocation.getY();
dz = location.getZ() - newLocation.getZ();
Vector vector = new Vector(dx, dy, dz);
if (distance > .5) {
entity.setVelocity(vector.normalize().multiply(.5));
} else {
entity.setVelocity(new Vector(0, 0, 0));
}
new TempPotionEffect((LivingEntity) entity, effect);
entity.setFallDistance(0);
if (entity instanceof Creature) {
@ -222,7 +232,7 @@ public class Bloodbending extends BloodAbility {
AirAbility.breakBreathbendingHold(entity);
}
}
for (Entity entity : TARGETED_ENTITIES.keySet()) {
if (!entities.contains(entity)) {
TARGETED_ENTITIES.remove(entity);
@ -237,13 +247,13 @@ public class Bloodbending extends BloodAbility {
continue;
}
}
Location newLocation = entity.getLocation();
if (player.getWorld() != newLocation.getWorld()) {
TARGETED_ENTITIES.remove(entity);
continue;
}
Location location = GeneralMethods.getTargetedLocation(player, 6, getTransparentMaterial());
double distance = location.distance(newLocation);
double dx, dy, dz;
@ -251,13 +261,13 @@ public class Bloodbending extends BloodAbility {
dy = location.getY() - newLocation.getY();
dz = location.getZ() - newLocation.getZ();
Vector vector = new Vector(dx, dy, dz);
if (distance > .5) {
entity.setVelocity(vector.normalize().multiply(.5));
} else {
entity.setVelocity(new Vector(0, 0, 0));
}
new TempPotionEffect((LivingEntity) entity, effect);
entity.setFallDistance(0);
if (entity instanceof Creature) {
@ -271,7 +281,7 @@ public class Bloodbending extends BloodAbility {
public static boolean isBloodbended(Entity entity) {
return entity != null ? TARGETED_ENTITIES.containsKey(entity) : null;
}
public static Location getBloodbendingLocation(Entity entity) {
return entity != null ? TARGETED_ENTITIES.get(entity) : null;
}
@ -290,7 +300,7 @@ public class Bloodbending extends BloodAbility {
public long getCooldown() {
return cooldown;
}
@Override
public boolean isSneakAbility() {
return true;
@ -368,5 +378,5 @@ public class Bloodbending extends BloodAbility {
public void setCooldown(long cooldown) {
this.cooldown = cooldown;
}
}

View file

@ -42,10 +42,18 @@ public class HealingWaters extends HealingAbility {
if (player.isSneaking()) {
Entity entity = GeneralMethods.getTargetedEntity(player, getRadius());
if (entity instanceof LivingEntity && inWater(entity)) {
giveHPToEntity((LivingEntity) entity);
if (getShiftRequired() && player.isSneaking()) {
giveHPToEntity((LivingEntity) entity);
} else if (!getShiftRequired()) {
giveHPToEntity((LivingEntity) entity);
}
}
} else {
giveHP(player);
if (getShiftRequired() && player.isSneaking()) {
giveHP(player);
} else if (!getShiftRequired()) {
giveHP(player);
}
}
}
}
@ -105,6 +113,10 @@ public class HealingWaters extends HealingAbility {
HealingWaters.time = time;
}
public static boolean getShiftRequired() {
return getConfig().getBoolean("Abilities.Water.HealingWaters.ShiftRequired");
}
public static double getRadius() {
return getConfig().getDouble("Abilities.Water.HealingWaters.Radius");
}

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
@ -159,7 +160,7 @@ public class WaterArms extends WaterAbility {
@Override
public void progress() {
if (!world.equals(player.getWorld()) || !bPlayer.canBendIgnoreBindsCooldowns(this)) {
if (!world.equals(player.getWorld()) || !bPlayer.canBendIgnoreBindsCooldowns(this) || !bPlayer.hasElement(Element.WATER)) {
remove();
return;
} else if (!bPlayer.isToggled()) {

View file

@ -35,6 +35,7 @@ permissions:
bending.command.check: true
bending.command.preset.bind.external: true
bending.command.preset.bind.external.other: true
bending.command.copy.assign: true
bending.admin.debug: true
bending.admin.remove: true
bending.player:
@ -44,6 +45,7 @@ permissions:
bending.command.bind: true
bending.command.display: true
bending.command.toggle: true
bending.command.copy: true
bending.command.choose: true
bending.command.version: true
bending.command.help: true