diff --git a/src/main/java/com/gmail/val59000mc/scenarios/Scenario.java b/src/main/java/com/gmail/val59000mc/scenarios/Scenario.java index 33e56be56..219f341c1 100644 --- a/src/main/java/com/gmail/val59000mc/scenarios/Scenario.java +++ b/src/main/java/com/gmail/val59000mc/scenarios/Scenario.java @@ -48,7 +48,6 @@ public class Scenario { public static final Scenario INFINITE_ENCHANTS = new Scenario("infinite_enchants", UniversalMaterial.ENCHANTING_TABLE, InfiniteEnchantsListener.class); public static final Scenario CHILDREN_LEFT_UNATTENDED = new Scenario("children_left_unattended", UniversalMaterial.WOLF_SPAWN_EGG, ChildrenLeftUnattended.class); public static final Scenario SILENT_NIGHT = new Scenario("silent_night", UniversalMaterial.CLOCK, SilentNightListener.class); - // TODO: Fix bugs before releasing. public static final Scenario SHARED_HEALTH = new Scenario("shared_health", UniversalMaterial.RED_DYE, SharedHealthListener.class); public static final Scenario PERMAKILL = new Scenario("permakill", UniversalMaterial.IRON_SWORD, PermaKillListener.class); public static final Scenario WEAKEST_LINK = new Scenario("weakest_link", UniversalMaterial.DIAMOND_SWORD, WeakestLinkListener.class); public static final Scenario EGGS = new Scenario("eggs", UniversalMaterial.EGG, EggsScenarioListener.class); diff --git a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SharedHealthListener.java b/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SharedHealthListener.java deleted file mode 100644 index 5602ecc2f..000000000 --- a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SharedHealthListener.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gmail.val59000mc.scenarios.scenariolisteners; - -import com.gmail.val59000mc.exceptions.UhcPlayerNotOnlineException; -import com.gmail.val59000mc.game.GameState; -import com.gmail.val59000mc.players.PlayerState; -import com.gmail.val59000mc.players.UhcPlayer; -import com.gmail.val59000mc.scenarios.ScenarioListener; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; - -import java.util.List; - -public class SharedHealthListener extends ScenarioListener{ - - @EventHandler (priority = EventPriority.HIGH) - public void onPlayerDamage(EntityDamageEvent e){ - // Check if entity is player - if (e.getEntityType() != EntityType.PLAYER){ - return; - } - - if (e.isCancelled()){ - return; - } - - // Check if GameState is Playing | Deathmatch - GameState state = getGameManager().getGameState(); - if (state != GameState.PLAYING && state != GameState.DEATHMATCH){ - return; - } - - UhcPlayer uhcPlayer = getPlayerManager().getUhcPlayer((Player) e.getEntity()); - - // Check if player is playing - if (uhcPlayer.getState() != PlayerState.PLAYING){ - return; - } - - // If solo player don't share damage - List onlinePlayingMembers = uhcPlayer.getTeam().getOnlinePlayingMembers(); - if (onlinePlayingMembers.size() <= 1){ - return; - } - - double damage = e.getDamage()/onlinePlayingMembers.size(); - e.setDamage(damage); - - for (UhcPlayer uhcMember : onlinePlayingMembers){ - if (uhcMember == uhcPlayer){ - continue; - } - - try { - uhcMember.getPlayer().damage(damage); - }catch (UhcPlayerNotOnlineException ex){ - ex.printStackTrace(); - } - } - } - -} \ No newline at end of file