Fixed various ways of players going invisible through Spec mode.
This commit is contained in:
parent
852f96a314
commit
ace7d1764c
@ -861,6 +861,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
|
|
||||||
public void Clear(Player player)
|
public void Clear(Player player)
|
||||||
{
|
{
|
||||||
|
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||||
|
player.setSpectatorTarget(null);
|
||||||
|
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlySpeed(0.1F);
|
player.setFlySpeed(0.1F);
|
||||||
|
@ -8,6 +8,7 @@ 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;
|
||||||
@ -481,6 +482,10 @@ public class Paintball extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
|
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||||
|
player.setSpectatorTarget(null);
|
||||||
|
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
((CraftPlayer)player).getHandle().spectating = false;
|
((CraftPlayer)player).getHandle().spectating = false;
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
|
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;
|
||||||
@ -820,6 +821,10 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||||
|
player.setSpectatorTarget(null);
|
||||||
|
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
((CraftPlayer) player).getHandle().spectating = false;
|
((CraftPlayer) player).getHandle().spectating = false;
|
||||||
|
@ -2,6 +2,19 @@ package nautilus.game.arcade.managers;
|
|||||||
|
|
||||||
import java.util.List;
|
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.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilMath;
|
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.ArcadeManager;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
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
|
public class GameSpectatorManager implements Listener
|
||||||
{
|
{
|
||||||
ArcadeManager Manager;
|
ArcadeManager Manager;
|
||||||
@ -228,19 +224,25 @@ public class GameSpectatorManager implements Listener
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
player.setSpectatorTarget(target);
|
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)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
Loading…
Reference in New Issue
Block a user