Event update

This commit is contained in:
Cheese 2015-03-06 19:43:17 +11:00
parent e62d9774a9
commit 0336df55aa
4 changed files with 71 additions and 7 deletions

View File

@ -648,7 +648,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.getOpenInventory().getType() != InventoryType.CREATIVE)
return;
if (!UtilGear.isMat(player.getInventory().getItem(8), Material.WATCH))
if (!UtilGear.isMat(player.getInventory().getItem(8), Material.WATCH) && !UtilGear.isMat(player.getInventory().getItem(8), Material.SPECKLED_MELON))
{
player.getInventory().setItem(
8,

View File

@ -36,6 +36,7 @@ import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.event.kits.*;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -82,6 +83,9 @@ public class EventGame extends SoloGame
this.TeleportsDisqualify = false;
this.PrepareFreeze = false;
//Dont timeout
this.GameTimeout = -1;
_mps = manager.GetGameHostManager();
}
@ -89,7 +93,48 @@ public class EventGame extends SoloGame
@EventHandler
public void playerJoinTeam(PlayerJoinEvent event)
{
//Put onto team and spawn
joinTeam(event.getPlayer());
}
@EventHandler
public void spectatorsJoinGame(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (!GetTeamList().get(0).HasPlayer(player))
{
joinTeam(player);
}
}
}
public void joinTeam(Player player)
{
//Set Team
SetPlayerTeam(player, GetTeamList().get(0), true);
//Kit
SetKit(player, GetKits()[0], true);
GetKits()[0].ApplyKit(player);
//Refresh
for (Player other : UtilServer.getPlayers())
{
other.hidePlayer(player);
other.showPlayer(player);
}
//Spawn
GetTeamList().get(0).SpawnTeleport(player);
//GameMode
player.setGameMode(GameMode.SURVIVAL);
}
//Help
@ -113,6 +158,9 @@ public class EventGame extends SoloGame
@EventHandler(priority = EventPriority.LOWEST)
public void commandHandler(PlayerCommandPreprocessEvent event)
{
if (!InProgress())
return;
if (!event.getMessage().toLowerCase().startsWith("/e "))
return;
@ -465,6 +513,9 @@ public class EventGame extends SoloGame
@EventHandler
public void forcefieldUpdate(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.FASTER)
return;
@ -504,6 +555,9 @@ public class EventGame extends SoloGame
@EventHandler
public void updateVisibility(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.FAST)
return;
@ -526,6 +580,8 @@ public class EventGame extends SoloGame
}
}
@Override
public void EndCheck()
{
@ -556,4 +612,12 @@ public class EventGame extends SoloGame
Scoreboard.Draw();
}
//This re-enables cosmetic hotbar, because MPS disables it
@EventHandler(priority = EventPriority.MONITOR)
public void fixHotbarItemTemp(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().startsWith("/sethost"))
Manager.GetServerConfig().HotbarInventory = true;
}
}

View File

@ -209,21 +209,21 @@ public class GameHostManager implements Listener
if (Manager.GetGame() == null)
return;
if (UtilGear.isMat(player.getInventory().getItem(7), Material.SPECKLED_MELON))
if (UtilGear.isMat(player.getInventory().getItem(8), Material.SPECKLED_MELON))
return;
if (player.getOpenInventory().getType() != InventoryType.CRAFTING &&
player.getOpenInventory().getType() != InventoryType.CREATIVE)
return;
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.SPECKLED_MELON, (byte)0, 1, C.cGreen + C.Bold + "/menu"));
player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.SPECKLED_MELON, (byte)0, 1, C.cGreen + C.Bold + "/menu"));
}
private void removeAdminItem(Player player)
{
if (player.getInventory().getItem(7).getType() == Material.SPECKLED_MELON)
if (player.getInventory().getItem(8).getType() == Material.SPECKLED_MELON)
{
player.getInventory().setItem(7, null);
player.getInventory().setItem(8, null);
}
}

View File

@ -201,7 +201,7 @@ public class GameManager implements Listener
}
else if (game.GetState() == GameState.Live)
{
if (UtilTime.elapsed(game.GetStateTime(), game.GameTimeout) && Manager.IsGameTimeout())
if (game.GameTimeout != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout) && Manager.IsGameTimeout())
{
game.HandleTimeout();
}