Added small cooldown to be able to click hub clock after your gamestate changes. (prevents accidental clicking)
Moved stat stuff to gamemanager.
This commit is contained in:
parent
767a0247a6
commit
9fce0b1926
@ -1184,23 +1184,7 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.End)
|
||||
{
|
||||
for (StatTracker tracker : getStatTrackers())
|
||||
HandlerList.unregisterAll(tracker);
|
||||
|
||||
if (CanAddStats)
|
||||
{
|
||||
Manager.saveBasicStats(this);
|
||||
|
||||
if (Manager.IsTournamentServer())
|
||||
Manager.saveLeaderboardStats(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Collection<StatTracker<? extends Game>> getStatTrackers()
|
||||
{
|
||||
|
@ -26,6 +26,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
@ -36,6 +37,7 @@ import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class GameManager implements Listener
|
||||
@ -316,6 +318,24 @@ public class GameManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void StatGameRecord(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.End)
|
||||
{
|
||||
for (StatTracker tracker : event.GetGame().getStatTrackers())
|
||||
HandlerList.unregisterAll(tracker);
|
||||
|
||||
if (event.GetGame().CanAddStats)
|
||||
{
|
||||
Manager.saveBasicStats(event.GetGame());
|
||||
|
||||
if (Manager.IsTournamentServer())
|
||||
Manager.saveLeaderboardStats(event.GetGame());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ScoreboardTitle(UpdateEvent event)
|
||||
{
|
||||
|
@ -26,10 +26,12 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
@ -139,6 +141,12 @@ public class GamePlayerManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerStateChange(PlayerStateChangeEvent event)
|
||||
{
|
||||
Recharge.Instance.useForce(event.GetPlayer(), "Return to Hub", 4000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void InventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -148,6 +149,9 @@ public class MiscManager implements Listener
|
||||
if (player.getItemInHand().getType() != Material.WATCH)
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.usable(event.getPlayer(), "Return to Hub"))
|
||||
return;
|
||||
|
||||
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user