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();
}
Aggregations