Show Host Rank in private servers
This commit is contained in:
parent
7104f1363a
commit
7ad12d0a6b
@ -1,5 +1,7 @@
|
|||||||
package mineplex.hub.server;
|
package mineplex.hub.server;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
|
||||||
public class ServerInfo
|
public class ServerInfo
|
||||||
{
|
{
|
||||||
public String Name;
|
public String Name;
|
||||||
@ -9,7 +11,7 @@ public class ServerInfo
|
|||||||
public String Map;
|
public String Map;
|
||||||
public String ServerType;
|
public String ServerType;
|
||||||
public String Game;
|
public String Game;
|
||||||
public boolean HostedByStaff;
|
public Rank HostRank = Rank.ALL;
|
||||||
|
|
||||||
public int getAvailableSlots()
|
public int getAvailableSlots()
|
||||||
{
|
{
|
||||||
|
@ -435,7 +435,25 @@ public class ServerManager extends MiniPlugin
|
|||||||
serverInfo.MOTD = args.length > 0 ? args[0] : serverStatus.getMotd();
|
serverInfo.MOTD = args.length > 0 ? args[0] : serverStatus.getMotd();
|
||||||
serverInfo.CurrentPlayers = serverStatus.getPlayerCount();
|
serverInfo.CurrentPlayers = serverStatus.getPlayerCount();
|
||||||
serverInfo.MaxPlayers = serverStatus.getMaxPlayerCount();
|
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)
|
if (args.length > 1)
|
||||||
serverInfo.ServerType = args[1];
|
serverInfo.ServerType = args[1];
|
||||||
|
@ -237,7 +237,7 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
|||||||
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers <= 0)
|
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers <= 0)
|
||||||
continue;
|
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()));
|
addButton(staffSlot, getPrivateItem(serverInfo), new JoinServerButton(this, getPlugin(), serverInfo, getPlayer()));
|
||||||
staffSlot++;
|
staffSlot++;
|
||||||
@ -375,10 +375,10 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
|||||||
if (serverInfo.Map != null)
|
if (serverInfo.Map != null)
|
||||||
lore.add(ChatColor.RESET + C.cYellow + "Map: " + C.cWhite + serverInfo.Map);
|
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(" ");
|
||||||
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);
|
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())
|
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
|
||||||
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
|
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
|
||||||
|
|
||||||
if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.MODERATOR))
|
if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.TWITCH))
|
||||||
extrainformation += "|StaffHosted";
|
extrainformation += "|HostRank." + _gameHostManager.getHostRank().toString();
|
||||||
|
|
||||||
//Always Joinable
|
//Always Joinable
|
||||||
// if (_game != null && _game.JoinInProgress)
|
// 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)
|
if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH)
|
||||||
return 100;
|
return 100;
|
||||||
|
else if (_hostRank == Rank.YOUTUBE_SMALL)
|
||||||
|
return 60;
|
||||||
else if (hasRank(Rank.LEGEND))
|
else if (hasRank(Rank.LEGEND))
|
||||||
return 40;
|
return 40;
|
||||||
else if (hasRank(Rank.HERO))
|
else if (hasRank(Rank.HERO))
|
||||||
|
Loading…
Reference in New Issue
Block a user