Delete useless options & make code more readable
This commit is contained in:
parent
07d9bbbf7c
commit
3dab24c142
@ -209,7 +209,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||||
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
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);
|
getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this);
|
||||||
}
|
}
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
|
|||||||
@ -24,6 +24,8 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
|
|
||||||
private static Material material = Material.matchMaterial("PORTAL");
|
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};
|
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -40,7 +42,7 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
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 (isFixPortalStuck) {
|
||||||
if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) {
|
if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,7 +60,7 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
JoinBlock.breakNaturally();
|
JoinBlock.breakNaturally();
|
||||||
}
|
}
|
||||||
player.sendMessage("§a你在登录时卡在了地狱门, 现已修正");
|
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();
|
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
int MaxHeight = world.getMaxHeight();
|
int MaxHeight = world.getMaxHeight();
|
||||||
|
|||||||
@ -2,10 +2,10 @@ package fr.xephi.authme.settings.properties;
|
|||||||
|
|
||||||
import ch.jalu.configme.Comment;
|
import ch.jalu.configme.Comment;
|
||||||
import ch.jalu.configme.SettingsHolder;
|
import ch.jalu.configme.SettingsHolder;
|
||||||
|
|
||||||
import ch.jalu.configme.properties.Property;
|
import ch.jalu.configme.properties.Property;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.settings.EnumSetProperty;
|
import fr.xephi.authme.settings.EnumSetProperty;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
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)")
|
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
|
||||||
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world");
|
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world");
|
||||||
|
|
||||||
@Comment("Should we enable the new LoginLocationFix feature?")
|
|
||||||
public static final Property<Boolean> LOGIN_LOC_FIX = newProperty("3rdPartyFeature.fixes.loginLocationFix.enabled", false);
|
|
||||||
|
|
||||||
@Comment("Should we fix the location when players logged in the portal?")
|
@Comment("Should we fix the location when players logged in the portal?")
|
||||||
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user