Search in sources :

Example 11 with Difficulty

use of org.spongepowered.api.world.difficulty.Difficulty in project Nucleus by NucleusPowered.

the class SetDifficultyWorldCommand method executeCommand.

@Override
public CommandResult executeCommand(final CommandSource src, CommandContext args) throws Exception {
    Difficulty difficultyInput = args.<Difficulty>getOne(difficulty).get();
    WorldProperties worldProperties = getWorldFromUserOrArgs(src, this.world, args);
    worldProperties.setDifficulty(difficultyInput);
    src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.world.setdifficulty.success", worldProperties.getWorldName(), Util.getTranslatableIfPresent(difficultyInput)));
    return CommandResult.success();
}
Also used : Difficulty(org.spongepowered.api.world.difficulty.Difficulty) WorldProperties(org.spongepowered.api.world.storage.WorldProperties)

Aggregations

Difficulty (org.spongepowered.api.world.difficulty.Difficulty)11 WorldProperties (org.spongepowered.api.world.storage.WorldProperties)6 DimensionType (org.spongepowered.api.world.DimensionType)4 GeneratorType (org.spongepowered.api.world.GeneratorType)4 WorldGeneratorModifier (org.spongepowered.api.world.gen.WorldGeneratorModifier)4 ArrayList (java.util.ArrayList)3 GameMode (org.spongepowered.api.entity.living.player.gamemode.GameMode)3 Gamemode (com.gmail.trentech.pjw.utils.Gamemode)2 CommandException (org.spongepowered.api.command.CommandException)2 WorldArchetype (org.spongepowered.api.world.WorldArchetype)2 Help (com.gmail.trentech.pjc.help.Help)1 Usage (com.gmail.trentech.pjc.help.Usage)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ReturnMessageException (io.github.nucleuspowered.nucleus.internal.command.ReturnMessageException)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Locale (java.util.Locale)1 Optional (java.util.Optional)1 TranslatedParserException (org.cubeengine.libcube.service.command.TranslatedParserException)1 LanternDifficulty (org.lanternpowered.server.world.difficulty.LanternDifficulty)1