From c95bf3cc3025ad63f2e48dc865b16492f03e79dd Mon Sep 17 00:00:00 2001 From: Intelli Date: Tue, 22 Feb 2022 20:10:55 -0700 Subject: [PATCH] Fixed fire/water displaying in inventory lookups --- .../java/net/coreprotect/command/LookupCommand.java | 2 ++ .../coreprotect/command/RollbackRestoreCommand.java | 6 ++++++ src/main/java/net/coreprotect/database/Rollback.java | 12 ++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/coreprotect/command/LookupCommand.java b/src/main/java/net/coreprotect/command/LookupCommand.java index 5b3d6c8..638ed36 100755 --- a/src/main/java/net/coreprotect/command/LookupCommand.java +++ b/src/main/java/net/coreprotect/command/LookupCommand.java @@ -263,6 +263,8 @@ public class LookupCommand { } if (argAction.contains(4) && argAction.contains(11)) { // a:inventory + argExclude.add(Material.FIRE); + argExclude.add(Material.WATER); argExcludeUsers.add("#hopper"); } diff --git a/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java b/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java index d574ff8..eafc516 100755 --- a/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java +++ b/src/main/java/net/coreprotect/command/RollbackRestoreCommand.java @@ -183,6 +183,12 @@ public class RollbackRestoreCommand { Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER)); return; } + if (!argExclude.contains(Material.FIRE)) { + argExclude.add(Material.FIRE); + } + if (!argExclude.contains(Material.WATER)) { + argExclude.add(Material.WATER); + } if (!argExcludeUsers.contains("#hopper")) { argExcludeUsers.add("#hopper"); } diff --git a/src/main/java/net/coreprotect/database/Rollback.java b/src/main/java/net/coreprotect/database/Rollback.java index e0cfeed..6587718 100644 --- a/src/main/java/net/coreprotect/database/Rollback.java +++ b/src/main/java/net/coreprotect/database/Rollback.java @@ -1394,8 +1394,14 @@ public class Rollback extends Queue { int excludeCount = 0; for (Object excludeTarget : excludeList) { - String targetName = ""; + // don't display that excluded water/fire in inventory rollbacks + if (actionList.contains(4) && actionList.contains(11)) { + if (excludeTarget.equals(Material.FIRE) || excludeTarget.equals(Material.WATER)) { + continue; + } + } + String targetName = ""; if (excludeTarget instanceof Material) { targetName = ((Material) excludeTarget).name().toLowerCase(Locale.ROOT); item = (!item ? !(((Material) excludeTarget).isBlock()) : item); @@ -1427,7 +1433,9 @@ public class Rollback extends Queue { targetType = Selector.SECOND; } - Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_INCLUDE, excludeTargets.toString(), Selector.SECOND, targetType, (excludeCount == 1 ? Selector.FIRST : Selector.SECOND))); // exclude + if (excludeCount > 0) { + Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_INCLUDE, excludeTargets.toString(), Selector.SECOND, targetType, (excludeCount == 1 ? Selector.FIRST : Selector.SECOND))); // exclude + } } if (excludeUserList.size() > 0) {