Completely removed gui captcha things
This commit is contained in:
parent
0fbe7d99cb
commit
dc599fe5c3
@ -20,7 +20,6 @@ import fr.xephi.authme.listener.BedrockAutoLoginListener;
|
|||||||
import fr.xephi.authme.listener.BlockListener;
|
import fr.xephi.authme.listener.BlockListener;
|
||||||
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
||||||
import fr.xephi.authme.listener.EntityListener;
|
import fr.xephi.authme.listener.EntityListener;
|
||||||
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
|
||||||
import fr.xephi.authme.listener.LoginLocationFixListener;
|
import fr.xephi.authme.listener.LoginLocationFixListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener;
|
import fr.xephi.authme.listener.PlayerListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener111;
|
import fr.xephi.authme.listener.PlayerListener111;
|
||||||
@ -347,13 +346,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Register 3rd party listeners
|
//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) {
|
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);
|
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
|
||||||
} else if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && (!settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) || getServer().getPluginManager().getPlugin("floodgate") == null)) {
|
} else if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && (!settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) || getServer().getPluginManager().getPlugin("floodgate") == null)) {
|
||||||
@ -368,7 +360,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && !isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
|
if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && !isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(AdvancedShulkerFixListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(AdvancedShulkerFixListener.class), this);
|
||||||
} else if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
|
} else if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
|
||||||
logger.warning("You are running an 1.13+ minecraft server, advancedShulkerFix won't enable.");
|
logger.warning("You are running an 1.13+ minecraft server, AdvancedShulkerFix won't enable.");
|
||||||
}
|
}
|
||||||
if (settings.getProperty(SecuritySettings.PURGE_DATA_ON_QUIT)) {
|
if (settings.getProperty(SecuritySettings.PURGE_DATA_ON_QUIT)) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PurgeListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PurgeListener.class), this);
|
||||||
|
|||||||
@ -1,263 +0,0 @@
|
|||||||
package fr.xephi.authme.listener;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
|
||||||
import fr.xephi.authme.events.LoginEvent;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
|
||||||
import fr.xephi.authme.message.Messages;
|
|
||||||
import fr.xephi.authme.service.BukkitService;
|
|
||||||
import fr.xephi.authme.service.CommonService;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import static fr.xephi.authme.util.PlayerUtils.getPlayerIp;
|
|
||||||
import static fr.xephi.authme.util.PlayerUtils.isNpc;
|
|
||||||
import static org.bukkit.Bukkit.getLogger;
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class handles ALL the GUI captcha features in the plugin.
|
|
||||||
*/
|
|
||||||
public class GuiCaptchaHandler implements Listener {
|
|
||||||
//define AuthMeApi
|
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
|
||||||
@Inject
|
|
||||||
private BukkitService bukkitService;
|
|
||||||
@Inject
|
|
||||||
private AuthMe plugin;
|
|
||||||
@Inject
|
|
||||||
private Messages messages;
|
|
||||||
@Inject
|
|
||||||
private CommonService service;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Settings settings;
|
|
||||||
|
|
||||||
|
|
||||||
private PacketAdapter chatPacketListener;
|
|
||||||
private PacketAdapter windowPacketListener;
|
|
||||||
|
|
||||||
//define timesLeft
|
|
||||||
private int timesLeft = 3;
|
|
||||||
//Use ConcurrentHashMap to store player and their close reason
|
|
||||||
/* We used many async tasks so there is concurrent**/
|
|
||||||
public static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
|
||||||
//define randomStringSet
|
|
||||||
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
|
||||||
String randomString = "";
|
|
||||||
Random randomItemSet = new Random();
|
|
||||||
Random howManyRandom = new Random();
|
|
||||||
private Material captchaMaterial = getRandomMaterial();
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isPacketListenersActive = false;
|
|
||||||
|
|
||||||
public GuiCaptchaHandler() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private StringBuilder sb;
|
|
||||||
private final List<String> whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST);
|
|
||||||
|
|
||||||
private boolean isBedrockPlayer(UUID uuid) {
|
|
||||||
if (getServer().getPluginManager().getPlugin("floodgate") != null) {
|
|
||||||
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void initializePacketListeners() {
|
|
||||||
if (!isPacketListenersActive) {
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
|
|
||||||
isPacketListenersActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
|
||||||
if (event.getWhoClicked() instanceof Player) {
|
|
||||||
Player player = (Player) event.getWhoClicked();
|
|
||||||
ItemStack currentItem = event.getCurrentItem();
|
|
||||||
if (!authmeApi.isRegistered(player.getName())) {
|
|
||||||
if (isBedrockPlayer(player.getUniqueId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (currentItem != null && currentItem.getType().equals(captchaMaterial)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
if (!closeReasonMap.containsKey(player)) {
|
|
||||||
closeReasonMap.put(player, "verified");
|
|
||||||
}
|
|
||||||
player.closeInventory();
|
|
||||||
messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
bukkitService.runTaskAsynchronously(() -> {
|
|
||||||
sb = new StringBuilder();
|
|
||||||
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
|
||||||
for (int i = 0; i < howLongIsRandomString; i++) {
|
|
||||||
//生成随机索引号
|
|
||||||
int index = randomItemSet.nextInt(randomSet.length());
|
|
||||||
|
|
||||||
// 从字符串中获取由索引 index 指定的字符
|
|
||||||
char randomChar = randomSet.charAt(index);
|
|
||||||
|
|
||||||
// 将字符追加到字符串生成器
|
|
||||||
sb.append(randomChar);
|
|
||||||
}
|
|
||||||
if (!whiteList.isEmpty()) {
|
|
||||||
String ip = getPlayerIp(player);
|
|
||||||
if (whiteList.contains(authmeApi.getCountryCode(ip)) && ip != null) {
|
|
||||||
if (!closeReasonMap.containsKey(player)) {
|
|
||||||
closeReasonMap.put(player, "verified:whitelist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
||||||
randomString = "";
|
|
||||||
Player playerunreg = event.getPlayer();
|
|
||||||
String name = playerunreg.getName();
|
|
||||||
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg) && !closeReasonMap.containsKey(playerunreg)) {
|
|
||||||
if (isBedrockPlayer(playerunreg.getUniqueId())) {
|
|
||||||
if (!closeReasonMap.containsKey(playerunreg)) {
|
|
||||||
closeReasonMap.put(playerunreg, "verified:bedrock");
|
|
||||||
}
|
|
||||||
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
randomString = sb.toString();
|
|
||||||
Random random_blockpos = new Random();
|
|
||||||
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(27));
|
|
||||||
Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString));
|
|
||||||
ItemStack item = new ItemStack(captchaMaterial);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
try {
|
|
||||||
if (meta != null) {
|
|
||||||
meta.setDisplayName(messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_CLICKABLE_NAME, randomString));
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
}
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
|
|
||||||
}
|
|
||||||
windowPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
Player packetPlayer = event.getPlayer();
|
|
||||||
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
|
|
||||||
if (timesLeft <= 0) {
|
|
||||||
bukkitService.runTask(() -> {
|
|
||||||
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
|
||||||
});
|
|
||||||
timesLeft = 3;
|
|
||||||
} else {
|
|
||||||
--timesLeft;
|
|
||||||
if (timesLeft <= 0) {
|
|
||||||
bukkitService.runTask(() -> {
|
|
||||||
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
|
||||||
});
|
|
||||||
timesLeft = 3;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft));
|
|
||||||
event.setCancelled(true);
|
|
||||||
random_num.set(random_blockpos.nextInt(26));
|
|
||||||
bukkitService.runTask(() -> {
|
|
||||||
menu.clear();
|
|
||||||
menu.setItem(random_num.get(), item);
|
|
||||||
packetPlayer.openInventory(menu);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
Player packetPlayer = event.getPlayer();
|
|
||||||
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
|
|
||||||
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE);
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
initializePacketListeners();
|
|
||||||
//Open captcha inventory
|
|
||||||
menu.setItem(random_num.get(), item);
|
|
||||||
playerunreg.openInventory(menu);
|
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
|
|
||||||
long timeOut = settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
|
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > settings.getProperty(RestrictionSettings.TIMEOUT)) {
|
|
||||||
bukkitService.runTask(() -> {
|
|
||||||
getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
|
|
||||||
settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
|
|
||||||
});
|
|
||||||
timeOut = settings.getProperty(RestrictionSettings.TIMEOUT);
|
|
||||||
}
|
|
||||||
long finalTimeOut = timeOut;
|
|
||||||
bukkitService.runTaskLater(() -> {
|
|
||||||
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
|
||||||
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
|
|
||||||
timesLeft = 3; // Reset the attempt counter
|
|
||||||
}
|
|
||||||
}, finalTimeOut * 20L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//This prevents players from unregistering by Admins
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerAuthMeLogin(LoginEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (!closeReasonMap.containsKey(player)) {
|
|
||||||
closeReasonMap.put(player, "verified:login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Material getRandomMaterial() {
|
|
||||||
Material[] allMaterials = Material.values();
|
|
||||||
Random random = new Random();
|
|
||||||
return allMaterials[random.nextInt(allMaterials.length)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,14 +1,11 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
import fr.xephi.authme.service.ValidationService;
|
import fr.xephi.authme.service.ValidationService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -21,7 +18,6 @@ import javax.inject.Inject;
|
|||||||
* Service class for the AuthMe listeners to determine whether an event should be canceled.
|
* Service class for the AuthMe listeners to determine whether an event should be canceled.
|
||||||
*/
|
*/
|
||||||
class ListenerService implements SettingsDependent {
|
class ListenerService implements SettingsDependent {
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
private final PlayerCache playerCache;
|
private final PlayerCache playerCache;
|
||||||
private final ValidationService validationService;
|
private final ValidationService validationService;
|
||||||
@ -84,14 +80,6 @@ class ListenerService implements SettingsDependent {
|
|||||||
|
|
||||||
return player != null && !checkAuth(player.getName()) && !PlayerUtils.isNpc(player);
|
return player != null && !checkAuth(player.getName()) && !PlayerUtils.isNpc(player);
|
||||||
}
|
}
|
||||||
public boolean shouldCancelInvEvent(Player player) {
|
|
||||||
try {
|
|
||||||
return !AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA) || authmeApi.isRegistered(player.getName()) || GuiCaptchaHandler.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reload(Settings settings) {
|
public void reload(Settings settings) {
|
||||||
isRegistrationForced = settings.getProperty(RegistrationSettings.FORCE);
|
isRegistrationForced = settings.getProperty(RegistrationSettings.FORCE);
|
||||||
|
|||||||
@ -64,12 +64,7 @@ import static org.bukkit.Bukkit.getServer;
|
|||||||
/**
|
/**
|
||||||
* Listener class for player events.
|
* Listener class for player events.
|
||||||
*/
|
*/
|
||||||
public class PlayerListener implements Listener{
|
public class PlayerListener implements Listener {
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
@Inject
|
@Inject
|
||||||
@ -508,9 +503,8 @@ public class PlayerListener implements Listener{
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||||
final HumanEntity player = event.getPlayer();
|
final HumanEntity player = event.getPlayer();
|
||||||
Player ply = (Player) event.getPlayer();
|
|
||||||
if (listenerService.shouldCancelEvent(player)
|
if (listenerService.shouldCancelEvent(player)
|
||||||
&& !isInventoryWhitelisted(event.getView()) && listenerService.shouldCancelInvEvent(ply)) {
|
&& !isInventoryWhitelisted(event.getView())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -29,46 +29,6 @@ public enum MessageKey {
|
|||||||
*/
|
*/
|
||||||
BEDROCK_AUTO_LOGGED_IN("bedrock_auto_login.success"),
|
BEDROCK_AUTO_LOGGED_IN("bedrock_auto_login.success"),
|
||||||
|
|
||||||
/**
|
|
||||||
* %random Verification
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_WINDOW_NAME("gui_captcha.captcha_window_name", "%random"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* %random I am human
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_CLICKABLE_NAME("gui_captcha.captcha_clickable_name", "%random"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verification failed, you have %times retries left
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_RETRY_MESSAGE("gui_captcha.message_on_retry", "%times"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bedrock verification success!
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK("gui_captcha.bedrock_auto_verify_success"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Please be verified before chatting!
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_DENIED_MESSAGE("gui_captcha.denied_message_sending"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verification timed out!
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_KICK_TIMEOUT("gui_captcha.kick_on_timeout"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Please complete the verification!
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_KICK_FAILED("gui_captcha.kick_on_failed"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verification success!
|
|
||||||
*/
|
|
||||||
GUI_CAPTCHA_VERIFIED("gui_captcha.success"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In order to use this command you must be authenticated!
|
* In order to use this command you must be authenticated!
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,10 +6,8 @@ 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.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||||
|
|
||||||
@ -21,11 +19,6 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
||||||
newProperty("Security.SQLProblem.stopServer", false);
|
newProperty("Security.SQLProblem.stopServer", false);
|
||||||
|
|
||||||
@Comment({"Should send GUI captcha by country code whitelist?",
|
|
||||||
"If the country of the player is in this list, the captcha won't be sent."})
|
|
||||||
public static final Property<List<String>> GUI_CAPTCHA_COUNTRY_WHITELIST =
|
|
||||||
newListProperty("3rdPartyFeature.features.captcha.whiteList");
|
|
||||||
|
|
||||||
@Comment({"Should we let Bedrock players login automatically?",
|
@Comment({"Should we let Bedrock players login automatically?",
|
||||||
"(Requires hookFloodgate to be true & floodgate loaded)",
|
"(Requires hookFloodgate to be true & floodgate loaded)",
|
||||||
"(**THIS IS SAFE DO NOT WORRY**)"})
|
"(**THIS IS SAFE DO NOT WORRY**)"})
|
||||||
@ -48,20 +41,6 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> ADVANCED_SHULKER_FIX =
|
public static final Property<Boolean> ADVANCED_SHULKER_FIX =
|
||||||
newProperty("3rdPartyFeature.fixes.advancedShulkerFix", false);
|
newProperty("3rdPartyFeature.fixes.advancedShulkerFix", false);
|
||||||
|
|
||||||
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
|
|
||||||
public static final Property<Boolean> GUI_CAPTCHA =
|
|
||||||
newProperty("3rdPartyFeature.features.captcha.guiCaptcha", false);
|
|
||||||
|
|
||||||
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
|
|
||||||
"(less than or equals 0 is disabled)"})
|
|
||||||
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT =
|
|
||||||
newProperty("3rdPartyFeature.features.captcha.timeOut", 0);
|
|
||||||
|
|
||||||
@Comment({"Should we ignore floodgate players when sending GUI captcha?",
|
|
||||||
"(Requires floodgate and hookFloodgate: true)"})
|
|
||||||
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY =
|
|
||||||
newProperty("3rdPartyFeature.features.captcha.ignoreBedrock", 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 =
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL =
|
||||||
newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
||||||
|
|||||||
@ -156,17 +156,6 @@ time:
|
|||||||
day: 'day'
|
day: 'day'
|
||||||
days: 'days'
|
days: 'days'
|
||||||
|
|
||||||
# 3rd party features: GUI Captcha
|
|
||||||
gui_captcha:
|
|
||||||
success: '&aVerification success!'
|
|
||||||
bedrock_auto_verify_success: '&aBedrock verification success!'
|
|
||||||
captcha_window_name: '%random Verification'
|
|
||||||
captcha_clickable_name: '%random I am human'
|
|
||||||
message_on_retry: '&cVerification failed, you have %times retries left'
|
|
||||||
denied_message_sending: '&cPlease be verified before chatting!'
|
|
||||||
kick_on_failed: '&cPlease complete the verification!'
|
|
||||||
kick_on_timeout: '&cVerification timed out!'
|
|
||||||
|
|
||||||
# 3rd party features: Bedrock Auto Login
|
# 3rd party features: Bedrock Auto Login
|
||||||
bedrock_auto_login:
|
bedrock_auto_login:
|
||||||
success: '&aBedrock auto login success!'
|
success: '&aBedrock auto login success!'
|
||||||
|
|||||||
@ -155,17 +155,6 @@ time:
|
|||||||
day: 'дн.'
|
day: 'дн.'
|
||||||
days: 'дн.'
|
days: 'дн.'
|
||||||
|
|
||||||
# 3rd party features: GUI Captcha
|
|
||||||
gui_captcha:
|
|
||||||
success: '&aВы успешно прошли проверку на робота!'
|
|
||||||
bedrock_auto_verify_success: '&aВы обошли проверку на робота потому что вы играете с Bedrock!'
|
|
||||||
captcha_window_name: '%random Верификация'
|
|
||||||
captcha_clickable_name: '%random Я человек'
|
|
||||||
message_on_retry: '&cНеверно! %times попыток осталось'
|
|
||||||
denied_message_sending: '&cНеобходимо верифицироваться, чтобы писать в чат!'
|
|
||||||
kick_on_failed: '&cВы провалили верификацию!'
|
|
||||||
kick_on_timeout: '&cВремя верификации истекло!'
|
|
||||||
|
|
||||||
# 3rd party features: Bedrock Auto Login
|
# 3rd party features: Bedrock Auto Login
|
||||||
bedrock_auto_login:
|
bedrock_auto_login:
|
||||||
success: '&aВы автоматически авторизовались потому что вы играете с Bedrock!'
|
success: '&aВы автоматически авторизовались потому что вы играете с Bedrock!'
|
||||||
|
|||||||
@ -166,17 +166,6 @@ two_factor:
|
|||||||
removed_success: '&c双重验证已从您的账号上禁用'
|
removed_success: '&c双重验证已从您的账号上禁用'
|
||||||
invalid_code: '&c无效的验证码'
|
invalid_code: '&c无效的验证码'
|
||||||
|
|
||||||
# 3rd party features: GUI Captcha
|
|
||||||
gui_captcha:
|
|
||||||
success: '&a*** 验证完成 ***'
|
|
||||||
bedrock_auto_verify_success: '&a*** 基岩版自动验证完成 ***'
|
|
||||||
captcha_window_name: '&k%random&r&n请验证你是真人'
|
|
||||||
captcha_clickable_name: '&k%random&r&n我是真人'
|
|
||||||
message_on_retry: '&c验证失败,你还有 %times 次机会'
|
|
||||||
denied_message_sending: '&c请先完成验证再聊天!'
|
|
||||||
kick_on_failed: '&c请先完成验证!'
|
|
||||||
kick_on_timeout: '&c验证超时'
|
|
||||||
|
|
||||||
# 3rd party features: Bedrock Auto Login
|
# 3rd party features: Bedrock Auto Login
|
||||||
bedrock_auto_login:
|
bedrock_auto_login:
|
||||||
success: "&a基岩版自动登录完成"
|
success: "&a基岩版自动登录完成"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user