From 861fb45e5c8d3c82a0d9fdb270f8ebe3ebbafac4 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 16 Jul 2021 19:07:02 +0100 Subject: [PATCH] Fix #1075 --- .../com/sk89q/worldedit/command/HistorySubCommands.java | 8 ++++++-- .../util/formatting/component/PaginationBox.java | 6 ++++++ worldedit-core/src/main/resources/lang/strings.json | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 338ac6c8c..b7809ee5f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -396,7 +396,7 @@ public class HistorySubCommands { PaginationBox pages = cached == null ? null : cached.get(); if (page == null || pages == null) { RollbackOptimizedHistory edit = database.getEdit(other, index).get(); - SimpleChangeSetSummary summary = edit.summarize(null, false); + SimpleChangeSetSummary summary = edit.summarize(RegionWrapper.GLOBAL(), false); if (summary != null) { List> distr = summary.getBlockDistributionWithData(); SelectionCommands.BlockDistributionResult distrPages = new SelectionCommands.BlockDistributionResult((List) distr, true, pageCommand); @@ -405,7 +405,11 @@ public class HistorySubCommands { } page = 1; } - player.print(pages.create(page)); + if (pages == null) { + player.print(Caption.of("fawe.worldedit.history.distr.summary_null")); + } else { + player.print(pages.create(page)); + } } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java index 1d4a83356..5e61f5ce9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java @@ -182,6 +182,9 @@ public abstract class PaginationBox extends MessageBox { @Override public Component getComponent(int number) { for (PaginationBox box : values) { + if (box == null) { + continue; + } int size = box.getComponentsSize(); if (size > number) { return box.getComponent(number); @@ -195,6 +198,9 @@ public abstract class PaginationBox extends MessageBox { public int getComponentsSize() { int size = 0; for (PaginationBox box : values) { + if (box == null) { + continue; + } size += box.getComponentsSize(); } return size; diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 4810c8666..e5a435fe9 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -4,6 +4,7 @@ "fawe.worldedit.history.find.element": "&2{0} {1} &7ago &3{2}m &6{3} &c/{4}", "fawe.worldedit.history.find.element.more": " - Changes: {0}\n - Bounds: {1} -> {2}\n - Extra: {3}\n - Size on Disk: {4}", "fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info", + "fawe.worldedit.history.distr.summary_null": "Could not find edit summary for inputs.", "fawe.info.lighting.propagate.selection": "Lighting has been propagated in {0} chunks. (Note: To remove light use //removelight)", "fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)",