Fix LoginLocationFixListener throws error on legacy versions

This commit is contained in:
HaHaWTH 2023-10-13 19:48:35 +08:00
parent 3e971c3dfd
commit c71bd9f3a8

View File

@ -24,7 +24,12 @@ public class LoginLocationFixListener implements Listener{
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!authmeApi.isRegistered(player.getName()) || !authmeApi.isAuthenticated(player)) {
Material material = Material.getMaterial("PORTAL") != null || Material.getMaterial("PORTAL_BLOCK") != null ? Material.LEGACY_PORTAL : Material.getMaterial("NETHER_PORTAL") != null ? Material.NETHER_PORTAL : null;
Material material = Material.matchMaterial("PORTAL");
if(material == null){
material = Material.matchMaterial("PORTAL_BLOCK");
} else {
material = Material.matchMaterial("NETHER_PORTAL");
}
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) {