Kick banned players from games

This commit is contained in:
Shaun Bennett 2015-02-24 14:38:12 -05:00
parent 61b1e3f48b
commit 48dd5639d2
2 changed files with 21 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@ -152,6 +153,19 @@ public class Portal extends MiniPlugin
addCommand(new SendCommand(this));
}
public void sendToHub(Player player, String message)
{
if (message != null)
{
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGold + C.Bold + message);
UtilPlayer.message(player, " ");
}
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
sendPlayerToServer(player, "Lobby");
}
private void sendPlayer(final Player player, String serverName)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();

View File

@ -398,10 +398,7 @@ public class GameHostManager implements Listener
{
_blacklist.add(player.getName());
UtilPlayer.message(player, C.cGold + C.Bold + "You were kicked from this Mineplex Private Server.");
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
Manager.GetPortal().sendPlayerToServer(player, "Lobby");
Manager.GetPortal().sendToHub(player, "You were kicked from this Mineplex Private Server.");
}
public void giveAdmin(Player player)
@ -485,6 +482,12 @@ public class GameHostManager implements Listener
if (!isPrivateServer())
return;
if (_blacklist.contains(event.getPlayer().getName()))
{
Manager.GetPortal().sendToHub(event.getPlayer(), "You were kicked from this Mineplex Private Server.");
return;
}
String serverName = Manager.GetPlugin().getConfig().getString("serverstatus.name");
UtilPlayer.message(event.getPlayer(), ChatColor.BOLD + "Welcome to Mineplex Private Servers!");
UtilPlayer.message(event.getPlayer(), C.Bold + "Friends can connect with " + C.cGreen + C.Bold + "/server " + serverName);