mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-01 05:57:54 +01:00
Small change to clarify /island use outside of island worlds
This commit is contained in:
parent
6a18cc4ccc
commit
682d34849a
@ -130,6 +130,7 @@ commands:
|
||||
teleported: "&aTeleported you to home &e#[number]."
|
||||
help:
|
||||
description: "The main island command"
|
||||
pick-world: "&cSpecify world from [worlds]"
|
||||
spawn:
|
||||
description: "teleport you to the spawn"
|
||||
create:
|
||||
|
@ -21,6 +21,7 @@ import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.events.command.CommandEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.managers.IslandWorldManager;
|
||||
import us.tastybento.bskyblock.managers.IslandsManager;
|
||||
import us.tastybento.bskyblock.managers.PlayersManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
@ -263,6 +264,13 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the island worlds manager
|
||||
* @return island worlds manager
|
||||
*/
|
||||
public IslandWorldManager getIWM() {
|
||||
return plugin.getIWM();
|
||||
}
|
||||
/**
|
||||
* @return Settings object
|
||||
*/
|
||||
|
@ -69,6 +69,11 @@ public class IslandCommand extends CompositeCommand {
|
||||
return false;
|
||||
}
|
||||
if (args.isEmpty()) {
|
||||
// Check if not in world. If multiple worlds, then tell user to pick one
|
||||
if (!getIWM().inWorld(user.getLocation()) && getIWM().getOverWorlds().size() > 1) {
|
||||
user.sendMessage("commands.island.help.pick-world", "[worlds]", getIWM().getFriendlyNames());
|
||||
return false;
|
||||
}
|
||||
// If in world, go
|
||||
if (getPlugin().getIslands().hasIsland(user.getWorld(), user.getUniqueId())) {
|
||||
return getSubCommand("go").map(goCmd -> goCmd.execute(user, new ArrayList<>())).orElse(false);
|
||||
|
@ -396,5 +396,17 @@ public class IslandWorldManager {
|
||||
World w = Util.getWorld(world);
|
||||
return (worldSettings.containsKey(w) && !worldSettings.get(w).isDragonSpawn()) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a comma separated string of friendly world names
|
||||
*/
|
||||
public String getFriendlyNames() {
|
||||
StringBuilder r = new StringBuilder();
|
||||
worlds.values().forEach(n -> r.append(n).append(", "));
|
||||
if (r.length() > 0) {
|
||||
r.setLength(r.length() - 2);
|
||||
}
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user