Search in sources :

Example 31 with ServerLocation

use of org.spongepowered.api.world.server.ServerLocation in project SpongeCommon by SpongePowered.

the class ProjectileTest method registerCommand.

@Listener
public void registerCommand(final RegisterCommandEvent<Command.Parameterized> event) {
    final Parameter.Value<EntityType<@NonNull ?>> entityTypeParameter = Parameter.registryElement(new TypeToken<EntityType<?>>() {
    }, (ctx) -> Sponge.game(), RegistryTypes.ENTITY_TYPE, "minecraft", "sponge").key("type").build();
    final Parameter.Value<Boolean> targetParameter = Parameter.bool().key("target").optional().build();
    final Command.Parameterized launchCommand = Command.builder().addParameters(entityTypeParameter, targetParameter).executor(context -> {
        final Player player = context.cause().first(Player.class).orElseThrow(() -> new CommandException(Component.text("Only a player can execute this command")));
        final EntityType<?> entityType = context.requireOne(entityTypeParameter);
        final Optional<Projectile> launched;
        if (context.one(targetParameter).orElse(false)) {
            final Collection<? extends Entity> nearbyEntities = player.nearbyEntities(10, entity -> entity instanceof Living && entity != player);
            if (nearbyEntities.isEmpty()) {
                return CommandResult.error(Component.text("No entity to target nearby"));
            }
            final Entity target = nearbyEntities.iterator().next();
            launched = player.launchProjectileTo((EntityType<Projectile>) entityType, target);
            if (launched.isPresent()) {
                player.sendMessage(Identity.nil(), Component.text("Launched projectile to " + RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), target.type()).asString()));
                return CommandResult.success();
            }
        } else {
            launched = player.launchProjectile((EntityType<Projectile>) entityType);
            if (launched.isPresent()) {
                player.sendMessage(Identity.nil(), Component.text("Launched projectile"));
                return CommandResult.success();
            }
        }
        throw new CommandException(Component.text("Could not launch projectile"));
    }).build();
    event.register(this.plugin, launchCommand, "launch");
    final Command.Parameterized launchToMeCommand = Command.builder().addParameter(entityTypeParameter).executor(context -> {
        final Player player = context.cause().first(Player.class).orElseThrow(() -> new CommandException(Component.text("Only a player can execute this command")));
        final Collection<? extends ProjectileSource> nearbyProjectileSources = (Collection<? extends ProjectileSource>) player.nearbyEntities(10, entity -> entity instanceof ProjectileSource);
        if (nearbyProjectileSources.isEmpty()) {
            return CommandResult.error(Component.text("No projectile source nearby"));
        }
        final ProjectileSource projectileSource = nearbyProjectileSources.iterator().next();
        final EntityType<?> entityType = context.requireOne(entityTypeParameter);
        final Optional<? extends Projectile> launched = projectileSource.launchProjectileTo((EntityType<Projectile>) entityType, player);
        final EntityType<?> type = ((Entity) projectileSource).type();
        if (launched.isPresent()) {
            final EntityType<?> launchedType = launched.get().type();
            player.sendMessage(Identity.nil(), Component.text().append(Component.text("You made a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), type).asString())).append(Component.text(" shoot a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), launchedType).asString())).append(Component.text(" at you")).build());
            return CommandResult.success();
        }
        throw new CommandException(Component.text().append(Component.text("Could not launch a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), type).asString())).append(Component.text(" from a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), entityType).asString())).append(Component.text(" at you")).build());
    }).build();
    event.register(this.plugin, launchToMeCommand, "launchtome");
    final Parameter.Value<ServerLocation> dispenserParameter = Parameter.location().key("dispenser").build();
    final Command.Parameterized triggerDispenserCommand = Command.builder().addParameters(dispenserParameter, entityTypeParameter).executor(context -> {
        final Player player = context.cause().first(Player.class).orElseThrow(() -> new CommandException(Component.text("Only a player can execute this command")));
        final BlockEntity dispenser = context.requireOne(dispenserParameter).blockEntity().orElse(null);
        if (dispenser == null) {
            return CommandResult.error(Component.text("Could not find dispenser"));
        }
        final EntityType<?> entityType = context.requireOne(entityTypeParameter);
        final Optional<? extends Projectile> launched = ((Dispenser) dispenser).launchProjectile((EntityType<Projectile>) entityType);
        if (launched.isPresent()) {
            launched.get().offer(Keys.SHOOTER, player);
            player.sendMessage(Identity.nil(), Component.text().append(Component.text("The dispenser launched a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), launched.get().type()).asString())).build());
            return CommandResult.success();
        }
        return CommandResult.error(Component.text().append(Component.text("Could not make the dispenser launch a ")).append(Component.text(RegistryTypes.ENTITY_TYPE.keyFor(Sponge.game(), entityType).asString())).build());
    }).build();
    event.register(this.plugin, triggerDispenserCommand, "triggerdispenser");
}
Also used : BlockEntity(org.spongepowered.api.block.entity.BlockEntity) NonNull(org.checkerframework.checker.nullness.qual.NonNull) Command(org.spongepowered.api.command.Command) ServerWorld(org.spongepowered.api.world.server.ServerWorld) Inject(com.google.inject.Inject) EntityTypes(org.spongepowered.api.entity.EntityTypes) Parameter(org.spongepowered.api.command.parameter.Parameter) Component(net.kyori.adventure.text.Component) InteractBlockEvent(org.spongepowered.api.event.block.InteractBlockEvent) LinkedList(java.util.LinkedList) Living(org.spongepowered.api.entity.living.Living) RegisterCommandEvent(org.spongepowered.api.event.lifecycle.RegisterCommandEvent) CommandResult(org.spongepowered.api.command.CommandResult) Plugin(org.spongepowered.plugin.builtin.jvm.Plugin) LoadableModule(org.spongepowered.test.LoadableModule) Identity(net.kyori.adventure.identity.Identity) Collection(java.util.Collection) Sponge(org.spongepowered.api.Sponge) TypeToken(io.leangen.geantyref.TypeToken) Entity(org.spongepowered.api.entity.Entity) ProjectileSource(org.spongepowered.api.projectile.source.ProjectileSource) RegistryTypes(org.spongepowered.api.registry.RegistryTypes) Dispenser(org.spongepowered.api.block.entity.carrier.Dispenser) Keys(org.spongepowered.api.data.Keys) Vector3d(org.spongepowered.math.vector.Vector3d) PluginContainer(org.spongepowered.plugin.PluginContainer) CommandContext(org.spongepowered.api.command.parameter.CommandContext) EntityType(org.spongepowered.api.entity.EntityType) Optional(java.util.Optional) Player(org.spongepowered.api.entity.living.player.Player) Projectile(org.spongepowered.api.entity.projectile.Projectile) Queue(java.util.Queue) Listener(org.spongepowered.api.event.Listener) CommandException(org.spongepowered.api.command.exception.CommandException) First(org.spongepowered.api.event.filter.cause.First) ServerPlayer(org.spongepowered.api.entity.living.player.server.ServerPlayer) ServerLocation(org.spongepowered.api.world.server.ServerLocation) BlockEntity(org.spongepowered.api.block.entity.BlockEntity) Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) ServerPlayer(org.spongepowered.api.entity.living.player.server.ServerPlayer) Optional(java.util.Optional) ServerLocation(org.spongepowered.api.world.server.ServerLocation) Living(org.spongepowered.api.entity.living.Living) CommandException(org.spongepowered.api.command.exception.CommandException) Projectile(org.spongepowered.api.entity.projectile.Projectile) EntityType(org.spongepowered.api.entity.EntityType) Command(org.spongepowered.api.command.Command) NonNull(org.checkerframework.checker.nullness.qual.NonNull) Parameter(org.spongepowered.api.command.parameter.Parameter) Collection(java.util.Collection) ProjectileSource(org.spongepowered.api.projectile.source.ProjectileSource) BlockEntity(org.spongepowered.api.block.entity.BlockEntity) Listener(org.spongepowered.api.event.Listener)

Example 32 with ServerLocation

use of org.spongepowered.api.world.server.ServerLocation in project SpongeCommon by SpongePowered.

the class WorldTest method transportToWorld.

private void transportToWorld(final ServerPlayer player, final ServerWorld world) {
    player.sendMessage(Identity.nil(), Component.text("Teleporting..."));
    final ServerLocation spawn = world.location(world.properties().spawnPosition());
    player.setLocation(Sponge.server().teleportHelper().findSafeLocation(spawn).orElse(spawn));
    player.showTitle(Title.title(Component.text("Welcome to your world"), Component.text(player.name())));
}
Also used : ServerLocation(org.spongepowered.api.world.server.ServerLocation)

Example 33 with ServerLocation

use of org.spongepowered.api.world.server.ServerLocation in project SpongeCommon by SpongePowered.

the class WorldTest method onRegisterCommand.

@Listener
public void onRegisterCommand(final RegisterCommandEvent<Command.Parameterized> event) {
    final Parameter.Value<ServerPlayer> optPlayerParameter = Parameter.player().optional().key("player").build();
    final Parameter.Value<ResourceKey> worldKeyParameter = Parameter.resourceKey().key("world").build();
    final Parameter.Value<ServerWorld> optWorldParameter = Parameter.world().optional().key("world").build();
    final Parameter.Value<Vector3d> optPositionParameter = Parameter.vector3d().optional().key("position").build();
    final Parameter.Value<PortalType> portalTypeParameter = Parameter.registryElement(TypeToken.get(PortalType.class), RegistryTypes.PORTAL_TYPE, "minecraft", "sponge").key("portal_type").build();
    final Parameter.Value<WorldType> worldTypeParameter = Parameter.registryElement(TypeToken.get(WorldType.class), RegistryTypes.WORLD_TYPE, "minecraft", "sponge").key("world_type").build();
    final Parameter.Value<ResourceKey> copyWorldKeyParameter = Parameter.resourceKey().key("copy_world").build();
    final Parameter.Value<ResourceKey> moveWorldKeyParameter = Parameter.resourceKey().key("move_world").build();
    event.register(this.plugin, Command.builder().addParameters(CommonParameters.LOCATION_ONLINE_ONLY, portalTypeParameter).permission(this.plugin.metadata().id() + ".command.portal.create").executor(context -> {
        final ServerLocation location = context.requireOne(CommonParameters.LOCATION_ONLINE_ONLY);
        final PortalType portalType = context.requireOne(portalTypeParameter);
        portalType.generatePortal(location, Axis.X);
        return CommandResult.success();
    }).build(), "cp", "createportal").register(this.plugin, Command.builder().addParameters(optPlayerParameter, CommonParameters.LOCATION_ONLINE_ONLY, portalTypeParameter).permission(this.plugin.metadata().id() + ".command.portal.use").executor(context -> {
        final ServerPlayer player = context.one(optPlayerParameter).orElse(this.getSourcePlayer(context));
        final ServerLocation location = context.requireOne(CommonParameters.LOCATION_ONLINE_ONLY);
        final PortalType portalType = context.requireOne(portalTypeParameter);
        return portalType.teleport(player, location, true) ? CommandResult.success() : CommandResult.error(Component.text("Could not teleport!"));
    }).build(), "up", "useportal").register(this.plugin, Command.builder().addParameters(optPlayerParameter, worldTypeParameter).permission(this.plugin.metadata().id() + ".command.environment.change").executor(context -> {
        final ServerPlayer player = context.one(optPlayerParameter).orElse(this.getSourcePlayer(context));
        final WorldType worldType = context.requireOne(worldTypeParameter);
        player.sendWorldType(worldType);
        return CommandResult.success();
    }).build(), "ce", "changeenvironment").register(this.plugin, Command.builder().addParameters(CommonParameters.WORLD, worldTypeParameter).permission(this.plugin.metadata().id() + ".command.worldtype.change").executor(context -> {
        final ServerWorld world = context.requireOne(CommonParameters.WORLD);
        final WorldType worldType = context.requireOne(worldTypeParameter);
        world.properties().setWorldType(worldType);
        return CommandResult.success();
    }).build(), "cwt", "changeworldtype").register(this.plugin, Command.builder().addParameters(optPlayerParameter, optWorldParameter, optPositionParameter).permission(this.plugin.metadata().id() + ".command.location.change").executor(context -> {
        final ServerPlayer player = context.one(optPlayerParameter).orElse(this.getSourcePlayer(context));
        final ServerWorld world = context.one(optWorldParameter).orElse(player.world());
        final Vector3d position = context.one(optPositionParameter).orElse(world.properties().spawnPosition().toDouble());
        return player.setLocation(ServerLocation.of(world, position)) ? CommandResult.success() : CommandResult.error(Component.text("Could not teleport!"));
    }).build(), "cl", "changelocation").register(this.plugin, Command.builder().addParameter(worldKeyParameter).permission(this.plugin.metadata().id() + ".command.world.load").executor(context -> {
        final ResourceKey key = context.requireOne(worldKeyParameter);
        this.game.server().worldManager().loadWorld(key).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r != null) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World loaded successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to load!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "lw", "loadworld").register(this.plugin, Command.builder().addParameters(worldKeyParameter, worldTypeParameter).permission(this.plugin.metadata().id() + ".command.world.create").executor(context -> {
        final ResourceKey key = context.requireOne(worldKeyParameter);
        final ResourceKey worldType = RegistryTypes.WORLD_TYPE.get().valueKey(context.requireOne(worldTypeParameter));
        final WorldTemplate template = WorldTemplate.builder().from(WorldTemplate.overworld()).key(key).worldType(RegistryKey.of(RegistryTypes.WORLD_TYPE, worldType).asReference()).performsSpawnLogic(true).build();
        this.game.server().worldManager().loadWorld(template).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r != null) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World created successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to create!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "cw", "createworld").register(this.plugin, Command.builder().addParameter(CommonParameters.WORLD).executor(context -> {
        final ServerWorld world = context.requireOne(CommonParameters.WORLD);
        this.game.server().worldManager().unloadWorld(world).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World unloaded successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to unload!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "uw", "unloadworld").register(this.plugin, Command.builder().addParameters(worldKeyParameter, copyWorldKeyParameter).executor(context -> {
        final ResourceKey key = context.requireOne(worldKeyParameter);
        final ResourceKey copyWorldKey = context.requireOne(copyWorldKeyParameter);
        this.game.server().worldManager().copyWorld(key, copyWorldKey).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World copied successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to copy!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "cpw", "copyworld").register(this.plugin, Command.builder().addParameters(worldKeyParameter, moveWorldKeyParameter).executor(context -> {
        final ResourceKey key = context.requireOne(worldKeyParameter);
        final ResourceKey moveWorldKey = context.requireOne(moveWorldKeyParameter);
        this.game.server().worldManager().moveWorld(key, moveWorldKey).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World moved successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to move!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "mw", "moveworld").register(this.plugin, Command.builder().addParameters(worldKeyParameter).executor(context -> {
        final ResourceKey key = context.requireOne(worldKeyParameter);
        this.game.server().worldManager().deleteWorld(key).whenComplete((r, t) -> {
            if (t != null) {
                context.cause().audience().sendMessage(Identity.nil(), Component.text(t.getMessage()));
            } else {
                if (r) {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World deleted successfully!"));
                } else {
                    context.cause().audience().sendMessage(Identity.nil(), Component.text("World failed to delete!"));
                }
            }
        });
        return CommandResult.success();
    }).build(), "dw", "deleteworld").register(this.plugin, Command.builder().addParameter(optPlayerParameter).executor(context -> {
        final ServerPlayer player = context.one(optPlayerParameter).orElse(this.getSourcePlayer(context));
        player.sendMessage(Identity.nil(), Component.text("You are in World ").append(player.world().properties().displayName().orElseGet(() -> Component.text(player.world().key().toString(), NamedTextColor.AQUA))).append(Component.text(" at (" + player.position().floorX() + ", " + player.position().floorY() + ", " + player.position().floorZ() + ")")));
        return CommandResult.success();
    }).build(), "wai", "whereami").register(this.plugin, Command.builder().executor(this::createRandomCheckerboardWorld).build(), "createrandomworld", "crw");
}
Also used : IntStream(java.util.stream.IntStream) RegistryEntry(org.spongepowered.api.registry.RegistryEntry) PortalType(org.spongepowered.api.world.portal.PortalType) Command(org.spongepowered.api.command.Command) ServerWorld(org.spongepowered.api.world.server.ServerWorld) Game(org.spongepowered.api.Game) SerializationBehavior(org.spongepowered.api.world.SerializationBehavior) WorldType(org.spongepowered.api.world.WorldType) Inject(com.google.inject.Inject) Random(java.util.Random) Biome(org.spongepowered.api.world.biome.Biome) Title(net.kyori.adventure.title.Title) WorldTemplate(org.spongepowered.api.world.server.WorldTemplate) BiomeProvider(org.spongepowered.api.world.biome.provider.BiomeProvider) Parameter(org.spongepowered.api.command.parameter.Parameter) Component(net.kyori.adventure.text.Component) Map(java.util.Map) NoiseGeneratorConfig(org.spongepowered.api.world.generation.config.NoiseGeneratorConfig) ResourceKey(org.spongepowered.api.ResourceKey) ChunkGenerator(org.spongepowered.api.world.generation.ChunkGenerator) NoSuchElementException(java.util.NoSuchElementException) CommonParameters(org.spongepowered.api.command.parameter.CommonParameters) RegisterCommandEvent(org.spongepowered.api.event.lifecycle.RegisterCommandEvent) CommandResult(org.spongepowered.api.command.CommandResult) RegistryKey(org.spongepowered.api.registry.RegistryKey) Plugin(org.spongepowered.plugin.builtin.jvm.Plugin) WorldTypes(org.spongepowered.api.world.WorldTypes) WorldManager(org.spongepowered.api.world.server.WorldManager) Structure(org.spongepowered.api.world.generation.structure.Structure) Identity(net.kyori.adventure.identity.Identity) CheckerboardBiomeConfig(org.spongepowered.api.world.biome.provider.CheckerboardBiomeConfig) Sponge(org.spongepowered.api.Sponge) Axis(org.spongepowered.api.util.Axis) TypeToken(io.leangen.geantyref.TypeToken) RegistryTypes(org.spongepowered.api.registry.RegistryTypes) Collectors(java.util.stream.Collectors) NamedTextColor(net.kyori.adventure.text.format.NamedTextColor) SeparatedStructureConfig(org.spongepowered.api.world.generation.config.structure.SeparatedStructureConfig) List(java.util.List) RegistryReference(org.spongepowered.api.registry.RegistryReference) Vector3d(org.spongepowered.math.vector.Vector3d) PluginContainer(org.spongepowered.plugin.PluginContainer) StructureGenerationConfig(org.spongepowered.api.world.generation.config.structure.StructureGenerationConfig) CommandContext(org.spongepowered.api.command.parameter.CommandContext) Listener(org.spongepowered.api.event.Listener) ServerPlayer(org.spongepowered.api.entity.living.player.server.ServerPlayer) NoiseConfig(org.spongepowered.api.world.generation.config.noise.NoiseConfig) ServerLocation(org.spongepowered.api.world.server.ServerLocation) ServerLocation(org.spongepowered.api.world.server.ServerLocation) ResourceKey(org.spongepowered.api.ResourceKey) ServerWorld(org.spongepowered.api.world.server.ServerWorld) WorldType(org.spongepowered.api.world.WorldType) Vector3d(org.spongepowered.math.vector.Vector3d) ServerPlayer(org.spongepowered.api.entity.living.player.server.ServerPlayer) Parameter(org.spongepowered.api.command.parameter.Parameter) WorldTemplate(org.spongepowered.api.world.server.WorldTemplate) PortalType(org.spongepowered.api.world.portal.PortalType) Listener(org.spongepowered.api.event.Listener)

Example 34 with ServerLocation

use of org.spongepowered.api.world.server.ServerLocation in project SpongeCommon by SpongePowered.

the class RayTraceTest method registerCommands.

@Listener
public void registerCommands(final RegisterCommandEvent<Command.Parameterized> event) {
    final Parameter.Value<ServerLocation> serverLocationParameter = Parameter.builder(ServerLocation.class).key("target_location").addParser(ResourceKeyedValueParameters.TARGET_BLOCK).build();
    final Parameter.Value<Entity> entityParameter = Parameter.builder(Entity.class).key("target_entity").addParser(ResourceKeyedValueParameters.TARGET_ENTITY).build();
    event.register(this.pluginContainer, Command.builder().addParameter(serverLocationParameter).executor(context -> {
        final ServerLocation serverLocation = context.requireOne(serverLocationParameter);
        context.sendMessage(Identity.nil(), Component.text("Location: " + serverLocation.toString()));
        context.sendMessage(Identity.nil(), Component.text("Block: " + serverLocation.block().toString()));
        return CommandResult.success();
    }).build(), "targetblock");
    event.register(this.pluginContainer, Command.builder().addParameter(entityParameter).executor(context -> {
        final Entity entity = context.requireOne(entityParameter);
        context.sendMessage(Identity.nil(), Component.text("Location: " + entity.location().toString()));
        context.sendMessage(Identity.nil(), Component.text("Entity Type: " + RegistryTypes.ENTITY_TYPE.keyFor(entity.world(), entity.type()).asString()));
        return CommandResult.success();
    }).build(), "targetentity");
}
Also used : Entity(org.spongepowered.api.entity.Entity) ServerLocation(org.spongepowered.api.world.server.ServerLocation) Parameter(org.spongepowered.api.command.parameter.Parameter) Listener(org.spongepowered.api.event.Listener)

Aggregations

ServerLocation (org.spongepowered.api.world.server.ServerLocation)34 ServerWorld (org.spongepowered.api.world.server.ServerWorld)12 Component (net.kyori.adventure.text.Component)9 Cause (org.spongepowered.api.event.Cause)9 CauseStackManager (org.spongepowered.api.event.CauseStackManager)8 ArrayList (java.util.ArrayList)7 Optional (java.util.Optional)7 Sponge (org.spongepowered.api.Sponge)7 Entity (org.spongepowered.api.entity.Entity)7 Redirect (org.spongepowered.asm.mixin.injection.Redirect)7 Vector3d (org.spongepowered.math.vector.Vector3d)7 Collection (java.util.Collection)6 List (java.util.List)6 BlockPos (net.minecraft.core.BlockPos)6 DamageSource (net.minecraft.world.damagesource.DamageSource)6 Nullable (org.checkerframework.checker.nullness.qual.Nullable)6 ServerPlayer (org.spongepowered.api.entity.living.player.server.ServerPlayer)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 ServerLevel (net.minecraft.server.level.ServerLevel)5