SSM fixes
This commit is contained in:
parent
a830b5b388
commit
0131850fc3
@ -49,7 +49,11 @@ public class HighExplosive extends Grenade
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
continue;
|
||||
{
|
||||
Bukkit.broadcastMessage("They are dead");
|
||||
}
|
||||
|
||||
Bukkit.broadcastMessage("Dealing damage");
|
||||
|
||||
// Damage Event
|
||||
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(),
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@ -22,6 +23,7 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
import nautilus.game.arcade.kit.perks.data.NightLivingDeadData;
|
||||
|
||||
@ -128,6 +130,16 @@ public class PerkNightLivingDead extends SmashPerk
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,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 PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
@ -225,6 +226,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
|
||||
Slime slime = (Slime)data.GetThrown();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false,
|
||||
|
@ -2,6 +2,17 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -17,20 +28,10 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.kit.SmashPerk;
|
||||
|
||||
public class PerkWitherImage extends SmashPerk
|
||||
{
|
||||
private HashMap<Player, Skeleton> _images = new HashMap<Player, Skeleton>();
|
||||
private HashMap<Player, Skeleton> _ownerToSkeleton = new HashMap<Player, Skeleton>();
|
||||
private HashMap<Skeleton, Player> _skeletonToOwner = new HashMap<Skeleton, Player>();
|
||||
|
||||
public PerkWitherImage()
|
||||
{
|
||||
@ -67,7 +68,7 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!_images.containsKey(player))
|
||||
if (!_ownerToSkeleton.containsKey(player))
|
||||
{
|
||||
if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
|
||||
return;
|
||||
@ -94,7 +95,8 @@ public class PerkWitherImage extends SmashPerk
|
||||
|
||||
UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true);
|
||||
|
||||
_images.put(player, skel);
|
||||
_ownerToSkeleton.put(player, skel);
|
||||
_skeletonToOwner.put(skel, player);
|
||||
|
||||
Recharge.Instance.use(player, "Wither Swap", 500, false, false);
|
||||
|
||||
@ -109,7 +111,7 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false))
|
||||
return;
|
||||
|
||||
Skeleton skel = _images.get(player);
|
||||
Skeleton skel = _ownerToSkeleton.get(player);
|
||||
|
||||
Location loc = skel.getLocation();
|
||||
skel.teleport(player.getLocation());
|
||||
@ -126,9 +128,21 @@ public class PerkWitherImage extends SmashPerk
|
||||
@EventHandler
|
||||
public void entityTarget(EntityTargetEvent event)
|
||||
{
|
||||
if (_images.containsKey(event.getTarget()))
|
||||
if (_images.get(event.getTarget()).equals(event.getEntity()))
|
||||
if (_ownerToSkeleton.containsKey(event.getTarget()) && _skeletonToOwner.containsKey(event.getEntity()))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -137,13 +151,13 @@ public class PerkWitherImage extends SmashPerk
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
if (!_images.containsKey(damagee))
|
||||
if (!_ownerToSkeleton.containsKey(damagee.getUniqueId()))
|
||||
return;
|
||||
|
||||
LivingEntity damager = event.GetDamagerEntity(false);
|
||||
if (damager == null) return;
|
||||
|
||||
if (_images.get(damagee).equals(damager))
|
||||
if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager))
|
||||
event.SetCancelled("Wither Image");
|
||||
}
|
||||
|
||||
@ -153,12 +167,12 @@ public class PerkWitherImage extends SmashPerk
|
||||
LivingEntity damager = event.GetDamagerEntity(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!_images.containsValue(damager))
|
||||
if (!_ownerToSkeleton.containsValue(damager))
|
||||
return;
|
||||
|
||||
for (Player player : _images.keySet())
|
||||
for (Player player : _ownerToSkeleton.keySet())
|
||||
{
|
||||
if (_images.get(player).equals(damager))
|
||||
if (_ownerToSkeleton.get(player).equals(damager))
|
||||
{
|
||||
event.SetDamager(player);
|
||||
event.setKnockbackOrigin(damager.getLocation());
|
||||
@ -173,12 +187,12 @@ public class PerkWitherImage extends SmashPerk
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Player> playerIterator = _images.keySet().iterator();
|
||||
Iterator<Player> playerIterator = _ownerToSkeleton.keySet().iterator();
|
||||
|
||||
while (playerIterator.hasNext())
|
||||
{
|
||||
Player player = playerIterator.next();
|
||||
Skeleton skel = _images.get(player);
|
||||
Skeleton skel = _ownerToSkeleton.get(player);
|
||||
|
||||
if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160)
|
||||
{
|
||||
@ -195,7 +209,8 @@ public class PerkWitherImage extends SmashPerk
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void clean(PlayerDeathEvent event)
|
||||
{
|
||||
Skeleton skel = _images.remove(event.getEntity());
|
||||
Skeleton skel = _ownerToSkeleton.remove(event.getEntity());
|
||||
_skeletonToOwner.remove(skel);
|
||||
|
||||
if (skel != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user