Merge branch 'MPS-Maps'
Conflicts: Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java
This commit is contained in:
commit
e0ab853e57
@ -18,6 +18,8 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="Mineplex.Database" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/org-apache-commons-lang.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -21,8 +21,34 @@
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
<profile default="false" name="Annotation profile for hub" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="true" />
|
||||
<module name="hub" />
|
||||
</profile>
|
||||
<profile default="false" name="Annotation profile for gameplay" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="true" />
|
||||
<module name="gameplay" />
|
||||
</profile>
|
||||
<profile default="false" name="Annotation profile for common" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="true" />
|
||||
<module name="common" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.7" />
|
||||
<bytecodeTargetLevel target="1.7">
|
||||
<module name="common" target="1.7" />
|
||||
<module name="gameplay" target="1.7" />
|
||||
<module name="hub" target="1.7" />
|
||||
<module name="parent" target="1.7" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="GENERATE_NO_WARNINGS" value="true" />
|
||||
|
@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<file url="file://$PROJECT_DIR$/ParkerFactions" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ParkerFactions/common" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ParkerFactions/gameplay" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/ParkerFactions/hub" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -7,6 +7,13 @@
|
||||
</list>
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="7E81636CD93857493DFE224533ECF492" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/ParkerFactions/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
|
@ -18,6 +18,10 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
|
||||
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/common/common.iml" filepath="$PROJECT_DIR$/ParkerFactions/common/common.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/gameplay/gameplay.iml" filepath="$PROJECT_DIR$/ParkerFactions/gameplay/gameplay.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/hub/hub.iml" filepath="$PROJECT_DIR$/ParkerFactions/hub/hub.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/ParkerFactions/parent.iml" filepath="$PROJECT_DIR$/ParkerFactions/parent.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -36,6 +36,8 @@ public class GameServerConfig
|
||||
public boolean PlayerKickIdle = true;
|
||||
|
||||
public boolean PublicServer = true;
|
||||
|
||||
public boolean PlayerServerWhitelist = false;
|
||||
|
||||
public boolean IsValid()
|
||||
{
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.gui.privateServer.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 08/07/2015
|
||||
*/
|
||||
public class ChooseMapButton implements IButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private PrivateServerShop _privateServerShop;
|
||||
private GameType _gameType;
|
||||
private String _map;
|
||||
|
||||
public ChooseMapButton(ArcadeManager arcadeManager, PrivateServerShop privateServerShop, GameType gameType, String map)
|
||||
{
|
||||
_arcadeManager = arcadeManager;
|
||||
_privateServerShop = privateServerShop;
|
||||
_gameType = gameType;
|
||||
_map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_arcadeManager.GetGameCreationManager().MapPref = _map;
|
||||
_arcadeManager.GetGame().setGame(_gameType, player, true);
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nautilus.game.arcade.gui.privateServer.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 24/07/15
|
||||
*/
|
||||
public class GameVotingButton implements IButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private PrivateServerShop _shop;
|
||||
|
||||
public GameVotingButton(ArcadeManager arcadeManager, PrivateServerShop shop)
|
||||
{
|
||||
_shop = shop;
|
||||
_arcadeManager = arcadeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_shop.openPageForPlayer(player, new GameVotingPage(_arcadeManager, _shop, player));
|
||||
}
|
||||
}
|
@ -44,6 +44,18 @@ public abstract class BasePage extends ShopPageBase<ArcadeManager, PrivateServer
|
||||
});
|
||||
}
|
||||
|
||||
public void addBackToSetGamePage()
|
||||
{
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new SetGamePage(getPlugin(), getShop(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ItemStack getPlayerHead(String playerName, String title)
|
||||
{
|
||||
return getPlayerHead(playerName, title, null);
|
||||
|
@ -0,0 +1,43 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.button.ChooseMapButton;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 08/07/2015
|
||||
*/
|
||||
public class ChooseMapPage extends BasePage
|
||||
{
|
||||
private GameType _gameType;
|
||||
|
||||
public ChooseMapPage(ArcadeManager plugin, PrivateServerShop shop, Player player, GameType gameType)
|
||||
{
|
||||
super(plugin, shop, "Choose Map", player);
|
||||
_gameType = gameType;
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addBackToSetGamePage();
|
||||
|
||||
int slot = 9;
|
||||
for (String cur : getPlugin().LoadFiles(_gameType.GetName())){
|
||||
ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur);
|
||||
addButton(slot, new ShopItem(Material.PAPER, cur.split("_")[1], new String[]{"§7Click to select map."}, 1, false), btn);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -9,6 +10,7 @@ import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -30,6 +32,8 @@ public class EditRotationPage extends BasePage
|
||||
|
||||
List<GameType> enabledGames = getPlugin().GetServerConfig().GameList;
|
||||
|
||||
//Old code I'm not removing in-case the old style is wanted. - William
|
||||
/*
|
||||
int arcadeSlot = 9;
|
||||
int classicSlot = 13;
|
||||
int survivalSlot = 15;
|
||||
@ -64,13 +68,39 @@ public class EditRotationPage extends BasePage
|
||||
|
||||
addGameButton(slot, type, enabledGames.contains(type));
|
||||
}
|
||||
*/
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
return;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type, enabledGames.contains(type));
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type, boolean enabled)
|
||||
{
|
||||
String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetLobbyName();
|
||||
String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetName();
|
||||
String infoString = ChatColor.RESET + C.cGray + (enabled ? "Click to Disable" : "Click to Enable");
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, new String[]{infoString}, 1, false, false);
|
||||
String[] lore = new String[]{infoString};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
lore = new String[]{infoString, "§1", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, lore, 1, false, false);
|
||||
int itemCount = enabled ? 1 : 0;
|
||||
|
||||
addButtonFakeCount(slot, shopItem, new IButton()
|
||||
|
@ -0,0 +1,173 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 24/07/15
|
||||
*/
|
||||
public class GameVotingPage extends BasePage
|
||||
{
|
||||
public GameVotingPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Game Voting Menu", player, 54);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
boolean host = getPlugin().GetGameHostManager().isHost(getPlayer());
|
||||
|
||||
if (host)
|
||||
{
|
||||
addBackButton(4);
|
||||
addStartVoteButton(0);
|
||||
addEndVoteButton(8);
|
||||
}
|
||||
else
|
||||
{
|
||||
addCloseButton(4);
|
||||
}
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
return;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type);
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addCloseButton(int slot)
|
||||
{
|
||||
ShopItem item = new ShopItem(Material.BED, (byte)0, "§cClose Menu", new String[]{}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
player.closeInventory();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addEndVoteButton(int slot)
|
||||
{
|
||||
ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "§c§lEnd Vote", new String[]{}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (!_manager.isHost(player)) //Double Check...
|
||||
return;
|
||||
|
||||
getPlugin().GetGameHostManager().setVoteInProgress(false);
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(p, F.main("Vote", "The vote has ended!"));
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addStartVoteButton(int slot)
|
||||
{
|
||||
String warning = "§c§lWARNING: §fThis will reset current votes!";
|
||||
ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Start Vote", new String[]{warning}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (!_manager.isHost(player)) //Double Check...
|
||||
return;
|
||||
|
||||
getPlugin().GetGameHostManager().setVoteInProgress(true);
|
||||
getPlugin().GetGameHostManager().getVotes().clear();
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(p, F.main("Vote", "A vote has started! Use " + F.skill("/vote") + " to vote."));
|
||||
p.playSound(p.getLocation(), Sound.NOTE_BASS, 1F, 1F);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type)
|
||||
{
|
||||
String click = "§7Click to vote for this Game Type";
|
||||
int votes = 0;
|
||||
for (GameType cur : getPlugin().GetGameHostManager().getVotes().values())
|
||||
{
|
||||
if (cur.equals(type))
|
||||
votes++;
|
||||
}
|
||||
String curVotes = "§7Votes: §e" + votes;
|
||||
String[] lore = new String[]{click, curVotes};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
lore = new String[]{click, curVotes, "§1", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem item = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), new String[]{click, curVotes}, 1, false, false);
|
||||
if (votes >= 1)
|
||||
{
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
addButtonFakeCount(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
|
||||
refresh();
|
||||
}
|
||||
}, votes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.button.BanButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.GameVotingButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.KillButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.PlayerHeadButton;
|
||||
@ -30,7 +31,7 @@ public class MenuPage extends BasePage
|
||||
{
|
||||
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Private Server Menu", player, 9*3);
|
||||
super(plugin, shop, "Private Server Menu", player, 9*4);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@ -93,8 +94,11 @@ public class MenuPage extends BasePage
|
||||
addButton(4 + 18, new ShopItem(Material.GOLD_SWORD, "Remove Admin", new String[]{}, 1, false), removeAdminButton);
|
||||
|
||||
KillButton killButton = new KillButton(getPlugin());
|
||||
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
|
||||
addButton(4 + 27, new ShopItem(Material.TNT, "Kill Private Server",
|
||||
new String[]{ChatColor.RESET + C.cGray + "Shift-Right Click to Kill Private Server"}, 1, false), killButton);
|
||||
|
||||
GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop());
|
||||
addButton(8 + 18, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
|
||||
}
|
||||
|
||||
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());
|
||||
|
@ -43,7 +43,7 @@ public class OptionsPage extends BasePage
|
||||
}
|
||||
});
|
||||
|
||||
buildPreference(13, Material.PAPER, "Enforce Whitelist (Coming Soon)", false, new IButton()
|
||||
buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
@ -116,7 +116,7 @@ public class OptionsPage extends BasePage
|
||||
|
||||
private void toggleWhitelist()
|
||||
{
|
||||
// TODO CHISSPIE
|
||||
_config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@ -138,6 +138,14 @@ public class OptionsPage extends BasePage
|
||||
ChatColor.RED + " ",
|
||||
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
|
||||
|
||||
if (name.equalsIgnoreCase("Enforce Whitelist"))
|
||||
{
|
||||
description = new String[] {
|
||||
"" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
|
||||
ChatColor.RED + " ",
|
||||
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable"), "", "§7Use §a/whitelist §e<name>" };
|
||||
}
|
||||
|
||||
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -24,6 +28,8 @@ public class SetGamePage extends BasePage
|
||||
{
|
||||
addBackButton(4);
|
||||
|
||||
//Old code I'm not removing in-case you want the old style - William.
|
||||
/*
|
||||
int arcadeSlot = 9;
|
||||
int classicSlot = 13;
|
||||
int survivalSlot = 15;
|
||||
@ -58,19 +64,58 @@ public class SetGamePage extends BasePage
|
||||
|
||||
addGameButton(slot, type);
|
||||
}
|
||||
*/
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
return;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type);
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type)
|
||||
{
|
||||
String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
|
||||
String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
|
||||
String space = "§1";
|
||||
String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.";
|
||||
String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.";
|
||||
String[] normLore = new String[]{infoString, space, left, right};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
|
||||
addButton(slot, shopItem, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGame().setGame(type, player, true);
|
||||
player.closeInventory();
|
||||
if (clickType == ClickType.LEFT)
|
||||
{
|
||||
getPlugin().GetGame().setGame(type, player, true);
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
else if (clickType == ClickType.RIGHT)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -18,6 +20,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -32,6 +35,7 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -61,6 +65,10 @@ public class GameHostManager implements Listener
|
||||
private boolean _isEventServer = false;
|
||||
|
||||
private HashMap<Player, Boolean> _permissionMap = new HashMap<Player, Boolean>();
|
||||
|
||||
private boolean _voteInProgress = false;
|
||||
private HashMap<String, GameType> _votes = new HashMap<String, GameType>();
|
||||
private int _voteNotificationStage = 1;
|
||||
|
||||
public GameHostManager(ArcadeManager manager)
|
||||
{
|
||||
@ -104,16 +112,22 @@ public class GameHostManager implements Listener
|
||||
legendGames.add(GameType.SnowFight);
|
||||
legendGames.add(GameType.Gravity);
|
||||
legendGames.add(GameType.Barbarians);
|
||||
legendGames.add(GameType.OldMineWare);
|
||||
legendGames.add(GameType.SmashDomination);
|
||||
legendGames.add(GameType.Skywars);
|
||||
// Team variants
|
||||
// Team variants - Currently being remade.
|
||||
/*
|
||||
legendGames.add(GameType.DragonEscapeTeams);
|
||||
legendGames.add(GameType.DragonsTeams);
|
||||
legendGames.add(GameType.QuiverTeams);
|
||||
legendGames.add(GameType.SmashTeams);
|
||||
legendGames.add(GameType.SpleefTeams);
|
||||
legendGames.add(GameType.SurvivalGamesTeams);
|
||||
*/
|
||||
//Rejected / Other
|
||||
legendGames.add(GameType.Evolution);
|
||||
legendGames.add(GameType.MilkCow);
|
||||
legendGames.add(GameType.SearchAndDestroy);
|
||||
legendGames.add(GameType.ZombieSurvival);
|
||||
|
||||
//Config Defaults
|
||||
if (Manager.GetHost() != null && Manager.GetHost().length() > 0)
|
||||
@ -122,6 +136,16 @@ public class GameHostManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<GameType> hasWarning()
|
||||
{
|
||||
ArrayList<GameType> games = new ArrayList<>();
|
||||
games.add(GameType.Evolution);
|
||||
games.add(GameType.MilkCow);
|
||||
games.add(GameType.SearchAndDestroy);
|
||||
games.add(GameType.ZombieSurvival);
|
||||
return games;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateHost(UpdateEvent event)
|
||||
{
|
||||
@ -152,6 +176,58 @@ public class GameHostManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void voteNotification(UpdateEvent e)
|
||||
{
|
||||
if (e.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
if (!_voteInProgress)
|
||||
return;
|
||||
|
||||
if (_voteNotificationStage == 1)
|
||||
{
|
||||
UtilTextBottom.display("§e§l> §6§lUse §e§l/vote §6§lto vote for a game! §e§l<", UtilServer.getPlayers());
|
||||
_voteNotificationStage++;
|
||||
return;
|
||||
}
|
||||
else if (_voteNotificationStage == 2)
|
||||
{
|
||||
UtilTextBottom.display("§a§l> §2§lUse §a§l/vote §2§lto vote for a game! §a§l<", UtilServer.getPlayers());
|
||||
_voteNotificationStage++;
|
||||
return;
|
||||
}
|
||||
else if (_voteNotificationStage == 3)
|
||||
{
|
||||
UtilTextBottom.display("§c§l> §4§lUse §c§l/vote §4§lto vote for a game! §c§l<", UtilServer.getPlayers());
|
||||
_voteNotificationStage++;
|
||||
return;
|
||||
}
|
||||
else if (_voteNotificationStage == 4)
|
||||
{
|
||||
UtilTextBottom.display("§b§l> §3§lUse §b§l/vote §3§lto vote for a game! §b§l<", UtilServer.getPlayers());
|
||||
_voteNotificationStage++;
|
||||
return;
|
||||
}
|
||||
else if (_voteNotificationStage == 5)
|
||||
{
|
||||
UtilTextBottom.display("§d§l> §5§lUse §d§l/vote §5§lto vote for a game! §d§l<", UtilServer.getPlayers());
|
||||
_voteNotificationStage = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void whitelistJoin(PlayerLoginEvent event)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
if (Manager.GetServerConfig().PlayerServerWhitelist){
|
||||
if (!getWhitelist().contains(p.getName())){
|
||||
Manager.GetPortal().sendToHub(p, "You aren't on the whitelist of this Mineplex Private Server.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void adminJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -296,19 +372,78 @@ public class GameHostManager implements Listener
|
||||
{
|
||||
return _adminList;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void broadcastCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getMessage().toLowerCase().startsWith("/bc"))
|
||||
return;
|
||||
|
||||
if (!isPrivateServer())
|
||||
return;
|
||||
|
||||
if (!isAdmin(event.getPlayer(), true))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Broadcast", "Only MPS admins can use this command."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (event.getMessage().split(" ").length < 2)
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Broadcast", "/bc <message>"));
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = "";
|
||||
for (int i = 1; i < event.getMessage().split(" ").length; i++)
|
||||
{
|
||||
msg += event.getMessage().split(" ")[i] + " ";
|
||||
}
|
||||
msg = msg.trim();
|
||||
|
||||
Bukkit.broadcastMessage("§6§l" + event.getPlayer().getName() + " §e" + msg);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void voteCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getMessage().toLowerCase().startsWith("/vote"))
|
||||
return;
|
||||
|
||||
if (!isPrivateServer())
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Vote", "This command is only available on private servers."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_voteInProgress)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Vote", "There is no vote in progress."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
_shop.openPageForPlayer(event.getPlayer(), new GameVotingPage(Manager, _shop, event.getPlayer()));
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void menuCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getMessage().toLowerCase().startsWith("/menu"))
|
||||
return;
|
||||
|
||||
if (!isPrivateServer())
|
||||
return;
|
||||
|
||||
if (!isAdmin(event.getPlayer(), true))
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/menu"))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
openMenu(event.getPlayer());
|
||||
}
|
||||
@ -355,8 +490,13 @@ public class GameHostManager implements Listener
|
||||
if (_host == null || !event.getPlayer().equals(_host))
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/whitelist "))
|
||||
if (!event.getMessage().toLowerCase().startsWith("/whitelist"))
|
||||
return;
|
||||
|
||||
if (!isPrivateServer())
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
String[] args = event.getMessage().split(" ");
|
||||
|
||||
@ -366,7 +506,7 @@ public class GameHostManager implements Listener
|
||||
|
||||
if (_whitelist.add(name))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(name) + " to the whitelist."));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(args[i]) + " to the whitelist."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -451,6 +591,24 @@ public class GameHostManager implements Listener
|
||||
return games;
|
||||
}
|
||||
|
||||
public HashMap<GameCategory, ArrayList<GameType>> getGames(Player p)
|
||||
{
|
||||
HashMap<GameCategory, ArrayList<GameType>> games = new HashMap<GameCategory, ArrayList<GameType>>();
|
||||
for (GameCategory cat : GameCategory.values())
|
||||
{
|
||||
ArrayList<GameType> types = new ArrayList<>();
|
||||
for (GameType type : getAvailableGames(p))
|
||||
{
|
||||
if (type.getGameCategory().equals(cat))
|
||||
{
|
||||
types.add(type);
|
||||
}
|
||||
}
|
||||
games.put(cat, types);
|
||||
}
|
||||
return games;
|
||||
}
|
||||
|
||||
public void ban(Player player)
|
||||
{
|
||||
_blacklist.add(player.getName());
|
||||
@ -650,4 +808,19 @@ public class GameHostManager implements Listener
|
||||
{
|
||||
_isEventServer = var;
|
||||
}
|
||||
|
||||
public HashMap<String, GameType> getVotes()
|
||||
{
|
||||
return _votes;
|
||||
}
|
||||
|
||||
public void setVoteInProgress(boolean voteInProgress)
|
||||
{
|
||||
_voteInProgress = voteInProgress;
|
||||
}
|
||||
|
||||
public boolean isVoteInProgress()
|
||||
{
|
||||
return _voteInProgress;
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,10 @@ public class GameManager implements Listener
|
||||
{
|
||||
if (game instanceof UHC && !((UHC)game).isMapLoaded())
|
||||
return;
|
||||
|
||||
|
||||
if (Manager.GetGameHostManager().isPrivateServer() && Manager.GetGameHostManager().isVoteInProgress())
|
||||
return;
|
||||
|
||||
//Disabling Cosmetics
|
||||
if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user