Merge pull request #487 from grasshopperMatt/master

Various fixes
This commit is contained in:
OmniCypher 2016-04-30 16:08:34 -07:00
commit 49493a1797
3 changed files with 188 additions and 159 deletions

View file

@ -1,105 +1,12 @@
package com.projectkorra.projectkorra; package com.projectkorra.projectkorra;
import com.projectkorra.projectkorra.ability.Ability; import java.util.ArrayList;
import com.projectkorra.projectkorra.ability.AddonAbility; import java.util.Arrays;
import com.projectkorra.projectkorra.ability.AirAbility; import java.util.HashMap;
import com.projectkorra.projectkorra.ability.ChiAbility; import java.util.List;
import com.projectkorra.projectkorra.ability.CoreAbility; import java.util.Map;
import com.projectkorra.projectkorra.ability.EarthAbility; import java.util.Set;
import com.projectkorra.projectkorra.ability.ElementalAbility; import java.util.UUID;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.airbending.AirBlast;
import com.projectkorra.projectkorra.airbending.AirBubble;
import com.projectkorra.projectkorra.airbending.AirBurst;
import com.projectkorra.projectkorra.airbending.AirFlight;
import com.projectkorra.projectkorra.airbending.AirScooter;
import com.projectkorra.projectkorra.airbending.AirShield;
import com.projectkorra.projectkorra.airbending.AirSpout;
import com.projectkorra.projectkorra.airbending.AirSuction;
import com.projectkorra.projectkorra.airbending.AirSwipe;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.airbending.Tornado;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
import com.projectkorra.projectkorra.chiblocking.HighJump;
import com.projectkorra.projectkorra.chiblocking.Paralyze;
import com.projectkorra.projectkorra.chiblocking.QuickStrike;
import com.projectkorra.projectkorra.chiblocking.RapidPunch;
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
import com.projectkorra.projectkorra.chiblocking.WarriorStance;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.Catapult;
import com.projectkorra.projectkorra.earthbending.Collapse;
import com.projectkorra.projectkorra.earthbending.CollapseWall;
import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.earthbending.EarthBlast;
import com.projectkorra.projectkorra.earthbending.EarthGrab;
import com.projectkorra.projectkorra.earthbending.EarthPassive;
import com.projectkorra.projectkorra.earthbending.EarthSmash;
import com.projectkorra.projectkorra.earthbending.EarthTunnel;
import com.projectkorra.projectkorra.earthbending.Extraction;
import com.projectkorra.projectkorra.earthbending.LavaFlow;
import com.projectkorra.projectkorra.earthbending.LavaFlow.AbilityType;
import com.projectkorra.projectkorra.earthbending.LavaSurge;
import com.projectkorra.projectkorra.earthbending.LavaSurgeWave;
import com.projectkorra.projectkorra.earthbending.MetalClips;
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
import com.projectkorra.projectkorra.earthbending.RaiseEarthWall;
import com.projectkorra.projectkorra.earthbending.SandSpout;
import com.projectkorra.projectkorra.earthbending.Shockwave;
import com.projectkorra.projectkorra.earthbending.Tremorsense;
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.PlayerJumpEvent;
import com.projectkorra.projectkorra.firebending.Blaze;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.firebending.BlazeRing;
import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.firebending.FireBlastCharged;
import com.projectkorra.projectkorra.firebending.FireBurst;
import com.projectkorra.projectkorra.firebending.FireCombo;
import com.projectkorra.projectkorra.firebending.FireDamageTimer;
import com.projectkorra.projectkorra.firebending.FireJet;
import com.projectkorra.projectkorra.firebending.FireShield;
import com.projectkorra.projectkorra.firebending.HeatControlExtinguish;
import com.projectkorra.projectkorra.firebending.HeatControlSolidify;
import com.projectkorra.projectkorra.firebending.Illumination;
import com.projectkorra.projectkorra.firebending.Lightning;
import com.projectkorra.projectkorra.firebending.WallOfFire;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.Bloodbending;
import com.projectkorra.projectkorra.waterbending.IceBlast;
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
import com.projectkorra.projectkorra.waterbending.OctopusForm;
import com.projectkorra.projectkorra.waterbending.PhaseChangeFreeze;
import com.projectkorra.projectkorra.waterbending.PhaseChangeMelt;
import com.projectkorra.projectkorra.waterbending.PlantArmor;
import com.projectkorra.projectkorra.waterbending.SurgeWall;
import com.projectkorra.projectkorra.waterbending.SurgeWave;
import com.projectkorra.projectkorra.waterbending.Torrent;
import com.projectkorra.projectkorra.waterbending.WaterArms;
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterPassive;
import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.rpg.RPGMethods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -158,13 +65,105 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList; import com.projectkorra.projectkorra.ability.Ability;
import java.util.Arrays; import com.projectkorra.projectkorra.ability.AddonAbility;
import java.util.HashMap; import com.projectkorra.projectkorra.ability.AirAbility;
import java.util.List; import com.projectkorra.projectkorra.ability.ChiAbility;
import java.util.Map; import com.projectkorra.projectkorra.ability.CoreAbility;
import java.util.Set; import com.projectkorra.projectkorra.ability.EarthAbility;
import java.util.UUID; import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.airbending.AirBlast;
import com.projectkorra.projectkorra.airbending.AirBubble;
import com.projectkorra.projectkorra.airbending.AirBurst;
import com.projectkorra.projectkorra.airbending.AirFlight;
import com.projectkorra.projectkorra.airbending.AirScooter;
import com.projectkorra.projectkorra.airbending.AirShield;
import com.projectkorra.projectkorra.airbending.AirSpout;
import com.projectkorra.projectkorra.airbending.AirSuction;
import com.projectkorra.projectkorra.airbending.AirSwipe;
import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.airbending.Tornado;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
import com.projectkorra.projectkorra.chiblocking.HighJump;
import com.projectkorra.projectkorra.chiblocking.Paralyze;
import com.projectkorra.projectkorra.chiblocking.QuickStrike;
import com.projectkorra.projectkorra.chiblocking.RapidPunch;
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
import com.projectkorra.projectkorra.chiblocking.WarriorStance;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.Catapult;
import com.projectkorra.projectkorra.earthbending.Collapse;
import com.projectkorra.projectkorra.earthbending.CollapseWall;
import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.earthbending.EarthBlast;
import com.projectkorra.projectkorra.earthbending.EarthGrab;
import com.projectkorra.projectkorra.earthbending.EarthPassive;
import com.projectkorra.projectkorra.earthbending.EarthSmash;
import com.projectkorra.projectkorra.earthbending.EarthTunnel;
import com.projectkorra.projectkorra.earthbending.Extraction;
import com.projectkorra.projectkorra.earthbending.LavaFlow;
import com.projectkorra.projectkorra.earthbending.LavaFlow.AbilityType;
import com.projectkorra.projectkorra.earthbending.LavaSurge;
import com.projectkorra.projectkorra.earthbending.MetalClips;
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
import com.projectkorra.projectkorra.earthbending.RaiseEarthWall;
import com.projectkorra.projectkorra.earthbending.SandSpout;
import com.projectkorra.projectkorra.earthbending.Shockwave;
import com.projectkorra.projectkorra.earthbending.Tremorsense;
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.PlayerJumpEvent;
import com.projectkorra.projectkorra.firebending.Blaze;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.firebending.BlazeRing;
import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.firebending.FireBlastCharged;
import com.projectkorra.projectkorra.firebending.FireBurst;
import com.projectkorra.projectkorra.firebending.FireCombo;
import com.projectkorra.projectkorra.firebending.FireDamageTimer;
import com.projectkorra.projectkorra.firebending.FireJet;
import com.projectkorra.projectkorra.firebending.FireShield;
import com.projectkorra.projectkorra.firebending.HeatControlExtinguish;
import com.projectkorra.projectkorra.firebending.HeatControlSolidify;
import com.projectkorra.projectkorra.firebending.Illumination;
import com.projectkorra.projectkorra.firebending.Lightning;
import com.projectkorra.projectkorra.firebending.WallOfFire;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.Bloodbending;
import com.projectkorra.projectkorra.waterbending.IceBlast;
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
import com.projectkorra.projectkorra.waterbending.OctopusForm;
import com.projectkorra.projectkorra.waterbending.PhaseChangeFreeze;
import com.projectkorra.projectkorra.waterbending.PhaseChangeMelt;
import com.projectkorra.projectkorra.waterbending.PlantArmor;
import com.projectkorra.projectkorra.waterbending.SurgeWall;
import com.projectkorra.projectkorra.waterbending.SurgeWave;
import com.projectkorra.projectkorra.waterbending.Torrent;
import com.projectkorra.projectkorra.waterbending.WaterArms;
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterPassive;
import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.rpg.RPGMethods;
public class PKListener implements Listener { public class PKListener implements Listener {
@ -390,9 +389,12 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) { public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
if (event.getDamager() != null) { Block block = event.getDamager();
if (LavaSurgeWave.isBlockInWave(event.getDamager())) {
if (TempBlock.isTempBlock(block)) {
if (EarthAbility.isEarthbendable(block.getType()) && GeneralMethods.isSolid(block)) {
event.setCancelled(true); event.setCancelled(true);
return;
} }
} }
} }
@ -1033,10 +1035,12 @@ public class PKListener implements Listener {
} }
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent e) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = e.getPlayer(); Player player = event.getPlayer();
JUMPS.put(player, player.getStatistic(Statistic.JUMP)); JUMPS.put(player, player.getStatistic(Statistic.JUMP));
GeneralMethods.createBendingPlayer(e.getPlayer().getUniqueId(), player.getName());
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
GeneralMethods.removeUnusableAbilities(player.getName());
} }
@EventHandler @EventHandler

