Show Host Rank in private servers
This commit is contained in:
parent
7104f1363a
commit
7ad12d0a6b
@ -1,5 +1,7 @@
|
||||
package mineplex.hub.server;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
public class ServerInfo
|
||||
{
|
||||
public String Name;
|
||||
@ -9,7 +11,7 @@ public class ServerInfo
|
||||
public String Map;
|
||||
public String ServerType;
|
||||
public String Game;
|
||||
public boolean HostedByStaff;
|
||||
public Rank HostRank = Rank.ALL;
|
||||
|
||||
public int getAvailableSlots()
|
||||
{
|
||||
|
@ -435,7 +435,25 @@ public class ServerManager extends MiniPlugin
|
||||
serverInfo.MOTD = args.length > 0 ? args[0] : serverStatus.getMotd();
|
||||
serverInfo.CurrentPlayers = serverStatus.getPlayerCount();
|
||||
serverInfo.MaxPlayers = serverStatus.getMaxPlayerCount();
|
||||
serverInfo.HostedByStaff = serverStatus.getMotd().contains("StaffHosted");
|
||||
|
||||
for (String arg : args)
|
||||
{
|
||||
if (arg != null && arg.startsWith("HostRank.") && arg.length() > "HostRank.".length())
|
||||
{
|
||||
String rankEnum = arg.split("\\.")[1];
|
||||
|
||||
try
|
||||
{
|
||||
serverInfo.HostRank = Rank.valueOf(rankEnum);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
serverInfo.ServerType = args[1];
|
||||
|
@ -237,7 +237,7 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers <= 0)
|
||||
continue;
|
||||
|
||||
if (serverInfo.HostedByStaff && staffSlot < 9)
|
||||
if (serverInfo.HostRank != null && serverInfo.HostRank.has(Rank.TWITCH) && staffSlot < 9)
|
||||
{
|
||||
addButton(staffSlot, getPrivateItem(serverInfo), new JoinServerButton(this, getPlugin(), serverInfo, getPlayer()));
|
||||
staffSlot++;
|
||||
@ -375,10 +375,10 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
if (serverInfo.Map != null)
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Map: " + C.cWhite + serverInfo.Map);
|
||||
|
||||
if (serverInfo.HostedByStaff)
|
||||
if (serverInfo.HostRank != null && serverInfo.HostRank.has(Rank.TWITCH))
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.cGreen + "Hosted by a Staff Member");
|
||||
lore.add(ChatColor.RESET + "Host Rank: " + serverInfo.HostRank.getTag(true, false));
|
||||
}
|
||||
|
||||
ShopItem shopItem = new ShopItem(material, data, server, lore.toArray(new String[0]), 1, false, false);
|
||||
|
@ -610,8 +610,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
|
||||
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
|
||||
|
||||
if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.MODERATOR))
|
||||
extrainformation += "|StaffHosted";
|
||||
if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.TWITCH))
|
||||
extrainformation += "|HostRank." + _gameHostManager.getHostRank().toString();
|
||||
|
||||
//Always Joinable
|
||||
// if (_game != null && _game.JoinInProgress)
|
||||
|
@ -698,6 +698,8 @@ public class GameHostManager implements Listener
|
||||
{
|
||||
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH)
|
||||
return 100;
|
||||
else if (_hostRank == Rank.YOUTUBE_SMALL)
|
||||
return 60;
|
||||
else if (hasRank(Rank.LEGEND))
|
||||
return 40;
|
||||
else if (hasRank(Rank.HERO))
|
||||
|
Loading…
Reference in New Issue
Block a user