Minor rollback command changes

This commit is contained in:
Jesse Boyd 2017-01-01 23:23:02 +11:00
parent 3f70fb6585
commit 6230188646
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -46,6 +46,7 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import java.io.File; import java.io.File;
import java.util.UUID; import java.util.UUID;
@ -79,7 +80,7 @@ public class HistoryCommands {
max = 3 max = 3
) )
@CommandPermissions("worldedit.history.rollback") @CommandPermissions("worldedit.history.rollback")
public void faweRollback(final Player player, LocalSession session, final String user, Integer radius, String time) throws WorldEditException { public void faweRollback(final Player player, LocalSession session, final String user, @Optional("0") int radius, @Optional("0") String time) throws WorldEditException {
if (!Settings.HISTORY.USE_DATABASE) { if (!Settings.HISTORY.USE_DATABASE) {
BBC.SETTING_DISABLE.send(player, "history.use-database"); BBC.SETTING_DISABLE.send(player, "history.use-database");
return; return;
@ -150,17 +151,16 @@ public class HistoryCommands {
} }
return; return;
} }
default:
if (radius == null) {
BBC.COMMAND_SYNTAX.send(player, "/frb <user> <radius> <time>");
return;
}
} }
UUID other = Fawe.imp().getUUID(user); UUID other = Fawe.imp().getUUID(user);
if (other == null) { if (other == null) {
BBC.PLAYER_NOT_FOUND.send(player, user); BBC.PLAYER_NOT_FOUND.send(player, user);
return; return;
} }
if (radius == 0) {
BBC.COMMAND_SYNTAX.send(player, "/frb " + user + " <radius> <time>");
return;
}
long timeDiff = MainUtil.timeToSec(time) * 1000; long timeDiff = MainUtil.timeToSec(time) * 1000;
if (timeDiff == 0) { if (timeDiff == 0) {
BBC.COMMAND_SYNTAX.send(player, "/frb " + user + " " + radius + " <time>"); BBC.COMMAND_SYNTAX.send(player, "/frb " + user + " " + radius + " <time>");