Merge pull request #67 in MIN/mineplex from thanos-bug-fixes to master
* commit '2504493ebc9cc9b0043d7a64f949f2237ba71381': Fixed four super paintball bugs.
This commit is contained in:
commit
80bc493b6f
@ -4,17 +4,44 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
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.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EnderPearl;
|
import org.bukkit.entity.EnderPearl;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
@ -22,9 +49,11 @@ import org.bukkit.entity.ThrownPotion;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
@ -34,31 +63,6 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
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 class Paintball extends TeamGame
|
||||||
{
|
{
|
||||||
public static class ReviveEvent extends PlayerEvent
|
public static class ReviveEvent extends PlayerEvent
|
||||||
@ -137,7 +141,6 @@ public class Paintball extends TeamGame
|
|||||||
this.GetTeamList().get(1).SetName("Nether");
|
this.GetTeamList().get(1).SetName("Nether");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void ColorArmor(PlayerPrepareTeleportEvent event)
|
public void ColorArmor(PlayerPrepareTeleportEvent event)
|
||||||
{
|
{
|
||||||
@ -161,31 +164,44 @@ public class Paintball extends TeamGame
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void Paint(ProjectileHitEvent event)
|
public void Paint(ProjectileHitEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof ThrownPotion)
|
// Fixed projectile wool painting in waiting lobby.
|
||||||
return;
|
|
||||||
|
|
||||||
byte color = 3;
|
if (IsLive() || GetState() == GameState.End)
|
||||||
if (event.getEntity() instanceof EnderPearl)
|
|
||||||
color = 14;
|
|
||||||
|
|
||||||
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
|
|
||||||
|
|
||||||
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
|
|
||||||
{
|
{
|
||||||
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY)
|
if (event.getEntity() instanceof ThrownPotion)
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
|
byte color = 3;
|
||||||
|
if (event.getEntity() instanceof EnderPearl)
|
||||||
|
color = 14;
|
||||||
|
|
||||||
|
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
|
||||||
|
|
||||||
|
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
|
||||||
|
{
|
||||||
|
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
block.setData(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
|
||||||
|
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
|
||||||
|
|
||||||
block.setData(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
|
|
||||||
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerQuit(PlayerQuitEvent event)
|
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
|
@EventHandler
|
||||||
@ -194,7 +210,9 @@ public class Paintball extends TeamGame
|
|||||||
if (event.GetDamageePlayer() == null)
|
if (event.GetDamageePlayer() == null)
|
||||||
event.SetCancelled("Not Player");
|
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");
|
event.SetCancelled("No Projectile");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +221,7 @@ public class Paintball extends TeamGame
|
|||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.GetProjectile() == null)
|
if (event.GetProjectile() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -211,23 +229,28 @@ public class Paintball extends TeamGame
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Negate
|
//Negate
|
||||||
|
|
||||||
event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false);
|
event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false);
|
||||||
|
|
||||||
event.AddMod("Paintball", "Paintball", 2, true);
|
event.AddMod("Paintball", "Paintball", 2, true);
|
||||||
event.AddKnockback("Paintball", 2);
|
event.AddKnockback("Paintball", 2);
|
||||||
|
|
||||||
Player damagee = event.GetDamageePlayer();
|
Player damagee = event.GetDamageePlayer();
|
||||||
if (damagee == null) return;
|
if (damagee == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Player damager = event.GetDamagerPlayer(true);
|
Player damager = event.GetDamagerPlayer(true);
|
||||||
if (damager == null) return;
|
if (damager == null)
|
||||||
|
return;
|
||||||
|
|
||||||
GameTeam damageeTeam = GetTeam(damagee);
|
GameTeam damageeTeam = GetTeam(damagee);
|
||||||
if (damageeTeam == null) return;
|
if (damageeTeam == null)
|
||||||
|
return;
|
||||||
|
|
||||||
GameTeam damagerTeam = GetTeam(damager);
|
GameTeam damagerTeam = GetTeam(damager);
|
||||||
if (damagerTeam == null) return;
|
if (damagerTeam == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (damagerTeam.equals(damageeTeam))
|
if (damagerTeam.equals(damageeTeam))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -257,8 +280,21 @@ public class Paintball extends TeamGame
|
|||||||
Player player = event.GetDamagerPlayer(true);
|
Player player = event.GetDamagerPlayer(true);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
|
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)
|
public boolean Color(Player player, int amount)
|
||||||
{
|
{
|
||||||
//Get Non-Coloured
|
//Get Non-Coloured
|
||||||
|
Loading…
Reference in New Issue
Block a user