Completely prevent players in parties from joining Clans servers
This commit is contained in:
parent
d162750aec
commit
157c969e8d
@ -98,12 +98,18 @@ public class Portal extends MiniPlugin
|
||||
final boolean override = serverName.equalsIgnoreCase("Lobby") || serverName.equalsIgnoreCase("ClansHub");
|
||||
final Rank playerRank = _clientManager.Get(player).GetRank();
|
||||
|
||||
if(event.getParty() != null && override)
|
||||
if (event.getParty() != null && override)
|
||||
{
|
||||
Party party = event.getParty();
|
||||
sendParty(party);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getParty() != null && serverName.toUpperCase().startsWith("CLANS-"))
|
||||
{
|
||||
event.getParty().sendMessage(F.main(getName(), "You cannot join Clans while in a party!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (override)
|
||||
{
|
||||
@ -111,7 +117,7 @@ public class Portal extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.isCancel())
|
||||
if (event.isCancel())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -139,23 +145,23 @@ public class Portal extends MiniPlugin
|
||||
MinecraftServer best = null;
|
||||
List<MinecraftServer> serverList = Lists.newArrayList(repository.getServersByGroup("Lobby"));
|
||||
int lowest = Integer.MAX_VALUE;
|
||||
for(MinecraftServer server : serverList)
|
||||
for (MinecraftServer server : serverList)
|
||||
{
|
||||
int playercount = server.getPlayerCount();
|
||||
if(playercount < 20)
|
||||
if (playercount < 20)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(playercount < lowest)
|
||||
if (playercount < lowest)
|
||||
{
|
||||
lowest = playercount;
|
||||
if(best == null)
|
||||
if (best == null)
|
||||
{
|
||||
best = server;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(best == null)
|
||||
if (best == null)
|
||||
{
|
||||
//Well, fuck.
|
||||
best = serverList.get(new Random().nextInt(serverList.size()));
|
||||
|
@ -28,6 +28,7 @@ import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.data.MinecraftServer;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
@ -193,6 +194,13 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), _hub.GetSpawn()), 1, true, 0.5, 0, 1.0, true);
|
||||
return;
|
||||
}
|
||||
if (_party.getParty(player) != null)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
|
||||
player.sendMessage(F.main("Party", "You cannot join Clans while in a party."));
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), _hub.GetSpawn()), 1, true, 0.5, 0, 1.0, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Transfer Portal", 5000, false, false))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user