mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Enable to use command line to set spawn island settings.
https://github.com/BentoBoxWorld/BentoBox/issues/1703
This commit is contained in:
parent
9f9dc40773
commit
031d789896
@ -34,6 +34,7 @@ import world.bentobox.bentobox.util.Util;
|
|||||||
*/
|
*/
|
||||||
public class AdminSettingsCommand extends CompositeCommand {
|
public class AdminSettingsCommand extends CompositeCommand {
|
||||||
|
|
||||||
|
private static final String SPAWN_ISLAND = "spawn-island";
|
||||||
private final List<String> PROTECTION_FLAG_NAMES;
|
private final List<String> PROTECTION_FLAG_NAMES;
|
||||||
private Island island;
|
private Island island;
|
||||||
private final List<String> SETTING_FLAG_NAMES;
|
private final List<String> SETTING_FLAG_NAMES;
|
||||||
@ -84,6 +85,12 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean getIsland(User user, List<String> args) {
|
private boolean getIsland(User user, List<String> args) {
|
||||||
|
if (args.get(0).equalsIgnoreCase(SPAWN_ISLAND)) {
|
||||||
|
if (getIslands().getSpawn(getWorld()).isPresent()) {
|
||||||
|
island = getIslands().getSpawn(getWorld()).get();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Get target player
|
// Get target player
|
||||||
@Nullable UUID targetUUID = Util.getUUID(args.get(0));
|
@Nullable UUID targetUUID = Util.getUUID(args.get(0));
|
||||||
if (targetUUID == null) {
|
if (targetUUID == null) {
|
||||||
@ -200,8 +207,8 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||||||
}
|
}
|
||||||
// GUI requires in-game
|
// GUI requires in-game
|
||||||
if (!user.isPlayer()) {
|
if (!user.isPlayer()) {
|
||||||
user.sendMessage("general.errors.use-in-game");
|
user.sendMessage("general.errors.use-in-game");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
getPlayers().setFlagsDisplayMode(user.getUniqueId(), Mode.EXPERT);
|
getPlayers().setFlagsDisplayMode(user.getUniqueId(), Mode.EXPERT);
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
@ -234,9 +241,12 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||||||
List<String> options = new ArrayList<>();
|
List<String> options = new ArrayList<>();
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
// Player names or world settings
|
// Player names or world settings
|
||||||
options = Util.tabLimit(Util.getOnlinePlayerList(user), lastArg);
|
options = Util.tabLimit(Util.getOnlinePlayerList(user), lastArg);
|
||||||
options.addAll(WORLD_SETTING_FLAG_NAMES);
|
options.addAll(WORLD_SETTING_FLAG_NAMES);
|
||||||
|
if (getIslands().getSpawn(getWorld()).isPresent()) {
|
||||||
|
options.add(SPAWN_ISLAND);
|
||||||
|
}
|
||||||
} else if (args.size() == 3) {
|
} else if (args.size() == 3) {
|
||||||
// If world settings, then active/disabled, otherwise player flags
|
// If world settings, then active/disabled, otherwise player flags
|
||||||
if (WORLD_SETTING_FLAG_NAMES.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
if (WORLD_SETTING_FLAG_NAMES.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
||||||
|
@ -273,7 +273,7 @@ commands:
|
|||||||
success: "&a Successfully set this location as the spawn point for this island."
|
success: "&a Successfully set this location as the spawn point for this island."
|
||||||
island-spawnpoint-changed: "&a [user] changed this island spawn point."
|
island-spawnpoint-changed: "&a [user] changed this island spawn point."
|
||||||
settings:
|
settings:
|
||||||
parameters: "[player]/[world flag] [flag/active/disable] [rank/active/disable]"
|
parameters: "[player]/[world flag]/spawn-island [flag/active/disable] [rank/active/disable]"
|
||||||
description: "open settings GUI or set settings"
|
description: "open settings GUI or set settings"
|
||||||
unknown-setting: "&c Unknown setting"
|
unknown-setting: "&c Unknown setting"
|
||||||
blueprint:
|
blueprint:
|
||||||
|
Loading…
Reference in New Issue
Block a user