MPS updates
This commit is contained in:
parent
4a50e3ae62
commit
2472ca95ec
@ -0,0 +1,33 @@
|
|||||||
|
package nautilus.game.arcade.gui.privateServer.button;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.shop.item.IButton;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
|
public class StartGameButton implements IButton
|
||||||
|
{
|
||||||
|
private ArcadeManager _arcadeManager;
|
||||||
|
|
||||||
|
public StartGameButton(ArcadeManager arcadeManager)
|
||||||
|
{
|
||||||
|
_arcadeManager = arcadeManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
if (_arcadeManager.GetGame().GetState() != GameState.Recruit)
|
||||||
|
{
|
||||||
|
player.sendMessage("Game is already in progress...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_arcadeManager.GetGameManager().StateCountdown(_arcadeManager.GetGame(), 20, true);
|
||||||
|
|
||||||
|
_arcadeManager.GetGame().Announce(C.cDGreen + C.Bold + player.getName() + " has started the game.");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package nautilus.game.arcade.gui.privateServer.button;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.shop.item.IButton;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
|
public class StopGameButton implements IButton
|
||||||
|
{
|
||||||
|
private ArcadeManager _arcadeManager;
|
||||||
|
|
||||||
|
public StopGameButton(ArcadeManager arcadeManager)
|
||||||
|
{
|
||||||
|
_arcadeManager = arcadeManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
if (_arcadeManager.GetGame().GetState() == GameState.End || _arcadeManager.GetGame().GetState() == GameState.End)
|
||||||
|
{
|
||||||
|
player.sendMessage("Game is already ending...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (_arcadeManager.GetGame().GetState() == GameState.Recruit)
|
||||||
|
{
|
||||||
|
_arcadeManager.GetGame().SetState(GameState.Dead);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_arcadeManager.GetGame().SetState(GameState.End);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_arcadeManager.GetGame().Announce(C.cDGreen + C.Bold + player.getName() + " has stopped the game.");
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,8 @@ import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
|
|||||||
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
|
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
|
||||||
import nautilus.game.arcade.gui.privateServer.button.SetGameButton;
|
import nautilus.game.arcade.gui.privateServer.button.SetGameButton;
|
||||||
import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
|
import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
|
||||||
|
import nautilus.game.arcade.gui.privateServer.button.StartGameButton;
|
||||||
|
import nautilus.game.arcade.gui.privateServer.button.StopGameButton;
|
||||||
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
|
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
|
||||||
|
|
||||||
public class MenuPage extends BasePage
|
public class MenuPage extends BasePage
|
||||||
@ -29,17 +31,23 @@ public class MenuPage extends BasePage
|
|||||||
ItemStack ownerHead = getOwnerHead();
|
ItemStack ownerHead = getOwnerHead();
|
||||||
setItem(4, ownerHead);
|
setItem(4, ownerHead);
|
||||||
|
|
||||||
|
StartGameButton startGameButton = new StartGameButton(Plugin);
|
||||||
|
AddButton(1 + 9, new ShopItem(Material.EMERALD_BLOCK, "Start Game", new String[] {}, 1, false), startGameButton);
|
||||||
|
|
||||||
|
StopGameButton stopGameButton = new StopGameButton(Plugin);
|
||||||
|
AddButton(1 + 18, new ShopItem(Material.REDSTONE_BLOCK, "Stop Game", new String[] {}, 1, false), stopGameButton);
|
||||||
|
|
||||||
SetGameButton setGameButton = new SetGameButton(Plugin, Shop);
|
SetGameButton setGameButton = new SetGameButton(Plugin, Shop);
|
||||||
AddButton(1 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton);
|
AddButton(3 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton);
|
||||||
|
|
||||||
EditRotationButton editRotationButton = new EditRotationButton(Plugin, Shop);
|
EditRotationButton editRotationButton = new EditRotationButton(Plugin, Shop);
|
||||||
AddButton(1 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton);
|
AddButton(3 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton);
|
||||||
|
|
||||||
GiveAdminButton giveAdminButton = new GiveAdminButton(Plugin, Shop);
|
GiveAdminButton giveAdminButton = new GiveAdminButton(Plugin, Shop);
|
||||||
AddButton(3 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[] {}, 1, false), giveAdminButton);
|
AddButton(5 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[] {}, 1, false), giveAdminButton);
|
||||||
|
|
||||||
OptionsButton optionsButton = new OptionsButton(Plugin, Shop);
|
OptionsButton optionsButton = new OptionsButton(Plugin, Shop);
|
||||||
AddButton(5 + 9, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton);
|
AddButton(5 + 18, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton);
|
||||||
|
|
||||||
BanButton banButton = new BanButton(Plugin, Shop);
|
BanButton banButton = new BanButton(Plugin, Shop);
|
||||||
AddButton(7 + 9, new ShopItem(Material.LAVA_BUCKET, "Ban Player", new String[] {}, 1, false), banButton);
|
AddButton(7 + 9, new ShopItem(Material.LAVA_BUCKET, "Ban Player", new String[] {}, 1, false), banButton);
|
||||||
|
@ -61,15 +61,28 @@ public class GameChatManager implements Listener
|
|||||||
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
|
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
|
||||||
|
|
||||||
//Level
|
//Level
|
||||||
String levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank);
|
String levelStr = "";
|
||||||
|
if (!Manager.GetGameHostManager().isPrivateServer())
|
||||||
|
levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank);
|
||||||
|
|
||||||
//Rank Prefix
|
|
||||||
String rankStr = "";
|
String rankStr = "";
|
||||||
|
//Rank Prefix & MPS Host Prefix
|
||||||
|
if (Manager.GetGameHostManager().isHost(event.getPlayer()))
|
||||||
|
{
|
||||||
|
rankStr = C.cDGreen + "MPS HOST ";
|
||||||
|
}
|
||||||
|
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer()))
|
||||||
|
{
|
||||||
|
rankStr = C.cDGreen + "MPS ADMIN ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (rank != Rank.ALL)
|
if (rank != Rank.ALL)
|
||||||
rankStr = rank.GetTag(true, true) + " ";
|
rankStr = rank.GetTag(true, true) + " ";
|
||||||
|
|
||||||
if (ownsUltra && !rank.Has(Rank.ULTRA))
|
if (ownsUltra && !rank.Has(Rank.ULTRA))
|
||||||
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
|
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
|
||||||
|
}
|
||||||
|
|
||||||
//Base Format
|
//Base Format
|
||||||
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
|
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
|
||||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
@ -9,6 +10,7 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -20,6 +22,7 @@ import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -57,6 +60,27 @@ public class GameHostManager implements Listener
|
|||||||
_shop = new PrivateServerShop(manager, manager.GetClients(), manager.GetDonation());
|
_shop = new PrivateServerShop(manager, manager.GetClients(), manager.GetDonation());
|
||||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||||
|
|
||||||
|
//Game Rotation
|
||||||
|
if (Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate) ||
|
||||||
|
Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate))
|
||||||
|
{
|
||||||
|
Iterator<GameType> gameIterator = Manager.GetServerConfig().GameList.iterator();
|
||||||
|
|
||||||
|
//Remove Non-Champion Games
|
||||||
|
while (gameIterator.hasNext())
|
||||||
|
{
|
||||||
|
GameType type = gameIterator.next();
|
||||||
|
|
||||||
|
if (type != GameType.ChampionsDominate && type != GameType.ChampionsDominate)
|
||||||
|
gameIterator.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Hero Games
|
||||||
|
heroGames.add(GameType.ChampionsDominate);
|
||||||
|
heroGames.add(GameType.ChampionsTDM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//Ultra Games
|
//Ultra Games
|
||||||
ultraGames.add(GameType.Smash);
|
ultraGames.add(GameType.Smash);
|
||||||
ultraGames.add(GameType.BaconBrawl);
|
ultraGames.add(GameType.BaconBrawl);
|
||||||
@ -74,8 +98,6 @@ public class GameHostManager implements Listener
|
|||||||
ultraGames.add(GameType.Spleef);
|
ultraGames.add(GameType.Spleef);
|
||||||
|
|
||||||
//Hero Games
|
//Hero Games
|
||||||
heroGames.add(GameType.ChampionsDominate);
|
|
||||||
heroGames.add(GameType.ChampionsTDM);
|
|
||||||
heroGames.add(GameType.HideSeek);
|
heroGames.add(GameType.HideSeek);
|
||||||
heroGames.add(GameType.Draw);
|
heroGames.add(GameType.Draw);
|
||||||
|
|
||||||
@ -84,10 +106,14 @@ public class GameHostManager implements Listener
|
|||||||
legendGames.add(GameType.SurvivalGames);
|
legendGames.add(GameType.SurvivalGames);
|
||||||
legendGames.add(GameType.CastleSiege);
|
legendGames.add(GameType.CastleSiege);
|
||||||
legendGames.add(GameType.MineStrike);
|
legendGames.add(GameType.MineStrike);
|
||||||
|
}
|
||||||
|
|
||||||
_blacklist.add("Chiss");
|
|
||||||
_blacklist.add("defek7");
|
Manager.GetServerConfig().HotbarInventory = false;
|
||||||
_blacklist.add("Ayreloc");
|
Manager.GetServerConfig().RewardAchievements = false;
|
||||||
|
Manager.GetServerConfig().RewardGems = false;
|
||||||
|
Manager.GetServerConfig().RewardItems = false;
|
||||||
|
Manager.GetServerConfig().RewardStats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -100,20 +126,16 @@ public class GameHostManager implements Listener
|
|||||||
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
|
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Host Update
|
// Admins update
|
||||||
if (_host != null)
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
giveAdminItem(_host);
|
if (player.equals(_host) || _adminList.contains(player.getName()) || Manager.GetClients().Get(player).GetRank().Has(Rank.SNR_MODERATOR))
|
||||||
|
{
|
||||||
|
if (Manager.GetGame() == null || Manager.GetGame().GetState() == GameState.Recruit)
|
||||||
|
giveAdminItem(player);
|
||||||
|
|
||||||
_lastOnline = System.currentTimeMillis();
|
_lastOnline = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admins update
|
|
||||||
for (Player admin : _onlineAdmins)
|
|
||||||
{
|
|
||||||
giveAdminItem(admin);
|
|
||||||
|
|
||||||
_lastOnline = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +191,7 @@ public class GameHostManager implements Listener
|
|||||||
if (UtilGear.isMat(player.getInventory().getItem(5), Material.BOOK_AND_QUILL))
|
if (UtilGear.isMat(player.getInventory().getItem(5), Material.BOOK_AND_QUILL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.BOOK, (byte)0, 1, C.cGreen + C.Bold + "/menu"));
|
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte)0, 1, C.cGreen + C.Bold + "/menu"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<String> getWhitelist()
|
public HashSet<String> getWhitelist()
|
||||||
@ -205,7 +227,7 @@ public class GameHostManager implements Listener
|
|||||||
if (!isAdmin(event.getPlayer()))
|
if (!isAdmin(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UtilGear.isMat(_host.getItemInHand(), Material.BOOK))
|
if (!UtilGear.isMat(_host.getItemInHand(), Material.BLAZE_POWDER))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
openMenu(event.getPlayer());
|
openMenu(event.getPlayer());
|
||||||
@ -224,7 +246,7 @@ public class GameHostManager implements Listener
|
|||||||
|
|
||||||
public boolean isHost(Player player)
|
public boolean isHost(Player player)
|
||||||
{
|
{
|
||||||
return player.equals(Manager.GetHost());
|
return player.getName().equals(Manager.GetHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPrivateServer()
|
public boolean isPrivateServer()
|
||||||
@ -353,7 +375,11 @@ public class GameHostManager implements Listener
|
|||||||
public void ban(Player player)
|
public void ban(Player player)
|
||||||
{
|
{
|
||||||
_blacklist.add(player.getName());
|
_blacklist.add(player.getName());
|
||||||
player.kickPlayer("You were removed by the game host.");
|
|
||||||
|
UtilPlayer.message(player, C.cGold + C.Bold + "You were kicked from this Mineplex Private Server.");
|
||||||
|
|
||||||
|
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||||
|
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void giveAdmin(Player player)
|
public void giveAdmin(Player player)
|
||||||
|
Loading…
Reference in New Issue
Block a user