mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
commit
52271cf162
10 changed files with 60 additions and 46 deletions
|
@ -8,6 +8,7 @@ import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||||
import com.projectkorra.projectkorra.util.Flight;
|
import com.projectkorra.projectkorra.util.Flight;
|
||||||
import com.projectkorra.projectkorra.util.RevertChecker;
|
import com.projectkorra.projectkorra.util.RevertChecker;
|
||||||
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
||||||
|
import com.projectkorra.rpg.RPGMethods;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -55,6 +56,11 @@ public class BendingManager implements Runnable {
|
||||||
times.put(world, false);
|
times.put(world, false);
|
||||||
}
|
}
|
||||||
} else {
|
} 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)) {
|
if (times.get(world) && !FireAbility.isDay(world)) {
|
||||||
// The hashmap says it is day, but it is not.
|
// The hashmap says it is day, but it is not.
|
||||||
times.put(world, false); // Sets time to night.
|
times.put(world, false); // Sets time to night.
|
||||||
|
@ -63,7 +69,6 @@ public class BendingManager implements Runnable {
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.hasElement(Element.WATER) && player.hasPermission("bending.message.daymessage")) {
|
if (bPlayer.hasElement(Element.WATER) && player.hasPermission("bending.message.daymessage")) {
|
||||||
player.sendMessage(Element.WATER.getColor() + getMoonriseMessage());
|
player.sendMessage(Element.WATER.getColor() + getMoonriseMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
import com.projectkorra.projectkorra.earthbending.EarthBlast;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||||
import com.projectkorra.projectkorra.event.BendingReloadEvent;
|
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.event.EntityBendingDeathEvent;
|
||||||
import com.projectkorra.projectkorra.firebending.Combustion;
|
import com.projectkorra.projectkorra.firebending.Combustion;
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
import com.projectkorra.projectkorra.firebending.FireBlast;
|
||||||
|
@ -164,7 +164,7 @@ public class GeneralMethods {
|
||||||
*/
|
*/
|
||||||
public static void bindAbility(Player player, String ability) {
|
public static void bindAbility(Player player, String ability) {
|
||||||
int slot = player.getInventory().getHeldItemSlot() + 1;
|
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);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled())
|
if(!event.isCancelled())
|
||||||
bindAbility(player, ability, slot);
|
bindAbility(player, ability, slot);
|
||||||
|
@ -184,7 +184,7 @@ public class GeneralMethods {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BindingUpdateEvent event = new BindingUpdateEvent(player, ability, slot, true);
|
BindChangeEvent event = new BindChangeEvent(player, ability, slot, true);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) {
|
if(!event.isCancelled()) {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player.getName());
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player.getName());
|
||||||
|
|
|
@ -104,11 +104,11 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
if (isNight(world)) {
|
if (isNight(world)) {
|
||||||
if (GeneralMethods.hasRPG()) {
|
if (GeneralMethods.hasRPG()) {
|
||||||
if (isLunarEclipse(world)) {
|
if (isLunarEclipse(world)) {
|
||||||
return RPGMethods.getFactor("LunarEclipse");
|
return RPGMethods.getFactor("LunarEclipse") * value;
|
||||||
} else if (isFullMoon(world)) {
|
} else if (isFullMoon(world)) {
|
||||||
return RPGMethods.getFactor("FullMoon");
|
return RPGMethods.getFactor("FullMoon") * value;
|
||||||
} else {
|
} else {
|
||||||
return value;
|
return getConfig().getDouble("Properties.Water.NightFactor") * value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isFullMoon(world)) {
|
if (isFullMoon(world)) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.event.BindingUpdateEvent;
|
import com.projectkorra.projectkorra.event.BindChangeEvent;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -42,7 +42,7 @@ public class MultiAbilityManager {
|
||||||
* @param multiAbility
|
* @param multiAbility
|
||||||
*/
|
*/
|
||||||
public static void bindMultiAbility(Player player, String 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);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.projectkorra.projectkorra.airbending;
|
package com.projectkorra.projectkorra.airbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
|
|
@ -138,6 +138,8 @@ public class AirScooter extends AirAbility {
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
super.remove();
|
super.remove();
|
||||||
|
player.setAllowFlight(canFly);
|
||||||
|
player.setFlying(hadFly);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spinScooter() {
|
private void spinScooter() {
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class AirShield extends AirAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
velocity.multiply(radius / maxRadius);
|
velocity.multiply(0.5);
|
||||||
GeneralMethods.setVelocity(entity, velocity);
|
GeneralMethods.setVelocity(entity, velocity);
|
||||||
entity.setFallDistance(0);
|
entity.setFallDistance(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,12 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player binds or unbinds an ability
|
* Called when a player binds or unbinds an ability
|
||||||
*
|
*
|
||||||
* @author savior67
|
* @author savior67
|
||||||
*/
|
*/
|
||||||
public class BindingUpdateEvent extends Event{
|
public class BindChangeEvent extends Event{
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -22,7 +20,7 @@ public class BindingUpdateEvent extends Event{
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
//bind event for abilities
|
//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.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
|
@ -32,7 +30,7 @@ public class BindingUpdateEvent extends Event{
|
||||||
}
|
}
|
||||||
|
|
||||||
//used for multi abilities
|
//used for multi abilities
|
||||||
public BindingUpdateEvent(Player player, String ability, boolean isBinding) {
|
public BindChangeEvent(Player player, String ability, boolean isBinding) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.slot = -1;
|
this.slot = -1;
|
||||||
|
@ -41,30 +39,10 @@ public class BindingUpdateEvent extends Event{
|
||||||
this.isMultiAbility = true;
|
this.isMultiAbility = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled) {
|
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAbility() {
|
public String getAbility() {
|
||||||
return ability;
|
return ability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSlot() {
|
|
||||||
return slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBinding() {
|
|
||||||
return isBinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
@ -74,4 +52,27 @@ public class BindingUpdateEvent extends Event{
|
||||||
return handlers;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,8 +4,6 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.IceAbility;
|
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.TempBlock;
|
||||||
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
||||||
|
|
||||||
|
@ -47,6 +45,10 @@ public class IceSpikeBlast extends IceAbility {
|
||||||
public IceSpikeBlast(Player player) {
|
public IceSpikeBlast(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
|
if (bPlayer.isOnCooldown("IceSpikeBlast")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.data = 0;
|
this.data = 0;
|
||||||
this.interval = getConfig().getLong("Abilities.Water.IceSpike.Blast.Interval");
|
this.interval = getConfig().getLong("Abilities.Water.IceSpike.Blast.Interval");
|
||||||
this.slowCooldown = getConfig().getLong("Abilities.Water.IceSpike.Blast.SlowCooldown");
|
this.slowCooldown = getConfig().getLong("Abilities.Water.IceSpike.Blast.SlowCooldown");
|
||||||
|
@ -66,7 +68,10 @@ public class IceSpikeBlast extends IceAbility {
|
||||||
this.range = getNightFactor(range);
|
this.range = getNightFactor(range);
|
||||||
this.damage = getNightFactor(damage);
|
this.damage = getNightFactor(damage);
|
||||||
this.slowPower = (int) getNightFactor(slowPower);
|
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) {
|
if (sourceBlock == null) {
|
||||||
new IceSpikePillarField(player);
|
new IceSpikePillarField(player);
|
||||||
|
@ -216,9 +221,6 @@ public class IceSpikeBlast extends IceAbility {
|
||||||
progressing = false;
|
progressing = false;
|
||||||
}
|
}
|
||||||
originalSource.revertBlock();
|
originalSource.revertBlock();
|
||||||
if (player != null && player.isOnline()) {
|
|
||||||
bPlayer.addCooldown("IceSpikeBlast", cooldown);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void returnWater() {
|
private void returnWater() {
|
||||||
|
@ -269,18 +271,21 @@ public class IceSpikeBlast extends IceAbility {
|
||||||
|
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
} else if (bPlayer.isOnCooldown("IceSpikeBlast")) {
|
}
|
||||||
|
|
||||||
|
if (bPlayer.isOnCooldown("IceSpikeBlast")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IceSpikeBlast ice : getAbilities(player, IceSpikeBlast.class)) {
|
for (IceSpikeBlast ice : getAbilities(player, IceSpikeBlast.class)) {
|
||||||
if (ice.prepared) {
|
if (ice.prepared) {
|
||||||
ice.throwIce();
|
ice.throwIce();
|
||||||
|
bPlayer.addCooldown("IceSpikeBlast", ice.getCooldown());
|
||||||
activate = true;
|
activate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activate) {
|
if (!activate && !getPlayers(IceSpikeBlast.class).contains(player)) {
|
||||||
IceSpikePillar spike = new IceSpikePillar(player);
|
IceSpikePillar spike = new IceSpikePillar(player);
|
||||||
if (!spike.isStarted()) {
|
if (!spike.isStarted()) {
|
||||||
waterBottle(player);
|
waterBottle(player);
|
||||||
|
|
|
@ -154,6 +154,8 @@ public class WaterSpout extends WaterAbility {
|
||||||
AFFECTED_BLOCKS.remove(tb.getBlock());
|
AFFECTED_BLOCKS.remove(tb.getBlock());
|
||||||
tb.revertBlock();
|
tb.revertBlock();
|
||||||
}
|
}
|
||||||
|
player.setAllowFlight(false);
|
||||||
|
player.setFlying(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revertBaseBlock() {
|
public void revertBaseBlock() {
|
||||||
|
|
Loading…
Reference in a new issue