mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2025-01-15 20:32:24 +01:00
Added hidden "exclude-tnt" rollback option to exclude TNT blocks (default: false)
This commit is contained in:
parent
2b96daa422
commit
02dcc873d6
@ -3,8 +3,10 @@ package net.coreprotect;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -147,17 +149,17 @@ public class CoreProtectAPI extends Queue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Object> parseList(List<Object> list) {
|
private static Map<Object, Boolean> parseList(List<Object> list) {
|
||||||
List<Object> result = new ArrayList<>();
|
Map<Object, Boolean> result = new HashMap<>();
|
||||||
|
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (Object value : list) {
|
for (Object value : list) {
|
||||||
if (value instanceof Material || value instanceof EntityType) {
|
if (value instanceof Material || value instanceof EntityType) {
|
||||||
result.add(value);
|
result.put(value, false);
|
||||||
}
|
}
|
||||||
else if (value instanceof Integer) {
|
else if (value instanceof Integer) {
|
||||||
Material material = Util.getType((Integer) value);
|
Material material = Util.getType((Integer) value);
|
||||||
result.add(material);
|
result.put(material, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +419,7 @@ public class CoreProtectAPI extends Queue {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String[]> processData(int time, int radius, Location location, List<Object> restrictBlocks, List<Object> excludeBlocks, List<String> restrictUsers, List<String> excludeUsers, List<Integer> actionList, int action, int lookup, int offset, int rowCount, boolean useLimit) {
|
private List<String[]> processData(int time, int radius, Location location, Map<Object, Boolean> restrictBlocksMap, Map<Object, Boolean> excludeBlocks, List<String> restrictUsers, List<String> excludeUsers, List<Integer> actionList, int action, int lookup, int offset, int rowCount, boolean useLimit) {
|
||||||
// You need to either specify time/radius or time/user
|
// You need to either specify time/radius or time/user
|
||||||
List<String[]> result = new ArrayList<>();
|
List<String[]> result = new ArrayList<>();
|
||||||
List<String> uuids = new ArrayList<>();
|
List<String> uuids = new ArrayList<>();
|
||||||
@ -434,6 +436,7 @@ public class CoreProtectAPI extends Queue {
|
|||||||
actionList = new ArrayList<>();
|
actionList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Object> restrictBlocks = new ArrayList<>(restrictBlocksMap.keySet());
|
||||||
if (actionList.size() == 0 && restrictBlocks.size() > 0) {
|
if (actionList.size() == 0 && restrictBlocks.size() > 0) {
|
||||||
boolean addedMaterial = false;
|
boolean addedMaterial = false;
|
||||||
boolean addedEntity = false;
|
boolean addedEntity = false;
|
||||||
@ -530,7 +533,7 @@ public class CoreProtectAPI extends Queue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private List<String[]> processData(String user, int time, int radius, Location location, List<Object> restrictBlocks, List<Object> excludeBlocks, int action, int lookup, int offset, int rowCount, boolean useLimit) {
|
private List<String[]> processData(String user, int time, int radius, Location location, Map<Object, Boolean> restrictBlocks, Map<Object, Boolean> excludeBlocks, int action, int lookup, int offset, int rowCount, boolean useLimit) {
|
||||||
ArrayList<String> restrictUsers = new ArrayList<>();
|
ArrayList<String> restrictUsers = new ArrayList<>();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
restrictUsers.add(user);
|
restrictUsers.add(user);
|
||||||
|
@ -3,8 +3,10 @@ package net.coreprotect.command;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -255,9 +257,9 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<Object> parseExcluded(CommandSender player, String[] inputArguments, List<Integer> argAction) {
|
protected static Map<Object, Boolean> parseExcluded(CommandSender player, String[] inputArguments, List<Integer> argAction) {
|
||||||
String[] argumentArray = inputArguments.clone();
|
String[] argumentArray = inputArguments.clone();
|
||||||
List<Object> excluded = new ArrayList<>();
|
Map<Object, Boolean> excluded = new HashMap<>();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int next = 0;
|
int next = 0;
|
||||||
for (String argument : argumentArray) {
|
for (String argument : argumentArray) {
|
||||||
@ -276,20 +278,22 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
String[] i2 = argument.split(",");
|
String[] i2 = argument.split(",");
|
||||||
for (String i3 : i2) {
|
for (String i3 : i2) {
|
||||||
if (i3.equals("#natural")) {
|
if (i3.equals("#natural")) {
|
||||||
excluded.addAll(naturalBlocks);
|
for (Material block : naturalBlocks) {
|
||||||
|
excluded.put(block, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Material i3_material = Util.getType(i3);
|
Material i3_material = Util.getType(i3);
|
||||||
if (i3_material != null && (i3_material.isBlock() || argAction.contains(4))) {
|
if (i3_material != null && (i3_material.isBlock() || argAction.contains(4))) {
|
||||||
excluded.add(i3_material);
|
excluded.put(i3_material, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EntityType i3_entity = Util.getEntityType(i3);
|
EntityType i3_entity = Util.getEntityType(i3);
|
||||||
if (i3_entity != null) {
|
if (i3_entity != null) {
|
||||||
excluded.add(i3_entity);
|
excluded.put(i3_entity, false);
|
||||||
}
|
}
|
||||||
else if (i3_material != null) {
|
else if (i3_material != null) {
|
||||||
excluded.add(i3_material);
|
excluded.put(i3_material, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,20 +307,22 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (argument.equals("#natural")) {
|
if (argument.equals("#natural")) {
|
||||||
excluded.addAll(naturalBlocks);
|
for (Material block : naturalBlocks) {
|
||||||
|
excluded.put(block, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Material iMaterial = Util.getType(argument);
|
Material iMaterial = Util.getType(argument);
|
||||||
if (iMaterial != null && (iMaterial.isBlock() || argAction.contains(4))) {
|
if (iMaterial != null && (iMaterial.isBlock() || argAction.contains(4))) {
|
||||||
excluded.add(iMaterial);
|
excluded.put(iMaterial, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EntityType iEntity = Util.getEntityType(argument);
|
EntityType iEntity = Util.getEntityType(argument);
|
||||||
if (iEntity != null) {
|
if (iEntity != null) {
|
||||||
excluded.add(iEntity);
|
excluded.put(iEntity, false);
|
||||||
}
|
}
|
||||||
else if (iMaterial != null) {
|
else if (iMaterial != null) {
|
||||||
excluded.add(iMaterial);
|
excluded.put(iMaterial, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.text.NumberFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -49,7 +50,7 @@ public class LookupCommand {
|
|||||||
int argNoisy = CommandHandler.parseNoisy(args);
|
int argNoisy = CommandHandler.parseNoisy(args);
|
||||||
List<Integer> argAction = CommandHandler.parseAction(args);
|
List<Integer> argAction = CommandHandler.parseAction(args);
|
||||||
List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
|
List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
|
||||||
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
|
Map<Object, Boolean> argExclude = CommandHandler.parseExcluded(player, args, argAction);
|
||||||
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
|
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
|
||||||
String ts = CommandHandler.parseTimeString(args);
|
String ts = CommandHandler.parseTimeString(args);
|
||||||
long[] argTime = CommandHandler.parseTime(args);
|
long[] argTime = CommandHandler.parseTime(args);
|
||||||
@ -94,7 +95,7 @@ public class LookupCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for invalid block/entity combinations (exclude) */
|
/* check for invalid block/entity combinations (exclude) */
|
||||||
for (Object arg : argExclude) {
|
for (Object arg : argExclude.keySet()) {
|
||||||
if (arg instanceof Material) {
|
if (arg instanceof Material) {
|
||||||
hasBlock = true;
|
hasBlock = true;
|
||||||
}
|
}
|
||||||
@ -266,9 +267,9 @@ public class LookupCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argAction.contains(4) && argAction.contains(11)) { // a:inventory
|
if (argAction.contains(4) && argAction.contains(11)) { // a:inventory
|
||||||
argExclude.add(Material.FIRE);
|
argExclude.put(Material.FIRE, false);
|
||||||
argExclude.add(Material.WATER);
|
argExclude.put(Material.WATER, false);
|
||||||
argExclude.add(Material.FARMLAND);
|
argExclude.put(Material.FARMLAND, false);
|
||||||
argExcludeUsers.add("#hopper");
|
argExcludeUsers.add("#hopper");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +696,7 @@ public class LookupCommand {
|
|||||||
final int restricted = argRestricted;
|
final int restricted = argRestricted;
|
||||||
// final List<String> uuid_list = arg_uuids;
|
// final List<String> uuid_list = arg_uuids;
|
||||||
final List<Object> blist = argBlocks;
|
final List<Object> blist = argBlocks;
|
||||||
final List<Object> elist = argExclude;
|
final Map<Object, Boolean> elist = argExclude;
|
||||||
final List<String> euserlist = argExcludeUsers;
|
final List<String> euserlist = argExcludeUsers;
|
||||||
final int page = pa;
|
final int page = pa;
|
||||||
final int displayResults = re;
|
final int displayResults = re;
|
||||||
|
@ -5,6 +5,7 @@ import java.sql.Statement;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -39,7 +40,7 @@ public class RollbackRestoreCommand {
|
|||||||
int argNoisy = CommandHandler.parseNoisy(args);
|
int argNoisy = CommandHandler.parseNoisy(args);
|
||||||
List<Integer> argAction = CommandHandler.parseAction(args);
|
List<Integer> argAction = CommandHandler.parseAction(args);
|
||||||
List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
|
List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
|
||||||
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
|
Map<Object, Boolean> argExclude = CommandHandler.parseExcluded(player, args, argAction);
|
||||||
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
|
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
|
||||||
String ts = CommandHandler.parseTimeString(args);
|
String ts = CommandHandler.parseTimeString(args);
|
||||||
long[] argTime = CommandHandler.parseTime(args);
|
long[] argTime = CommandHandler.parseTime(args);
|
||||||
@ -76,7 +77,7 @@ public class RollbackRestoreCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for invalid block/entity combinations (exclude) */
|
/* check for invalid block/entity combinations (exclude) */
|
||||||
for (Object arg : argExclude) {
|
for (Object arg : argExclude.keySet()) {
|
||||||
if (arg instanceof Material) {
|
if (arg instanceof Material) {
|
||||||
hasBlock = true;
|
hasBlock = true;
|
||||||
}
|
}
|
||||||
@ -186,11 +187,14 @@ public class RollbackRestoreCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
argExclude.add(Material.FIRE);
|
argExclude.put(Material.FIRE, false);
|
||||||
argExclude.add(Material.WATER);
|
argExclude.put(Material.WATER, false);
|
||||||
argExclude.add(Material.FARMLAND);
|
argExclude.put(Material.FARMLAND, false);
|
||||||
argExcludeUsers.add("#hopper");
|
argExcludeUsers.add("#hopper");
|
||||||
}
|
}
|
||||||
|
else if (!argAction.contains(4) && Config.getGlobal().EXCLUDE_TNT && !argExclude.containsKey(Material.TNT) && !argBlocks.contains(Material.TNT)) {
|
||||||
|
argExclude.put(Material.TNT, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (g == 1 && (argUsers.size() > 0 || (argUsers.size() == 0 && argRadius != null))) {
|
if (g == 1 && (argUsers.size() > 0 || (argUsers.size() == 0 && argRadius != null))) {
|
||||||
Integer MAX_RADIUS = Config.getGlobal().MAX_RADIUS;
|
Integer MAX_RADIUS = Config.getGlobal().MAX_RADIUS;
|
||||||
@ -329,7 +333,7 @@ public class RollbackRestoreCommand {
|
|||||||
final String rtime = ts;
|
final String rtime = ts;
|
||||||
final List<String> uuidList = argUuids;
|
final List<String> uuidList = argUuids;
|
||||||
final List<Object> blist = argBlocks;
|
final List<Object> blist = argBlocks;
|
||||||
final List<Object> elist = argExclude;
|
final Map<Object, Boolean> elist = argExclude;
|
||||||
final List<String> euserlist = argExcludeUsers;
|
final List<String> euserlist = argExcludeUsers;
|
||||||
final Location locationFinal = lo;
|
final Location locationFinal = lo;
|
||||||
final int finalArgWid = argWid;
|
final int finalArgWid = argWid;
|
||||||
|
@ -46,6 +46,7 @@ public class Config extends Language {
|
|||||||
public boolean DATABASE_LOCK;
|
public boolean DATABASE_LOCK;
|
||||||
public boolean LOG_CANCELLED_CHAT;
|
public boolean LOG_CANCELLED_CHAT;
|
||||||
public boolean HOPPER_FILTER_META;
|
public boolean HOPPER_FILTER_META;
|
||||||
|
public boolean EXCLUDE_TNT;
|
||||||
public boolean MYSQL;
|
public boolean MYSQL;
|
||||||
public boolean CHECK_UPDATES;
|
public boolean CHECK_UPDATES;
|
||||||
public boolean API_ENABLED;
|
public boolean API_ENABLED;
|
||||||
@ -185,6 +186,7 @@ public class Config extends Language {
|
|||||||
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
|
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
|
||||||
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
|
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
|
||||||
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
|
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
|
||||||
|
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
|
||||||
this.DONATION_KEY = this.getString("donation-key");
|
this.DONATION_KEY = this.getString("donation-key");
|
||||||
this.MYSQL = this.getBoolean("use-mysql");
|
this.MYSQL = this.getBoolean("use-mysql");
|
||||||
this.PREFIX = this.getString("table-prefix");
|
this.PREFIX = this.getString("table-prefix");
|
||||||
|
@ -105,7 +105,7 @@ public class ConfigHandler extends Queue {
|
|||||||
public static Map<String, Integer> lookupPage = syncMap();
|
public static Map<String, Integer> lookupPage = syncMap();
|
||||||
public static Map<String, String> lookupCommand = syncMap();
|
public static Map<String, String> lookupCommand = syncMap();
|
||||||
public static Map<String, List<Object>> lookupBlist = syncMap();
|
public static Map<String, List<Object>> lookupBlist = syncMap();
|
||||||
public static Map<String, List<Object>> lookupElist = syncMap();
|
public static Map<String, Map<Object, Boolean>> lookupElist = syncMap();
|
||||||
public static Map<String, List<String>> lookupEUserlist = syncMap();
|
public static Map<String, List<String>> lookupEUserlist = syncMap();
|
||||||
public static Map<String, List<String>> lookupUlist = syncMap();
|
public static Map<String, List<String>> lookupUlist = syncMap();
|
||||||
public static Map<String, List<Integer>> lookupAlist = syncMap();
|
public static Map<String, List<Integer>> lookupAlist = syncMap();
|
||||||
|
@ -4,6 +4,7 @@ import java.sql.Statement;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -28,7 +29,7 @@ import net.coreprotect.utility.Util;
|
|||||||
|
|
||||||
public class ContainerRollback extends Queue {
|
public class ContainerRollback extends Queue {
|
||||||
|
|
||||||
public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType) {
|
public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType) {
|
||||||
try {
|
try {
|
||||||
long timeStart = System.currentTimeMillis();
|
long timeStart = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -75,7 +76,7 @@ public class Lookup extends Queue {
|
|||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long countLookupRows(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
|
public static long countLookupRows(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
|
||||||
Long rows = 0L;
|
Long rows = 0L;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -102,7 +103,7 @@ public class Lookup extends Queue {
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String[]> performLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
|
public static List<String[]> performLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
|
||||||
List<String[]> newList = new ArrayList<>();
|
List<String[]> newList = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -116,7 +117,7 @@ public class Lookup extends Queue {
|
|||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Object[]> performLookupRaw(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
|
static List<Object[]> performLookupRaw(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
|
||||||
List<Object[]> list = new ArrayList<>();
|
List<Object[]> list = new ArrayList<>();
|
||||||
List<Integer> invalidRollbackActions = new ArrayList<>();
|
List<Integer> invalidRollbackActions = new ArrayList<>();
|
||||||
invalidRollbackActions.add(2);
|
invalidRollbackActions.add(2);
|
||||||
@ -272,7 +273,7 @@ public class Lookup extends Queue {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String[]> performPartialLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
|
public static List<String[]> performPartialLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
|
||||||
List<String[]> newList = new ArrayList<>();
|
List<String[]> newList = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -286,7 +287,7 @@ public class Lookup extends Queue {
|
|||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResultSet rawLookupResultSet(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup, boolean count) {
|
private static ResultSet rawLookupResultSet(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup, boolean count) {
|
||||||
ResultSet results = null;
|
ResultSet results = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -391,7 +392,7 @@ public class Lookup extends Queue {
|
|||||||
StringBuilder excludeListMaterial = new StringBuilder();
|
StringBuilder excludeListMaterial = new StringBuilder();
|
||||||
StringBuilder excludeListEntity = new StringBuilder();
|
StringBuilder excludeListEntity = new StringBuilder();
|
||||||
|
|
||||||
for (Object restrictTarget : excludeList) {
|
for (Object restrictTarget : excludeList.keySet()) {
|
||||||
String targetName = "";
|
String targetName = "";
|
||||||
|
|
||||||
if (restrictTarget instanceof Material) {
|
if (restrictTarget instanceof Material) {
|
||||||
|
@ -95,7 +95,7 @@ import net.coreprotect.utility.entity.HangingUtil;
|
|||||||
|
|
||||||
public class Rollback extends Queue {
|
public class Rollback extends Queue {
|
||||||
|
|
||||||
public static List<String[]> performRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType, final int preview) {
|
public static List<String[]> performRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType, final int preview) {
|
||||||
List<String[]> list = new ArrayList<>();
|
List<String[]> list = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -112,12 +112,12 @@ public class Rollback extends Queue {
|
|||||||
|
|
||||||
boolean ROLLBACK_ITEMS = false;
|
boolean ROLLBACK_ITEMS = false;
|
||||||
List<Object> itemRestrictList = new ArrayList<>(restrictList);
|
List<Object> itemRestrictList = new ArrayList<>(restrictList);
|
||||||
List<Object> itemExcludeList = new ArrayList<>(excludeList);
|
Map<Object, Boolean> itemExcludeList = new HashMap<>(excludeList);
|
||||||
|
|
||||||
if (actionList.contains(1)) {
|
if (actionList.contains(1)) {
|
||||||
for (Object target : restrictList) {
|
for (Object target : restrictList) {
|
||||||
if (target instanceof Material) {
|
if (target instanceof Material) {
|
||||||
if (!excludeList.contains(target)) {
|
if (!excludeList.containsKey(target)) {
|
||||||
if (BlockGroup.CONTAINERS.contains(target)) {
|
if (BlockGroup.CONTAINERS.contains(target)) {
|
||||||
ROLLBACK_ITEMS = true;
|
ROLLBACK_ITEMS = true;
|
||||||
itemRestrictList.clear();
|
itemRestrictList.clear();
|
||||||
@ -137,6 +137,7 @@ public class Rollback extends Queue {
|
|||||||
itemActionList.add(4);
|
itemActionList.add(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemExcludeList.entrySet().removeIf(entry -> Boolean.TRUE.equals(entry.getValue()));
|
||||||
itemList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, itemRestrictList, itemExcludeList, excludeUserList, itemActionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
|
itemList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, itemRestrictList, itemExcludeList, excludeUserList, itemActionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1277,7 +1278,7 @@ public class Rollback extends Queue {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finishRollbackRestore(CommandSender user, Location location, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, String timeString, Integer chunkCount, Double seconds, Integer itemCount, Integer blockCount, Integer entityCount, int rollbackType, Integer[] radius, boolean verbose, boolean restrictWorld, int preview) {
|
static void finishRollbackRestore(CommandSender user, Location location, List<String> checkUsers, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, String timeString, Integer chunkCount, Double seconds, Integer itemCount, Integer blockCount, Integer entityCount, int rollbackType, Integer[] radius, boolean verbose, boolean restrictWorld, int preview) {
|
||||||
try {
|
try {
|
||||||
if (preview == 2) {
|
if (preview == 2) {
|
||||||
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_CANCELLED));
|
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_CANCELLED));
|
||||||
@ -1418,7 +1419,15 @@ public class Rollback extends Queue {
|
|||||||
boolean entity = false;
|
boolean entity = false;
|
||||||
|
|
||||||
int excludeCount = 0;
|
int excludeCount = 0;
|
||||||
for (Object excludeTarget : excludeList) {
|
for (Map.Entry<Object, Boolean> entry : excludeList.entrySet()) {
|
||||||
|
Object excludeTarget = entry.getKey();
|
||||||
|
Boolean excludeTargetInternal = entry.getValue();
|
||||||
|
|
||||||
|
// don't display default block excludes
|
||||||
|
if (Boolean.TRUE.equals(excludeTargetInternal)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// don't display that excluded water/fire/farmland in inventory rollbacks
|
// don't display that excluded water/fire/farmland in inventory rollbacks
|
||||||
if (actionList.contains(4) && actionList.contains(11)) {
|
if (actionList.contains(4) && actionList.contains(11)) {
|
||||||
if (excludeTarget.equals(Material.FIRE) || excludeTarget.equals(Material.WATER) || excludeTarget.equals(Material.FARMLAND)) {
|
if (excludeTarget.equals(Material.FIRE) || excludeTarget.equals(Material.WATER) || excludeTarget.equals(Material.FARMLAND)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user