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