Whitelist fixes. Implemented MapSource.
This commit is contained in:
parent
817b8b03f6
commit
644d6c9914
@ -33,8 +33,8 @@ public class ChooseMapButton implements IButton
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_arcadeManager.GetGameCreationManager().MapPref = _map;
|
|
||||||
_arcadeManager.GetGameCreationManager().MapSource = _gameType.GetName();
|
_arcadeManager.GetGameCreationManager().MapSource = _gameType.GetName();
|
||||||
|
_arcadeManager.GetGameCreationManager().MapPref = _map;
|
||||||
_arcadeManager.GetGame().setGame(_gameType, player, true);
|
_arcadeManager.GetGame().setGame(_gameType, player, true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
return;
|
return;
|
||||||
|
@ -32,11 +32,6 @@ public class WhitelistButton implements IButton
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
List<String> strings = new ArrayList<>();
|
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
|
||||||
for (String s : _arcadeManager.GetGameHostManager().getWhitelist())
|
|
||||||
{
|
|
||||||
strings.add(s);
|
|
||||||
}
|
|
||||||
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player, strings));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,11 @@ public class OptionsPage extends BasePage
|
|||||||
|
|
||||||
private void togglePublic()
|
private void togglePublic()
|
||||||
{
|
{
|
||||||
|
if (_config.PlayerServerWhitelist==true)
|
||||||
|
{
|
||||||
|
_config.PublicServer = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_config.PublicServer = !_config.PublicServer;
|
_config.PublicServer = !_config.PublicServer;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public abstract class PlayerPage extends BasePage
|
|||||||
{
|
{
|
||||||
addBackButton(4);
|
addBackButton(4);
|
||||||
|
|
||||||
List<Player> players = null;
|
List<Player> players = new ArrayList<>();
|
||||||
if (useOtherList)
|
if (useOtherList)
|
||||||
{
|
{
|
||||||
players = new ArrayList<>();
|
players = new ArrayList<>();
|
||||||
|
@ -2,9 +2,14 @@ package nautilus.game.arcade.gui.privateServer.page;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.shop.item.IButton;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||||
|
|
||||||
@ -15,33 +20,38 @@ import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
|||||||
* consent of William Burns. 2015.
|
* consent of William Burns. 2015.
|
||||||
* 29/07/15
|
* 29/07/15
|
||||||
*/
|
*/
|
||||||
public class WhitelistedPage extends PlayerPage
|
public class WhitelistedPage extends BasePage
|
||||||
{
|
{
|
||||||
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player, List<String> players)
|
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||||
{
|
{
|
||||||
super(plugin, shop, "Whitelisted Players", player, players);
|
super(plugin, shop, "Whitelisted Players", player);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showPlayer(Player player)
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
|
addBackButton(4);
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
int slot = 9;
|
||||||
public void clicked(int slot, Player player)
|
for (final String s : getPlugin().GetGameHostManager().getWhitelist())
|
||||||
{
|
{
|
||||||
getPlugin().GetGameHostManager().getWhitelist().remove(player.getName());
|
ItemStack head = getPlayerHead(s, C.cGreen + C.Bold + s, new String[]{C.cGray + "Click to un-whitelist player"});
|
||||||
getPlugin().GetPortal().sendToHub(player, "You are no longer whitelisted.");
|
final int i = slot;
|
||||||
getPlayer().sendMessage(F.main("Whitelist", "§e" + player.getName() + " §7is no longer whitelisted."));
|
addButton(slot, head, new IButton()
|
||||||
}
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
getPlugin().GetGameHostManager().getWhitelist().remove(s);
|
||||||
|
removeButton(i);
|
||||||
|
getPlayer().sendMessage(F.main("Whitelist", "§e" + s + " §7is no longer whitelisted."));
|
||||||
|
if (Bukkit.getPlayer(s)!=null)
|
||||||
|
getPlugin().GetPortal().sendToHub(Bukkit.getPlayer(s), "You are no longer whitelisted.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
slot++;
|
||||||
public String getDisplayString(Player player)
|
}
|
||||||
{
|
|
||||||
return "Click to remove from whitelist";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,6 @@ public class GameGemManager implements Listener
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void GameStateChange(GameStateChangeEvent event)
|
public void GameStateChange(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!Manager.IsRewardGems())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetState() != GameState.Dead)
|
if (event.GetState() != GameState.Dead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -129,12 +126,12 @@ public class GameGemManager implements Listener
|
|||||||
|
|
||||||
public void RewardGems(Game game, Player player, boolean give)
|
public void RewardGems(Game game, Player player, boolean give)
|
||||||
{
|
{
|
||||||
if (!Manager.IsRewardGems())
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Inform Gems
|
//Inform Gems
|
||||||
AnnounceGems(game, player, game.GetPlayerGems().get(player), give);
|
AnnounceGems(game, player, game.GetPlayerGems().get(player), give);
|
||||||
|
|
||||||
|
if (!Manager.IsRewardGems())
|
||||||
|
return;
|
||||||
|
|
||||||
//Give Gems
|
//Give Gems
|
||||||
if (give)
|
if (give)
|
||||||
GiveGems(game, player, game.GetPlayerGems().remove(player), game.GemMultiplier);
|
GiveGems(game, player, game.GetPlayerGems().remove(player), game.GemMultiplier);
|
||||||
@ -221,7 +218,12 @@ public class GameGemManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Manager.IsRewardGems())
|
if (!Manager.IsRewardGems())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
earnedGems = (int) (earnedGems * game.GemMultiplier);
|
earnedGems = (int) (earnedGems * game.GemMultiplier);
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ public class GameHostManager implements Listener
|
|||||||
ArcadeManager Manager;
|
ArcadeManager Manager;
|
||||||
|
|
||||||
private Player _host;
|
private Player _host;
|
||||||
|
private String _hostName;
|
||||||
private Rank _hostRank;
|
private Rank _hostRank;
|
||||||
private long _serverStartTime = System.currentTimeMillis();
|
private long _serverStartTime = System.currentTimeMillis();
|
||||||
private long _serverExpireTime = 21600000;
|
private long _serverExpireTime = 21600000;
|
||||||
@ -208,8 +209,10 @@ public class GameHostManager implements Listener
|
|||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if (Manager.GetServerConfig().PlayerServerWhitelist){
|
if (Manager.GetServerConfig().PlayerServerWhitelist){
|
||||||
if (!getWhitelist().contains(p.getName())){
|
if (!getWhitelist().contains(p.getName())){
|
||||||
if (_host == p)
|
if ((Manager.GetHost() != null) && (Manager.GetHost().equalsIgnoreCase(p.getName())))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "This MPS is whitelisted.");
|
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "This MPS is whitelisted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,6 +371,9 @@ public class GameHostManager implements Listener
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (!isPrivateServer())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
|
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user