Fixes certain abilities in Team SSM that could be used to
damage/knockback other team members
This commit is contained in:
Sam 2016-07-02 13:38:22 +01:00
parent 8d8824446d
commit 26361eaee0
4 changed files with 53 additions and 26 deletions

View File

@ -30,6 +30,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkBoneRush extends SmashPerk implements IThrown
@ -151,6 +152,18 @@ public class PerkBoneRush extends SmashPerk implements IThrown
double damage = 0.7;
String reason = GetName();
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) target;
Player throwerPlayer = (Player) data.getThrower();
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
{
return;
}
}
if (isSuperActive(damager))
{
damage = 3;

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
@ -20,7 +21,8 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkInferno extends SmashPerk
@ -119,4 +121,17 @@ public class PerkInferno extends SmashPerk
}
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (Manager.GetGame() instanceof TeamSuperSmash)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
if (smash.GetTeam(event.GetDamagerPlayer(false)).equals(smash.GetTeam(event.GetDamageePlayer())))
{
event.GetDamageeEntity().setFireTicks(0);
event.SetCancelled("Team Damage");
}
}
}
}

View File

@ -1,6 +1,5 @@
package nautilus.game.arcade.kit.perks;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@ -14,8 +13,6 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
@ -128,18 +125,18 @@ public class PerkNightLivingDead extends SmashPerk
{
if (data.Zombies.contains(event.getEntity()))
{
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) event.getTarget();
if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer)))
{
event.setCancelled(true);
}
}
if (data.Player.equals(event.getTarget()))
{
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) event.getTarget();
if (!smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer)))
{
return;
}
}
event.setCancelled(true);
}
}

View File

@ -128,21 +128,23 @@ public class PerkWitherImage extends SmashPerk
@EventHandler
public void entityTarget(EntityTargetEvent event)
{
if (_ownerToSkeleton.containsKey(event.getTarget()) && _skeletonToOwner.containsKey(event.getEntity()))
if (_skeletonToOwner.containsKey(event.getEntity()))
{
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) event.getTarget();
if(smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer)))
{
event.setCancelled(true);
}
}
if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity()))
{
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) event.getTarget();
if(!smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer)))
{
return;
}
}
event.setCancelled(true);
event.setCancelled(true);
}
}
}
@EventHandler