MPS updates

This commit is contained in:
Chiss 2014-12-22 13:19:45 +11:00
parent 4a50e3ae62
commit 2472ca95ec
5 changed files with 174 additions and 54 deletions

View File

@ -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.");
}
}

View File

@ -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.");
}
}

View File

@ -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);

View File

@ -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 = "";
if (rank != Rank.ALL) //Rank Prefix & MPS Host Prefix
rankStr = rank.GetTag(true, true) + " "; 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)
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");

View File

@ -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,37 +60,60 @@ 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());
//Ultra Games //Game Rotation
ultraGames.add(GameType.Smash); if (Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate) ||
ultraGames.add(GameType.BaconBrawl); Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate))
ultraGames.add(GameType.DeathTag); {
ultraGames.add(GameType.DragonEscape); Iterator<GameType> gameIterator = Manager.GetServerConfig().GameList.iterator();
ultraGames.add(GameType.Dragons);
ultraGames.add(GameType.Micro); //Remove Non-Champion Games
ultraGames.add(GameType.Paintball); while (gameIterator.hasNext())
ultraGames.add(GameType.Quiver); {
ultraGames.add(GameType.Runner); GameType type = gameIterator.next();
ultraGames.add(GameType.Sheep);
ultraGames.add(GameType.Snake); if (type != GameType.ChampionsDominate && type != GameType.ChampionsDominate)
ultraGames.add(GameType.SneakyAssassins); gameIterator.remove();
ultraGames.add(GameType.TurfWars); }
ultraGames.add(GameType.Spleef);
//Hero Games
heroGames.add(GameType.ChampionsDominate);
heroGames.add(GameType.ChampionsTDM);
}
else
{
//Ultra Games
ultraGames.add(GameType.Smash);
ultraGames.add(GameType.BaconBrawl);
ultraGames.add(GameType.DeathTag);
ultraGames.add(GameType.DragonEscape);
ultraGames.add(GameType.Dragons);
ultraGames.add(GameType.Micro);
ultraGames.add(GameType.Paintball);
ultraGames.add(GameType.Quiver);
ultraGames.add(GameType.Runner);
ultraGames.add(GameType.Sheep);
ultraGames.add(GameType.Snake);
ultraGames.add(GameType.SneakyAssassins);
ultraGames.add(GameType.TurfWars);
ultraGames.add(GameType.Spleef);
//Hero Games //Hero Games
heroGames.add(GameType.ChampionsDominate); heroGames.add(GameType.HideSeek);
heroGames.add(GameType.ChampionsTDM); heroGames.add(GameType.Draw);
heroGames.add(GameType.HideSeek);
heroGames.add(GameType.Draw);
//Legend Games //Legend Games
legendGames.add(GameType.Bridge); legendGames.add(GameType.Bridge);
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"); Manager.GetServerConfig().HotbarInventory = false;
_blacklist.add("defek7"); Manager.GetServerConfig().RewardAchievements = false;
_blacklist.add("Ayreloc"); 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
if (_host != null)
{
giveAdminItem(_host);
_lastOnline = System.currentTimeMillis();
}
// Admins update // Admins update
for (Player admin : _onlineAdmins) for (Player player : UtilServer.getPlayers())
{ {
giveAdminItem(admin); if (player.equals(_host) || _adminList.contains(player.getName()) || Manager.GetClients().Get(player).GetRank().Has(Rank.SNR_MODERATOR))
{
_lastOnline = System.currentTimeMillis(); if (Manager.GetGame() == null || Manager.GetGame().GetState() == GameState.Recruit)
giveAdminItem(player);
_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)