Fixing needler, projectiles in SW and "Banannas...".

This commit is contained in:
Sarah 2015-07-30 02:33:06 +02:00
parent aaf4991737
commit de4d0a7dc3
5 changed files with 31 additions and 4 deletions

View File

@ -83,11 +83,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -962,6 +964,9 @@ public abstract class Skywars extends Game
if (event.GetDamage() >= 1) if (event.GetDamage() >= 1)
return; return;
if(GetTeam(event.GetDamagerPlayer(true)) == GetTeam(event.GetDamageePlayer()))
return;
if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball) if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball)
{ {
event.SetCancelled("Egg/Snowball"); event.SetCancelled("Egg/Snowball");
@ -983,6 +988,25 @@ public abstract class Skywars extends Game
} }
} }
@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) private void fillChest(Player looter, Block block)
{ {
_lootedBlocks.add(block.getLocation()); _lootedBlocks.add(block.getLocation());

View File

@ -134,7 +134,7 @@ public class TeamSkywars extends Skywars
private enum TeamColors 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"}), GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}), AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}), 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 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"}), GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}), AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}), 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 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"}), GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}), AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}), RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),

View File

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