mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Improved '/bentobox version' gameworld layout to convey information through color-stripped text
The previous design had a flaw: if the output was pasted as text, we would not be able to tell if the dimension was disabled or if islands were disabled in that dimension.
This commit is contained in:
parent
01df19c424
commit
d8dda75ca5
@ -20,10 +20,6 @@ import world.bentobox.bentobox.versions.ServerCompatibility;
|
||||
*/
|
||||
public class BentoBoxVersionCommand extends CompositeCommand {
|
||||
|
||||
private static final String GAMEWORLD_COLOR_ISLANDS = "&a";
|
||||
private static final String GAMEWORLD_COLOR_EXISTS_NO_ISLANDS = "&6";
|
||||
private static final String GAMEWORLD_COLOR_NOT_EXIST = "&c";
|
||||
|
||||
/**
|
||||
* Info command
|
||||
* @param parent - command parent
|
||||
@ -51,35 +47,35 @@ public class BentoBoxVersionCommand extends CompositeCommand {
|
||||
|
||||
getIWM().getOverWorldNames().entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey))
|
||||
.forEach(e -> {
|
||||
String netherColor = GAMEWORLD_COLOR_ISLANDS;
|
||||
String endColor = GAMEWORLD_COLOR_ISLANDS;
|
||||
String worlds = user.getTranslation("general.worlds.overworld");
|
||||
|
||||
// It should be present, but let's stay safe.
|
||||
Optional<GameModeAddon> addonOptional = getIWM().getAddon(Bukkit.getWorld(e.getKey()));
|
||||
if (addonOptional.isPresent()) {
|
||||
GameModeAddon addon = addonOptional.get();
|
||||
/* Get the colors
|
||||
&a = dimension exists and contains islands
|
||||
&6 = dimension exists but is vanilla
|
||||
&c = dimension does not exist
|
||||
*/
|
||||
// Get the nether color
|
||||
if (addon.getNetherWorld() == null || !getIWM().isNetherGenerate(addon.getOverWorld())) {
|
||||
netherColor = GAMEWORLD_COLOR_NOT_EXIST;
|
||||
} else if (!getIWM().isNetherIslands(addon.getOverWorld())) {
|
||||
netherColor = GAMEWORLD_COLOR_EXISTS_NO_ISLANDS;
|
||||
/*
|
||||
* If the dimension is generated, it is displayed.
|
||||
* If the dimension is not made up of islands, a '*' is appended to its name.
|
||||
*/
|
||||
// Append the nether
|
||||
if (addon.getNetherWorld() != null && getIWM().isNetherGenerate(addon.getOverWorld())) {
|
||||
worlds += ", " + user.getTranslation("general.worlds.nether");
|
||||
if (!getIWM().isNetherIslands(addon.getOverWorld())) {
|
||||
worlds += "*";
|
||||
}
|
||||
}
|
||||
|
||||
// Get the nether color
|
||||
if (addon.getEndWorld() == null || !getIWM().isEndGenerate(addon.getOverWorld())) {
|
||||
endColor = GAMEWORLD_COLOR_NOT_EXIST;
|
||||
} else if (!getIWM().isEndIslands(addon.getOverWorld())) {
|
||||
endColor = GAMEWORLD_COLOR_EXISTS_NO_ISLANDS;
|
||||
// Append the End
|
||||
if (addon.getEndWorld() != null && getIWM().isEndGenerate(addon.getOverWorld())) {
|
||||
worlds += ", " + user.getTranslation("general.worlds.the-end");
|
||||
if (!getIWM().isEndIslands(addon.getOverWorld())) {
|
||||
worlds += "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
user.sendMessage(user.getTranslation("commands.bentobox.version.game-world", TextVariables.NAME, e.getKey(), "[addon]", e.getValue(),
|
||||
"[nether_color]", netherColor, "[end_color]", endColor));
|
||||
"[worlds]", worlds));
|
||||
});
|
||||
|
||||
user.sendMessage("commands.bentobox.version.loaded-addons");
|
||||
|
@ -398,7 +398,7 @@ commands:
|
||||
loaded-addons: "Loaded Addons:"
|
||||
loaded-game-worlds: "Loaded Game Worlds:"
|
||||
addon-syntax: "&2 [name] &3 [version] &7 (&3 [state]&7 )"
|
||||
game-world: "&2 [name] &7 (&3 [addon]&7 ): &a Overworld&7 , &r [nether_color]Nether&7 , &r [end_color]End"
|
||||
game-world: "&2 [name] &7 (&3 [addon]&7 ): &3 [worlds]"
|
||||
server: "&2 Running &3 [name] [version]&2 ."
|
||||
database: "&2 Database: &3 [database]"
|
||||
manage:
|
||||
|
Loading…
Reference in New Issue
Block a user