mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-08-19 20:02:52 +02:00
Added /bsb range reset <player>
This commit is contained in:
parent
a5a1ccb7e5
commit
e15ed63899
|
@ -21,6 +21,7 @@ public class AdminRangeCommand extends CompositeCommand {
|
||||||
|
|
||||||
new AdminRangeDisplayCommand(this);
|
new AdminRangeDisplayCommand(this);
|
||||||
new AdminRangeSetCommand(this);
|
new AdminRangeSetCommand(this);
|
||||||
|
new AdminRangeResetCommand(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package us.tastybento.bskyblock.commands.admin.range;
|
||||||
|
|
||||||
|
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||||
|
import us.tastybento.bskyblock.api.user.User;
|
||||||
|
import us.tastybento.bskyblock.database.objects.Island;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class AdminRangeResetCommand extends CompositeCommand {
|
||||||
|
|
||||||
|
public AdminRangeResetCommand(CompositeCommand parent) {
|
||||||
|
super(parent, "reset");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
setPermission("admin.range.reset");
|
||||||
|
setParameters("commands.admin.range.reset.parameters");
|
||||||
|
setDescription("commands.admin.range.reset.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
// Show help
|
||||||
|
showHelp(this, user);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get target player
|
||||||
|
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||||
|
if (targetUUID == null) {
|
||||||
|
user.sendMessage("general.errors.unknown-player");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||||
|
user.sendMessage("general.errors.player-has-no-island");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get island
|
||||||
|
Island island = getIslands().getIsland(getWorld(), targetUUID);
|
||||||
|
|
||||||
|
// Reset the protection range
|
||||||
|
island.setProtectionRange(getSettings().getIslandProtectionRange());
|
||||||
|
// TODO send message?
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,6 +67,7 @@ public class AdminRangeSetCommand extends CompositeCommand {
|
||||||
|
|
||||||
// Well, now it can be applied without taking any risks !
|
// Well, now it can be applied without taking any risks !
|
||||||
island.setProtectionRange(range);
|
island.setProtectionRange(range);
|
||||||
|
// TODO send message?
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user