Merge pull request #260 from Simplicitee/patch

General fixes
This commit is contained in:
OmniCypher 2015-09-26 12:13:16 -07:00
commit d058aefa01
4 changed files with 52 additions and 7 deletions

View file

@ -110,6 +110,7 @@ import com.projectkorra.projectkorra.earthbending.SandSpout;
import com.projectkorra.projectkorra.earthbending.Shockwave; import com.projectkorra.projectkorra.earthbending.Shockwave;
import com.projectkorra.projectkorra.earthbending.Tremorsense; import com.projectkorra.projectkorra.earthbending.Tremorsense;
import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent; import com.projectkorra.projectkorra.event.PlayerBendingDeathEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.firebending.ArcOfFire; import com.projectkorra.projectkorra.firebending.ArcOfFire;
import com.projectkorra.projectkorra.firebending.Combustion; import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.Enflamed; import com.projectkorra.projectkorra.firebending.Enflamed;
@ -174,23 +175,31 @@ public class PKListener implements Listener {
Preset.loadPresets(player); Preset.loadPresets(player);
String append = ""; String append = "";
ChatColor color = null;
boolean chatEnabled = ProjectKorra.plugin.getConfig().getBoolean("Properties.Chat.Enable"); boolean chatEnabled = ProjectKorra.plugin.getConfig().getBoolean("Properties.Chat.Enable");
if ((player.hasPermission("bending.avatar") || GeneralMethods.getBendingPlayer(player.getName()).getElements().size() > 1) && chatEnabled) { if ((player.hasPermission("bending.avatar") || GeneralMethods.getBendingPlayer(player.getName()).getElements().size() > 1) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Avatar"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Avatar");
color = ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Avatar"));
} else if (GeneralMethods.isBender(player.getName(), Element.Air) && chatEnabled) { } else if (GeneralMethods.isBender(player.getName(), Element.Air) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Air"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Air");
color = AirMethods.getAirColor();
} else if (GeneralMethods.isBender(player.getName(), Element.Water) && chatEnabled) { } else if (GeneralMethods.isBender(player.getName(), Element.Water) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Water"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Water");
color = WaterMethods.getWaterColor();
} else if (GeneralMethods.isBender(player.getName(), Element.Earth) && chatEnabled) { } else if (GeneralMethods.isBender(player.getName(), Element.Earth) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Earth"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Earth");
color = EarthMethods.getEarthColor();
} else if (GeneralMethods.isBender(player.getName(), Element.Fire) && chatEnabled) { } else if (GeneralMethods.isBender(player.getName(), Element.Fire) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Fire"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Fire");
color = FireMethods.getFireColor();
} else if (GeneralMethods.isBender(player.getName(), Element.Chi) && chatEnabled) { } else if (GeneralMethods.isBender(player.getName(), Element.Chi) && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Chi"); append = plugin.getConfig().getString("Properties.Chat.Prefixes.Chi");
color = ChiMethods.getChiColor();
} }
if (chatEnabled) { if (chatEnabled) {
player.setDisplayName(append + player.getDisplayName()); player.setDisplayName(player.getName());
player.setDisplayName(color + append + ChatColor.RESET + player.getDisplayName());
} }
// Handle the AirSpout/WaterSpout login glitches // Handle the AirSpout/WaterSpout login glitches
@ -345,6 +354,39 @@ public class PKListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.NORMAL)
public void onElementChange(PlayerChangeElementEvent event) {
Player player = event.getTarget();
Element e = event.getElement();
String append = "";
ChatColor color = null;
boolean chatEnabled = ProjectKorra.plugin.getConfig().getBoolean("Properties.Chat.Enable");
if (GeneralMethods.getBendingPlayer(player).getElements().size() > 1) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Avatar");
color = ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Avatar"));
} else if (e == Element.Air && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Air");
color = AirMethods.getAirColor();
} else if (e == Element.Water && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Water");
color = WaterMethods.getWaterColor();
} else if (e == Element.Earth && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Earth");
color = EarthMethods.getEarthColor();
} else if (e == Element.Fire && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Fire");
color = FireMethods.getFireColor();
} else if (e == Element.Chi && chatEnabled) {
append = plugin.getConfig().getString("Properties.Chat.Prefixes.Chi");
color = ChiMethods.getChiColor();
}
if (chatEnabled) {
player.setDisplayName(player.getName());
player.setDisplayName(color + append + ChatColor.RESET + player.getDisplayName());
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) { public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
if (event.isCancelled()) if (event.isCancelled())

View file

@ -138,7 +138,7 @@ public class ComboManager {
iceBullet.add(new AbilityInformation("IceBlast", ClickType.SHIFT_DOWN)); iceBullet.add(new AbilityInformation("IceBlast", ClickType.SHIFT_DOWN));
comboAbilityList.put("IceBullet", 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."); 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"); instructions.put("IceBullet", "WaterBubble (Tap Shift) > IceBlast (Hold Shift) > Wait for ice to Form > Then alternate between Left and Right click with IceBlast");
ArrayList<AbilityInformation> iceBulletLeft = new ArrayList<AbilityInformation>(); ArrayList<AbilityInformation> iceBulletLeft = new ArrayList<AbilityInformation>();
iceBulletLeft.add(new AbilityInformation("IceBlast", ClickType.LEFT_CLICK)); iceBulletLeft.add(new AbilityInformation("IceBlast", ClickType.LEFT_CLICK));

View file

@ -36,7 +36,8 @@ public class AirBlast extends CoreAbility {
public static double speed = config.get().getDouble("Abilities.Air.AirBlast.Speed"); public static double speed = config.get().getDouble("Abilities.Air.AirBlast.Speed");
public static double defaultrange = config.get().getDouble("Abilities.Air.AirBlast.Range"); public static double defaultrange = config.get().getDouble("Abilities.Air.AirBlast.Range");
public static double affectingradius = config.get().getDouble("Abilities.Air.AirBlast.Radius"); public static double affectingradius = config.get().getDouble("Abilities.Air.AirBlast.Radius");
public static double defaultpushfactor = config.get().getDouble("Abilities.Air.AirBlast.Push"); public static double defaultpushfactor = config.get().getDouble("Abilities.Air.AirBlast.Push.Entities");
public static double otherpushfactor = config.get().getDouble("Abilities.Air.AirBlast.Push.Self");
public static boolean flickLevers = config.get().getBoolean("Abilities.Air.AirBlast.CanFlickLevers"); public static boolean flickLevers = config.get().getBoolean("Abilities.Air.AirBlast.CanFlickLevers");
public static boolean openDoors = config.get().getBoolean("Abilities.Air.AirBlast.CanOpenDoors"); public static boolean openDoors = config.get().getBoolean("Abilities.Air.AirBlast.CanOpenDoors");
@ -185,6 +186,7 @@ public class AirBlast extends CoreAbility {
boolean isUser = entity.getUniqueId() == player.getUniqueId(); boolean isUser = entity.getUniqueId() == player.getUniqueId();
if (!isUser || otherorigin) { if (!isUser || otherorigin) {
pushfactor = otherpushfactor;
Vector velocity = entity.getVelocity(); Vector velocity = entity.getVelocity();
// double mag = Math.abs(velocity.getY()); // double mag = Math.abs(velocity.getY());
double max = maxspeed; double max = maxspeed;

View file

@ -202,14 +202,15 @@ public class ConfigManager {
config.addDefault("Abilities.Air.AirBlast.Speed", 25); config.addDefault("Abilities.Air.AirBlast.Speed", 25);
config.addDefault("Abilities.Air.AirBlast.Range", 20); config.addDefault("Abilities.Air.AirBlast.Range", 20);
config.addDefault("Abilities.Air.AirBlast.Radius", 2); config.addDefault("Abilities.Air.AirBlast.Radius", 2);
config.addDefault("Abilities.Air.AirBlast.Push", 2.5); config.addDefault("Abilities.Air.AirBlast.Push.Self", 2.5);
config.addDefault("Abilities.Air.AirBlast.Push.Entities", 3.5);
config.addDefault("Abilities.Air.AirBlast.CanFlickLevers", true); config.addDefault("Abilities.Air.AirBlast.CanFlickLevers", true);
config.addDefault("Abilities.Air.AirBlast.CanOpenDoors", true); config.addDefault("Abilities.Air.AirBlast.CanOpenDoors", true);
config.addDefault("Abilities.Air.AirBlast.CanPressButtons", true); config.addDefault("Abilities.Air.AirBlast.CanPressButtons", true);
config.addDefault("Abilities.Air.AirBlast.CanCoolLava", true); config.addDefault("Abilities.Air.AirBlast.CanCoolLava", true);
config.addDefault("Abilities.Air.AirBubble.Enabled", true); config.addDefault("Abilities.Air.AirBubble.Enabled", true);
config.addDefault("Abilities.Air.AirBubble.Description", "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability."); config.addDefault("Abilities.Air.AirBubble.Description", "To use, the bender must hold down sneak. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
config.addDefault("Abilities.Air.AirBubble.Radius", 7); config.addDefault("Abilities.Air.AirBubble.Radius", 7);
config.addDefault("Abilities.Air.AirBurst.Enabled", true); config.addDefault("Abilities.Air.AirBurst.Enabled", true);
@ -435,7 +436,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.WaterArms.Spear.NightAugments.Duration.FullMoon", 12000); config.addDefault("Abilities.Water.WaterArms.Spear.NightAugments.Duration.FullMoon", 12000);
config.addDefault("Abilities.Water.WaterBubble.Enabled", true); config.addDefault("Abilities.Water.WaterBubble.Enabled", true);
config.addDefault("Abilities.Water.WaterBubble.Description", "To use, the bender must merely have the ability selected. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability."); config.addDefault("Abilities.Water.WaterBubble.Description", "To use, the bender must hold down sneak. All water around the user in a small bubble will vanish, replacing itself once the user either gets too far away or selects a different ability.");
config.addDefault("Abilities.Water.WaterBubble.Radius", 7); config.addDefault("Abilities.Water.WaterBubble.Radius", 7);
config.addDefault("Abilities.Water.WaterManipulation.Enabled", true); config.addDefault("Abilities.Water.WaterManipulation.Enabled", true);