@Override public boolean execute() { // Check if player already has a rollback processing if (session.doingRollback()) { Util.sendMessage(sender, "&cYou already have a rollback command processing!"); return true; } // Parse arguments SearchParser parser = null; try { parser = new SearchParser(player, args); parser.loc = null; // Check that supplied actions can rollback if (parser.actions.size() > 0) { for (DataType type : parser.actions) if (!type.canRollback()) throw new IllegalArgumentException( "You cannot rollback that action type: &7" + type.getConfigName()); } // If none supplied, add in all rollback types else { for (DataType type : DataType.values()) if (type.canRollback()) parser.actions.add(type); } } catch (IllegalArgumentException e) { Util.sendMessage(sender, "&c" + e.getMessage()); return true; } // Create new SearchQuery with data new SearchQuery(new RollbackCallback(session, RollbackType.LOCAL), parser, SearchDir.DESC); session.setInPreview(true); return true; }
/** * Check if a {@link DataType} is logged or not * * @param dataType * @return true or false */ public static boolean isLogged(DataType dataType) { if (config.getBoolean("log." + dataType.getConfigName(), false) == true) return true; return false; }