mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Release Bug Fixes/Patches (#1064)
## Fixes * Patches AirBlast same origin & destination erroring. * Patches PhaseChange duplication glitch * Patches EarthGrab duplication glitch * Fixes invalid preset name throwing NPE * Fixes ChatPrefix not correctly displaying Avatar for those w/ multiple elements.
This commit is contained in:
parent
3c1d6b7b85
commit
ca2bb791ea
6 changed files with 33 additions and 22 deletions
|
@ -808,7 +808,7 @@ public class PKListener implements Listener {
|
|||
String e = "Nonbender";
|
||||
ChatColor c = ChatColor.WHITE;
|
||||
if (bPlayer != null) {
|
||||
if (player.hasPermission("bending.avatar") || (bPlayer.hasElement(Element.AIR) && bPlayer.hasElement(Element.EARTH) && bPlayer.hasElement(Element.FIRE) && bPlayer.hasElement(Element.WATER))) {
|
||||
if (player.hasPermission("bending.avatar") || bPlayer.getElements().size() > 1) {
|
||||
c = Element.AVATAR.getColor();
|
||||
e = Element.AVATAR.getName();
|
||||
} else if (bPlayer.getElements().size() > 0) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.bukkit.Material;
|
|||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -215,8 +216,8 @@ public abstract class ElementalAbility extends CoreAbility {
|
|||
public static boolean isWater(final Block block) {
|
||||
if (block == null) {
|
||||
return false;
|
||||
} else if (isWater(block.getType())) {
|
||||
return true;
|
||||
} else if (block.getState() instanceof Container) {
|
||||
return false;
|
||||
} else {
|
||||
return isWater(block.getBlockData());
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class AirBlast extends AirAbility {
|
|||
ORIGINS.remove(player);
|
||||
|
||||
if (entity != null) {
|
||||
this.direction = GeneralMethods.getDirection(this.origin, entity.getLocation()).normalize();
|
||||
this.direction = GeneralMethods.getDirection(this.origin, GeneralMethods.getTargetedLocation(player, this.range, false, false)).normalize();
|
||||
} else {
|
||||
this.direction = GeneralMethods.getDirection(this.origin, GeneralMethods.getTargetedLocation(player, this.range)).normalize();
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ public class AirBlast extends AirAbility {
|
|||
this.origin = player.getEyeLocation();
|
||||
this.direction = player.getEyeLocation().getDirection().normalize();
|
||||
}
|
||||
|
||||
if(!Double.isFinite(this.direction.getX()) || !Double.isFinite(this.direction.getY()) || !Double.isFinite(this.direction.getZ())) {
|
||||
return;
|
||||
}
|
||||
this.location = this.origin.clone();
|
||||
this.bPlayer.addCooldown(this);
|
||||
this.start();
|
||||
|
|
|
@ -40,6 +40,8 @@ public class PresetCommand extends PKCommand {
|
|||
private final String alreadyExists;
|
||||
private final String createdNewPreset;
|
||||
private final String cantEditBinds;
|
||||
private final String playerNotFound;
|
||||
private final String invalidName;
|
||||
|
||||
public PresetCommand() {
|
||||
super("preset", "/bending preset <Bind/Create/Delete/List> [Preset]", ConfigManager.languageConfig.get().getString("Commands.Preset.Description"), new String[] { "preset", "presets", "pre", "set", "p" });
|
||||
|
@ -58,6 +60,8 @@ public class PresetCommand extends PKCommand {
|
|||
this.alreadyExists = ConfigManager.languageConfig.get().getString("Commands.Preset.AlreadyExists");
|
||||
this.createdNewPreset = ConfigManager.languageConfig.get().getString("Commands.Preset.Created");
|
||||
this.cantEditBinds = ConfigManager.languageConfig.get().getString("Commands.Preset.CantEditBinds");
|
||||
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound");
|
||||
this.invalidName = ConfigManager.languageConfig.get().getString("Commands.Preset.InvalidName");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,7 +181,7 @@ public class PresetCommand extends PKCommand {
|
|||
}
|
||||
return;
|
||||
} else {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound"));
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.playerNotFound);
|
||||
}
|
||||
} else if (this.hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) {
|
||||
if (!Preset.presetExists(player, name)) {
|
||||
|
@ -207,12 +211,15 @@ public class PresetCommand extends PKCommand {
|
|||
}
|
||||
return;
|
||||
} else {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound"));
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.playerNotFound);
|
||||
}
|
||||
}
|
||||
} else if (Arrays.asList(createaliases).contains(args.get(0)) && this.hasPermission(sender, "create")) { // bending preset create name.
|
||||
final int limit = GeneralMethods.getMaxPresets(player);
|
||||
|
||||
if (name == null) {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.invalidName);
|
||||
return;
|
||||
}
|
||||
if (Preset.presets.get(player.getUniqueId()) != null && Preset.presets.get(player.getUniqueId()).size() >= limit) {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.reachedMax);
|
||||
return;
|
||||
|
|
|
@ -135,6 +135,7 @@ public class ConfigManager {
|
|||
config.addDefault("Commands.Preset.AlreadyExists", "A preset with that name already exists.");
|
||||
config.addDefault("Commands.Preset.BendingPermanentlyRemoved", "Your bending was permanently removed.");
|
||||
config.addDefault("Commands.Preset.PlayerNotFound", "Player not found.");
|
||||
config.addDefault("Commands.Preset.InvalidName", "You must enter a valid name for your preset.");
|
||||
config.addDefault("Commands.Preset.MaxPresets", "You've reached your maximum number of presets.");
|
||||
config.addDefault("Commands.Preset.CantEditBinds", "You can't edit your binds right now!");
|
||||
config.addDefault("Commands.Preset.Other.BendingPermanentlyRemoved", "That player's bending was permanently removed.");
|
||||
|
|
|
@ -203,20 +203,20 @@ public class EarthGrab extends EarthAbility {
|
|||
this.mHandler = new MovementHandler(this.target, this);
|
||||
this.mHandler.stop(Element.EARTH.getColor() + "* Trapped *");
|
||||
|
||||
if (this.target instanceof Player || this.target instanceof Zombie || this.target instanceof Skeleton) {
|
||||
final ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
final LeatherArmorMeta legmeta = (LeatherArmorMeta) legs.getItemMeta();
|
||||
legmeta.setColor(Color.fromRGB(EarthArmor.getColor(m)));
|
||||
legs.setItemMeta(legmeta);
|
||||
|
||||
final ItemStack feet = new ItemStack(Material.LEATHER_BOOTS);
|
||||
final LeatherArmorMeta footmeta = (LeatherArmorMeta) feet.getItemMeta();
|
||||
footmeta.setColor(Color.fromRGB(EarthArmor.getColor(m)));
|
||||
feet.setItemMeta(footmeta);
|
||||
|
||||
final ItemStack[] pieces = { (this.target.getEquipment().getArmorContents()[0] == null || this.target.getEquipment().getArmorContents()[0].getType() == Material.AIR) ? feet : null, (this.target.getEquipment().getArmorContents()[1] == null || this.target.getEquipment().getArmorContents()[1].getType() == Material.AIR) ? legs : null, null, null };
|
||||
this.armor = new TempArmor(this.target, 36000000L, this, pieces);
|
||||
}
|
||||
// if (this.target instanceof Player || this.target instanceof Zombie || this.target instanceof Skeleton) {
|
||||
// final ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
// final LeatherArmorMeta legmeta = (LeatherArmorMeta) legs.getItemMeta();
|
||||
// legmeta.setColor(Color.fromRGB(EarthArmor.getColor(m)));
|
||||
// legs.setItemMeta(legmeta);
|
||||
//
|
||||
// final ItemStack feet = new ItemStack(Material.LEATHER_BOOTS);
|
||||
// final LeatherArmorMeta footmeta = (LeatherArmorMeta) feet.getItemMeta();
|
||||
// footmeta.setColor(Color.fromRGB(EarthArmor.getColor(m)));
|
||||
// feet.setItemMeta(footmeta);
|
||||
//
|
||||
// final ItemStack[] pieces = { (this.target.getEquipment().getArmorContents()[0] == null || this.target.getEquipment().getArmorContents()[0].getType() == Material.AIR) ? feet : null, (this.target.getEquipment().getArmorContents()[1] == null || this.target.getEquipment().getArmorContents()[1].getType() == Material.AIR) ? legs : null, null, null };
|
||||
// this.armor = new TempArmor(this.target, 36000000L, this, pieces);
|
||||
// }
|
||||
|
||||
playEarthbendingSound(this.target.getLocation());
|
||||
this.initiated = true;
|
||||
|
|
Loading…
Reference in a new issue