Killing cheaters for a few things in bridges

This commit is contained in:
Chiss 2014-08-24 16:45:47 +10:00
parent 642f8b46b9
commit 3f5cff3e21
4 changed files with 98 additions and 21 deletions

View File

@ -287,9 +287,9 @@ public class MapParser extends JavaPlugin implements Listener
for (Player player : UtilServer.getPlayers())
{
player.sendMessage(C.cGold + msg);
System.out.println("[Announce] " + msg);
}
System.out.println("[Announce] " + msg);
}
public boolean DoesMapExist(String mapName, GameType gameType)

View File

@ -680,6 +680,9 @@ public abstract class Game implements Listener
public GameTeam GetTeam(Player player)
{
if (player == null)
return null;
for (GameTeam team : _teamList)
if (team.HasPlayer(player))
return team;

View File

@ -39,6 +39,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -48,6 +49,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -343,24 +345,7 @@ public class Bridge extends TeamGame implements OreObsfucation
}
}
@EventHandler
public void ChestDeny(BlockBreakEvent event)
{
if (_bridgesDown)
return;
if (event.getBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getBlock()))
{
event.setCancelled(true);
return;
}
}
}
private void ParseOre(ArrayList<Location> teamOre)
{
@ -1038,6 +1023,8 @@ public class Bridge extends TeamGame implements OreObsfucation
blockIterator.remove();
}
}
@EventHandler(priority = EventPriority.LOW)
public void BucketEmpty(PlayerBucketEmptyEvent event)
@ -1363,4 +1350,91 @@ public class Bridge extends TeamGame implements OreObsfucation
{
return _bridgesDown;
}
@EventHandler
public void CheatChestBreak(BlockBreakEvent event)
{
if (_bridgesDown)
return;
if (event.getBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getBlock()))
{
cheaterKill(event.getPlayer());
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void CheatChestInteract(PlayerInteractEvent event)
{
if (_bridgesDown)
return;
if (event.getClickedBlock() == null)
return;
if (event.getClickedBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getClickedBlock()))
{
cheaterKill(event.getPlayer());
event.setCancelled(true);
return;
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void PreBridgeDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (_bridgesDown || event.GetProjectile() != null)
return;
GameTeam damageeTeam = GetTeam(event.GetDamageePlayer());
GameTeam damagerTeam = GetTeam(event.GetDamagerPlayer(false));
if (damageeTeam == null || damagerTeam == null)
return;
if (damageeTeam.equals(damagerTeam))
return;
Player damagee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(false);
//Damagee is closer to Damagers Island
if (UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns())) >
UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns())))
{
cheaterKill(damagee);
}
//Damagee is closer to Damagees Island
if (UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns())) >
UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns())))
{
cheaterKill(damager);
}
}
public void cheaterKill(Player player)
{
Announce(C.Bold + player.getName() + " was killed for cheating!");
_usedLife.add(player.getName());
player.damage(9999);
}
}

View File

@ -34,7 +34,7 @@ public class QuiverTeams extends TeamGame
private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>();
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
private int _reqKills = 6;
private int _reqKills = 60;
public QuiverTeams(ArcadeManager manager)
{