WorldRemoveCommand class
Пакет: com.hypixel.hytale.server.core.universe.world.commands.world
Файл: com/hypixel/hytale/server/core/universe/world/commands/world/WorldRemoveCommand.java
extends: CommandBase
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
Message |
MESSAGE_UNIVERSE_REMOVE_WORLD_NOT_FOUND |
|
CommandSender |
var2 |
|
String |
var3 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("remove", "server.commands.removeworld.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.universe.world.commands.world;
class="kw">import com.hypixel.hytale.server.core.HytaleServer;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandSender;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
class="kw">import com.hypixel.hytale.server.core.universe.Universe;
class="kw">import javax.annotation.Nonnull;
class="kw">public class WorldRemoveCommand class="kw">extends CommandBase {
class="kw">public class="kw">static class="kw">final Message MESSAGE_UNIVERSE_REMOVE_WORLD_NOT_FOUND = Message.translation("server.universe.removeworld.notFound");
class="kw">public class="kw">static class="kw">final Message MESSAGE_UNIVERSE_REMOVE_WORLD_ONLY_ONE_WORLD_LOADED = Message.translation("server.universe.removeworld.onlyOneWorldLoaded");
class="kw">public class="kw">static class="kw">final Message MESSAGE_UNIVERSE_REMOVE_WORLD_CHANGE_DEFAULT_WORLD = Message.translation("server.universe.removeworld.changeDefaultWorld");
@Nonnull
class="kw">private class="kw">final RequiredArg<String> nameArg = this.withRequiredArg("name", "server.commands.removeworld.arg.name.desc", ArgTypes.STRING);
class="kw">public WorldRemoveCommand() {
super("remove", "server.commands.removeworld.desc");
this.addAliases("rm");
}
@Override
class="kw">protected void executeSync(@Nonnull CommandContext var1) {
CommandSender var2 = var1.sender();
String var3 = var1.get(this.nameArg);
if (Universe.get().getWorld(var3) == null) {
var2.sendMessage(MESSAGE_UNIVERSE_REMOVE_WORLD_NOT_FOUND);
} else if (Universe.get().getWorlds().size() == 1) {
var2.sendMessage(MESSAGE_UNIVERSE_REMOVE_WORLD_ONLY_ONE_WORLD_LOADED);
} else if (var3.equalsIgnoreCase(HytaleServer.get().getConfig().getDefaults().getWorld())) {
var2.sendMessage(MESSAGE_UNIVERSE_REMOVE_WORLD_CHANGE_DEFAULT_WORLD);
} else {
Universe.get().removeWorld(var3);
var2.sendMessage(Message.translation("server.universe.removeworld.success").param("worldName", var3));
}
}
}