Updated for bukkit 600+

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1039 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
zenexer 2011-03-30 16:40:44 +00:00
parent c0ab3e290e
commit 825ad4edfc

View file

@ -162,18 +162,30 @@ public class EssentialsPlayerListener extends PlayerListener
} }
@Override @Override
public void onPlayerJoin(PlayerEvent event) public void onPlayerLogin(PlayerLoginEvent event)
{ {
Essentials.getStatic().backup.onPlayerJoin();
User user = User.get(event.getPlayer()); User user = User.get(event.getPlayer());
if (event.getResult() != Result.ALLOWED)
return;
//we do not know the ip address on playerlogin so we need to do this here. if (user.isBanned())
{
event.disallow(Result.KICK_BANNED, "The Ban Hammer has spoken!");
return;
}
if (user.isIpBanned()) if (user.isIpBanned())
{ {
user.kickPlayer("The Ban Hammer has spoken!"); user.kickPlayer("The Ban Hammer has spoken!");
return; return;
} }
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isOp())
{
event.disallow(Result.KICK_FULL, "Server is full");
return;
}
user.setDisplayName(user.getNick()); user.setDisplayName(user.getNick());
if (!Essentials.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd")) if (!Essentials.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
@ -191,26 +203,6 @@ public class EssentialsPlayerListener extends PlayerListener
if (mail.isEmpty()) user.sendMessage("§7You have no new mail."); if (mail.isEmpty()) user.sendMessage("§7You have no new mail.");
else user.sendMessage("§cYou have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail."); else user.sendMessage("§cYou have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail.");
} }
}
@Override
public void onPlayerLogin(PlayerLoginEvent event)
{
User user = User.get(event.getPlayer());
if (event.getResult() != Result.ALLOWED)
return;
if (user.isBanned())
{
event.disallow(Result.KICK_BANNED, "The Ban Hammer has spoken!");
return;
}
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isOp())
{
event.disallow(Result.KICK_FULL, "Server is full");
return;
}
updateCompass(user); updateCompass(user);
} }