Removing right clicking.

This commit is contained in:
Sarah 2016-01-25 07:45:38 +01:00
parent f722831e6a
commit 31ef7ffe19

View File

@ -6,7 +6,6 @@ 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;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -23,10 +22,10 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -53,10 +52,10 @@ public class GameSpectatorManager implements Listener
if (!Manager.GetGame().IsAlive(player)) if (!Manager.GetGame().IsAlive(player))
event.setCancelled(true); event.setCancelled(true);
//processClick(player, event.getAction()); processClick(player, event.getAction());
} }
/*public void processClick(Player player, Action action) public void processClick(Player player, Action action)
{ {
if (Manager.GetGame() == null) if (Manager.GetGame() == null)
return; return;
@ -87,6 +86,8 @@ public class GameSpectatorManager implements Listener
if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK)
currentPlayer = currentPlayer - 2; currentPlayer = currentPlayer - 2;
else
return;
if(currentPlayer < 0) if(currentPlayer < 0)
currentPlayer = players.size() - 1; currentPlayer = players.size() - 1;
@ -100,7 +101,7 @@ public class GameSpectatorManager implements Listener
Player specPlayer = players.get(currentPlayer); Player specPlayer = players.get(currentPlayer);
setSpectating(player, specPlayer); setSpectating(player, specPlayer);
}*/ }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void interactEntityCancel(PlayerInteractEntityEvent event) public void interactEntityCancel(PlayerInteractEntityEvent event)
@ -126,13 +127,6 @@ public class GameSpectatorManager implements Listener
if(Manager.GetGame().AllowEntitySpectate) if(Manager.GetGame().AllowEntitySpectate)
{ {
setSpectating(player, event.getRightClicked()); setSpectating(player, event.getRightClicked());
// player.setGameMode(GameMode.SPECTATOR);
// player.setSpectatorTarget(event.getRightClicked());
// UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating"));
// if(event.getRightClicked() instanceof Player)
// {
// UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) event.getRightClicked()).getName()), player);
// }
} }
} }
} }
@ -161,10 +155,6 @@ public class GameSpectatorManager implements Listener
{ {
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(true); player.setAllowFlight(true);
for(int i = 1; i <= 7; i++)
{
player.getInventory().setItem(i, null);
}
} }
} }
} }
@ -198,10 +188,6 @@ public class GameSpectatorManager implements Listener
} }
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(true); player.setAllowFlight(true);
for(int i = 1; i <= 7; i++)
{
player.getInventory().setItem(i, null);
}
} }
} }
} }
@ -226,10 +212,6 @@ public class GameSpectatorManager implements Listener
{ {
event.getPlayer().setGameMode(GameMode.SURVIVAL); event.getPlayer().setGameMode(GameMode.SURVIVAL);
event.getPlayer().setAllowFlight(true); event.getPlayer().setAllowFlight(true);
for(int i = 1; i <= 7; i++)
{
event.getPlayer().getInventory().setItem(i, null);
}
} }
} }
} }
@ -241,10 +223,6 @@ public class GameSpectatorManager implements Listener
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
player.teleport(target.getLocation().add(0, 1, 0)); player.teleport(target.getLocation().add(0, 1, 0));
player.getInventory().setHeldItemSlot(5); player.getInventory().setHeldItemSlot(5);
for(int i = 1; i <= 7; i++)
{
player.getInventory().setItem(i, new ItemStack(Material.STONE));
}
Manager.runSyncLater(new Runnable() Manager.runSyncLater(new Runnable()
{ {
@Override @Override