diff --git a/bukkit/build/resources/main/plugin.yml b/bukkit/build/resources/main/plugin.yml index d049e5e3..1ca8120b 100644 --- a/bukkit/build/resources/main/plugin.yml +++ b/bukkit/build/resources/main/plugin.yml @@ -24,6 +24,9 @@ commands: wrg: description: (FAWE) Select your current WorldEdit Region. aliases: [/wrg,wer,/wer,worldeditregion,/worldeditregion,/region] + frb: + description: (FAWE) Rollback an edit + aliases: [fawerollback,fawerb,/uu,/rb,/frb,/fawerollback,/fawerb] permissions: fawe.bypass: default: false diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index 15b1c2dc..153a73f7 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -315,4 +316,14 @@ public class FaweBukkit extends JavaPlugin implements IFawe, Listener { public String getPlatform() { return "bukkit"; } + + @Override + public UUID getUUID(String name) { + return Bukkit.getOfflinePlayer(name).getUniqueId(); + } + + @Override + public String getName(UUID uuid) { + return Bukkit.getOfflinePlayer(uuid).getName(); + } } diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index d049e5e3..1ca8120b 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -24,6 +24,9 @@ commands: wrg: description: (FAWE) Select your current WorldEdit Region. aliases: [/wrg,wer,/wer,worldeditregion,/worldeditregion,/region] + frb: + description: (FAWE) Rollback an edit + aliases: [fawerollback,fawerb,/uu,/rb,/frb,/fawerollback,/fawerb] permissions: fawe.bypass: default: false diff --git a/core/src/main/java/com/boydti/fawe/Fawe.java b/core/src/main/java/com/boydti/fawe/Fawe.java index f391ee83..1f1715d9 100644 --- a/core/src/main/java/com/boydti/fawe/Fawe.java +++ b/core/src/main/java/com/boydti/fawe/Fawe.java @@ -2,6 +2,7 @@ package com.boydti.fawe; import com.boydti.fawe.command.FixLighting; import com.boydti.fawe.command.Reload; +import com.boydti.fawe.command.Rollback; import com.boydti.fawe.command.Stream; import com.boydti.fawe.command.Wea; import com.boydti.fawe.command.WorldEditRegion; @@ -201,6 +202,7 @@ public class Fawe { this.IMP.setupCommand("stream", new Stream()); this.IMP.setupCommand("wrg", new WorldEditRegion()); this.IMP.setupCommand("fawe", new Reload()); + this.IMP.setupCommand("frb", new Rollback()); } public void setupConfigs() { diff --git a/core/src/main/java/com/boydti/fawe/IFawe.java b/core/src/main/java/com/boydti/fawe/IFawe.java index 6675e262..cca2efbc 100644 --- a/core/src/main/java/com/boydti/fawe/IFawe.java +++ b/core/src/main/java/com/boydti/fawe/IFawe.java @@ -10,6 +10,7 @@ import com.sk89q.worldedit.EditSession; import java.io.File; import java.util.Collection; import java.util.Set; +import java.util.UUID; public interface IFawe { public void debug(final String s); @@ -39,4 +40,8 @@ public interface IFawe { public Set getPlayers(); public String getPlatform(); + + public UUID getUUID(String name); + + public String getName(UUID uuid); } diff --git a/core/src/main/java/com/boydti/fawe/command/Rollback.java b/core/src/main/java/com/boydti/fawe/command/Rollback.java new file mode 100644 index 00000000..0686c6fc --- /dev/null +++ b/core/src/main/java/com/boydti/fawe/command/Rollback.java @@ -0,0 +1,160 @@ +package com.boydti.fawe.command; + +import com.boydti.fawe.Fawe; +import com.boydti.fawe.config.BBC; +import com.boydti.fawe.object.FaweCommand; +import com.boydti.fawe.object.FaweLocation; +import com.boydti.fawe.object.FawePlayer; +import com.boydti.fawe.object.RegionWrapper; +import com.boydti.fawe.object.RunnableVal; +import com.boydti.fawe.object.changeset.DiskStorageHistory; +import com.boydti.fawe.util.MainUtil; +import com.boydti.fawe.util.MathMan; +import com.boydti.fawe.util.SetQueue; +import com.boydti.fawe.util.TaskManager; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.world.World; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +public class Rollback extends FaweCommand { + + public Rollback() { + super("fawe.rollback"); + } + + @Override + public boolean execute(final FawePlayer player, final String... args) { + if (args.length < 1) { + BBC.COMMAND_SYNTAX.send(player, "/frb u: r: t: