mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Merge remote-tracking branch 'ProjectKorra/master' into patch
This commit is contained in:
commit
093fd0854d
57 changed files with 322 additions and 275 deletions
|
@ -75,4 +75,18 @@ public enum Element {
|
||||||
return null;
|
return null;
|
||||||
return Arrays.asList(values()).get(index);
|
return Arrays.asList(values()).get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an element based on ChatColor.
|
||||||
|
* @param color
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Element getFromChatColor(ChatColor color) {
|
||||||
|
for (Element element : Element.values()) {
|
||||||
|
if (element.getChatColor().equals(color) || element.getSubColor().equals(color)) {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,8 +293,6 @@ public class GeneralMethods {
|
||||||
return false;
|
return false;
|
||||||
if (!bPlayer.isToggled())
|
if (!bPlayer.isToggled())
|
||||||
return false;
|
return false;
|
||||||
if (p == null)
|
|
||||||
return false;
|
|
||||||
if (p.getGameMode() == GameMode.SPECTATOR)
|
if (p.getGameMode() == GameMode.SPECTATOR)
|
||||||
return false;
|
return false;
|
||||||
if (cooldowns.containsKey(p.getName())) {
|
if (cooldowns.containsKey(p.getName())) {
|
||||||
|
@ -488,7 +486,7 @@ public class GeneralMethods {
|
||||||
* @param ability The ability that is used to damage the entity
|
* @param ability The ability that is used to damage the entity
|
||||||
*/
|
*/
|
||||||
public static void damageEntity(Player player, Entity entity, double damage, String ability) {
|
public static void damageEntity(Player player, Entity entity, double damage, String ability) {
|
||||||
if (abilityExists(ability)) {
|
if (ability != null && abilityExists(ability)) {
|
||||||
damageEntity(player, entity, damage, getAbilityElement(ability), getAbilitySubElement(ability), ability);
|
damageEntity(player, entity, damage, getAbilityElement(ability), getAbilitySubElement(ability), ability);
|
||||||
} else {
|
} else {
|
||||||
damageEntity(player, entity, damage, null, null, ability);
|
damageEntity(player, entity, damage, null, null, ability);
|
||||||
|
|
|
@ -1,8 +1,95 @@
|
||||||
package com.projectkorra.projectkorra;
|
package com.projectkorra.projectkorra;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||||
import java.util.HashMap;
|
import com.projectkorra.projectkorra.ability.api.CoreAbility;
|
||||||
import java.util.List;
|
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
||||||
|
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirBlast;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirBubble;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirBurst;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirMethods;
|
||||||
|
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.FlightAbility;
|
||||||
|
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||||
|
import com.projectkorra.projectkorra.airbending.Tornado;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.ChiMethods;
|
||||||
|
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.CompactColumn;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthColumn;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthGrab;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthSmash;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthTunnel;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthWall;
|
||||||
|
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.LavaWave;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.MetalClips;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.SandSpout;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||||
|
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||||
|
import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent;
|
||||||
|
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
||||||
|
import com.projectkorra.projectkorra.firebending.ArcOfFire;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Combustion;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Enflamed;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Extinguish;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireBlast;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireBurst;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireJet;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireMethods;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireShield;
|
||||||
|
import com.projectkorra.projectkorra.firebending.FireStream;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Fireball;
|
||||||
|
import com.projectkorra.projectkorra.firebending.HeatControl;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Illumination;
|
||||||
|
import com.projectkorra.projectkorra.firebending.Lightning;
|
||||||
|
import com.projectkorra.projectkorra.firebending.RingOfFire;
|
||||||
|
import com.projectkorra.projectkorra.firebending.WallOfFire;
|
||||||
|
import com.projectkorra.projectkorra.object.Preset;
|
||||||
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
import com.projectkorra.projectkorra.util.Flight;
|
||||||
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.Bloodbending;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.FreezeMelt;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.IceBlast;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.IceSpike2;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.Melt;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.Torrent;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterArms;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterWall;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterWave;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.Wave;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -59,96 +146,9 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
import java.util.ArrayList;
|
||||||
import com.projectkorra.projectkorra.ability.api.CoreAbility;
|
import java.util.HashMap;
|
||||||
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
import java.util.List;
|
||||||
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirBlast;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirBubble;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirBurst;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirMethods;
|
|
||||||
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.FlightAbility;
|
|
||||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
|
||||||
import com.projectkorra.projectkorra.airbending.Tornado;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiMethods;
|
|
||||||
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.CompactColumn;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthColumn;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthGrab;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthSmash;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthTunnel;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthWall;
|
|
||||||
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.LavaWave;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.MetalClips;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.SandSpout;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
|
||||||
import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent;
|
|
||||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
|
||||||
import com.projectkorra.projectkorra.firebending.ArcOfFire;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Combustion;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Enflamed;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Extinguish;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireBurst;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireJet;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireMethods;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireShield;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireStream;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Fireball;
|
|
||||||
import com.projectkorra.projectkorra.firebending.HeatControl;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Illumination;
|
|
||||||
import com.projectkorra.projectkorra.firebending.Lightning;
|
|
||||||
import com.projectkorra.projectkorra.firebending.RingOfFire;
|
|
||||||
import com.projectkorra.projectkorra.firebending.WallOfFire;
|
|
||||||
import com.projectkorra.projectkorra.object.Preset;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
|
||||||
import com.projectkorra.projectkorra.util.Flight;
|
|
||||||
import com.projectkorra.projectkorra.util.HorizontalVelocityChangeEvent;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.Bloodbending;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.FreezeMelt;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.IceBlast;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.IceSpike2;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.Melt;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.Torrent;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterArms;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterWall;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterWave;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.Wave;
|
|
||||||
|
|
||||||
public class PKListener implements Listener {
|
public class PKListener implements Listener {
|
||||||
|
|
||||||
|
@ -909,10 +909,17 @@ public class PKListener implements Listener {
|
||||||
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
if (bendingDeathPlayer.containsKey(event.getEntity())) {
|
||||||
String message = ConfigManager.deathMsgConfig.get().getString("Properties.Default");
|
String message = ConfigManager.deathMsgConfig.get().getString("Properties.Default");
|
||||||
String ability = bendingDeathPlayer.get(event.getEntity());
|
String ability = bendingDeathPlayer.get(event.getEntity());
|
||||||
String tempAbility = ChatColor.stripColor(ability);
|
String tempAbility = ChatColor.stripColor(ability).replaceAll(" ", "");
|
||||||
Element element = null;
|
Element element = null;
|
||||||
|
boolean isAvatarAbility = false;
|
||||||
if (GeneralMethods.abilityExists(tempAbility)) {
|
if (GeneralMethods.abilityExists(tempAbility)) {
|
||||||
element = GeneralMethods.getAbilityElement(tempAbility);
|
element = GeneralMethods.getAbilityElement(tempAbility);
|
||||||
|
if (element == null) {
|
||||||
|
isAvatarAbility = true;
|
||||||
|
ability = GeneralMethods.getAvatarColor() + tempAbility;
|
||||||
|
}
|
||||||
|
} else if (ChatColor.getByChar(ability.substring(1, 2)) != null) {
|
||||||
|
element = Element.getFromChatColor(ChatColor.getByChar(ability.substring(1, 2)));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Player killer = event.getEntity().getKiller();
|
Player killer = event.getEntity().getKiller();
|
||||||
|
@ -936,9 +943,15 @@ public class PKListener implements Listener {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if (ConfigManager.deathMsgConfig.get().contains(element.toString() + "." + tempAbility)) {
|
if (ConfigManager.deathMsgConfig.get().contains(element.toString() + "." + tempAbility)) {
|
||||||
message = ConfigManager.deathMsgConfig.get().getString(element + "." + tempAbility);
|
message = ConfigManager.deathMsgConfig.get().getString(element + "." + tempAbility);
|
||||||
|
} else if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||||
|
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
if (isAvatarAbility) {
|
||||||
|
if (ConfigManager.deathMsgConfig.get().contains("Avatar." + tempAbility)) {
|
||||||
|
message = ConfigManager.deathMsgConfig.get().getString("Avatar." + tempAbility);
|
||||||
|
}
|
||||||
|
} else if (ConfigManager.deathMsgConfig.get().contains("Combo." + tempAbility)) {
|
||||||
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
message = ConfigManager.deathMsgConfig.get().getString("Combo." + tempAbility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1295,7 @@ public class PKListener implements Listener {
|
||||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
||||||
|
|
||||||
if (Suffocate.isBreathbent(player)) {
|
if (Suffocate.isBreathbent(player)) {
|
||||||
if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirSwipe") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("FireBlast") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("EarthBlast") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("WaterManipulation")) {
|
if (GeneralMethods.getBoundAbility(player) != null || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirSwipe") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("FireBlast") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("EarthBlast") || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("WaterManipulation")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class AbilityModuleManager {
|
||||||
fill();
|
fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private void fill() {
|
private void fill() {
|
||||||
|
|
||||||
for (StockAbility a : StockAbility.values()) {
|
for (StockAbility a : StockAbility.values()) {
|
||||||
|
|
|
@ -16,11 +16,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ComboManager {
|
public class ComboManager {
|
||||||
private static final long CLEANUP_DELAY = 20 * 60 * 60;
|
private static final long CLEANUP_DELAY = 20 * 30;
|
||||||
public static ConcurrentHashMap<String, ArrayList<AbilityInformation>> recentlyUsedAbilities = new ConcurrentHashMap<String, ArrayList<AbilityInformation>>();
|
public static ConcurrentHashMap<String, ArrayList<AbilityInformation>> recentlyUsedAbilities = new ConcurrentHashMap<String, ArrayList<AbilityInformation>>();
|
||||||
public static HashMap<String, ComboAbility> comboAbilityList = new HashMap<String, ComboAbility>();
|
public static HashMap<String, ComboAbility> comboAbilityList = new HashMap<String, ComboAbility>();
|
||||||
public static HashMap<String, String> authors = new HashMap<String, String>();
|
public static HashMap<String, String> authors = new HashMap<String, String>();
|
||||||
|
@ -205,6 +204,7 @@ public class ComboManager {
|
||||||
list = new ArrayList<AbilityInformation>();
|
list = new ArrayList<AbilityInformation>();
|
||||||
list.add(info);
|
list.add(info);
|
||||||
recentlyUsedAbilities.put(name, list);
|
recentlyUsedAbilities.put(name, list);
|
||||||
|
//Bukkit.broadcastMessage("recentlyUsedAbilities: " + recentlyUsedAbilities.get(name).size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -244,8 +244,11 @@ public class ComboManager {
|
||||||
Enumeration<String> keys = recentlyUsedAbilities.keys();
|
Enumeration<String> keys = recentlyUsedAbilities.keys();
|
||||||
while (keys.hasMoreElements()) {
|
while (keys.hasMoreElements()) {
|
||||||
String name = keys.nextElement();
|
String name = keys.nextElement();
|
||||||
ArrayList<AbilityInformation> usedAbilities = recentlyUsedAbilities.get(name);
|
//ArrayList<AbilityInformation> usedAbilities = recentlyUsedAbilities.get(name);
|
||||||
usedAbilities.clear();
|
if(recentlyUsedAbilities.get(name).size() > 75) {
|
||||||
|
recentlyUsedAbilities.get(name).clear();
|
||||||
|
//Bukkit.broadcastMessage(name + " recentlyUsed Cleared");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,6 +296,7 @@ public class ComboManager {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
cleanupOldCombos();
|
cleanupOldCombos();
|
||||||
|
//Bukkit.broadcastMessage("Cleaned");
|
||||||
}
|
}
|
||||||
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY);
|
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class AirBlast extends CoreAbility {
|
||||||
if (location.getBlock().isLiquid()) {
|
if (location.getBlock().isLiquid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
source = burst;
|
source = burst;
|
||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class AirBubble extends CoreAbility {
|
||||||
private ConcurrentHashMap<Block, BlockState> waterorigins;
|
private ConcurrentHashMap<Block, BlockState> waterorigins;
|
||||||
|
|
||||||
public AirBubble(Player player) {
|
public AirBubble(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
waterorigins = new ConcurrentHashMap<Block, BlockState>();
|
waterorigins = new ConcurrentHashMap<Block, BlockState>();
|
||||||
//instances.put(uuid, this);
|
//instances.put(uuid, this);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class AirBurst extends CoreAbility {
|
||||||
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
private ArrayList<Entity> affectedentities = new ArrayList<Entity>();
|
||||||
|
|
||||||
public AirBurst() {
|
public AirBurst() {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AirBurst(Player player) {
|
public AirBurst(Player player) {
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class AirCombo implements ConfigLoadable {
|
||||||
|
|
||||||
public AirCombo(Player player, String ability) {
|
public AirCombo(Player player, String ability) {
|
||||||
/* Initial Checks */
|
/* Initial Checks */
|
||||||
|
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
if (Commands.isToggledForAll)
|
if (Commands.isToggledForAll)
|
||||||
|
@ -94,7 +95,7 @@ public class AirCombo implements ConfigLoadable {
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlast", player.getLocation()))
|
if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlast", player.getLocation()))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class AirScooter extends CoreAbility {
|
||||||
if (GeneralMethods.isSolid(player.getLocation().add(0, -.5, 0).getBlock()))
|
if (GeneralMethods.isSolid(player.getLocation().add(0, -.5, 0).getBlock()))
|
||||||
return;
|
return;
|
||||||
/* End Initial Check */
|
/* End Initial Check */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
// wasflying = player.isFlying();
|
// wasflying = player.isFlying();
|
||||||
// canfly = player.getAllowFlight();
|
// canfly = player.getAllowFlight();
|
||||||
|
@ -49,6 +49,7 @@ public class AirScooter extends CoreAbility {
|
||||||
angles.add((double) (60 * i));
|
angles.add((double) (60 * i));
|
||||||
}
|
}
|
||||||
//instances.put(uuid, this);
|
//instances.put(uuid, this);
|
||||||
|
speed = configSpeed;
|
||||||
putInstance(player, this);
|
putInstance(player, this);
|
||||||
progress();
|
progress();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class AirShield extends CoreAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End Initial Check */
|
/* End Initial Check */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
int angle = 0;
|
int angle = 0;
|
||||||
int di = (int) (maxradius * 2 / numberOfStreams);
|
int di = (int) (maxradius * 2 / numberOfStreams);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class AirSpout extends CoreAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End Initial Check */
|
/* End Initial Check */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
new Flight(player);
|
new Flight(player);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class AirSuction extends CoreAbility {
|
||||||
if (AirSpout.getPlayers().contains(player.getUniqueId()) || WaterSpout.getPlayers().contains(player)) //TODO: UPDATE THIS LINE
|
if (AirSpout.getPlayers().contains(player.getUniqueId()) || WaterSpout.getPlayers().contains(player)) //TODO: UPDATE THIS LINE
|
||||||
return;
|
return;
|
||||||
/* End Initial Check */
|
/* End Initial Check */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
if (origins.containsKey(player)) {
|
if (origins.containsKey(player)) {
|
||||||
origin = origins.get(player);
|
origin = origins.get(player);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class AirSwipe extends CoreAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End Initial Check */
|
/* End Initial Check */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.charging = charging;
|
this.charging = charging;
|
||||||
origin = player.getEyeLocation();
|
origin = player.getEyeLocation();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class Suffocate extends CoreAbility {
|
||||||
tasks = new ArrayList<BukkitRunnable>();
|
tasks = new ArrayList<BukkitRunnable>();
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
|
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
reqConstantAim = REQUIRE_CONSTANT_AIM;
|
reqConstantAim = REQUIRE_CONSTANT_AIM;
|
||||||
canSuffUndead = CAN_SUFFOCATE_UNDEAD;
|
canSuffUndead = CAN_SUFFOCATE_UNDEAD;
|
||||||
chargeTime = CHARGE_TIME;
|
chargeTime = CHARGE_TIME;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class Tornado extends CoreAbility {
|
||||||
// private boolean canfly;
|
// private boolean canfly;
|
||||||
|
|
||||||
public Tornado(Player player) {
|
public Tornado(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
// canfly = player.getAllowFlight();
|
// canfly = player.getAllowFlight();
|
||||||
// player.setAllowFlight(true);
|
// player.setAllowFlight(true);
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ChiCombo {
|
||||||
*/
|
*/
|
||||||
public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>();
|
public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>();
|
||||||
|
|
||||||
private Player player;
|
//private Player player;
|
||||||
private Entity target;
|
private Entity target;
|
||||||
|
|
||||||
public ChiCombo(Player player, String ability) {
|
public ChiCombo(Player player, String ability) {
|
||||||
|
@ -41,7 +41,7 @@ public class ChiCombo {
|
||||||
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize"))
|
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize"))
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
this.player = player;
|
//this.player = player;
|
||||||
target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>());
|
target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>());
|
||||||
paralyze(target, IMMOBILIZE_DURATION);
|
paralyze(target, IMMOBILIZE_DURATION);
|
||||||
instances.add(this);
|
instances.add(this);
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class AddCommand extends PKCommand {
|
||||||
target.sendMessage(color + "You are also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
target.sendMessage(color + "You are also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||||
target.sendMessage(color + "You are also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
target.sendMessage(color + "You are also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||||
} else if (element.equalsIgnoreCase("chi")) {
|
} else if (element.charAt(0) == 'c' || element.equalsIgnoreCase("chi")) {
|
||||||
target.sendMessage(color + "You are now a Chiblocker.");
|
target.sendMessage(color + "You are now a Chiblocker.");
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
|
@ -78,8 +78,8 @@ public class AddCommand extends PKCommand {
|
||||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||||
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
} else if (element.charAt(0) == 'e' || element.charAt(0) == 'a') {
|
||||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also an " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "bender.");
|
||||||
} else if (element.equalsIgnoreCase("chi")) {
|
} else if (element.charAt(0) == 'c' || element.equalsIgnoreCase("chi")) {
|
||||||
target.sendMessage(color + "You are now a Chiblocker.");
|
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a " + Character.toString(element.charAt(0)).toUpperCase() + element.substring(1) + "blocker.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeneralMethods.saveElements(bPlayer);
|
GeneralMethods.saveElements(bPlayer);
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
*/
|
*/
|
||||||
private void displaySubElement(CommandSender sender, String element) {
|
private void displaySubElement(CommandSender sender, String element) {
|
||||||
List<String> abilities = ProjectKorra.plugin.abManager.getAbilities(element);
|
List<String> abilities = ProjectKorra.plugin.abManager.getAbilities(element);
|
||||||
if (abilities.isEmpty()) {
|
if (abilities.isEmpty() && element != null) {
|
||||||
Element e = SubElement.getType(element.toLowerCase()).getMainElement();
|
Element e = SubElement.getType(element.toLowerCase()).getMainElement();
|
||||||
ChatColor color = GeneralMethods.getSubBendingColor(e);
|
ChatColor color = GeneralMethods.getSubBendingColor(e);
|
||||||
sender.sendMessage(ChatColor.YELLOW + "There are no " + color + element + ChatColor.YELLOW + " abilities installed!");
|
sender.sendMessage(ChatColor.YELLOW + "There are no " + color + element + ChatColor.YELLOW + " abilities installed!");
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class ImportCommand extends PKCommand {
|
||||||
if (string.equalsIgnoreCase("version"))
|
if (string.equalsIgnoreCase("version"))
|
||||||
continue;
|
continue;
|
||||||
String playername = string;
|
String playername = string;
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
UUID uuid = ProjectKorra.plugin.getServer().getOfflinePlayer(playername).getUniqueId();
|
UUID uuid = ProjectKorra.plugin.getServer().getOfflinePlayer(playername).getUniqueId();
|
||||||
ArrayList<Element> element = new ArrayList<Element>();
|
ArrayList<Element> element = new ArrayList<Element>();
|
||||||
List<Integer> oe = bendingPlayers.getIntegerList(string + ".BendingTypes");
|
List<Integer> oe = bendingPlayers.getIntegerList(string + ".BendingTypes");
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class Catapult extends CoreAbility {
|
||||||
if (bplayer.isOnCooldown("Catapult"))
|
if (bplayer.isOnCooldown("Catapult"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
origin = player.getEyeLocation().clone();
|
origin = player.getEyeLocation().clone();
|
||||||
direction = origin.getDirection().clone().normalize();
|
direction = origin.getDirection().clone().normalize();
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class EarthBlast {
|
||||||
unfocusBlock();
|
unfocusBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void focusBlock() {
|
private void focusBlock() {
|
||||||
if (EarthPassive.isPassiveSand(sourceblock))
|
if (EarthPassive.isPassiveSand(sourceblock))
|
||||||
EarthPassive.revertSand(sourceblock);
|
EarthPassive.revertSand(sourceblock);
|
||||||
|
@ -130,6 +131,7 @@ public class EarthBlast {
|
||||||
location = sourceblock.getLocation();
|
location = sourceblock.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void unfocusBlock() {
|
private void unfocusBlock() {
|
||||||
if(destination != null){
|
if(destination != null){
|
||||||
breakBlock();
|
breakBlock();
|
||||||
|
@ -204,6 +206,7 @@ public class EarthBlast {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private boolean progress() {
|
private boolean progress() {
|
||||||
if (player.isDead() || !player.isOnline()
|
if (player.isDead() || !player.isOnline()
|
||||||
|| !GeneralMethods.canBend(player.getName(), "EarthBlast")) {
|
|| !GeneralMethods.canBend(player.getName(), "EarthBlast")) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class EarthPassive {
|
||||||
private static final long duration = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Passive.Duration");
|
private static final long duration = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Passive.Duration");
|
||||||
private static int sandspeed = ProjectKorra.plugin.getConfig().getInt("Properties.Earth.Passive.SandRunPower");
|
private static int sandspeed = ProjectKorra.plugin.getConfig().getInt("Properties.Earth.Passive.SandRunPower");
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static boolean softenLanding(Player player) {
|
public static boolean softenLanding(Player player) {
|
||||||
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||||
if (EarthMethods.canMetalbend(player) && EarthMethods.isMetalBlock(block)) {
|
if (EarthMethods.canMetalbend(player) && EarthMethods.isMetalBlock(block)) {
|
||||||
|
@ -80,6 +81,7 @@ public class EarthPassive {
|
||||||
return (sandblocks.containsKey(block));
|
return (sandblocks.containsKey(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static void revertSand(Block block) {
|
public static void revertSand(Block block) {
|
||||||
MaterialData materialdata = sandidentities.get(block);
|
MaterialData materialdata = sandidentities.get(block);
|
||||||
sandidentities.remove(block);
|
sandidentities.remove(block);
|
||||||
|
|
|
@ -1,66 +1,70 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.event;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an ability is successfully loaded.
|
* Called when an ability is successfully loaded.
|
||||||
*
|
*
|
||||||
* @author kingbirdy
|
* @author kingbirdy
|
||||||
*/
|
*/
|
||||||
public class AbilityLoadEvent<T> extends Event {
|
public class AbilityLoadEvent<T> extends Event {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
private final T loadable;
|
private final T loadable;
|
||||||
private final JarFile jarFile;
|
private final JarFile jarFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new AbilityLoadEvent.
|
* Creates a new AbilityLoadEvent.
|
||||||
* @param plugin The instance of ProjectKorra
|
*
|
||||||
* @param loadable The class that was loaded
|
* @param plugin The instance of ProjectKorra
|
||||||
* @param jarFile The JarFile the class was loaded from
|
* @param loadable The class that was loaded
|
||||||
*/
|
* @param jarFile The JarFile the class was loaded from
|
||||||
public AbilityLoadEvent(Plugin plugin, T loadable, JarFile jarFile) {
|
*/
|
||||||
this.plugin = plugin;
|
public AbilityLoadEvent(Plugin plugin, T loadable, JarFile jarFile) {
|
||||||
this.loadable = loadable;
|
this.plugin = plugin;
|
||||||
this.jarFile = jarFile;
|
this.loadable = loadable;
|
||||||
}
|
this.jarFile = jarFile;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
@Override
|
||||||
return handlers;
|
public HandlerList getHandlers() {
|
||||||
}
|
return handlers;
|
||||||
|
}
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
public static HandlerList getHandlerList() {
|
||||||
}
|
return handlers;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Gets the JarFile the ability was loaded from.
|
/**
|
||||||
* @return The JarFile from the event
|
* Gets the JarFile the ability was loaded from.
|
||||||
*/
|
*
|
||||||
public JarFile getJarFile() {
|
* @return The JarFile from the event
|
||||||
return jarFile;
|
*/
|
||||||
}
|
public JarFile getJarFile() {
|
||||||
|
return jarFile;
|
||||||
/**
|
}
|
||||||
* Gets the ability's class that was loaded
|
|
||||||
* @return The loaded class
|
/**
|
||||||
*/
|
* Gets the ability's class that was loaded.
|
||||||
public T getLoadable() {
|
*
|
||||||
return loadable;
|
* @return The loaded class
|
||||||
}
|
*/
|
||||||
|
public T getLoadable() {
|
||||||
/**
|
return loadable;
|
||||||
* Gets the ProjectKorra instance the ability was loaded into.
|
}
|
||||||
* @return The ProjectKorra instance
|
|
||||||
*/
|
/**
|
||||||
public Plugin getPlugin() {
|
* Gets the ProjectKorra instance the ability was loaded into.
|
||||||
return plugin;
|
*
|
||||||
}
|
* @return The ProjectKorra instance
|
||||||
}
|
*/
|
||||||
|
public Plugin getPlugin() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.event;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
|
@ -24,7 +24,7 @@ public class ArcOfFire implements ConfigLoadable {
|
||||||
if (bPlayer.isOnCooldown("Blaze"))
|
if (bPlayer.isOnCooldown("Blaze"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
|
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class Combustion extends CoreAbility {
|
||||||
if (bPlayer.isOnCooldown("Combustion"))
|
if (bPlayer.isOnCooldown("Combustion"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
starttime = System.currentTimeMillis();
|
starttime = System.currentTimeMillis();
|
||||||
origin = player.getEyeLocation();
|
origin = player.getEyeLocation();
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class Cook extends AddonAbility {
|
||||||
private long cooktime = COOK_TIME;
|
private long cooktime = COOK_TIME;
|
||||||
|
|
||||||
public Cook(Player player) {
|
public Cook(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
items = player.getItemInHand();
|
items = player.getItemInHand();
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class Extinguish implements ConfigLoadable {
|
||||||
if (bPlayer.isOnCooldown("HeatControl"))
|
if (bPlayer.isOnCooldown("HeatControl"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
|
|
||||||
double range = FireMethods.getFirebendingDayAugment(defaultrange, player.getWorld());
|
double range = FireMethods.getFirebendingDayAugment(defaultrange, player.getWorld());
|
||||||
if (WaterMethods.isMeltable(player.getTargetBlock((HashSet<Material>) null, (int) range))) {
|
if (WaterMethods.isMeltable(player.getTargetBlock((HashSet<Material>) null, (int) range))) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class FireBlast extends CoreAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
safe = safeblocks;
|
safe = safeblocks;
|
||||||
range = FireMethods.getFirebendingDayAugment(range, player.getWorld());
|
range = FireMethods.getFirebendingDayAugment(range, player.getWorld());
|
||||||
// timers.put(player, System.currentTimeMillis());
|
// timers.put(player, System.currentTimeMillis());
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class FireBurst extends CoreAbility {
|
||||||
if (containsPlayer(player, FireBurst.class))
|
if (containsPlayer(player, FireBurst.class))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
|
|
||||||
starttime = System.currentTimeMillis();
|
starttime = System.currentTimeMillis();
|
||||||
if (FireMethods.isDay(player.getWorld())) {
|
if (FireMethods.isDay(player.getWorld())) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class FireCombo implements ConfigLoadable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
@ -221,7 +221,7 @@ public class FireCombo implements ConfigLoadable {
|
||||||
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.VILLAGER_HIT, 0.3f, 0.3f);
|
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.VILLAGER_HIT, 0.3f, 0.3f);
|
||||||
|
|
||||||
if (ability.equalsIgnoreCase("FireKick")) {
|
if (ability.equalsIgnoreCase("FireKick")) {
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "FireKick");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireKick");
|
||||||
fstream.remove();
|
fstream.remove();
|
||||||
} else if (ability.equalsIgnoreCase("FireSpin")) {
|
} else if (ability.equalsIgnoreCase("FireSpin")) {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
|
@ -229,19 +229,19 @@ public class FireCombo implements ConfigLoadable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double knockback = AvatarState.isAvatarState(player) ? FIRE_SPIN_KNOCKBACK + 0.5 : FIRE_SPIN_KNOCKBACK;
|
double knockback = AvatarState.isAvatarState(player) ? FIRE_SPIN_KNOCKBACK + 0.5 : FIRE_SPIN_KNOCKBACK;
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "FireSpin");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireSpin");
|
||||||
entity.setVelocity(direction.normalize().multiply(knockback));
|
entity.setVelocity(direction.normalize().multiply(knockback));
|
||||||
fstream.remove();
|
fstream.remove();
|
||||||
} else if (ability.equalsIgnoreCase("JetBlaze")) {
|
} else if (ability.equalsIgnoreCase("JetBlaze")) {
|
||||||
if (!affectedEntities.contains(entity)) {
|
if (!affectedEntities.contains(entity)) {
|
||||||
affectedEntities.add(entity);
|
affectedEntities.add(entity);
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "JetBlaze");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "JetBlaze");
|
||||||
entity.setFireTicks((int) (fireticksJetBlaze * 20));
|
entity.setFireTicks((int) (fireticksJetBlaze * 20));
|
||||||
}
|
}
|
||||||
} else if (ability.equalsIgnoreCase("FireWheel")) {
|
} else if (ability.equalsIgnoreCase("FireWheel")) {
|
||||||
if (!affectedEntities.contains(entity)) {
|
if (!affectedEntities.contains(entity)) {
|
||||||
affectedEntities.add(entity);
|
affectedEntities.add(entity);
|
||||||
GeneralMethods.damageEntity(player, entity, damage, "FireWheel");
|
GeneralMethods.damageEntity(player, entity, damage, Element.Fire, "FireWheel");
|
||||||
entity.setFireTicks((int) (fireticksFireWheel * 20));
|
entity.setFireTicks((int) (fireticksFireWheel * 20));
|
||||||
this.remove();
|
this.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class FireJet extends CoreAbility {
|
||||||
if (bPlayer.isOnCooldown("FireJet"))
|
if (bPlayer.isOnCooldown("FireJet"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
|
|
||||||
factor = FireMethods.getFirebendingDayAugment(defaultfactor, player.getWorld());
|
factor = FireMethods.getFirebendingDayAugment(defaultfactor, player.getWorld());
|
||||||
GeneralMethods.invincible.add(this);
|
GeneralMethods.invincible.add(this);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class FireShield extends CoreAbility {
|
||||||
if (bPlayer.isOnCooldown("FireShield"))
|
if (bPlayer.isOnCooldown("FireShield"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.shield = shield;
|
this.shield = shield;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class Fireball extends AddonAbility {
|
||||||
private boolean damage_blocks;
|
private boolean damage_blocks;
|
||||||
|
|
||||||
public Fireball(Player player) {
|
public Fireball(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
starttime = time;
|
starttime = time;
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class HeatMelt implements ConfigLoadable {
|
||||||
private static int radius = config.get().getInt("Abilities.Fire.HeatControl.Melt.Radius");
|
private static int radius = config.get().getInt("Abilities.Fire.HeatControl.Melt.Radius");
|
||||||
|
|
||||||
public HeatMelt(Player player) {
|
public HeatMelt(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
Location location = GeneralMethods.getTargetedLocation(player, (int) FireMethods.getFirebendingDayAugment(range, player.getWorld()));
|
Location location = GeneralMethods.getTargetedLocation(player, (int) FireMethods.getFirebendingDayAugment(range, player.getWorld()));
|
||||||
for (Block block : GeneralMethods.getBlocksAroundPoint(location, (int) FireMethods.getFirebendingDayAugment(radius, player.getWorld()))) {
|
for (Block block : GeneralMethods.getBlocksAroundPoint(location, (int) FireMethods.getFirebendingDayAugment(radius, player.getWorld()))) {
|
||||||
if (WaterMethods.isMeltable(block)) {
|
if (WaterMethods.isMeltable(block)) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Illumination extends CoreAbility {
|
||||||
if (containsPlayer(player, Illumination.class)) {
|
if (containsPlayer(player, Illumination.class)) {
|
||||||
getAbilityFromPlayer(player, Illumination.class).remove();
|
getAbilityFromPlayer(player, Illumination.class).remove();
|
||||||
} else {
|
} else {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
set();
|
set();
|
||||||
//instances.put(player, this);
|
//instances.put(player, this);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Lightning extends CoreAbility {
|
||||||
private double newY;
|
private double newY;
|
||||||
|
|
||||||
public Lightning(Player player) {
|
public Lightning(Player player) {
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
bplayer = GeneralMethods.getBendingPlayer(player.getName());
|
bplayer = GeneralMethods.getBendingPlayer(player.getName());
|
||||||
charged = false;
|
charged = false;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class RingOfFire implements ConfigLoadable {
|
||||||
if (bPlayer.isOnCooldown("Blaze"))
|
if (bPlayer.isOnCooldown("Blaze"))
|
||||||
return;
|
return;
|
||||||
/* End Initial Checks */
|
/* End Initial Checks */
|
||||||
reloadVariables();
|
//reloadVariables();
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
|
|
||||||
for (double degrees = 0; degrees < 360; degrees += 10) {
|
for (double degrees = 0; degrees < 360; degrees += 10) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.projectkorra.projectkorra.object;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||||
import com.projectkorra.projectkorra.util.HorizontalVelocityChangeEvent;
|
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.event.AbilityLoadEvent;
|
||||||
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult;
|
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult;
|
||||||
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult.Result;
|
import com.projectkorra.projectkorra.util.AbilityLoadable.LoadResult.Result;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ import java.util.HashMap;
|
||||||
public class BlockSource {
|
public class BlockSource {
|
||||||
/**
|
/**
|
||||||
* An enum representation of the source types available for bending abilities.
|
* An enum representation of the source types available for bending abilities.
|
||||||
|
*
|
||||||
* @author kingbirdy
|
* @author kingbirdy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static enum BlockSourceType {
|
public static enum BlockSourceType {
|
||||||
WATER, ICE, PLANT, EARTH, METAL, LAVA
|
WATER, ICE, PLANT, EARTH, METAL, LAVA
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>> playerSources = new HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>>();
|
private static HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>> playerSources = new HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>>();
|
||||||
private static FileConfiguration config = ProjectKorra.plugin.getConfig();
|
private static FileConfiguration config = ConfigManager.defaultConfig.get();
|
||||||
// The player should never need to grab source blocks from farther than this.
|
// The player should never need to grab source blocks from farther than this.
|
||||||
private static double MAX_RANGE = config.getDouble("Abilities.Water.WaterManipulation.Range");
|
private static double MAX_RANGE = config.getDouble("Abilities.Water.WaterManipulation.Range");
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class BlockSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to create and update a specific source
|
* Helper method to create and update a specific source.
|
||||||
*
|
*
|
||||||
* @param player a player.
|
* @param player a player.
|
||||||
* @param block the block that is considered a source.
|
* @param block the block that is considered a source.
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The information for a bending source block.
|
* The information for a bending source block.
|
||||||
|
*
|
||||||
* @author kingbirdy
|
* @author kingbirdy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BlockSourceInformation {
|
public class BlockSourceInformation {
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -19,6 +19,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new BlockSourceInformation.
|
* Creates a new BlockSourceInformation.
|
||||||
|
*
|
||||||
* @param player The player the source belongs to
|
* @param player The player the source belongs to
|
||||||
* @param block The source block
|
* @param block The source block
|
||||||
* @param sourceType What {@link BlockSourceType source type} the block is
|
* @param sourceType What {@link BlockSourceType source type} the block is
|
||||||
|
@ -34,6 +35,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the source block.
|
* Gets the source block.
|
||||||
|
*
|
||||||
* @return The source block
|
* @return The source block
|
||||||
*/
|
*/
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
|
@ -42,6 +44,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new source block.
|
* Sets a new source block.
|
||||||
|
*
|
||||||
* @param block The new source block.
|
* @param block The new source block.
|
||||||
*/
|
*/
|
||||||
public void setBlock(Block block) {
|
public void setBlock(Block block) {
|
||||||
|
@ -50,6 +53,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get what {@link BlockSourceType source type} the source is.
|
* Get what {@link BlockSourceType source type} the source is.
|
||||||
|
*
|
||||||
* @return The block's source type
|
* @return The block's source type
|
||||||
*/
|
*/
|
||||||
public BlockSourceType getSourceType() {
|
public BlockSourceType getSourceType() {
|
||||||
|
@ -58,6 +62,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the source type.
|
* Sets the source type.
|
||||||
|
*
|
||||||
* @param sourceType The new source type.
|
* @param sourceType The new source type.
|
||||||
*/
|
*/
|
||||||
public void setSourceType(BlockSourceType sourceType) {
|
public void setSourceType(BlockSourceType sourceType) {
|
||||||
|
@ -66,6 +71,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets when the source was created.
|
* Gets when the source was created.
|
||||||
|
*
|
||||||
* @return The source's creation time
|
* @return The source's creation time
|
||||||
*/
|
*/
|
||||||
public long getCreationTime() {
|
public long getCreationTime() {
|
||||||
|
@ -74,6 +80,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the source's creation time.
|
* Sets the source's creation time.
|
||||||
|
*
|
||||||
* @param creationTime The new creation time
|
* @param creationTime The new creation time
|
||||||
*/
|
*/
|
||||||
public void setCreationTime(long creationTime) {
|
public void setCreationTime(long creationTime) {
|
||||||
|
@ -82,6 +89,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player the source belongs to.
|
* Get the player the source belongs to.
|
||||||
|
*
|
||||||
* @return The player the source belongs to
|
* @return The player the source belongs to
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
|
@ -90,6 +98,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the player the source belongs to.
|
* Sets the player the source belongs to.
|
||||||
|
*
|
||||||
* @param player The player the source will belong to
|
* @param player The player the source will belong to
|
||||||
*/
|
*/
|
||||||
public void setPlayer(Player player) {
|
public void setPlayer(Player player) {
|
||||||
|
@ -98,6 +107,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ClickType} used to select the source.
|
* Gets the {@link ClickType} used to select the source.
|
||||||
|
*
|
||||||
* @return The ClickType used to select the source
|
* @return The ClickType used to select the source
|
||||||
*/
|
*/
|
||||||
public ClickType getClickType() {
|
public ClickType getClickType() {
|
||||||
|
@ -106,6 +116,7 @@ public class BlockSourceInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the source's {@link ClickType}.
|
* Sets the source's {@link ClickType}.
|
||||||
|
*
|
||||||
* @param clickType The ClickType to set
|
* @param clickType The ClickType to set
|
||||||
*/
|
*/
|
||||||
public void setClickType(ClickType clickType) {
|
public void setClickType(ClickType clickType) {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enum representation of the ways in which an ability can be activated.
|
* An enum representation of the ways in which an ability can be activated.
|
||||||
|
*
|
||||||
* @author kingbirdy
|
* @author kingbirdy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum ClickType {
|
public enum ClickType {
|
||||||
SHIFT,
|
SHIFT,
|
||||||
|
|
|
@ -15,6 +15,7 @@ public final class FileExtensionFilter implements FileFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new FileExtensionFilter.
|
* Creates a new FileExtensionFilter.
|
||||||
|
*
|
||||||
* @param extension the extension to filter for
|
* @param extension the extension to filter for
|
||||||
*/
|
*/
|
||||||
public FileExtensionFilter(String extension) {
|
public FileExtensionFilter(String extension) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirScooter;
|
import com.projectkorra.projectkorra.airbending.AirScooter;
|
||||||
import com.projectkorra.projectkorra.airbending.AirSpout;
|
import com.projectkorra.projectkorra.airbending.AirSpout;
|
||||||
import com.projectkorra.projectkorra.airbending.Tornado;
|
import com.projectkorra.projectkorra.airbending.Tornado;
|
||||||
|
@ -21,10 +20,10 @@ public class Flight {
|
||||||
private static ConcurrentHashMap<Player, Flight> instances = new ConcurrentHashMap<Player, Flight>();
|
private static ConcurrentHashMap<Player, Flight> instances = new ConcurrentHashMap<Player, Flight>();
|
||||||
private static long duration = 5000;
|
private static long duration = 5000;
|
||||||
|
|
||||||
private Player player = null, source = null;
|
private Player player;
|
||||||
|
private Player source;
|
||||||
private boolean couldFly = false, wasFlying = false;
|
private boolean couldFly = false;
|
||||||
|
private boolean wasFlying = false;
|
||||||
private long time;
|
private long time;
|
||||||
|
|
||||||
public Flight(Player player) {
|
public Flight(Player player) {
|
||||||
|
@ -38,11 +37,11 @@ public class Flight {
|
||||||
instances.replace(player, flight);
|
instances.replace(player, flight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
couldFly = player.getAllowFlight();
|
this.couldFly = player.getAllowFlight();
|
||||||
wasFlying = player.isFlying();
|
this.wasFlying = player.isFlying();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
time = System.currentTimeMillis();
|
this.time = System.currentTimeMillis();
|
||||||
instances.put(player, this);
|
instances.put(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,14 +58,13 @@ public class Flight {
|
||||||
if (instances.containsKey(player)) {
|
if (instances.containsKey(player)) {
|
||||||
return instances.get(player).source;
|
return instances.get(player).source;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handle() {
|
public static void handle() {
|
||||||
ArrayList<Player> players = new ArrayList<Player>();
|
ArrayList<Player> players = new ArrayList<Player>();
|
||||||
ArrayList<Player> newflyingplayers = new ArrayList<Player>();
|
ArrayList<Player> newflyingplayers = new ArrayList<Player>();
|
||||||
ArrayList<Player> avatarstateplayers = new ArrayList<Player>();
|
//ArrayList<Player> avatarstateplayers = new ArrayList<Player>();
|
||||||
ArrayList<Player> airscooterplayers = new ArrayList<Player>();
|
ArrayList<Player> airscooterplayers = new ArrayList<Player>();
|
||||||
ArrayList<Player> waterspoutplayers = new ArrayList<Player>();
|
ArrayList<Player> waterspoutplayers = new ArrayList<Player>();
|
||||||
ArrayList<Player> airspoutplayers = new ArrayList<Player>();
|
ArrayList<Player> airspoutplayers = new ArrayList<Player>();
|
||||||
|
@ -76,7 +74,7 @@ public class Flight {
|
||||||
// players.addAll(Speed.getPlayers());
|
// players.addAll(Speed.getPlayers());
|
||||||
players.addAll(FireJet.getPlayers());
|
players.addAll(FireJet.getPlayers());
|
||||||
players.addAll(Catapult.getPlayers());
|
players.addAll(Catapult.getPlayers());
|
||||||
avatarstateplayers = AvatarState.getPlayers();
|
//avatarstateplayers = AvatarState.getPlayers();
|
||||||
airscooterplayers = AirScooter.getPlayers();
|
airscooterplayers = AirScooter.getPlayers();
|
||||||
waterspoutplayers = WaterSpout.getPlayers();
|
waterspoutplayers = WaterSpout.getPlayers();
|
||||||
airspoutplayers = AirSpout.getPlayers();
|
airspoutplayers = AirSpout.getPlayers();
|
||||||
|
@ -112,15 +110,8 @@ public class Flight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (flight.source == null) {
|
flight.revert();
|
||||||
flight.revert();
|
flight.remove();
|
||||||
flight.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (System.currentTimeMillis() > flight.time + duration) {
|
|
||||||
flight.revert();
|
|
||||||
flight.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,11 +119,10 @@ public class Flight {
|
||||||
public static void removeAll() {
|
public static void removeAll() {
|
||||||
for (Player player : instances.keySet()) {
|
for (Player player : instances.keySet()) {
|
||||||
Flight flight = instances.get(player);
|
Flight flight = instances.get(player);
|
||||||
if (player == null || flight == null) {
|
if (flight == null) {
|
||||||
instances.remove(player);
|
instances.remove(player);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//if (flight.source != null)
|
|
||||||
flight.revert();
|
flight.revert();
|
||||||
flight.remove();
|
flight.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -19,12 +21,12 @@ public class RevertChecker implements Runnable {
|
||||||
|
|
||||||
private ProjectKorra plugin;
|
private ProjectKorra plugin;
|
||||||
|
|
||||||
private static final boolean safeRevert = ProjectKorra.plugin.getConfig().getBoolean("Properties.Earth.SafeRevert");
|
private static final FileConfiguration config = ConfigManager.defaultConfig.get();
|
||||||
public static ConcurrentHashMap<Block, Block> earthRevertQueue = new ConcurrentHashMap<Block, Block>();
|
private static final boolean safeRevert = config.getBoolean("Properties.Earth.SafeRevert");
|
||||||
static ConcurrentHashMap<Integer, Integer> airRevertQueue = new ConcurrentHashMap<Integer, Integer>();
|
public static Map<Block, Block> earthRevertQueue = new ConcurrentHashMap<>();
|
||||||
static ConcurrentHashMap<Chunk, Chunk> chunks = new ConcurrentHashMap<Chunk, Chunk>();
|
static Map<Integer, Integer> airRevertQueue = new ConcurrentHashMap<>();
|
||||||
// static ConcurrentHashMap<Block, Material> movedEarthQueue = new
|
//static ConcurrentHashMap<Chunk, Chunk> chunks = new ConcurrentHashMap<Chunk, Chunk>();
|
||||||
// ConcurrentHashMap<Block, Material>();
|
// static ConcurrentHashMap<Block, Material> movedEarthQueue = new ConcurrentHashMap<Block, Material>();
|
||||||
|
|
||||||
private long time;
|
private long time;
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ public class RevertChecker implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
|
|
||||||
if (plugin.getConfig().getBoolean("Properties.Earth.RevertEarthbending")) {
|
if (config.getBoolean("Properties.Earth.RevertEarthbending")) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
returnFuture = plugin.getServer().getScheduler().callSyncMethod(plugin, new getOccupiedChunks(plugin.getServer()));
|
returnFuture = plugin.getServer().getScheduler().callSyncMethod(plugin, new getOccupiedChunks(plugin.getServer()));
|
||||||
|
@ -82,7 +84,7 @@ public class RevertChecker implements Runnable {
|
||||||
continue;
|
continue;
|
||||||
boolean remove = true;
|
boolean remove = true;
|
||||||
Information info = earth.get(block);
|
Information info = earth.get(block);
|
||||||
if (time < info.getTime() + ProjectKorra.plugin.getConfig().getLong("Properties.Earth.RevertCheckTime") || (chunks.contains(block.getChunk()) && safeRevert)) {
|
if (time < info.getTime() + config.getLong("Properties.Earth.RevertCheckTime") || (chunks.contains(block.getChunk()) && safeRevert)) {
|
||||||
remove = false;
|
remove = false;
|
||||||
}
|
}
|
||||||
if (remove) {
|
if (remove) {
|
||||||
|
@ -99,7 +101,7 @@ public class RevertChecker implements Runnable {
|
||||||
boolean remove = true;
|
boolean remove = true;
|
||||||
Information info = air.get(i);
|
Information info = air.get(i);
|
||||||
Block block = info.getBlock();
|
Block block = info.getBlock();
|
||||||
if (time < info.getTime() + ProjectKorra.plugin.getConfig().getLong("Properties.Earth.RevertCheckTime") || (chunks.contains(block.getChunk()) && safeRevert)) {
|
if (time < info.getTime() + config.getLong("Properties.Earth.RevertCheckTime") || (chunks.contains(block.getChunk()) && safeRevert)) {
|
||||||
remove = false;
|
remove = false;
|
||||||
}
|
}
|
||||||
if (remove) {
|
if (remove) {
|
||||||
|
|
|
@ -14,10 +14,10 @@ public class TempBlock {
|
||||||
|
|
||||||
public static ConcurrentHashMap<Block, TempBlock> instances = new ConcurrentHashMap<Block, TempBlock>();
|
public static ConcurrentHashMap<Block, TempBlock> instances = new ConcurrentHashMap<Block, TempBlock>();
|
||||||
|
|
||||||
Block block;
|
private Block block;
|
||||||
Material newtype;
|
private Material newtype;
|
||||||
byte newdata;
|
private byte newdata;
|
||||||
BlockState state;
|
private BlockState state;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public TempBlock(Block block, Material newtype, byte newdata) {
|
public TempBlock(Block block, Material newtype, byte newdata) {
|
||||||
|
@ -53,9 +53,7 @@ public class TempBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTempBlock(Block block) {
|
public static boolean isTempBlock(Block block) {
|
||||||
if (instances.containsKey(block))
|
return instances.containsKey(block);
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTouchingTempBlock(Block block) {
|
public static boolean isTouchingTempBlock(Block block) {
|
||||||
|
@ -71,13 +69,10 @@ public class TempBlock {
|
||||||
for (Block block : instances.keySet()) {
|
for (Block block : instances.keySet()) {
|
||||||
revertBlock(block, Material.AIR);
|
revertBlock(block, Material.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeBlock(Block block) {
|
public static void removeBlock(Block block) {
|
||||||
if (instances.containsKey(block)) {
|
instances.remove(block);
|
||||||
instances.remove(block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -34,8 +34,6 @@ public class TempPotionEffect {
|
||||||
|
|
||||||
public static void progressAll() {
|
public static void progressAll() {
|
||||||
for (LivingEntity entity : instances.keySet()) {
|
for (LivingEntity entity : instances.keySet()) {
|
||||||
if (instances.get(entity) == null)
|
|
||||||
continue;
|
|
||||||
instances.get(entity).progress();
|
instances.get(entity).progress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class FreezeMelt {
|
||||||
return;
|
return;
|
||||||
byte data = block.getData();
|
byte data = block.getData();
|
||||||
block.setType(Material.ICE);
|
block.setType(Material.ICE);
|
||||||
|
if(frozenblocks.size() % 50 == 0)
|
||||||
WaterMethods.playIcebendingSound(block.getLocation());
|
WaterMethods.playIcebendingSound(block.getLocation());
|
||||||
frozenblocks.put(block, data);
|
frozenblocks.put(block, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.projectkorra.projectkorra.waterbending;
|
package com.projectkorra.projectkorra.waterbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class WaterMethods {
|
||||||
|
|
||||||
public static void playIcebendingSound(Location loc) {
|
public static void playIcebendingSound(Location loc) {
|
||||||
if (plugin.getConfig().getBoolean("Properties.Water.PlaySound")) {
|
if (plugin.getConfig().getBoolean("Properties.Water.PlaySound")) {
|
||||||
loc.getWorld().playSound(loc, Sound.FIRE_IGNITE, 10, 4);
|
loc.getWorld().playSound(loc, Sound.FIRE_IGNITE, 2, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ public class WaterPassive {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
String ability = GeneralMethods.getBoundAbility(player);
|
String ability = GeneralMethods.getBoundAbility(player);
|
||||||
|
@ -44,15 +43,15 @@ public class WaterPassive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getLocation().getBlock().isLiquid()) {
|
// if (player.getLocation().getBlock().isLiquid()) {
|
||||||
for (Block block : GeneralMethods.getBlocksAroundPoint(player.getLocation(), 2)) {
|
// for (Block block : GeneralMethods.getBlocksAroundPoint(player.getLocation(), 2)) {
|
||||||
if (GeneralMethods.isAdjacentToThreeOrMoreSources(block) && WaterMethods.isWater(block)) {
|
// if (GeneralMethods.isAdjacentToThreeOrMoreSources(block) && WaterMethods.isWater(block)) {
|
||||||
byte full = 0x0;
|
// byte full = 0x0;
|
||||||
block.setType(Material.WATER);
|
// block.setType(Material.WATER);
|
||||||
block.setData(full);
|
// block.setData(full);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class WaterSpout {
|
||||||
private long interval = 50;
|
private long interval = 50;
|
||||||
private int angle = 0;
|
private int angle = 0;
|
||||||
private double rotation;
|
private double rotation;
|
||||||
|
private boolean canBendOnPackedIce = false;
|
||||||
|
|
||||||
public WaterSpout(Player player) {
|
public WaterSpout(Player player) {
|
||||||
// if (BendingPlayer.getBendingPlayer(player).isOnCooldown(
|
// if (BendingPlayer.getBendingPlayer(player).isOnCooldown(
|
||||||
|
@ -52,7 +53,8 @@ public class WaterSpout {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
this.canBendOnPackedIce = ProjectKorra.plugin.getConfig().getBoolean("Properties.Water.CanBendPackedIce");
|
||||||
|
|
||||||
WaterWave wwave = new WaterWave(player, WaterWave.AbilityType.CLICK);
|
WaterWave wwave = new WaterWave(player, WaterWave.AbilityType.CLICK);
|
||||||
if (WaterWave.instances.contains(wwave))
|
if (WaterWave.instances.contains(wwave))
|
||||||
return;
|
return;
|
||||||
|
@ -63,11 +65,13 @@ public class WaterSpout {
|
||||||
Material mat = topBlock.getType();
|
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 && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK)
|
||||||
return;
|
return;
|
||||||
|
if (mat == Material.PACKED_ICE && !canBendOnPackedIce)
|
||||||
|
return;
|
||||||
new Flight(player);
|
new Flight(player);
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
instances.put(player, this);
|
instances.put(player, this);
|
||||||
spout(player);
|
spout(player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void remove() {
|
private void remove() {
|
||||||
|
@ -240,7 +244,7 @@ public class WaterSpout {
|
||||||
return height;
|
return height;
|
||||||
return i;
|
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 || (blocki.getType() == Material.PACKED_ICE && spout.canBendOnPackedIce)) {
|
||||||
if (!TempBlock.isTempBlock(blocki)) {
|
if (!TempBlock.isTempBlock(blocki)) {
|
||||||
revertBaseBlock(player);
|
revertBaseBlock(player);
|
||||||
instances.get(player).baseblock = new TempBlock(blocki, Material.STATIONARY_WATER, (byte) 8);
|
instances.get(player).baseblock = new TempBlock(blocki, Material.STATIONARY_WATER, (byte) 8);
|
||||||
|
@ -355,4 +359,4 @@ public class WaterSpout {
|
||||||
public void setDefaultheight(int defaultheight) {
|
public void setDefaultheight(int defaultheight) {
|
||||||
this.defaultheight = defaultheight;
|
this.defaultheight = defaultheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -259,6 +259,8 @@ public class WaterWall {
|
||||||
|
|
||||||
if (GeneralMethods.getBoundAbility(player) == null) {
|
if (GeneralMethods.getBoundAbility(player) == null) {
|
||||||
unfocusBlock();
|
unfocusBlock();
|
||||||
|
breakBlock();
|
||||||
|
returnWater(location);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!progressing && !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Surge")) {
|
if (!progressing && !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Surge")) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -83,7 +82,7 @@ public class WaterWave {
|
||||||
|
|
||||||
public void progress() {
|
public void progress() {
|
||||||
progressCounter++;
|
progressCounter++;
|
||||||
if (player.isDead() || !player.isOnline()) {
|
if (player.isDead() || !player.isOnline() || !origin.getWorld().equals(player.getWorld())) {
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,9 @@ public class Wave {
|
||||||
|
|
||||||
if (GeneralMethods.getBoundAbility(player) == null) {
|
if (GeneralMethods.getBoundAbility(player) == null) {
|
||||||
unfocusBlock();
|
unfocusBlock();
|
||||||
|
thaw();
|
||||||
|
breakBlock();
|
||||||
|
returnWater(location);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!progressing && !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Surge")) {
|
if (!progressing && !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Surge")) {
|
||||||
|
|
Loading…
Reference in a new issue