Migrate to @Inject
This commit is contained in:
parent
ecbc11cf0b
commit
fcc34c28aa
@ -231,9 +231,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
|
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.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
|
// if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||||
getServer().getPluginManager().registerEvents(new BedrockAutoLoginListener((Plugin) this), this);
|
// getServer().getPluginManager().registerEvents(new BedrockAutoLoginListener((Plugin) this), this);
|
||||||
}
|
// }
|
||||||
// if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
|
// if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
// getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
// getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
||||||
// logger.info("(Beta)GUICaptcha is enabled successfully!");
|
// logger.info("(Beta)GUICaptcha is enabled successfully!");
|
||||||
@ -344,6 +344,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
|
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
|
||||||
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
|
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
|
// Try to register 1.8+ player listeners
|
||||||
|
|||||||
@ -3,6 +3,7 @@ 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.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,18 +11,21 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class BedrockAutoLoginListener implements Listener {
|
public class BedrockAutoLoginListener implements Listener {
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
private final Plugin plugin;
|
@Inject
|
||||||
|
private BukkitService bukkitService;
|
||||||
|
@Inject
|
||||||
|
private AuthMe plugin;
|
||||||
|
|
||||||
public BedrockAutoLoginListener(Plugin plugin) {
|
|
||||||
this.plugin = plugin;
|
public BedrockAutoLoginListener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBedrockPlayer(UUID uuid) {
|
private boolean isBedrockPlayer(UUID uuid) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user