Make MobaItemEffect abstract

This commit is contained in:
Sam 2017-05-13 17:30:59 +01:00
parent bc5a9a1d5e
commit 5edbddb3d2
6 changed files with 19 additions and 94 deletions

View File

@ -5,17 +5,25 @@ import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import org.bukkit.entity.Player;
public interface MobaItemEffect
public abstract class MobaItemEffect
{
void onCooldownCheck(CooldownCalculateEvent event);
protected void onCooldownCheck(CooldownCalculateEvent event)
{
}
void onDeath(Player killed, Player killer);
protected void onDeath(Player killed, Player killer)
{
}
void onHPRegen(MobaHPRegenEvent event);
protected void onHPRegen(MobaHPRegenEvent event)
{
}
void onRespawn(PlayerGameRespawnEvent event);
protected void onRespawn(PlayerGameRespawnEvent event)
{
}
String getDescription();
public abstract String getDescription();
}

View File

@ -1,13 +1,10 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaCDREffect implements MobaItemEffect
public class MobaCDREffect extends MobaItemEffect
{
private double _factor;
@ -23,21 +20,6 @@ public class MobaCDREffect implements MobaItemEffect
event.decreaseCooldown(_factor);
}
@Override
public void onDeath(Player killed, Player killer)
{
}
@Override
public void onHPRegen(MobaHPRegenEvent event)
{
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
{
}
@Override
public String getDescription()
{

View File

@ -1,13 +1,10 @@
package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.F;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaHPRegenEffect implements MobaItemEffect
public class MobaHPRegenEffect extends MobaItemEffect
{
private double _factor;
@ -17,27 +14,12 @@ public class MobaHPRegenEffect implements MobaItemEffect
_factor = factor;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
}
@Override
public void onDeath(Player killed, Player killer)
{
}
@Override
public void onHPRegen(MobaHPRegenEvent event)
{
event.increaseHealth(_factor);
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
{
}
@Override
public String getDescription()
{

View File

@ -8,7 +8,7 @@ import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaKillHealEffect implements MobaItemEffect
public class MobaKillHealEffect extends MobaItemEffect
{
private double _health;
@ -18,27 +18,12 @@ public class MobaKillHealEffect implements MobaItemEffect
_health = health;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
}
@Override
public void onDeath(Player killed, Player killer)
{
killer.setHealth(Math.min(killer.getMaxHealth(), killer.getHealth() + _health));
}
@Override
public void onHPRegen(MobaHPRegenEvent event)
{
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
{
}
@Override
public String getDescription()
{

View File

@ -7,7 +7,7 @@ import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaSpeedEffect implements MobaItemEffect
public class MobaSpeedEffect extends MobaItemEffect
{
private double _factor;
@ -17,21 +17,6 @@ public class MobaSpeedEffect implements MobaItemEffect
_factor = factor;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
}
@Override
public void onDeath(Player killed, Player killer)
{
}
@Override
public void onHPRegen(MobaHPRegenEvent event)
{
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
{

View File

@ -3,12 +3,10 @@ package nautilus.game.arcade.game.games.moba.shop.effects;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.games.moba.MobaHPRegenEvent;
import nautilus.game.arcade.game.games.moba.kit.CooldownCalculateEvent;
import nautilus.game.arcade.game.games.moba.shop.MobaItemEffect;
import org.bukkit.entity.Player;
public class MobaTotalHealthEffect implements MobaItemEffect
public class MobaTotalHealthEffect extends MobaItemEffect
{
private int _health;
@ -18,21 +16,6 @@ public class MobaTotalHealthEffect implements MobaItemEffect
_health = health;
}
@Override
public void onCooldownCheck(CooldownCalculateEvent event)
{
}
@Override
public void onDeath(Player killed, Player killer)
{
}
@Override
public void onHPRegen(MobaHPRegenEvent event)
{
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
{