Disallow start/stop/kick/setgame while a game is in progress for Donor ranks
This commit is contained in:
parent
857052992d
commit
be591c7d09
@ -1069,6 +1069,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGameInProgress()
|
||||
{
|
||||
return _game != null && _game.InProgress();
|
||||
}
|
||||
|
||||
public boolean isYoutuber(Player player)
|
||||
{
|
||||
return _youtube.contains(player);
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
@ -36,19 +37,49 @@ public class MenuPage extends BasePage
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
ItemStack ownerHead = getOwnerHead();
|
||||
AddButton(4, getOwnerHead(), new PlayerHeadButton(Plugin, this));
|
||||
|
||||
boolean host = _manager.isHost(Player);
|
||||
boolean disableChangeButtons = !ClientManager.Get(Player).GetRank().Has(Rank.YOUTUBE) && Plugin.isGameInProgress();
|
||||
|
||||
StartGameButton startGameButton = new StartGameButton(Plugin);
|
||||
AddButton(host ? 9 : 1 + 9, new ShopItem(Material.EMERALD_BLOCK, "Start Game", new String[] {}, 1, false), startGameButton);
|
||||
|
||||
StopGameButton stopGameButton = new StopGameButton(Plugin);
|
||||
AddButton(host ? 18 : 1 + 18, new ShopItem(Material.REDSTONE_BLOCK, "Stop Game", new String[] {}, 1, false), stopGameButton);
|
||||
|
||||
SetGameButton setGameButton = new SetGameButton(Plugin, Shop);
|
||||
AddButton(host ? 2 + 9 : 3 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton);
|
||||
{
|
||||
// Change Buttons - If a game is in progress and user isn't Youtube+ rank, they cannot
|
||||
// make changes until the game has completed.
|
||||
|
||||
int startSlot = host ? 9 : 1 + 9;
|
||||
int stopSlot = host ? 18 : 1 + 18;
|
||||
int banSlot = host ? 6 + 9 : 7 + 9;
|
||||
int setGameSlot = host ? 2 + 9 : 3 + 9;
|
||||
|
||||
String[] lore = disableChangeButtons ? new String[]{ChatColor.RESET + C.cRed + "Game in Progress. Please Wait"} : new String[]{};
|
||||
ShopItem startItem = new ShopItem(Material.EMERALD_BLOCK, "Start Game", lore, 1, false);
|
||||
ShopItem stopItem = new ShopItem(Material.REDSTONE_BLOCK, "Stop Game", lore, 1, false);
|
||||
ShopItem banItem = new ShopItem(Material.LAVA_BUCKET, "Remove Player", lore, 1, false);
|
||||
ShopItem setGameItem = new ShopItem(Material.BOOK_AND_QUILL, "Set Game", lore, 1, false);
|
||||
|
||||
|
||||
if (disableChangeButtons)
|
||||
{
|
||||
AddItem(startSlot, startItem);
|
||||
AddItem(stopSlot, stopItem);
|
||||
AddItem(banSlot, banItem);
|
||||
AddItem(setGameSlot, setGameItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartGameButton startGameButton = new StartGameButton(Plugin);
|
||||
AddButton(startSlot, startItem, startGameButton);
|
||||
|
||||
StopGameButton stopGameButton = new StopGameButton(Plugin);
|
||||
AddButton(stopSlot, stopItem, stopGameButton);
|
||||
|
||||
BanButton banButton = new BanButton(Plugin, Shop);
|
||||
AddButton(banSlot, banItem, banButton);
|
||||
|
||||
SetGameButton setGameButton = new SetGameButton(Plugin, Shop);
|
||||
AddButton(setGameSlot, setGameItem, setGameButton);
|
||||
}
|
||||
}
|
||||
|
||||
EditRotationButton editRotationButton = new EditRotationButton(Plugin, Shop);
|
||||
AddButton(host ? 2 + 18 : 3 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton);
|
||||
@ -69,9 +100,6 @@ public class MenuPage extends BasePage
|
||||
OptionsButton optionsButton = new OptionsButton(Plugin, Shop);
|
||||
AddButton(host ? 8 + 9 : 5 + 9, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton);
|
||||
|
||||
BanButton banButton = new BanButton(Plugin, Shop);
|
||||
AddButton(host ? 6 + 9 : 7 + 9, new ShopItem(Material.LAVA_BUCKET, "Remove Player", new String[] {}, 1, false), banButton);
|
||||
|
||||
UnbanButton unbanButton = new UnbanButton(Plugin, Shop);
|
||||
AddButton(host ? 6 + 18 : 7 + 18, new ShopItem(Material.WATER_BUCKET, "Un-Remove Player", new String[] {}, 1, false), unbanButton);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user