Allow QA and Admin+ to force deathmatch in test servers
This commit is contained in:
parent
f41e9a4e2c
commit
90b129dd64
@ -80,6 +80,8 @@ import org.bukkit.scoreboard.Team;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.Managers;
|
import mineplex.core.Managers;
|
||||||
|
import mineplex.core.account.permissions.Permission;
|
||||||
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
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.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
@ -174,6 +176,11 @@ public abstract class SurvivalGames extends Game
|
|||||||
|
|
||||||
private int _chestRefillTime = 60 * 7;
|
private int _chestRefillTime = 60 * 7;
|
||||||
|
|
||||||
|
public enum Perm implements Permission
|
||||||
|
{
|
||||||
|
FORCE_DEATHMATCH
|
||||||
|
}
|
||||||
|
|
||||||
public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
|
public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
|
||||||
{
|
{
|
||||||
this(manager, new Kit[]
|
this(manager, new Kit[]
|
||||||
@ -286,6 +293,12 @@ public abstract class SurvivalGames extends Game
|
|||||||
|
|
||||||
new WinStreakModule()
|
new WinStreakModule()
|
||||||
.register(this);
|
.register(this);
|
||||||
|
|
||||||
|
if (UtilServer.isTestServer())
|
||||||
|
{
|
||||||
|
PermissionGroup.ADMIN.setPermission(Perm.FORCE_DEATHMATCH, true, true);
|
||||||
|
PermissionGroup.QA.setPermission(Perm.FORCE_DEATHMATCH, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -567,6 +580,10 @@ public abstract class SurvivalGames extends Game
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
// If the player cannot force deathmatch, do the normal checks,
|
||||||
|
// otherwise ignore these
|
||||||
|
if (!Manager.GetClients().Get(event.getPlayer()).hasPermission(Perm.FORCE_DEATHMATCH))
|
||||||
|
{
|
||||||
if (!IsAlive(event.getPlayer()))
|
if (!IsAlive(event.getPlayer()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(),
|
UtilPlayer.message(event.getPlayer(),
|
||||||
@ -587,6 +604,7 @@ public abstract class SurvivalGames extends Game
|
|||||||
F.main("Game", "Deathmatch cannot be started now."));
|
F.main("Game", "Deathmatch cannot be started now."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Announce(C.cGreen + C.Bold + event.getPlayer().getName()
|
Announce(C.cGreen + C.Bold + event.getPlayer().getName()
|
||||||
+ " has initiated Deathmatch!");
|
+ " has initiated Deathmatch!");
|
||||||
|
Loading…
Reference in New Issue
Block a user