mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
General fixes and new additions
This commit is contained in:
parent
9607ac6eb2
commit
11c0bf6329
17 changed files with 161 additions and 90 deletions
|
@ -30,6 +30,7 @@ public class BendingPlayer {
|
|||
private ArrayList<Element> elements;
|
||||
private HashMap<Integer, String> abilities;
|
||||
private ConcurrentHashMap<String, Long> cooldowns;
|
||||
private ConcurrentHashMap<Element, Boolean> toggledElements;
|
||||
private boolean permaRemoved;
|
||||
private boolean toggled = true;
|
||||
private long slowTime = 0;
|
||||
|
@ -52,7 +53,13 @@ public class BendingPlayer {
|
|||
this.setAbilities(abilities);
|
||||
this.permaRemoved = permaRemoved;
|
||||
cooldowns = new ConcurrentHashMap<String, Long>();
|
||||
|
||||
toggledElements = new ConcurrentHashMap<Element, Boolean>();
|
||||
toggledElements.put(Element.Air, true);
|
||||
toggledElements.put(Element.Earth, true);
|
||||
toggledElements.put(Element.Fire, true);
|
||||
toggledElements.put(Element.Water, true);
|
||||
toggledElements.put(Element.Chi, true);
|
||||
|
||||
players.put(uuid, this);
|
||||
PKListener.login(this);
|
||||
}
|
||||
|
@ -194,6 +201,10 @@ public class BendingPlayer {
|
|||
public boolean isChiBlocked() {
|
||||
return this.chiBlocked;
|
||||
}
|
||||
|
||||
public boolean isElementToggled(Element e) {
|
||||
return this.toggledElements.get(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a specific ability is on cooldown.
|
||||
|
@ -293,6 +304,10 @@ public class BendingPlayer {
|
|||
public void toggleBending() {
|
||||
toggled = !toggled;
|
||||
}
|
||||
|
||||
public void toggleElement(Element e) {
|
||||
toggledElements.put(e, !toggledElements.get(e));
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the {@link BendingPlayer}'s tremor sensing.
|
||||
|
|
|
@ -293,8 +293,6 @@ public class GeneralMethods {
|
|||
return false;
|
||||
if (!bPlayer.isToggled())
|
||||
return false;
|
||||
if (p == null)
|
||||
return false;
|
||||
if (p.getGameMode() == GameMode.SPECTATOR)
|
||||
return false;
|
||||
if (cooldowns.containsKey(p.getName())) {
|
||||
|
@ -828,15 +826,7 @@ public class GeneralMethods {
|
|||
if (player == null) {
|
||||
player = Bukkit.getOfflinePlayer(playerName);
|
||||
}
|
||||
return getBendingPlayer(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static BendingPlayer getBendingPlayer(UUID uuid) {
|
||||
return BendingPlayer.getPlayers().get(uuid);
|
||||
}
|
||||
|
||||
public static BendingPlayer getBendingPlayer(OfflinePlayer player) {
|
||||
return getBendingPlayer(player.getUniqueId());
|
||||
return BendingPlayer.getPlayers().get(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) {
|
||||
|
|
|
@ -361,7 +361,7 @@ public class PKListener implements Listener {
|
|||
String append = "";
|
||||
ChatColor color = null;
|
||||
boolean chatEnabled = ProjectKorra.plugin.getConfig().getBoolean("Properties.Chat.Enable");
|
||||
if (GeneralMethods.getBendingPlayer(player).getElements().size() > 1) {
|
||||
if (GeneralMethods.getBendingPlayer(player.getName()).getElements().size() > 1) {
|
||||
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Avatar");
|
||||
color = ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Avatar"));
|
||||
} else if (e == Element.Air && chatEnabled) {
|
||||
|
@ -454,6 +454,8 @@ public class PKListener implements Listener {
|
|||
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
if (GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Fire))
|
||||
return;
|
||||
if (GeneralMethods.getBoundAbility(player) != null && GeneralMethods.getBoundAbility(player).equalsIgnoreCase("HeatControl")) {
|
||||
if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK) {
|
||||
player.setFireTicks(0);
|
||||
|
@ -812,36 +814,26 @@ public class PKListener implements Listener {
|
|||
if (GeneralMethods.isWeapon(sourceplayer.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
if (ChiPassive.willChiBlock(sourceplayer, targetplayer)) {
|
||||
if (GeneralMethods.getBendingPlayer(sourceplayer.getName()).isElementToggled(Element.Chi) == true) {
|
||||
if (GeneralMethods.getBoundAbility(sourceplayer) != null && GeneralMethods.getBoundAbility(sourceplayer).equalsIgnoreCase("Paralyze")) {
|
||||
new Paralyze(sourceplayer, targetplayer);
|
||||
} else {
|
||||
ChiPassive.blockChi(targetplayer);
|
||||
if (ChiPassive.willChiBlock(sourceplayer, targetplayer)) {
|
||||
ChiPassive.blockChi(targetplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (sourceplayer.getLocation().distance(targetplayer.getLocation()) <= plugin.getConfig().getDouble("Abilities.Chi.RapidPunch.Distance") && Methods.getBoundAbility(sourceplayer) == null) {
|
||||
// if (Methods.isWeapon(sourceplayer.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
|
||||
// return;
|
||||
// } else {
|
||||
// if (ChiPassive.willChiBlock(targetplayer)) {
|
||||
// ChiPassive.blockChi(targetplayer);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (GeneralMethods.canBendPassive(sourceplayer.getName(), Element.Chi)) {
|
||||
if (GeneralMethods.isWeapon(sourceplayer.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
if (e.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||
if (e.getCause() == DamageCause.ENTITY_ATTACK && GeneralMethods.getBendingPlayer(sourceplayer.getName()).isElementToggled(Element.Chi) == true) {
|
||||
if (GeneralMethods.getBoundAbility(sourceplayer) != null && GeneralMethods.getBoundAbility(sourceplayer).equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
|
||||
if (ChiPassive.willChiBlock(sourceplayer, targetplayer)) {
|
||||
if (CoreAbility.getAbilitiesFromPlayer(sourceplayer).isEmpty()) {
|
||||
new Paralyze(sourceplayer, targetplayer);
|
||||
}
|
||||
if (CoreAbility.getAbilitiesFromPlayer(sourceplayer).isEmpty()) {
|
||||
new Paralyze(sourceplayer, targetplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +982,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
|
||||
if (ChiCombo.isParalyzed(player)) {
|
||||
event.setTo(event.getFrom());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1123,7 @@ public class PKListener implements Listener {
|
|||
if (!player.isSneaking() && GeneralMethods.canBend(player.getName(), abil)) {
|
||||
if (GeneralMethods.isDisabledStockAbility(abil))
|
||||
return;
|
||||
if (AirMethods.isAirAbility(abil)) {
|
||||
if (AirMethods.isAirAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Air) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1163,7 +1155,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (WaterMethods.isWaterAbility(abil)) {
|
||||
if (WaterMethods.isWaterAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Water) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1196,7 +1188,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (EarthMethods.isEarthAbility(abil)) {
|
||||
if (EarthMethods.isEarthAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Earth) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1244,7 +1236,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (FireMethods.isFireAbility(abil)) {
|
||||
if (FireMethods.isFireAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Fire) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1308,7 +1300,7 @@ public class PKListener implements Listener {
|
|||
if (GeneralMethods.isDisabledStockAbility(abil))
|
||||
return;
|
||||
|
||||
if (AirMethods.isAirAbility(abil)) {
|
||||
if (AirMethods.isAirAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Air) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1344,7 +1336,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (WaterMethods.isWaterAbility(abil)) {
|
||||
if (WaterMethods.isWaterAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Water) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Water.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1380,7 +1372,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (EarthMethods.isEarthAbility(abil)) {
|
||||
if (EarthMethods.isEarthAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Earth) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1433,7 +1425,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (FireMethods.isFireAbility(abil)) {
|
||||
if (FireMethods.isFireAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Fire) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1466,7 +1458,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (ChiMethods.isChiAbility(abil)) {
|
||||
if (ChiMethods.isChiAbility(abil) && GeneralMethods.getBendingPlayer(player.getName()).isElementToggled(Element.Chi) == true) {
|
||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
|
||||
return;
|
||||
}
|
||||
|
@ -1476,9 +1468,6 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("RapidPunch")) {
|
||||
new RapidPunch(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Paralyze")) {
|
||||
//
|
||||
}
|
||||
if (abil.equalsIgnoreCase("Smokescreen")) {
|
||||
new Smokescreen(player);
|
||||
}
|
||||
|
|
|
@ -371,16 +371,22 @@ public class AbilityModuleManager {
|
|||
}
|
||||
}
|
||||
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (List.class.isAssignableFrom(field.getType())) {
|
||||
try {
|
||||
Collections.sort((List) field.get(this));
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(airbendingabilities);
|
||||
Collections.sort(firebendingabilities);
|
||||
Collections.sort(earthbendingabilities);
|
||||
Collections.sort(waterbendingabilities);
|
||||
Collections.sort(chiabilities);
|
||||
Collections.sort(iceabilities);
|
||||
Collections.sort(lavaabilities);
|
||||
Collections.sort(bloodabilities);
|
||||
Collections.sort(sandabilities);
|
||||
Collections.sort(metalabilities);
|
||||
Collections.sort(lightningabilities);
|
||||
Collections.sort(combustionabilities);
|
||||
Collections.sort(healingabilities);
|
||||
Collections.sort(flightabilities);
|
||||
Collections.sort(plantabilities);
|
||||
Collections.sort(spiritualprojectionabilities);
|
||||
}
|
||||
|
||||
public List<String> getAbilities(String element) {
|
||||
|
|
|
@ -126,7 +126,7 @@ public abstract class CoreAbility implements Ability {
|
|||
return instanceMap != null ? instanceMap : new ConcurrentHashMap<Integer, CoreAbility>();
|
||||
}
|
||||
|
||||
//TODO: Update bending managers to use bellow method
|
||||
//TODO: Update bending managers to use below method
|
||||
// /**
|
||||
// * Convenience method that calls {@link #progress()} for all instances.
|
||||
// *
|
||||
|
@ -166,7 +166,7 @@ public abstract class CoreAbility implements Ability {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Update bending managers to use bellow method
|
||||
//TODO: Update bending managers to use below method
|
||||
// /**
|
||||
// * Convenience method that calls {@link #remove()} for all instances.
|
||||
// *
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.projectkorra.projectkorra.chiblocking;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
|
||||
/**
|
||||
* A representation of all chi combo moves.
|
||||
|
@ -18,37 +18,45 @@ import java.util.Map;
|
|||
*/
|
||||
public class ChiCombo {
|
||||
|
||||
private static boolean enabled = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Chi.ChiCombo.Enabled");
|
||||
private static boolean enabled = ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.ChiCombo.Enabled");
|
||||
|
||||
public static long IMMOBILIZE_DURATION = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
|
||||
public static long IMMOBILIZE_COOLDOWN = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
|
||||
public static long IMMOBILIZE_DURATION = ConfigManager.defaultConfig.get().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
|
||||
public static long IMMOBILIZE_COOLDOWN = ConfigManager.defaultConfig.get().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
|
||||
/**
|
||||
* A List of every instance of an active {@link ChiCombo}.
|
||||
*/
|
||||
public static List<ChiCombo> instances = new ArrayList<ChiCombo>();
|
||||
public static ConcurrentHashMap<Player, ChiCombo> instances = new ConcurrentHashMap<Player, ChiCombo>();
|
||||
/**
|
||||
* a Map containing every entity which is paralyzed, and the time in milliseconds at which they will be unparalyzed.
|
||||
* A Map containing every entity which is paralyzed, and the time in milliseconds at which they will be unparalyzed.
|
||||
*/
|
||||
public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>();
|
||||
|
||||
private Player player;
|
||||
private static Player p;
|
||||
private Entity target;
|
||||
|
||||
public ChiCombo(Player player, String ability) {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (ability.equalsIgnoreCase("Immobilize")) {
|
||||
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize"))
|
||||
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player.getName()).isOnCooldown("Immobilize"))
|
||||
return;
|
||||
else {
|
||||
this.player = player;
|
||||
p = player;
|
||||
instances.put(player, this);
|
||||
target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>());
|
||||
paralyze(target, IMMOBILIZE_DURATION);
|
||||
instances.add(this);
|
||||
GeneralMethods.getBendingPlayer(player).addCooldown("Immobilize", IMMOBILIZE_COOLDOWN);
|
||||
GeneralMethods.getBendingPlayer(player.getName()).addCooldown("Immobilize", IMMOBILIZE_COOLDOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player
|
||||
* @return player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paralyzes the target for the given duration. The player will
|
||||
|
@ -90,8 +98,8 @@ public class ChiCombo {
|
|||
for (Entity e : paralyzedEntities.keySet()) {
|
||||
if (paralyzedEntities.get(e) <= System.currentTimeMillis()) {
|
||||
paralyzedEntities.remove(e);
|
||||
for (ChiCombo c : instances) {
|
||||
if (c.target.equals(e))
|
||||
for (ChiCombo c : instances.values()) {
|
||||
if (c.target.equals(e) && c.getPlayer() == p)
|
||||
instances.remove(c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AddCommand extends PKCommand {
|
|||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(target.getName());
|
||||
if (bPlayer == null) {
|
||||
GeneralMethods.createBendingPlayer(target.getUniqueId(), target.getName());
|
||||
bPlayer = GeneralMethods.getBendingPlayer(target);
|
||||
bPlayer = GeneralMethods.getBendingPlayer(target.getName());
|
||||
}
|
||||
if (bPlayer.isPermaRemoved()) {
|
||||
sender.sendMessage(ChatColor.RED + "That player's bending was permanently removed.");
|
||||
|
|
|
@ -28,6 +28,10 @@ public class BindCommand extends PKCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
if (GeneralMethods.getBendingPlayer(sender.getName()).isElementToggled(GeneralMethods.getAbilityElement(args.get(0)))) {
|
||||
sender.sendMessage(ChatColor.RED + "You have that ability's element toggled off currently.");
|
||||
}
|
||||
|
||||
String ability = GeneralMethods.getAbility(args.get(0));
|
||||
// bending bind [Ability]
|
||||
if (args.size() == 1) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ChooseCommand extends PKCommand {
|
|||
private void add(CommandSender sender, Player target, String element) {
|
||||
element = getElement(element);
|
||||
Element e = Element.getType(element);
|
||||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(target);
|
||||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(target.getName());
|
||||
bPlayer.setElement(e);
|
||||
ChatColor color = GeneralMethods.getElementColor(e);
|
||||
if (element.charAt(0) == 'w' || element.charAt(0) == 'f') {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class Commands {
|
|||
public static String[] watercomboaliases = { "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
||||
|
||||
public static String[] comboaliases = { "aircombo", "ac", "aircombos", "airbendingcombos", "chicombo", "cc", "chicombos", "chiblockingcombos", "chiblockercombos", "earthcombo", "ec", "earthcombos", "earthbendingcombos", "firecombo", "fc", "firecombos", "firebendingcombos", "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
||||
|
||||
public static String[] multicomboaliases = { "multielementcombo", "mc", "multielementcombos", "mec", "multicombos" };
|
||||
/*
|
||||
* Subelement Aliases
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PermaremoveCommand extends PKCommand {
|
|||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||
if (bPlayer == null) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
bPlayer = GeneralMethods.getBendingPlayer(player);
|
||||
bPlayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||
}
|
||||
|
||||
if (bPlayer.isPermaRemoved()) {
|
||||
|
|
|
@ -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.event.PlayerChangeElementEvent;
|
||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
|
||||
|
@ -18,12 +19,12 @@ import java.util.List;
|
|||
public class RemoveCommand extends PKCommand {
|
||||
|
||||
public RemoveCommand() {
|
||||
super("remove", "/bending remove [Player]", "This command will remove the element of the targeted [Player]. The player will be able to re-pick their element after this command is run on them, assuming their Bending was not permaremoved.", new String[] { "remove", "rm" });
|
||||
super("remove", "/bending remove [Player] <element>", "This command will remove the element of the targeted [Player]. The player will be able to re-pick their element after this command is run on them, assuming their Bending was not permaremoved.", new String[] { "remove", "rm" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, List<String> args) {
|
||||
if (!hasPermission(sender) || !correctLength(sender, args.size(), 1, 1)) {
|
||||
if (!hasPermission(sender) || !correctLength(sender, args.size(), 1, 2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,7 +37,22 @@ public class RemoveCommand extends PKCommand {
|
|||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||
if (bPlayer == null) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
bPlayer = GeneralMethods.getBendingPlayer(player);
|
||||
bPlayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||
}
|
||||
if (args.size() == 2) {
|
||||
if (Element.getType(args.get(1)) != null) {
|
||||
bPlayer.getElements().remove(Element.getType(args.get(1)));
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
if (Element.getType(args.get(1)) == Element.Chi) {
|
||||
sender.sendMessage(ChatColor.GREEN + "You have removed the " + args.get(1).toLowerCase() + "blocking of " + ChatColor.DARK_AQUA + player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "Your " + args.get(1).toLowerCase() + "blocking has been removed by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.GREEN + "You have removed the " + args.get(1).toLowerCase() + "bending of " + ChatColor.DARK_AQUA + player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "Your " + args.get(1).toLowerCase() + "bending has been removed by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
}
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, Element.getType(args.get(1)), Result.REMOVE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
bPlayer.getElements().clear();
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
|
|
|
@ -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 org.bukkit.Bukkit;
|
||||
|
@ -16,12 +17,12 @@ import java.util.List;
|
|||
public class ToggleCommand extends PKCommand {
|
||||
|
||||
public ToggleCommand() {
|
||||
super("toggle", "/bending toggle <all>", "This command will toggle a player's own Bending on or off. If toggled off, all abilities should stop working until it is toggled back on. Logging off will automatically toggle your Bending back on. If you run the command /bending toggle all, Bending will be turned off for all players and cannot be turned back on until the command is run again.", new String[] { "toggle", "t" });
|
||||
super("toggle", "/bending toggle <all | (element) <player>>", "This command will toggle a player's own Bending on or off. If toggled off, all abilities should stop working until it is toggled back on. Logging off will automatically toggle your Bending back on. If you run the command /bending toggle all, Bending will be turned off for all players and cannot be turned back on until the command is run again.", new String[] { "toggle", "t" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, List<String> args) {
|
||||
if (!correctLength(sender, args.size(), 0, 1)) {
|
||||
if (!correctLength(sender, args.size(), 0, 2)) {
|
||||
return;
|
||||
} else if (args.size() == 0) { //bending toggle
|
||||
if (!hasPermission(sender) || !isPlayer(sender)) {
|
||||
|
@ -59,6 +60,48 @@ public class ToggleCommand extends PKCommand {
|
|||
if (!(sender instanceof Player))
|
||||
sender.sendMessage(ChatColor.RED + "Bending has been toggled off for all players.");
|
||||
}
|
||||
} else if (sender instanceof Player && args.size() == 1 && Element.getType(args.get(0)) != null && sender.hasPermission("bending." + args.get(0).toLowerCase())) {
|
||||
Element e = Element.getType(args.get(0));
|
||||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(sender.getName());
|
||||
bPlayer.toggleElement(e);
|
||||
if (bPlayer.isElementToggled(e) == true) {
|
||||
if (e == Element.Chi) {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled off your " + args.get(0).toLowerCase() + "blocking");
|
||||
} else {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled off your " + args.get(0).toLowerCase() + "bending");
|
||||
}
|
||||
} else {
|
||||
if (e == Element.Chi) {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled on your " + args.get(0).toLowerCase() + "blocking");
|
||||
} else {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled on your " + args.get(0).toLowerCase() + "bending");
|
||||
}
|
||||
}
|
||||
} else if (sender instanceof Player && args.size() == 2 && Element.getType(args.get(0)) != null && sender.hasPermission("bending." + args.get(0).toLowerCase())) {
|
||||
Player target = Bukkit.getPlayer(args.get(1));
|
||||
if (target == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Target is not found.");
|
||||
}
|
||||
Element e = Element.getType(args.get(0));
|
||||
BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(target.getName());
|
||||
if (bPlayer.isElementToggled(e) == true) {
|
||||
if (e == Element.Chi) {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled off " + ChatColor.DARK_AQUA + target.getName() + "'s " + args.get(0).toLowerCase() + "blocking");
|
||||
target.sendMessage(GeneralMethods.getElementColor(e) + "Your " + args.get(0).toLowerCase() + "blocking has been toggled off by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
} else {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled off " + ChatColor.DARK_AQUA + target.getName() + "'s " + args.get(0).toLowerCase() + "bending");
|
||||
target.sendMessage(GeneralMethods.getElementColor(e) + "Your " + args.get(0).toLowerCase() + "bending has been toggled off by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
}
|
||||
} else {
|
||||
if (e == Element.Chi) {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled on " + ChatColor.DARK_AQUA + target.getName() + "'s " + args.get(0).toLowerCase() + "blocking");
|
||||
target.sendMessage(GeneralMethods.getElementColor(e) + "Your " + args.get(0).toLowerCase() + "blocking has been toggled on by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
} else {
|
||||
sender.sendMessage(GeneralMethods.getElementColor(e) + "You have toggled on " + ChatColor.DARK_AQUA + target.getName() + "'s " + args.get(0).toLowerCase() + "bending");
|
||||
target.sendMessage(GeneralMethods.getElementColor(e) + "Your " + args.get(0).toLowerCase() + "bending has been toggled on by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
}
|
||||
}
|
||||
bPlayer.toggleElement(e);
|
||||
} else {
|
||||
help(sender, false);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,9 @@ public class WhoCommand extends PKCommand {
|
|||
|
||||
staff.put("929b14fc-aaf1-4f0f-84c2-f20c55493f53", ChatColor.GREEN + "ProjectKorra Head Concept Designer"); // Vidcom
|
||||
|
||||
staff.put("15d1a5a7-76ef-49c3-b193-039b27c47e30", ChatColor.GREEN + "ProjectKorra Digital Director"); // Kiam
|
||||
staff.put("15d1a5a7-76ef-49c3-b193-039b27c47e30", ChatColor.BLUE + "ProjectKorra Digital Director"); // Kiam
|
||||
|
||||
staff.put("1553482a-5e86-4270-9262-b57c11151074", ChatColor.GOLD + "ProjectKorra Head Community Moderator"); // Pickle9775
|
||||
|
||||
staff.put("96f40c81-dd5d-46b6-9afe-365114d4a082", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Coolade
|
||||
staff.put("833a7132-a9ec-4f0a-ad9c-c3d6b8a1c7eb", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Jacklin213
|
||||
|
@ -59,7 +61,6 @@ public class WhoCommand extends PKCommand {
|
|||
staff.put("f30c871e-cd60-446b-b219-e31e00e16857", ChatColor.GREEN + "ProjectKorra Concept Designer"); // Gangksta
|
||||
staff.put("38217173-8a32-4ba7-9fe1-dd4fed031a74", ChatColor.GREEN + "ProjectKorra Concept Designer"); // Fly
|
||||
|
||||
staff.put("1553482a-5e86-4270-9262-b57c11151074", ChatColor.GOLD + "ProjectKorra Community Moderator"); // Pickle9775
|
||||
staff.put("3d5bc713-ab8b-4125-b5ba-a1c1c2400b2c", ChatColor.GOLD + "ProjectKorra Community Moderator"); // Gold
|
||||
|
||||
staff.put("2ab334d1-9691-4994-a624-209c7b4f220b", ChatColor.BLUE + "ProjectKorra Digital Team"); // Austygen
|
||||
|
@ -79,7 +80,7 @@ public class WhoCommand extends PKCommand {
|
|||
BendingPlayer bp = GeneralMethods.getBendingPlayer(playerName);
|
||||
if (bp == null) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
bp = GeneralMethods.getBendingPlayer(player);
|
||||
bp = GeneralMethods.getBendingPlayer(player.getName());
|
||||
}
|
||||
if (bp.getElements().size() > 1) {
|
||||
players.add(GeneralMethods.getAvatarColor() + playerName);
|
||||
|
|
|
@ -483,8 +483,7 @@ public class EarthSmash {
|
|||
*/
|
||||
if (!ALLOW_GRAB)
|
||||
return null;
|
||||
@SuppressWarnings("deprecation")
|
||||
List<Block> blocks = player.getLineOfSight(EarthMethods.getTransparentEarthbending(), (int) Math.round(grabRange));
|
||||
List<Block> blocks = GeneralMethods.getBlocksAroundPoint(GeneralMethods.getTargetedLocation(player, grabRange, GeneralMethods.nonOpaque), 1);
|
||||
for (EarthSmash smash : instances) {
|
||||
if (reqState == null || smash.state == reqState)
|
||||
for (Block block : blocks)
|
||||
|
|
|
@ -28,6 +28,7 @@ public class WaterSpout {
|
|||
private static final int HEIGHT = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterSpout.Height");
|
||||
private static final boolean PARTICLES = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterSpout.Particles");
|
||||
private static final boolean BLOCKS = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterSpout.BlockSpiral");
|
||||
private static final boolean PACKEDICE = ProjectKorra.plugin.getConfig().getBoolean("Properties.Water.CanBendPackedIce");
|
||||
|
||||
// private static final double threshold = .05;
|
||||
// private static final byte half = 0x4;
|
||||
|
@ -61,7 +62,7 @@ public class WaterSpout {
|
|||
if (topBlock == null)
|
||||
topBlock = player.getLocation().getBlock();
|
||||
Material mat = topBlock.getType();
|
||||
if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK)
|
||||
if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && (PACKEDICE && mat != Material.PACKED_ICE) && mat != Material.SNOW && mat != Material.SNOW_BLOCK)
|
||||
return;
|
||||
|
||||
new Flight(player);
|
||||
|
@ -240,7 +241,7 @@ public class WaterSpout {
|
|||
return height;
|
||||
return i;
|
||||
}
|
||||
if (blocki.getType() == Material.ICE || blocki.getType() == Material.SNOW || blocki.getType() == Material.SNOW_BLOCK) {
|
||||
if (blocki.getType() == Material.ICE || blocki.getType() == Material.SNOW || blocki.getType() == Material.SNOW_BLOCK || (PACKEDICE && blocki.getType() == Material.PACKED_ICE)) {
|
||||
if (!TempBlock.isTempBlock(blocki)) {
|
||||
revertBaseBlock(player);
|
||||
instances.get(player).baseblock = new TempBlock(blocki, Material.STATIONARY_WATER, (byte) 8);
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.projectkorra.projectkorra.util.BlockSource;
|
|||
import com.projectkorra.projectkorra.util.ClickType;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
|
Loading…
Reference in a new issue