View file

@ -1,5 +1,14 @@
package com.projectkorra.projectkorra; package com.projectkorra.projectkorra;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import com.bekvon.bukkit.residence.protection.FlagPermissions; import com.bekvon.bukkit.residence.protection.FlagPermissions;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.ComboManager;
@ -19,15 +28,6 @@ import com.projectkorra.projectkorra.util.Updater;
import com.projectkorra.projectkorra.util.logging.PKLogHandler; import com.projectkorra.projectkorra.util.logging.PKLogHandler;
import com.projectkorra.projectkorra.waterbending.WaterbendingManager; import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
import org.bukkit.Bukkit;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
public class ProjectKorra extends JavaPlugin { public class ProjectKorra extends JavaPlugin {
public static ProjectKorra plugin; public static ProjectKorra plugin;
@ -85,7 +85,9 @@ public class ProjectKorra extends JavaPlugin {
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
PKListener.getJumpStatistics().put(player, player.getStatistic(Statistic.JUMP)); PKListener.getJumpStatistics().put(player, player.getStatistic(Statistic.JUMP));
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName()); GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
GeneralMethods.removeUnusableAbilities(player.getName());
} }
try { try {

View file

@ -24,16 +24,22 @@ import java.util.List;
public class RemoveCommand extends PKCommand { public class RemoveCommand extends PKCommand {
private String succesfullyRemovedElementSelf, wrongElementSelf, invalidElement, playerOffline, wrongElementTarget, private String succesfullyRemovedElementSelf, wrongElementSelf, invalidElement, playerOffline, wrongElementTarget,
succesfullyRemovedElementTarget, succesfullyRemovedElementTargetConfirm, succesfullyRemovedAllElementsTarget, succesfullyRemovedAllElementsTargetConfirm; succesfullyRemovedElementTarget, succesfullyRemovedElementTargetConfirm, succesfullyRemovedAllElementsTarget,
succesfullyRemovedAllElementsTargetConfirm;
public RemoveCommand() { public RemoveCommand() {
super("remove", "/bending remove <Player> [Element]", ConfigManager.languageConfig.get().getString("Commands.Remove.Description"), new String[] { "remove", "rm" }); super("remove", "/bending remove <Player> [Element]",
ConfigManager.languageConfig.get().getString("Commands.Remove.Description"), new String[] { "remove", "rm" });
this.succesfullyRemovedElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.RemovedElement"); this.succesfullyRemovedElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.RemovedElement");
this.succesfullyRemovedAllElementsTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedAllElements"); this.succesfullyRemovedAllElementsTarget = ConfigManager.languageConfig.get()
this.succesfullyRemovedAllElementsTargetConfirm = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedAllElementsConfirm"); .getString("Commands.Remove.Other.RemovedAllElements");
this.succesfullyRemovedElementTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedElement"); this.succesfullyRemovedAllElementsTargetConfirm = ConfigManager.languageConfig.get()
this.succesfullyRemovedElementTargetConfirm = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedElementConfirm"); .getString("Commands.Remove.Other.RemovedAllElementsConfirm");
this.succesfullyRemovedElementTarget = ConfigManager.languageConfig.get()
.getString("Commands.Remove.Other.RemovedElement");
this.succesfullyRemovedElementTargetConfirm = ConfigManager.languageConfig.get()
.getString("Commands.Remove.Other.RemovedElementConfirm");
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Remove.InvalidElement"); this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Remove.InvalidElement");
this.wrongElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.WrongElement"); this.wrongElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.WrongElement");
this.wrongElementTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.WrongElement"); this.wrongElementTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.WrongElement");
@ -58,25 +64,34 @@ public class RemoveCommand extends PKCommand {
senderBPlayer.getSubElements().remove(e); senderBPlayer.getSubElements().remove(e);
GeneralMethods.saveSubElements(senderBPlayer); GeneralMethods.saveSubElements(senderBPlayer);
GeneralMethods.removeUnusableAbilities(sender.getName()); GeneralMethods.removeUnusableAbilities(sender.getName());
sender.sendMessage(e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}" , e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); sender.sendMessage(e.getColor() + this.succesfullyRemovedElementSelf
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE)); .replace("{element}", e.getName() + e.getType().getBending())
} else sender.sendMessage(ChatColor.RED + invalidElement); .replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e,
com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE));
} else
sender.sendMessage(ChatColor.RED + wrongElementSelf);
return; return;
} } else if (e instanceof Element) {
if (senderBPlayer.hasElement(e)) { if (senderBPlayer.hasElement(e)) {
senderBPlayer.getElements().remove(e); senderBPlayer.getElements().remove(e);
GeneralMethods.saveElements(senderBPlayer); GeneralMethods.saveElements(senderBPlayer);
GeneralMethods.removeUnusableAbilities(sender.getName()); GeneralMethods.removeUnusableAbilities(sender.getName());
sender.sendMessage(e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName())); sender.sendMessage(e.getColor() + succesfullyRemovedElementSelf.replace("{element}", e.getName()));
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE)); Bukkit.getServer().getPluginManager()
.callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
return; return;
} else { } else
sender.sendMessage(ChatColor.RED + wrongElementSelf); sender.sendMessage(ChatColor.RED + wrongElementSelf);
{
return; return;
} }
} else { }
} else
sender.sendMessage(ChatColor.RED + invalidElement); sender.sendMessage(ChatColor.RED + invalidElement);
{
return; return;
} }
} }
@ -105,8 +120,12 @@ public class RemoveCommand extends PKCommand {
} }
GeneralMethods.removeUnusableAbilities(player.getName()); GeneralMethods.removeUnusableAbilities(player.getName());
player.sendMessage(e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + player.getName() + e.getColor())); player.sendMessage(e.getColor()
sender.sendMessage(e.getColor() + this.succesfullyRemovedElementTarget.replace("{element}" , e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor())); + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending())
.replace("{sender}", ChatColor.DARK_AQUA + player.getName() + e.getColor()));
sender.sendMessage(e.getColor()
+ this.succesfullyRemovedElementTarget.replace("{element}", e.getName() + e.getType().getBending())
.replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE)); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
return; return;
} }
@ -116,16 +135,19 @@ public class RemoveCommand extends PKCommand {
GeneralMethods.saveElements(bPlayer); GeneralMethods.saveElements(bPlayer);
GeneralMethods.saveSubElements(bPlayer); GeneralMethods.saveSubElements(bPlayer);
GeneralMethods.removeUnusableAbilities(player.getName()); GeneralMethods.removeUnusableAbilities(player.getName());
if (GeneralMethods.hasRPG()) RPGMethods.revokeAvatar(bPlayer.getUUID()); if (GeneralMethods.hasRPG())
sender.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW)); RPGMethods.revokeAvatar(bPlayer.getUUID());
player.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTarget.replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + ChatColor.YELLOW)); sender.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}",
ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW));
player.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTarget.replace("{sender}",
ChatColor.DARK_AQUA + sender.getName() + ChatColor.YELLOW));
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.REMOVE)); Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.REMOVE));
} }
} }
/** /**
* Checks if the CommandSender has the permission 'bending.admin.remove'. If * Checks if the CommandSender has the permission 'bending.admin.remove'. If not, it tells them
* not, it tells them they don't have permission to use the command. * they don't have permission to use the command.
* *
* @return True if they have the permission, false otherwise * @return True if they have the permission, false otherwise
*/ */
@ -140,7 +162,8 @@ public class RemoveCommand extends PKCommand {
@Override @Override
protected List<String> getTabCompletion(CommandSender sender, List<String> args) { protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
if (args.size() >= 2 || !sender.hasPermission("bending.command.remove")) return new ArrayList<String>(); if (args.size() >= 2 || !sender.hasPermission("bending.command.remove"))
return new ArrayList<String>();
List<String> l = new ArrayList<String>(); List<String> l = new ArrayList<String>();
if (args.size() == 0) { if (args.size() == 0) {
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {