Skip to content

Commit

Permalink
feat(Listeners): 更新监听器以处理更多玩家事件
Browse files Browse the repository at this point in the history
  • Loading branch information
shulng committed Jul 11, 2024
1 parent 81818ed commit 502ccd6
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/main/java/cc/baka9/catseedlogin/bukkit/Listeners.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package cc.baka9.catseedlogin.bukkit;

import cc.baka9.catseedlogin.bukkit.database.Cache;
import cc.baka9.catseedlogin.bukkit.object.LoginPlayer;
import cc.baka9.catseedlogin.bukkit.object.LoginPlayerHelper;
import cc.baka9.catseedlogin.bukkit.task.Task;
import java.util.regex.Pattern;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
Expand All @@ -15,10 +13,21 @@
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.geysermc.floodgate.api.FloodgateApi;

import java.util.regex.Pattern;
import cc.baka9.catseedlogin.bukkit.database.Cache;
import cc.baka9.catseedlogin.bukkit.object.LoginPlayer;
import cc.baka9.catseedlogin.bukkit.object.LoginPlayerHelper;
import cc.baka9.catseedlogin.bukkit.task.Task;

public class Listeners implements Listener {

Expand Down Expand Up @@ -186,6 +195,10 @@ public void onPlayerJoin(PlayerJoinEvent event) {
p.sendMessage(Config.Language.BEDROCK_LOGIN_BYPASS);
return;
}
if (Config.Settings.LoginwiththesameIP && LoginPlayerHelper.recordCurrentIP(p)) {
p.sendMessage(Config.Language.LOGIN_WITH_THE_SAME_IP);
return;
}
Cache.refresh(p.getName());
if (Config.Settings.CanTpSpawnLocation) {
p.teleport(Config.Settings.SpawnLocation);
Expand Down Expand Up @@ -222,4 +235,4 @@ public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
}

}
}
}

0 comments on commit 502ccd6

Please sign in to comment.