Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-10-04 00:24:11 -05:00
commit f9ea325da1

View File

@ -4,17 +4,44 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun;
import nautilus.game.arcade.game.games.paintball.kits.KitRifle;
import nautilus.game.arcade.game.games.paintball.kits.KitShotgun;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
@ -22,9 +49,11 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
@ -34,31 +63,6 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.LastStandStatTracker;
import nautilus.game.arcade.stats.MedicStatTracker;
import nautilus.game.arcade.stats.WinFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class Paintball extends TeamGame
{
public static class ReviveEvent extends PlayerEvent
@ -137,7 +141,6 @@ public class Paintball extends TeamGame
this.GetTeamList().get(1).SetName("Nether");
}
@EventHandler(priority = EventPriority.HIGHEST)
public void ColorArmor(PlayerPrepareTeleportEvent event)
{
@ -160,6 +163,10 @@ public class Paintball extends TeamGame
@EventHandler
public void Paint(ProjectileHitEvent event)
{
// Fixed projectile wool painting in waiting lobby.
if (IsLive() || GetState() == GameState.End)
{
if (event.getEntity() instanceof ThrownPotion)
return;
@ -180,12 +187,21 @@ public class Paintball extends TeamGame
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
}
}
@EventHandler
public void PlayerQuit(PlayerQuitEvent event)
{
_doubles.remove(event.getPlayer());
Player player = event.getPlayer();
if (_doubles.containsKey(player))
{
PlayerCopy copy = _doubles.get(player);
copy.GetEntity().remove();
_doubles.remove(player);
}
}
@EventHandler
@ -194,7 +210,9 @@ public class Paintball extends TeamGame
if (event.GetDamageePlayer() == null)
event.SetCancelled("Not Player");
if (event.GetProjectile() == null)
// Fixed void damage being blocked from this check.
if (event.GetProjectile() == null && event.GetCause() != DamageCause.VOID)
event.SetCancelled("No Projectile");
}
@ -211,22 +229,27 @@ public class Paintball extends TeamGame
return;
//Negate
event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Paintball", "Paintball", 2, true);
event.AddKnockback("Paintball", 2);
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (damagee == null)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (damager == null)
return;
GameTeam damageeTeam = GetTeam(damagee);
if (damageeTeam == null) return;
if (damageeTeam == null)
return;
GameTeam damagerTeam = GetTeam(damager);
if (damagerTeam == null) return;
if (damagerTeam == null)
return;
if (damagerTeam.equals(damageeTeam))
return;
@ -259,6 +282,19 @@ public class Paintball extends TeamGame
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
}
@EventHandler
public void ArmorRemoveCancel(InventoryClickEvent event)
{
HumanEntity player = event.getWhoClicked();
// Fixed armor being taken off while spectating after being painted.
if (!IsAlive(player))
{
event.setCancelled(true);
}
}
public boolean Color(Player player, int amount)
{
//Get Non-Coloured