Unified code style

This commit is contained in:
HaHaWTH 2023-11-11 20:32:01 +08:00
parent ee58da2b39
commit 5a9b9ce619
2 changed files with 25 additions and 21 deletions

View File

@ -224,9 +224,9 @@ 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_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this);
}
// 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);
// }
}
/**
* Load the version and build number of the plugin from the description file.
@ -322,18 +322,6 @@ public class AuthMe extends JavaPlugin {
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
//Register 3rd party listeners
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
pluginManager.registerEvents(injector.getSingleton(GuiCaptchaHandler.class), this);
logger.info("(Beta)GUICaptcha is enabled successfully!");
logger.info("These features are still in early development, if you encountered any problem, please report.");
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
}
if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
}
// Try to register 1.8+ player listeners
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
@ -341,8 +329,7 @@ public class AuthMe extends JavaPlugin {
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
}
// Try to register 1.9 player listeners(Moved to else-if)
// Try to register 1.9 player listeners(Moved to else-if)
// if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
// pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
// }
@ -356,6 +343,21 @@ public class AuthMe extends JavaPlugin {
if (isClassLoaded("org.bukkit.event.entity.EntityAirChangeEvent")) {
pluginManager.registerEvents(injector.getSingleton(PlayerListener111.class), this);
}
//Register 3rd party listeners
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
pluginManager.registerEvents(injector.getSingleton(GuiCaptchaHandler.class), this);
logger.info("(Beta)GUICaptcha is enabled successfully!");
logger.info("These features are still in early development, if you encountered any problem, please report.");
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
}
if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
}
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
pluginManager.registerEvents(injector.getSingleton(LoginLocationFixListener.class), this);
}
}
/**

View File

@ -1,4 +1,5 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.settings.properties.SecuritySettings;
@ -12,15 +13,16 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import javax.inject.Inject;
public class LoginLocationFixListener implements Listener {
private final Plugin plugin;
@Inject
private AuthMe plugin;
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
public LoginLocationFixListener(Plugin plugin) {
this.plugin = plugin;
public LoginLocationFixListener() {
}
private static Material materialPortal = Material.matchMaterial("PORTAL");