Merge pull request #234 from StrangeOne101/master

Fix Earth Passive and Commands
This commit is contained in:
OmniCypher 2015-09-07 12:38:38 -07:00
commit 93543139c6
6 changed files with 45 additions and 47 deletions

View file

@ -953,7 +953,8 @@ public class GeneralMethods {
* @return The ChatColor to be used
*/
public static ChatColor getComboColor(String combo) {
for (ComboAbility comboability : ComboManager.comboAbilityList) {
for (String ability : ComboManager.comboAbilityList.keySet()) {
ComboAbility comboability = ComboManager.comboAbilityList.get(ability);
if (!comboability.getName().equalsIgnoreCase(combo)) {
continue;
}
@ -1889,11 +1890,12 @@ public class GeneralMethods {
ab.stop();
}
HashSet<ComboManager.ComboAbility> combos = ComboManager.comboAbilityList;
for (ComboManager.ComboAbility c : combos)
HashMap<String, ComboManager.ComboAbility> combos = ComboManager.comboAbilityList;
for (String combo : combos.keySet()) {
ComboManager.ComboAbility c = combos.get(combo);
if (c.getComboType() instanceof ComboAbilityModule)
((ComboAbilityModule) c.getComboType()).stop();
}
AirMethods.stopBending();
EarthMethods.stopBending();
WaterMethods.stopBending();

View file

@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ComboManager {
private static final long CLEANUP_DELAY = 20 * 60 * 60;
public static ConcurrentHashMap<String, ArrayList<AbilityInformation>> recentlyUsedAbilities = new ConcurrentHashMap<String, ArrayList<AbilityInformation>>();
public static HashSet<ComboAbility> comboAbilityList = new HashSet<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> descriptions = new HashMap<String, String>();
public static HashMap<String, String> instructions = new HashMap<String, String>();
@ -33,7 +33,7 @@ public class ComboManager {
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
fireKick.add(new AbilityInformation("FireBlast", ClickType.SHIFT_DOWN));
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("FireKick", fireKick, FireCombo.class));
comboAbilityList.put("FireKick", new ComboAbility("FireKick", fireKick, FireCombo.class));
descriptions.put("FireKick", "A short ranged arc of fire launches from the player's feet dealing moderate damage to enemies.");
instructions.put("FireKick", "FireBlast > FireBlast > (Hold Shift) > FireBlast.");
@ -43,7 +43,7 @@ public class ComboManager {
fireSpin.add(new AbilityInformation("FireShield", ClickType.LEFT_CLICK));
fireSpin.add(new AbilityInformation("FireShield", ClickType.SHIFT_DOWN));
fireSpin.add(new AbilityInformation("FireShield", ClickType.SHIFT_UP));
comboAbilityList.add(new ComboAbility("FireSpin", fireSpin, FireCombo.class));
comboAbilityList.put("FireSpin", new ComboAbility("FireSpin", fireSpin, FireCombo.class));
descriptions.put("FireSpin", "A circular array of fire that causes damage and massive knockback to nearby enemies.");
instructions.put("FireSpin", "FireBlast > FireBlast > FireShield > (Tap Shift).");
@ -55,7 +55,7 @@ public class ComboManager {
jetBlast.add(new AbilityInformation("FireShield", ClickType.SHIFT_DOWN));
jetBlast.add(new AbilityInformation("FireShield", ClickType.SHIFT_UP));
jetBlast.add(new AbilityInformation("FireJet", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("JetBlast", jetBlast, FireCombo.class));
comboAbilityList.put("JetBlast", new ComboAbility("JetBlast", jetBlast, FireCombo.class));
descriptions.put("JetBlast", "Create an explosive blast that propels your FireJet at higher speeds.");
instructions.put("JetBlast", "FireJet (Tap Shift) > FireJet (Tap Shift) > FireShield (Tap Shift) > FireJet.");
@ -67,7 +67,7 @@ public class ComboManager {
jetBlaze.add(new AbilityInformation("Blaze", ClickType.SHIFT_DOWN));
jetBlaze.add(new AbilityInformation("Blaze", ClickType.SHIFT_UP));
jetBlaze.add(new AbilityInformation("FireJet", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("JetBlaze", jetBlaze, FireCombo.class));
comboAbilityList.put("JetBlaze", new ComboAbility("JetBlaze", jetBlaze, FireCombo.class));
descriptions.put("JetBlaze", "Damages and burns all enemies in the proximity of your FireJet.");
instructions.put("JetBlaze", "FireJet (Tap Shift) > FireJet (Tap Shift) > Blaze (Tap Shift) > FireJet.");
@ -76,7 +76,7 @@ public class ComboManager {
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK));
fireWheel.add(new AbilityInformation("Blaze", ClickType.SHIFT_UP));
comboAbilityList.add(new ComboAbility("FireWheel", fireWheel, FireCombo.class));
comboAbilityList.put("FireWheel", new ComboAbility("FireWheel", fireWheel, FireCombo.class));
descriptions.put("FireWheel", "A high-speed wheel of fire that travels along the ground for long distances dealing high damage.");
instructions.put("FireWheel", "FireShield (Hold Shift) > Right Click a block in front of you twice > Switch to Blaze > Release Shift.");
@ -85,7 +85,7 @@ public class ComboManager {
twister.add(new AbilityInformation("AirShield", ClickType.SHIFT_UP));
twister.add(new AbilityInformation("Tornado", ClickType.SHIFT_DOWN));
twister.add(new AbilityInformation("AirBlast", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("Twister", twister, AirCombo.class));
comboAbilityList.put("Twister", new ComboAbility("Twister", twister, AirCombo.class));
descriptions.put("Twister", "Create a cyclone of air that travels along the ground grabbing nearby entities.");
instructions.put("Twister", "AirShield (Tap Shift) > Tornado (Hold Shift) > AirBlast (Left Click)");
@ -93,7 +93,7 @@ public class ComboManager {
airStream.add(new AbilityInformation("AirShield", ClickType.SHIFT_DOWN));
airStream.add(new AbilityInformation("AirSuction", ClickType.LEFT_CLICK));
airStream.add(new AbilityInformation("AirBlast", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("AirStream", airStream, AirCombo.class));
comboAbilityList.put("AirStream", new ComboAbility("AirStream", airStream, AirCombo.class));
descriptions.put("AirStream", "Control a large stream of air that grabs onto enemies allowing you to direct them temporarily.");
instructions.put("AirStream", "AirShield (Hold Shift) > AirSuction (Left Click) > AirBlast (Left Click)");
@ -104,7 +104,7 @@ public class ComboManager {
* AbilityInformation("AirScooter",ClickType.SHIFTDOWN));
* airSlice.add(new
* AbilityInformation("AirScooter",ClickType.LEFTCLICK));
* comboAbilityList.add(new
* comboAbilityList.put(new
* ComboAbility("AirSlice",airSlice,AirCombo.class));
*/
@ -113,14 +113,14 @@ public class ComboManager {
airSweep.add(new AbilityInformation("AirSwipe", ClickType.LEFT_CLICK));
airSweep.add(new AbilityInformation("AirBurst", ClickType.SHIFT_DOWN));
airSweep.add(new AbilityInformation("AirBurst", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("AirSweep", airSweep, AirCombo.class));
comboAbilityList.put("AirSweep", new ComboAbility("AirSweep", airSweep, AirCombo.class));
descriptions.put("AirSweep", "Sweep the air in front of you hitting multiple enemies, causing moderate damage and a large knockback. The radius and direction of AirSweep is controlled by moving your mouse in a sweeping motion. For example, if you want to AirSweep upward, then move your mouse upward right after you left click AirBurst");
instructions.put("AirSweep", "AirSwipe (Left Click) > AirSwipe (Left Click) > AirBurst (Hold Shift) > AirBurst (Left Click)");
ArrayList<AbilityInformation> iceWave = new ArrayList<AbilityInformation>();
iceWave.add(new AbilityInformation("WaterSpout", ClickType.SHIFT_UP));
iceWave.add(new AbilityInformation("PhaseChange", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("IceWave", iceWave, WaterCombo.class));
comboAbilityList.put("IceWave", new ComboAbility("IceWave", iceWave, WaterCombo.class));
descriptions.put("IceWave", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
instructions.put("IceWave", "Create a WaterSpout Wave > PhaseChange (Left Click)");
@ -131,7 +131,7 @@ public class ComboManager {
* icePillar.add(new AbilityInformation("IceSpike",
* ClickType.LEFT_CLICK)); icePillar.add(new
* AbilityInformation("WaterSpout", ClickType.LEFT_CLICK));
* comboAbilityList.add(new ComboAbility("IcePillar", icePillar,
* comboAbilityList.put(new ComboAbility("IcePillar", icePillar,
* WaterCombo.class));
*/
@ -140,23 +140,23 @@ public class ComboManager {
iceBullet.add(new AbilityInformation("WaterBubble", ClickType.SHIFT_UP));
iceBullet.add(new AbilityInformation("IceBlast", ClickType.SHIFT_DOWN));
iceBullet.add(new AbilityInformation("IceBlast", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("IceBullet", iceBullet, WaterCombo.class));
comboAbilityList.put("IceBullet", new ComboAbility("IceBullet", iceBullet, WaterCombo.class));
descriptions.put("IceBullet", "Using a large cavern of ice, you can punch ice shards at your opponent causing moderate damage. To rapid fire, you must alternate between Left clicking and right clicking with IceBlast.");
instructions.put("IceBullet", "WaterBubble (Tap Shift) > IceBlast (Hold Shift) > IceBlast (Left Click) > Wait for ice to Form > Then alternate between Left and Right click with IceBlast");
ArrayList<AbilityInformation> iceBulletLeft = new ArrayList<AbilityInformation>();
iceBulletLeft.add(new AbilityInformation("IceBlast", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("IceBulletLeftClick", iceBulletLeft, WaterCombo.class));
comboAbilityList.put("IceBulletLeftClick", new ComboAbility("IceBulletLeftClick", iceBulletLeft, WaterCombo.class));
ArrayList<AbilityInformation> iceBulletRight = new ArrayList<AbilityInformation>();
iceBulletRight.add(new AbilityInformation("IceBlast", ClickType.RIGHT_CLICK));
comboAbilityList.add(new ComboAbility("IceBulletRightClick", iceBulletRight, WaterCombo.class));
comboAbilityList.put("IceBulletRightClick", new ComboAbility("IceBulletRightClick", iceBulletRight, WaterCombo.class));
ArrayList<AbilityInformation> immobilize = new ArrayList<AbilityInformation>();
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK));
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
comboAbilityList.add(new ComboAbility("Immobilize", immobilize, ChiCombo.class));
comboAbilityList.put("Immobilize", new ComboAbility("Immobilize", immobilize, ChiCombo.class));
descriptions.put("Immobilize", "Immobilizes the opponent for several seconds.");
instructions.put("Immobilize", "QuickStrike (Left Click) > SwiftKick (Left Click) > QuickStrike (Left Click) > QuickStrike (Left Click)");
@ -186,13 +186,9 @@ public class ComboManager {
else if (comboAbil.getComboType().equals(ChiCombo.class))
new ChiCombo(player, comboAbil.getName());
else {
for (ComboAbility ca : comboAbilityList) {
if (comboAbil.getName().equals(ca.getName())) {
if (ca.getComboType() instanceof ComboAbilityModule) {
((ComboAbilityModule) ca.getComboType()).createNewComboInstance(player);
return;
}
}
if (comboAbil.getComboType() instanceof ComboAbilityModule) {
((ComboAbilityModule) comboAbil.getComboType()).createNewComboInstance(player);
return;
}
}
}
@ -227,7 +223,8 @@ public class ComboManager {
*/
public static ComboAbility checkForValidCombo(Player player) {
ArrayList<AbilityInformation> playerCombo = getRecentlyUsedAbilities(player, 8);
for (ComboAbility customAbility : comboAbilityList) {
for (String ability : comboAbilityList.keySet()) {
ComboAbility customAbility = comboAbilityList.get(ability);
ArrayList<AbilityInformation> abilityCombo = customAbility.getAbilities();
int size = abilityCombo.size();
@ -288,9 +285,9 @@ public class ComboManager {
*/
public static ArrayList<String> getCombosForElement(Element element) {
ArrayList<String> list = new ArrayList<String>();
for (ComboAbility comboab : comboAbilityList) {
if (GeneralMethods.getAbilityElement(comboab.getAbilities().get(0).getAbilityName()) == element)
list.add(comboab.getName());
for (String comboab : descriptions.keySet()) {
if (GeneralMethods.getAbilityElement(comboAbilityList.get(comboab).getAbilities().get(0).getAbilityName()) == element)
list.add(comboab);
}
Collections.sort(list);
return list;

View file

@ -26,7 +26,7 @@ public class ComboModuleManager {
private void loadComboModules() {
for (ComboAbilityModule cm : combo) {
cm.onThisLoad();
ComboManager.comboAbilityList.add(new ComboManager.ComboAbility(cm.getName(), cm.getCombination(), cm));
ComboManager.comboAbilityList.put(cm.getName(), new ComboManager.ComboAbility(cm.getName(), cm.getCombination(), cm));
ComboManager.descriptions.put(cm.getName(), cm.getDescription());
ComboManager.instructions.put(cm.getName(), cm.getInstructions());
ComboManager.authors.put(cm.getName(), cm.getAuthor());

View file

@ -102,7 +102,7 @@ public class Commands {
@Override
public boolean onCommand(CommandSender s, Command c, String label, String[] args) {
for (int i = 0; i < args.length; i++) {
args[i] = args[i].toLowerCase();
args[i] = args[i];
}
if (args.length == 0) {

View file

@ -41,9 +41,10 @@ public class HelpCommand extends PKCommand {
} else if (Arrays.asList(Commands.comboaliases).contains(arg)) { //bending help elementcombo
sender.sendMessage(ChatColor.GOLD + "Proper Usage: " + ChatColor.RED + "/bending display " + arg + ChatColor.GOLD + " or " + ChatColor.RED + "/bending help <comboname>");
} else if (GeneralMethods.abilityExists(arg)) { //bending help ability
ChatColor color = GeneralMethods.getAbilityColor(arg);
sender.sendMessage(color + arg + " - ");
sender.sendMessage(AbilityModuleManager.descriptions.get(GeneralMethods.getAbility(arg)));
String ability = GeneralMethods.getAbility(arg);
ChatColor color = GeneralMethods.getAbilityColor(ability);
sender.sendMessage(color + ability + " - ");
sender.sendMessage(color + AbilityModuleManager.descriptions.get(GeneralMethods.getAbility(ability)));
} else if (Arrays.asList(Commands.airaliases).contains(args.get(0))) {
sender.sendMessage(AirMethods.getAirColor() + "Air is the element of freedom. Airbenders are natural pacifists and " + "great explorers. There is nothing stopping them from scaling the tallest of mountains and walls easily. They specialize in redirection, " + "from blasting things away with gusts of winds, to forming a shield around them to prevent damage. Easy to get across flat terrains, " + "such as oceans, there is practically no terrain off limits to Airbenders. They lack much raw damage output, but make up for it with " + "with their ridiculous amounts of utility and speed.");
sender.sendMessage(ChatColor.YELLOW + "Learn More: " + ChatColor.DARK_AQUA + "http://tinyurl.com/qffg9m3");

View file

@ -11,6 +11,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.material.MaterialData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -20,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class EarthPassive {
public static ConcurrentHashMap<Block, Long> sandblocks = new ConcurrentHashMap<Block, Long>();
public static ConcurrentHashMap<Block, Material> sandidentities = new ConcurrentHashMap<Block, Material>();
public static ConcurrentHashMap<Block, MaterialData> sandidentities = new ConcurrentHashMap<Block, MaterialData>();
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");
@ -32,9 +33,9 @@ public class EarthPassive {
}
if (EarthMethods.isEarthbendable(player, block) || EarthMethods.isTransparentToEarthbending(player, block)) {
if (!EarthMethods.isTransparentToEarthbending(player, block)) {
Material type = block.getType();
MaterialData type = block.getState().getData();
if (GeneralMethods.isSolid(block.getRelative(BlockFace.DOWN))) {
if (type == Material.RED_SANDSTONE) {
if (type.getItemType() == Material.RED_SANDSTONE) {
byte data = (byte) 0x1;
block.setType(Material.SAND);
block.setData(data);
@ -51,8 +52,8 @@ public class EarthPassive {
for (Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) {
if (EarthMethods.isEarthbendable(player, affectedBlock)) {
if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) {
Material type = affectedBlock.getType();
if (type == Material.RED_SANDSTONE) {
MaterialData type = affectedBlock.getState().getData();
if (type.getItemType() == Material.RED_SANDSTONE) {
byte data = (byte) 0x1;
affectedBlock.setType(Material.SAND);
affectedBlock.setData(data);
@ -80,15 +81,12 @@ public class EarthPassive {
}
public static void revertSand(Block block) {
Material type = sandidentities.get(block);
MaterialData materialdata = sandidentities.get(block);
sandidentities.remove(block);
sandblocks.remove(block);
if (block.getType() == Material.SAND) {
if (block.getData() == (byte) 0x1) {
block.setType(type);
} else {
block.setType(type);
}
block.setType(materialdata.getItemType());
block.setData(materialdata.getData());
}
}