Small patches

This commit is contained in:
HaHaWTH 2023-10-13 18:58:35 +08:00
parent d385093403
commit 3f372d9228

View File

@ -1,5 +1,6 @@
package fr.xephi.authme.listener; package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -14,6 +15,7 @@ import org.bukkit.plugin.Plugin;
public class LoginLocationFixListener implements Listener{ public class LoginLocationFixListener implements Listener{
private final Plugin plugin; private final Plugin plugin;
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
public LoginLocationFixListener(Plugin plugin) { public LoginLocationFixListener(Plugin plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@ -21,6 +23,7 @@ public class LoginLocationFixListener implements Listener{
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!authmeApi.isRegistered(player.getName()) || !authmeApi.isAuthenticated(player)) {
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5); Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) { if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
if (!JoinLocation.getBlock().getType().equals(Material.NETHER_PORTAL) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(Material.NETHER_PORTAL)) { if (!JoinLocation.getBlock().getType().equals(Material.NETHER_PORTAL) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(Material.NETHER_PORTAL)) {
@ -68,4 +71,5 @@ public class LoginLocationFixListener implements Listener{
} }
} }
} }
}
} }