Merge branch 'SSM2PlayerTeams'

This commit is contained in:
Mini-Chiss 2015-07-30 08:42:50 +02:00
commit 8ef93c0b33
5 changed files with 31 additions and 4 deletions

View File

@ -80,11 +80,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
@ -957,6 +959,9 @@ public abstract class Skywars extends Game
if (event.GetDamage() >= 1)
return;
if(GetTeam(event.GetDamagerPlayer(true)) == GetTeam(event.GetDamageePlayer()))
return;
if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball)
{
event.SetCancelled("Egg/Snowball");
@ -977,6 +982,25 @@ public abstract class Skywars extends Game
event.GetDamageeEntity().setVelocity(vel);
}
}
@EventHandler
public void projectile(EntityDamageByEntityEvent event)
{
if(event.getDamager() instanceof Snowball || event.getDamager() instanceof Egg || event.getDamager() instanceof EnderPearl)
{
Projectile prj = (Projectile) event.getDamager();
if(prj.getShooter() instanceof Player)
{
if(event.getEntity() instanceof Player)
{
if(GetTeam((Player) prj.getShooter()) == GetTeam((Player) event.getEntity()))
{
event.setCancelled(true);
}
}
}
}
}
private void fillChest(Player looter, Block block)
{

View File

@ -134,7 +134,7 @@ public class TeamSkywars extends Skywars
private enum TeamColors
{
YELLOW(ChatColor.YELLOW, new String[]{"Bananna", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),

View File

@ -153,7 +153,7 @@ public class TeamSuperSmash extends SuperSmash
private enum TeamColors
{
YELLOW(ChatColor.YELLOW, new String[]{"Bananna", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),

View File

@ -106,7 +106,7 @@ public class TeamSurvivalGames extends SurvivalGames
private enum TeamColors
{
YELLOW(ChatColor.YELLOW, new String[]{"Bananna", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),

View File

@ -131,7 +131,10 @@ public class PerkNeedler extends SmashPerk
DamageCause.THORNS, 1.1, true, true, false,
damager.getName(), GetName());
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
if(Manager.GetGame().GetTeam(event.GetDamageePlayer()) != Manager.GetGame().GetTeam(damager))
{
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
}
}
@EventHandler