org.spongepowered.api.event.cause.entity.spawn.SpawnTypes Java Examples
The following examples show how to use
org.spongepowered.api.event.cause.entity.spawn.SpawnTypes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuildPermListener.java From Nations with MIT License | 6 votes |
@Listener(order=Order.FIRST, beforeModifications = true) public void onEntitySpawn(SpawnEntityEvent event, @First Player player) { if (player.hasPermission("nations.admin.bypass.perm.build")) { return; } if (event.getCause().contains(SpawnTypes.PLACEMENT)) { try { if (!ConfigHandler.getNode("worlds").getNode(event.getEntities().get(0).getWorld().getName()).getNode("enabled").getBoolean()) return; if (!ConfigHandler.isWhitelisted("spawn", event.getEntities().get(0).getType().getId()) && !DataHandler.getPerm("build", player.getUniqueId(), event.getEntities().get(0).getLocation())) event.setCancelled(true); } catch (IndexOutOfBoundsException e) {} } }
Example #2
Source File: KittyCannonExecutor.java From EssentialCmds with MIT License | 5 votes |
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src) { velocity = velocity.mul(5); Extent extent = location.getExtent(); Entity kitten = extent.createEntity(EntityTypes.OCELOT, location.getPosition()); kitten.offer(Keys.VELOCITY, velocity); extent.spawnEntity(kitten, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build()))); }
Example #3
Source File: MobSpawnExecutor.java From EssentialCmds with MIT License | 5 votes |
public void spawnEntity(Location<World> location, Player player, EntityType type, int amount) { for (int i = 1; i <= amount; i++) { Entity entity = location.getExtent().createEntity(type, location.getPosition()); location.getExtent().spawnEntity(entity, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build()))); } }
Example #4
Source File: FireballExecutor.java From EssentialCmds with MIT License | 5 votes |
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src) { Extent extent = location.getExtent(); Entity fireball = extent.createEntity(EntityTypes.FIREBALL, location.getPosition()); fireball.offer(Keys.VELOCITY, velocity); extent.spawnEntity(fireball, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build()))); }
Example #5
Source File: LightningExecutor.java From EssentialCmds with MIT License | 4 votes |
public void spawnEntity(Location<World> location, CommandSource src) { Extent extent = location.getExtent(); Entity lightning = extent.createEntity(EntityTypes.LIGHTNING, location.getPosition()); extent.spawnEntity(lightning, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build()))); }