Search in sources :

Example 1 with SpawnWorldDataModule

use of io.github.nucleuspowered.nucleus.modules.spawn.datamodules.SpawnWorldDataModule in project Nucleus by NucleusPowered.

the class SetSpawnCommand method executeCommand.

@Override
public CommandResult executeCommand(Player src, CommandContext args) throws Exception {
    // Minecraft does not set the rotation of the player at the spawn point, so we'll do it for them!
    ModularWorldService worldService = Nucleus.getNucleus().getWorldDataManager().getWorld(src.getWorld().getUniqueId()).get();
    SpawnWorldDataModule m = worldService.get(SpawnWorldDataModule.class);
    m.setSpawnRotation(src.getRotation());
    worldService.set(m);
    src.getWorld().getProperties().setSpawnPosition(src.getLocation().getBlockPosition());
    src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.setspawn.success", src.getWorld().getName()));
    return CommandResult.success();
}
Also used : SpawnWorldDataModule(io.github.nucleuspowered.nucleus.modules.spawn.datamodules.SpawnWorldDataModule) ModularWorldService(io.github.nucleuspowered.nucleus.dataservices.modular.ModularWorldService)

Aggregations

ModularWorldService (io.github.nucleuspowered.nucleus.dataservices.modular.ModularWorldService)1 SpawnWorldDataModule (io.github.nucleuspowered.nucleus.modules.spawn.datamodules.SpawnWorldDataModule)1