private void setupCommandProtection() { // TODO: Might re-check with plugins enabling during runtime (!). // Read lists and messages from config. final ConfigFile config = ConfigManager.getConfigFile(); // (Might add options to invert selection.) // "No permission". // TODO: Could/should set permission message to null here (server default), might use keyword "default". final List<String> noPerm = config.getStringList(ConfPaths.PROTECT_PLUGINS_HIDE_NOPERMISSION_CMDS); if (noPerm != null && !noPerm.isEmpty()) { final String noPermMsg = ColorUtil.replaceColors(ConfigManager.getConfigFile().getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOPERMISSION_MSG)); // Setup and add changes to history for undoing. changedCommands.addAll(PermissionUtil.protectCommands( Permissions.FILTER_COMMAND.getLowerCaseStringRepresentation(), noPerm, true, false, noPermMsg)); } // "Unknown command", override the other option. final List<String> noCommand = config.getStringList(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_CMDS); if (noCommand != null && !noCommand.isEmpty()) { final String noCommandMsg = ColorUtil.replaceColors(ConfigManager.getConfigFile().getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_MSG)); // Setup and add changes to history for undoing. changedCommands.addAll(PermissionUtil.protectCommands( Permissions.FILTER_COMMAND.getLowerCaseStringRepresentation(), noCommand, true, false, noCommandMsg)); } }
/** * Set up the command protection with the "unknown command" message for the permission message (attempt to hide the command). * @param permissionBase * @param ignoredCommands * @param invertIgnored * @param ops * @return */ public static List<CommandProtectionEntry> protectCommands(String permissionBase, Collection<String> ignoredCommands, boolean invertIgnored, boolean ops) { return protectCommands(permissionBase, ignoredCommands, invertIgnored, ops, ColorUtil.replaceColors(ConfigManager.getConfigFile().getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_MSG))); }
"extern.fromconfig", config.getString(ConfPaths.MOVING_SETBACK_METHOD)); if (playerSetBackMethod.doesThisMakeSense()) { msgKickIllegalMove = ColorUtil.replaceColors(config.getString(ConfPaths.MOVING_MESSAGE_ILLEGALPLAYERMOVE)); msgKickIllegalVehicleMove = ColorUtil.replaceColors(config.getString(ConfPaths.MOVING_MESSAGE_ILLEGALVEHICLEMOVE));
sender.sendMessage(ColorUtil.replaceColors(config.getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_MSG))); return true;
final String prefixIngame = ColorUtil.replaceColors(config.getString(ConfPaths.LOGGING_BACKEND_INGAMECHAT_PREFIX)); final String prefixFile = config.getString(ConfPaths.LOGGING_BACKEND_FILE_PREFIX); String fileName = config.getString(ConfPaths.LOGGING_BACKEND_FILE_FILENAME).trim(); ContentLogger<String> defaultFileLogger = null; if (!fileName.isEmpty() && !fileName.equalsIgnoreCase("none")) {
captchaCharacters = config.getString(ConfPaths.CHAT_CAPTCHA_CHARACTERS); captchaLength = config.getInt(ConfPaths.CHAT_CAPTCHA_LENGTH); captchaQuestion = config.getString(ConfPaths.CHAT_CAPTCHA_QUESTION); captchaSuccess = config.getString(ConfPaths.CHAT_CAPTCHA_SUCCESS); captchaTries = config.getInt(ConfPaths.CHAT_CAPTCHA_TRIES); captchaActions = config.getOptimizedActionList(ConfPaths.CHAT_CAPTCHA_ACTIONS, Permissions.CHAT_CAPTCHA); chatWarningMessage = config.getString(ConfPaths.CHAT_WARNING_MESSAGE); chatWarningTimeout = config.getLong(ConfPaths.CHAT_WARNING_TIMEOUT) * 1000; loginsSeconds = config.getInt(ConfPaths.CHAT_LOGINS_SECONDS); loginsLimit = config.getInt(ConfPaths.CHAT_LOGINS_LIMIT); loginsKickMessage = config.getString(ConfPaths.CHAT_LOGINS_KICKMESSAGE); loginsStartupDelay = config.getInt(ConfPaths.CHAT_LOGINS_STARTUPDELAY) * 1000; relogKickMessage = config.getString(ConfPaths.CHAT_RELOG_KICKMESSAGE); relogTimeout = config.getLong(ConfPaths.CHAT_RELOG_TIMEOUT); relogWarningMessage = config.getString(ConfPaths.CHAT_RELOG_WARNING_MESSAGE); relogWarningNumber = config.getInt(ConfPaths.CHAT_RELOG_WARNING_NUMBER); relogWarningTimeout = config.getLong(ConfPaths.CHAT_RELOG_WARNING_TIMEOUT); consoleOnlyMessage = ColorUtil.replaceColors(config.getString(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_MSG));
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerLogin(final PlayerLoginEvent event) { // (NORMAL to have chat checks come after this.) if (event.getResult() != Result.ALLOWED) { return; } final Player player = event.getPlayer(); // Check if login is denied (plus expiration check). // TODO: Store by id + HashMapLOW + AsyncPlayerPreLogin. if (checkDenyLoginsNames(player.getName())) { if (DataManager.getPlayerData(player).hasPermission(Permissions.BYPASS_DENY_LOGIN, player)) { return; } // TODO: Consider using the vanilla temporary ban feature instead (for an alternative?). // TODO: Display time for which the player is banned. event.setResult(Result.KICK_OTHER); // TODO: Some basic/language configuration object, possibly independent of checks. event.setKickMessage(ColorUtil.replaceColors(ConfigManager.getConfigFile(player.getWorld().getName()).getString(ConfPaths.STRINGS + ".msgtempdenylogin"))); } }