2018-11-20 20:51:07 +01:00
|
|
|
package com.massivecraft.factions.event;
|
|
|
|
|
2019-11-01 10:52:42 +01:00
|
|
|
import com.massivecraft.factions.Conf;
|
2018-11-20 20:51:07 +01:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2019-11-01 10:52:42 +01:00
|
|
|
import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
|
|
|
|
import com.massivecraft.factions.zcore.persist.MemoryFPlayers;
|
2019-02-11 05:57:45 +01:00
|
|
|
import org.bukkit.event.Cancellable;
|
2018-11-20 20:51:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Event called when a player regenerate power.
|
|
|
|
*/
|
|
|
|
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
private boolean cancelled = false;
|
2018-11-20 20:51:07 +01:00
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public PowerRegenEvent(Faction f, FPlayer p) {
|
|
|
|
super(f, p);
|
|
|
|
}
|
2018-11-20 20:51:07 +01:00
|
|
|
|
2019-11-01 10:52:42 +01:00
|
|
|
/**
|
|
|
|
* Get the amount of power this player will regen
|
|
|
|
* @return power amount gained as a Double.
|
|
|
|
*/
|
|
|
|
public Double getPowerGained() {
|
|
|
|
return fPlayer.getMillisPassed() * Conf.powerPerMinute / 60000;
|
|
|
|
}
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
@Override
|
|
|
|
public boolean isCancelled() {
|
|
|
|
return cancelled;
|
|
|
|
}
|
2018-11-20 20:51:07 +01:00
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
@Override
|
|
|
|
public void setCancelled(boolean c) {
|
|
|
|
this.cancelled = c;
|
|
|
|
}
|
2018-11-20 20:51:07 +01:00
|
|
|
|
|
|
|
}
|