Skip to content

Commit 44e031a

Browse files
committed
fix: update argument types from UUID to Player in history commands
1 parent d83f24a commit 44e031a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public HistorySubCommands(HistoryCommands parent) {
7979
public synchronized void rerun(
8080
Player player, World world, RollbackDatabase database,
8181
@ArgFlag(name = 'u', desc = "String user", def = "me")
82-
UUID other,
82+
Player other,
8383
@ArgFlag(name = 'r', def = "0", desc = "radius")
8484
@Range(from = 0, to = Integer.MAX_VALUE)
8585
int radius,
@@ -100,7 +100,7 @@ public synchronized void rerun(
100100
public synchronized void rollback(
101101
Player player, World world, RollbackDatabase database,
102102
@ArgFlag(name = 'u', desc = "String user", def = "")
103-
UUID other,
103+
Player other,
104104
@ArgFlag(name = 'r', def = "0", desc = "radius")
105105
@Range(from = 0, to = Integer.MAX_VALUE)
106106
int radius,
@@ -118,13 +118,13 @@ public synchronized void rollback(
118118
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
119119

120120
if (other == null) {
121-
other = player.getUniqueId();
121+
other = player;
122122
}
123-
if (!other.equals(player.getUniqueId())) {
123+
if (!other.equals(player)) {
124124
player.checkPermission("worldedit.history.undo.other");
125125
}
126-
if (other == Identifiable.EVERYONE) {
127-
other = null;
126+
if (other.getUniqueId() == Identifiable.EVERYONE) {
127+
return;
128128
}
129129
Location origin = player.getLocation();
130130
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
@@ -225,11 +225,11 @@ public synchronized void importdb(Actor actor) throws WorldEditException {
225225
public synchronized void summary(
226226
Player player, RollbackDatabase database, Arguments arguments,
227227
@Arg(desc = "Player uuid/name")
228-
UUID other,
228+
Player other,
229229
@Arg(desc = "edit index")
230230
Integer index
231231
) throws WorldEditException, ExecutionException, InterruptedException {
232-
RollbackOptimizedHistory edit = database.getEdit(other, index).get();
232+
RollbackOptimizedHistory edit = database.getEdit(other.getUniqueId(), index).get();
233233
if (edit == null) {
234234
player.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
235235
return;
@@ -295,7 +295,7 @@ public synchronized void summary(
295295
);
296296
Component distr = TextComponent
297297
.of("/history distr")
298-
.clickEvent(ClickEvent.suggestCommand("//history distr " + other + " " + index));
298+
.clickEvent(ClickEvent.suggestCommand("//history distr " + other.getUniqueId() + " " + index));
299299
TextComponentProducer content = new TextComponentProducer().append(header).newline().append(body).newline().append(distr);
300300
player.print(content.create());
301301
}
@@ -372,7 +372,7 @@ public Component apply(@Nullable Supplier<? extends ChangeSet> input) {
372372
public synchronized void find(
373373
Player player, World world, RollbackDatabase database, Arguments arguments,
374374
@ArgFlag(name = 'u', def = "", desc = "String user")
375-
UUID other,
375+
Player other,
376376
@ArgFlag(name = 'r', def = "0", desc = "radius")
377377
@Range(from = 0, to = Integer.MAX_VALUE)
378378
Integer radius,
@@ -399,13 +399,13 @@ public synchronized void find(
399399

400400
if (page == null || history == null) {
401401
if (other == null) {
402-
other = player.getUniqueId();
402+
other = player;
403403
}
404-
if (!other.equals(player.getUniqueId())) {
404+
if (!other.equals(player)) {
405405
player.checkPermission("worldedit.history.undo.other");
406406
}
407-
if (other == Identifiable.EVERYONE) {
408-
other = null;
407+
if (other.getUniqueId() == Identifiable.EVERYONE) {
408+
return;
409409
}
410410

411411
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
@@ -414,7 +414,7 @@ public synchronized void find(
414414
top = top.clampY(world.getMinY(), world.getMaxY());
415415

416416
long minTime = System.currentTimeMillis() - timeDiff;
417-
Iterable<Supplier<RollbackOptimizedHistory>> edits = database.getEdits(other, minTime, bot, top, false, false);
417+
Iterable<Supplier<RollbackOptimizedHistory>> edits = database.getEdits(other.getUniqueId(), minTime, bot, top, false, false);
418418
history = Lists.newArrayList(edits);
419419
player.setMeta(pageCommand, new SoftReference<>(history));
420420
page = 1;
@@ -436,7 +436,7 @@ public synchronized void find(
436436
public void distr(
437437
Player player, LocalSession session, RollbackDatabase database, Arguments arguments,
438438
@Arg(desc = "Player uuid/name")
439-
UUID other,
439+
Player other,
440440
@Arg(desc = "edit index")
441441
Integer index,
442442
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
@@ -446,7 +446,7 @@ public void distr(
446446
Reference<PaginationBox> cached = player.getMeta(pageCommand);
447447
PaginationBox pages = cached == null ? null : cached.get();
448448
if (page == null || pages == null) {
449-
RollbackOptimizedHistory edit = database.getEdit(other, index).get();
449+
RollbackOptimizedHistory edit = database.getEdit(other.getUniqueId(), index).get();
450450
SimpleChangeSetSummary summary = edit.summarize(RegionWrapper.GLOBAL(), false);
451451
if (summary != null) {
452452
List<Countable<BlockState>> distr = summary.getBlockDistributionWithData();
@@ -478,7 +478,7 @@ public void distr(
478478
public void list(
479479
Player player, LocalSession session, RollbackDatabase database, Arguments arguments,
480480
@Arg(desc = "Player uuid/name")
481-
UUID other,
481+
Player other,
482482
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
483483
Integer page
484484
) {

0 commit comments

Comments
 (0)