Merge pull request #149 in MIN/mineplex from bugfix/spectator-infest to develop
* commit 'ace7d1764c68f6ea679ae60b3104d1af96e1869c': Fixed various ways of players going invisible through Spec mode.
This commit is contained in:
commit
ee9e26e8ca
@ -861,6 +861,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
public void Clear(Player player)
|
||||
{
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
player.setSpectatorTarget(null);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setAllowFlight(false);
|
||||
player.setFlySpeed(0.1F);
|
||||
|
@ -8,6 +8,7 @@ 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;
|
||||
@ -481,6 +482,10 @@ public class Paintball extends TeamGame
|
||||
}
|
||||
|
||||
//Settings
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
player.setSpectatorTarget(null);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
((CraftPlayer)player).getHandle().spectating = false;
|
||||
|
@ -9,6 +9,7 @@ import java.util.Set;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -820,6 +821,10 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
}
|
||||
|
||||
// Settings
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
player.setSpectatorTarget(null);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
((CraftPlayer) player).getHandle().spectating = false;
|
||||
|
@ -2,6 +2,19 @@ package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -13,23 +26,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class GameSpectatorManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
@ -228,19 +224,25 @@ public class GameSpectatorManager implements Listener
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(target instanceof Player)
|
||||
Player ptarget = null;
|
||||
if (target instanceof Player)
|
||||
ptarget = (Player) target;
|
||||
|
||||
if (ptarget != null)
|
||||
{
|
||||
if(!Manager.GetGame().IsAlive(target))
|
||||
if (!Manager.GetGame().IsAlive(ptarget))
|
||||
return;
|
||||
}
|
||||
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.setSpectatorTarget(target);
|
||||
if(target instanceof Player)
|
||||
UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) target).getName()), player);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating"));
|
||||
if (ptarget != null)
|
||||
UtilTextBottom.display(C.cGray + "You are spectating " + F.elem(Manager.GetGame().GetTeam(ptarget).GetColor() + ptarget.getName()) + ".", player);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating."));
|
||||
}
|
||||
}, 3);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
|
Loading…
Reference in New Issue
Block a user