mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-03 16:13:30 +01:00
Improved gameworlds output in /bentobox version
It now displays the three dimensions for each world using a three-colour scale. Green means the world is generated and is an "island" world; orange means the world is generated but is not an "island" world and red means the world is not generated or does not exist. Actually, the overworld is always green, so I didn't put checks for it. I also improved the overall layout for the game worlds display in each localization file.
This commit is contained in:
parent
0d89f42441
commit
775b7f2377
@ -1,5 +1,7 @@
|
||||
package world.bentobox.bentobox.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
@ -8,6 +10,7 @@ import world.bentobox.bentobox.versions.ServerCompatibility;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Displays information about Gamemodes, Addons and versioning.
|
||||
@ -16,6 +19,10 @@ import java.util.Map;
|
||||
*/
|
||||
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
|
||||
@ -42,8 +49,35 @@ public class BentoBoxVersionCommand extends CompositeCommand {
|
||||
|
||||
getIWM().getOverWorldNames().entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey))
|
||||
.forEach(e -> {
|
||||
String gameWorld = user.getTranslation("commands.bentobox.version.game-world", TextVariables.NAME, e.getKey(), "[addon]", e.getValue());
|
||||
user.sendMessage(gameWorld);
|
||||
String netherColor = GAMEWORLD_COLOR_ISLANDS;
|
||||
String endColor = GAMEWORLD_COLOR_ISLANDS;
|
||||
|
||||
// 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.getNetherWorld())) {
|
||||
netherColor = GAMEWORLD_COLOR_NOT_EXIST;
|
||||
} else if (!getIWM().isNetherIslands(addon.getNetherWorld())) {
|
||||
netherColor = GAMEWORLD_COLOR_EXISTS_NO_ISLANDS;
|
||||
}
|
||||
|
||||
// Get the nether color
|
||||
if (addon.getEndWorld() == null || !getIWM().isEndGenerate(addon.getEndWorld())) {
|
||||
endColor = GAMEWORLD_COLOR_NOT_EXIST;
|
||||
} else if (!getIWM().isEndIslands(addon.getEndWorld())) {
|
||||
endColor = GAMEWORLD_COLOR_EXISTS_NO_ISLANDS;
|
||||
}
|
||||
}
|
||||
|
||||
user.sendMessage(user.getTranslation("commands.bentobox.version.game-world", TextVariables.NAME, e.getKey(), "[addon]", e.getValue(),
|
||||
"[nether_color]", netherColor, "[end_color]", endColor));
|
||||
});
|
||||
|
||||
user.sendMessage("commands.bentobox.version.loaded-addons");
|
||||
|
@ -306,7 +306,7 @@ commands:
|
||||
loaded-addons: "Loaded Addons:"
|
||||
loaded-game-worlds: "Loaded Game Worlds:"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-world: "&2[name] &7(&3[addon]&7)"
|
||||
game-world: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
server: "&2Running &3[name] [version]&2."
|
||||
manage:
|
||||
description: "display the management panel"
|
||||
|
@ -259,7 +259,7 @@ commands:
|
||||
loaded-addons: "Addons cargados:"
|
||||
loaded-game-worlds: "Mundos de juego cargados:"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7)"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
server: "&2Corriendo &3[name] [version]&2."
|
||||
manage:
|
||||
description: "Mostrar el panel de gestión"
|
||||
|
@ -142,7 +142,7 @@ commands:
|
||||
loaded-addons: "Addons :"
|
||||
loaded-game-worlds: "Mondes de jeu :"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-world: "&2[name] &7(&3[addon]&7)"
|
||||
game-world: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
server: "&2Serveur : &3[name] [version]&2."
|
||||
manage:
|
||||
description: "affiche le menu de gestion"
|
||||
|
@ -181,7 +181,7 @@ commands:
|
||||
loaded-addons: "読み込まれたアドオン"
|
||||
loaded-game-worlds: "ロードされたゲームの世界"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-world: "&2[name] &7(&3[addon]&7)"
|
||||
game-world: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
confirmation:
|
||||
confirm: "&c[seconds]秒でコマンドをもう一度入力して確認します。"
|
||||
previous-request-cancelled: "&c前の確認要求が取り消されました"
|
||||
|
@ -262,7 +262,7 @@ commands:
|
||||
loaded-addons: "Ielādētie Papildinājumi:"
|
||||
loaded-game-worlds: "Ielādētās spēles pasaules:"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-world: "&2[name] &7(&3[addon]&7)"
|
||||
game-world: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
server: "&2Darbojas uz &3[name] [version]&2."
|
||||
manage:
|
||||
description: "parādīt pārvaldīšanas paneli"
|
||||
|
@ -207,7 +207,7 @@ commands:
|
||||
loaded-addons: "已加载组件"
|
||||
loaded-game-worlds: "已加载游戏世界:"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7)"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
confirmation:
|
||||
confirm: "&c于 &b[seconds] &c秒内再次输入命令来确认"
|
||||
previous-request-cancelled: "&6上一个确认请求已取消"
|
||||
|
@ -228,7 +228,7 @@ commands:
|
||||
loaded-addons: "已加載組件"
|
||||
loaded-game-worlds: "已加載遊戲世界:"
|
||||
addon-syntax: "&2[name] &3[version]"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7)"
|
||||
game-worlds: "&2[name] &7(&3[addon]&7): &aOverworld&7, &r[nether_color]Nether&7, &r[end_color]End"
|
||||
confirmation:
|
||||
confirm: "&c於 &b[seconds] &c秒內再次輸入命令來確認"
|
||||
previous-request-cancelled: "&6上一個確認請求已取消"
|
||||
|
Loading…
Reference in New Issue
Block a user