mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-26 20:26:01 +01:00
This commit is contained in:
parent
8d8ce1c4eb
commit
483c9219a0
@ -29,6 +29,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -566,6 +567,43 @@ public class AuthMePlayerListener implements Listener {
|
||||
}, 300);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
if (event.getPlayer() == null)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName();
|
||||
String regex = Settings.getNickRegex;
|
||||
try {
|
||||
if (!player.getName().matches(regex) || name.equals("Player")) {
|
||||
try {
|
||||
event.setKickMessage(m.send("regex")[0].replace("REG_EX", regex));
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
} catch (Exception exc) {
|
||||
event.setKickMessage("allowed char : " + regex);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} catch (PatternSyntaxException pse) {
|
||||
if (regex == null || regex.isEmpty()) {
|
||||
event.setKickMessage("Your nickname do not match");
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
event.setKickMessage(m.send("regex")[0].replace("REG_EX", regex));
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
} catch (Exception exc) {
|
||||
event.setKickMessage("allowed char : " + regex);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (event.getPlayer() == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user