Range of Fixes (#527)

• Added a message to the bind command when you don’t have the required
elements
• Fixed combos not appearing in the tablist for /b help
• Fixed EarthTunnel using wrong config option to revert
This commit is contained in:
StrangeOne101 2016-08-04 12:35:45 +12:00 committed by OmniCypher
parent 693f3f61eb
commit 9921181113
6 changed files with 18 additions and 5 deletions

View file

@ -123,7 +123,6 @@ import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent;
import com.projectkorra.projectkorra.event.PlayerJumpEvent;
import com.projectkorra.projectkorra.firebending.Blaze;
import com.projectkorra.projectkorra.firebending.BlazeArc;

View file

@ -1,6 +1,7 @@
package com.projectkorra.projectkorra.command;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
@ -23,6 +24,7 @@ public class BindCommand extends PKCommand {
private String wrongNumber;
private String loadingInfo;
private String toggledElementOff;
private String noElement;
public BindCommand() {
super("bind", "/bending bind <Ability> [Slot]", ConfigManager.languageConfig.get().getString("Commands.Bind.Description"), new String[]{ "bind", "b" });
@ -31,6 +33,7 @@ public class BindCommand extends PKCommand {
this.wrongNumber = ConfigManager.languageConfig.get().getString("Commands.Bind.WrongNumber");
this.loadingInfo = ConfigManager.languageConfig.get().getString("Commands.Bind.LoadingInfo");
this.toggledElementOff = ConfigManager.languageConfig.get().getString("Commands.Bind.ToggledElementOff");
this.noElement = ConfigManager.languageConfig.get().getString("Commands.Bind.NoElement");
}
@Override
@ -70,7 +73,11 @@ public class BindCommand extends PKCommand {
sender.sendMessage(ChatColor.RED + loadingInfo);
return;
} else if (coreAbil == null || !bPlayer.canBind(coreAbil)) {
if (coreAbil != null && coreAbil.getElement() != Element.AVATAR && !bPlayer.hasElement(coreAbil.getElement())) {
sender.sendMessage(ChatColor.RED + this.noElement.replace("{element}", coreAbil.getElement().getName() + coreAbil.getElement().getType().getBender()));
} else {
sender.sendMessage(ChatColor.RED + super.noPermissionMessage);
}
return;
} else if (!bPlayer.isElementToggled(coreAbil.getElement())) {
sender.sendMessage(ChatColor.RED + toggledElementOff);

View file

@ -161,8 +161,13 @@ public class HelpCommand extends PKCommand {
}
List<String> abils = new ArrayList<String>();
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
if ((!(sender instanceof Player) || BendingPlayer.getBendingPlayer(sender.getName()).canBind(coreAbil)) && !coreAbil.isHiddenAbility() && coreAbil.isEnabled()) {
if (!(sender instanceof Player) && (!coreAbil.isHiddenAbility() || coreAbil instanceof ComboAbility) && coreAbil.isEnabled()) {
abils.add(coreAbil.getName());
} else if (sender instanceof Player) {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
if (bPlayer.canBind(coreAbil) || (coreAbil instanceof ComboAbility)) {
abils.add(coreAbil.getName());
}
}
}

View file

@ -198,6 +198,7 @@ public class ConfigManager {
config.addDefault("Commands.Bind.WrongNumber", "Slot must be an integer between 1 and 9.");
config.addDefault("Commands.Bind.ElementToggledOff", "You have that ability's element toggled off currently.");
config.addDefault("Commands.Bind.SuccessfullyBound", "Succesfully bound {ability} to slot {slot}.");
config.addDefault("Commands.Bind.NoElement", "You are not a {element}!");
config.addDefault("Commands.Add.Description", "This command will allow the user to add an element to the targeted <Player>, or themselves if the target is not specified. This command is typically reserved for server administrators.");
config.addDefault("Commands.Add.SuccessfullyAddedCFW", "You are now also a {element}.");

View file

@ -21,6 +21,7 @@ public class EarthTunnel extends EarthAbility {
private double maxRadius;
private double range;
private double radiusIncrement;
private boolean revert;
private Block block;
private Location origin;
private Location location;
@ -33,6 +34,7 @@ public class EarthTunnel extends EarthAbility {
this.range = getConfig().getDouble("Abilities.Earth.EarthTunnel.Range");
this.radius = getConfig().getDouble("Abilities.Earth.EarthTunnel.Radius");
this.interval = getConfig().getLong("Abilities.Earth.EarthTunnel.Interval");
this.revert = getConfig().getBoolean("Abilities.Earth.EarthTunnel.Revert");
this.radiusIncrement = radius;
this.time = System.currentTimeMillis();
@ -90,7 +92,7 @@ public class EarthTunnel extends EarthAbility {
block = location.clone().add(direction.clone().normalize().multiply(depth)).add(vec).getBlock();
}
if (isEarthRevertOn()) {
if (this.revert) {
addTempAirBlock(block);
} else {
block.breakNaturally();

View file

@ -12,7 +12,6 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterArmsWhip.Whip;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;