Merge pull request #408 from Simplicitee/master

Various fixes
This commit is contained in:
OmniCypher 2016-02-17 16:26:08 -08:00
commit 52271cf162
10 changed files with 60 additions and 46 deletions

View file

@ -8,6 +8,7 @@ import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.RevertChecker;
import com.projectkorra.projectkorra.util.TempPotionEffect;
import com.projectkorra.rpg.RPGMethods;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -55,6 +56,11 @@ public class BendingManager implements Runnable {
times.put(world, false);
}
} else {
if (GeneralMethods.hasRPG()) {
if (RPGMethods.isFullMoon(world) || RPGMethods.isLunarEclipse(world) || RPGMethods.isSolarEclipse(world) || RPGMethods.isSozinsComet(world)) {
continue;
}
}
if (times.get(world) && !FireAbility.isDay(world)) {
// The hashmap says it is day, but it is not.
times.put(world, false); // Sets time to night.
@ -63,7 +69,6 @@ public class BendingManager implements Runnable {
if (bPlayer == null) {
continue;
}
if (bPlayer.hasElement(Element.WATER) && player.hasPermission("bending.message.daymessage")) {
player.sendMessage(Element.WATER.getColor() + getMoonriseMessage());
}

View file

@ -94,7 +94,7 @@ import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.EarthBlast;
import com.projectkorra.projectkorra.earthbending.EarthPassive;
import com.projectkorra.projectkorra.event.BendingReloadEvent;
import com.projectkorra.projectkorra.event.BindingUpdateEvent;
import com.projectkorra.projectkorra.event.BindChangeEvent;
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast;
@ -164,7 +164,7 @@ public class GeneralMethods {
*/
public static void bindAbility(Player player, String ability) {
int slot = player.getInventory().getHeldItemSlot() + 1;
BindingUpdateEvent event = new BindingUpdateEvent(player, ability, slot, true);
BindChangeEvent event = new BindChangeEvent(player, ability, slot, true);
Bukkit.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled())
bindAbility(player, ability, slot);
@ -184,7 +184,7 @@ public class GeneralMethods {
return;
}
BindingUpdateEvent event = new BindingUpdateEvent(player, ability, slot, true);
BindChangeEvent event = new BindChangeEvent(player, ability, slot, true);
Bukkit.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player.getName());

View file

@ -104,11 +104,11 @@ public abstract class WaterAbility extends ElementalAbility {
if (isNight(world)) {
if (GeneralMethods.hasRPG()) {
if (isLunarEclipse(world)) {
return RPGMethods.getFactor("LunarEclipse");
return RPGMethods.getFactor("LunarEclipse") * value;
} else if (isFullMoon(world)) {
return RPGMethods.getFactor("FullMoon");
return RPGMethods.getFactor("FullMoon") * value;
} else {
return value;
return getConfig().getDouble("Properties.Water.NightFactor") * value;
}
} else {
if (isFullMoon(world)) {

View file

@ -4,7 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.event.BindingUpdateEvent;
import com.projectkorra.projectkorra.event.BindChangeEvent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -42,7 +42,7 @@ public class MultiAbilityManager {
* @param multiAbility
*/
public static void bindMultiAbility(Player player, String multiAbility) {
BindingUpdateEvent event = new BindingUpdateEvent(player, multiAbility, true);
BindChangeEvent event = new BindChangeEvent(player, multiAbility, true);
Bukkit.getServer().getPluginManager().callEvent(event);
if(event.isCancelled())
return;

View file

@ -1,6 +1,5 @@
package com.projectkorra.projectkorra.airbending;
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.avatar.AvatarState;

View file

@ -138,6 +138,8 @@ public class AirScooter extends AirAbility {
@Override
public void remove() {
super.remove();
player.setAllowFlight(canFly);
player.setFlying(hadFly);
}
private void spinScooter() {

View file

@ -138,7 +138,7 @@ public class AirShield extends AirAbility {
}
}
velocity.multiply(radius / maxRadius);
velocity.multiply(0.5);
GeneralMethods.setVelocity(entity, velocity);
entity.setFallDistance(0);
}

View file

@ -4,14 +4,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.projectkorra.projectkorra.ability.CoreAbility;
/**
* Called when a player binds or unbinds an ability
*
* @author savior67
*/
public class BindingUpdateEvent extends Event{
public class BindChangeEvent extends Event{
private static final HandlerList handlers = new HandlerList();
private Player player;
@ -22,7 +20,7 @@ public class BindingUpdateEvent extends Event{
private boolean cancelled;
//bind event for abilities
public BindingUpdateEvent(Player player, String ability, int slot, boolean isBinding) {
public BindChangeEvent(Player player, String ability, int slot, boolean isBinding) {
this.player = player;
this.ability = ability;
this.slot = slot;
@ -32,7 +30,7 @@ public class BindingUpdateEvent extends Event{
}
//used for multi abilities
public BindingUpdateEvent(Player player, String ability, boolean isBinding) {
public BindChangeEvent(Player player, String ability, boolean isBinding) {
this.player = player;
this.ability = ability;
this.slot = -1;
@ -41,30 +39,10 @@ public class BindingUpdateEvent extends Event{
this.isMultiAbility = true;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public boolean isCancelled() {
return cancelled;
}
public Player getPlayer() {
return player;
}
public String getAbility() {
return ability;
}
public int getSlot() {
return slot;
}
public boolean isBinding() {
return isBinding;
}
@Override
public HandlerList getHandlers() {
return handlers;
@ -74,4 +52,27 @@ public class BindingUpdateEvent extends Event{
return handlers;
}
public Player getPlayer() {
return player;
}
public int getSlot() {
return slot;
}
public boolean isBinding() {
return isBinding;
}
public boolean isCancelled() {
return cancelled;
}
public boolean isMultiAbility() {
return isMultiAbility;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View file

@ -4,8 +4,6 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect;
@ -47,6 +45,10 @@ public class IceSpikeBlast extends IceAbility {
public IceSpikeBlast(Player player) {
super(player);
if (bPlayer.isOnCooldown("IceSpikeBlast")) {
return;
}
this.data = 0;
this.interval = getConfig().getLong("Abilities.Water.IceSpike.Blast.Interval");
this.slowCooldown = getConfig().getLong("Abilities.Water.IceSpike.Blast.SlowCooldown");
@ -66,7 +68,10 @@ public class IceSpikeBlast extends IceAbility {
this.range = getNightFactor(range);
this.damage = getNightFactor(damage);
this.slowPower = (int) getNightFactor(slowPower);
sourceBlock = BlockSource.getWaterSourceBlock(player, range, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
sourceBlock = getWaterSourceBlock(player, range, bPlayer.canPlantbend());
if (sourceBlock == null) {
sourceBlock = getIceSourceBlock(player, range);
}
if (sourceBlock == null) {
new IceSpikePillarField(player);
@ -216,9 +221,6 @@ public class IceSpikeBlast extends IceAbility {
progressing = false;
}
originalSource.revertBlock();
if (player != null && player.isOnline()) {
bPlayer.addCooldown("IceSpikeBlast", cooldown);
}
}
private void returnWater() {
@ -269,18 +271,21 @@ public class IceSpikeBlast extends IceAbility {
if (bPlayer == null) {
return;
} else if (bPlayer.isOnCooldown("IceSpikeBlast")) {
}
if (bPlayer.isOnCooldown("IceSpikeBlast")) {
return;
}
for (IceSpikeBlast ice : getAbilities(player, IceSpikeBlast.class)) {
if (ice.prepared) {
ice.throwIce();
bPlayer.addCooldown("IceSpikeBlast", ice.getCooldown());
activate = true;
}
}
if (!activate) {
if (!activate && !getPlayers(IceSpikeBlast.class).contains(player)) {
IceSpikePillar spike = new IceSpikePillar(player);
if (!spike.isStarted()) {
waterBottle(player);

View file

@ -154,6 +154,8 @@ public class WaterSpout extends WaterAbility {
AFFECTED_BLOCKS.remove(tb.getBlock());
tb.revertBlock();
}
player.setAllowFlight(false);
player.setFlying(false);
}
public void revertBaseBlock() {