diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index ddc49831..00af21f9 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -209,7 +209,7 @@ public class AuthMe extends JavaPlugin { if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) { getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this); } - if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX)) { + if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) { getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this); } if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) { diff --git a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java index 2b47c592..05eef86a 100644 --- a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java +++ b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java @@ -24,6 +24,8 @@ public class LoginLocationFixListener implements Listener { private static Material material = Material.matchMaterial("PORTAL"); + private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL); + private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND); BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST}; static { @@ -40,7 +42,7 @@ public class LoginLocationFixListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5); - if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) { + if (isFixPortalStuck) { if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) { return; } @@ -58,7 +60,7 @@ public class LoginLocationFixListener implements Listener { JoinBlock.breakNaturally(); } player.sendMessage("§a你在登录时卡在了地狱门, 现已修正"); - } else if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND)) { + } else if (isFixGroundStuck) { Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType(); World world = player.getWorld(); int MaxHeight = world.getMaxHeight(); diff --git a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java index 4956a244..e57c1d3b 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java @@ -2,10 +2,10 @@ package fr.xephi.authme.settings.properties; import ch.jalu.configme.Comment; import ch.jalu.configme.SettingsHolder; - import ch.jalu.configme.properties.Property; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.EnumSetProperty; + import java.util.Set; import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty; @@ -43,9 +43,6 @@ public final class SecuritySettings implements SettingsHolder { @Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)") public static final Property DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world"); - @Comment("Should we enable the new LoginLocationFix feature?") - public static final Property LOGIN_LOC_FIX = newProperty("3rdPartyFeature.fixes.loginLocationFix.enabled", false); - @Comment("Should we fix the location when players logged in the portal?") public static final Property LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);