mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-27 17:28:23 +01:00
Add PlayerJoinEvent to required linking
This commit is contained in:
parent
a0a5dd01fa
commit
a3f7b448ac
@ -30,7 +30,7 @@ public class BukkitRequiredLinkingConfig extends ServerRequiredLinkingConfig {
|
||||
public static class KickOptions {
|
||||
|
||||
@Comment("The event to use for kick.\n"
|
||||
+ "Available events: AsyncPlayerPreLoginEvent (preferred), PlayerLoginEvent")
|
||||
+ "Available events: AsyncPlayerPreLoginEvent (preferred), PlayerLoginEvent, PlayerJoinEvent")
|
||||
public String event = "AsyncPlayerPreLoginEvent";
|
||||
|
||||
@Comment("The event priority to use for the kick")
|
||||
|
@ -60,8 +60,9 @@ public class BukkitRequiredLinkingModule extends ServerRequireLinkingModule<Bukk
|
||||
public void enable() {
|
||||
super.enable();
|
||||
|
||||
register(PlayerLoginEvent.class, this::handle);
|
||||
register(AsyncPlayerPreLoginEvent.class, this::handle);
|
||||
register(PlayerLoginEvent.class, this::handle);
|
||||
register(PlayerJoinEvent.class, this::handle);
|
||||
discordSRV.server().getPluginManager().registerEvents(this, discordSRV.plugin());
|
||||
}
|
||||
|
||||
@ -136,6 +137,18 @@ public class BukkitRequiredLinkingModule extends ServerRequireLinkingModule<Bukk
|
||||
);
|
||||
}
|
||||
|
||||
private void handle(PlayerJoinEvent event, EventPriority priority) {
|
||||
Player player = event.getPlayer();
|
||||
handle(
|
||||
"PlayerJoinEvent",
|
||||
priority,
|
||||
player.getUniqueId(),
|
||||
player.getName(),
|
||||
() -> null,
|
||||
player::kickPlayer
|
||||
);
|
||||
}
|
||||
|
||||
private void handle(
|
||||
String eventType,
|
||||
EventPriority priority,
|
||||
|
Loading…
Reference in New Issue
Block a user