@Override public com.sk89q.worldedit.world.World getWorld() { return SpongeWorldEdit.inst().getAdapter().getWorld(player.getWorld()); }
@Override public void setPosition(Vector3 pos, float pitch, float yaw) { org.spongepowered.api.world.Location<World> loc = new org.spongepowered.api.world.Location<>( this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ() ); this.player.setLocationAndRotation(loc, new Vector3d(pitch, yaw, 0)); }
@Override public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) { org.spongepowered.api.world.Location<World> loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc.getBlockPosition(), loc.getBlock()); } else { // TODO // player.sendBlockChange(loc, BukkitAdapter.adapt(block)); // if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { // BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); // if (adapter != null) { // adapter.sendFakeNBT(player, pos, ((BaseBlock) block).getNbtData()); // } // } } }
public World getWorld() { return this.owner.getPlayer().getWorld(); }
private Optional<Painting> getPainting(Player player) { return player.getWorld().getEntity(paintings.get(player.getUniqueId())).filter(entity -> entity instanceof Painting).map(entity -> (Painting) entity); }
@Override public int getWorldBlockData(UserConnection user, Position position) { if (blockStateIds != null) { UUID uuid = user.get(ProtocolInfo.class).getUuid(); Optional<Player> player = Sponge.getServer().getPlayer(uuid); if (player.isPresent()) { World world = player.get().getWorld(); Optional<Chunk> chunk = world.getChunkAtBlock(position.getX().intValue(), position.getY().intValue(), position.getZ().intValue()); if (chunk.isPresent()) { BlockState b = chunk.get().getBlock(position.getX().intValue(), position.getY().intValue(), position.getZ().intValue()); Integer id = blockStateIds.get(b); if (id == null) { System.out.println("id not found"); } else { return id; } } } } return 0; } }
private void actOnGMChangeEvent(ChangeGameModeEvent.TargetPlayer event) { Player player = event.getTargetEntity(); UUID uuid = player.getUniqueId(); long time = System.currentTimeMillis(); String gameMode = event.getGameMode().getName().toUpperCase(); String worldName = player.getWorld().getName(); worldAliasSettings.addWorld(worldName); Optional<Session> cachedSession = SessionCache.getCachedSession(uuid); cachedSession.ifPresent(session -> session.changeState(worldName, gameMode, time)); }
.end(); final Optional<EntityUniverse.EntityHit> optionalEntityHit = player.getWorld() .getIntersectingEntities(player, MAX_DISTANCE, hit -> hit.getEntity() != player) .stream().reduce((a, b) -> a.getDistance() < b.getDistance() ? a : b); final Entity entity = player.getWorld().createEntity(EntityTypes.LIGHTNING, closest); Sponge.getCauseStackManager().pushCause(entity); player.getWorld().spawnEntity(entity); Sponge.getCauseStackManager().popCause();
@Override public void teleport(Location location) { if ((Math.abs(location.getX()) >= 30000000) || (Math.abs(location.getZ()) >= 30000000)) { return; } String world = this.player.getWorld().getName(); if (!world.equals(location.getWorld())) { this.player.transferToWorld(location.getWorld(), new Vector3d(location.getX(), location.getY(), location.getZ())); } else { org.spongepowered.api.world.Location<World> current = this.player.getLocation(); current = current.setPosition(new Vector3d(location.getX(), location.getY(), location.getZ())); this.player.setLocation(current); } }
world = java.util.Optional.of(((Player) c.getSource()).getWorld());
@Listener(order = Order.LAST) public void onDeath(DestructEntityEvent.Death e) { if (!(e.getTargetEntity() instanceof Player)) return; Player p = (Player) e.getTargetEntity(); if (isOnPipe(p.getUniqueId()) && Via.getConfig().isShowNewDeathMessages() && checkGamerule(p.getWorld())) { sendPacket(p, e.getMessage().toPlain()); } }
private void spawnFireball(Player player, boolean isLarge) { World world = player.getWorld(); Vector3d playerRot = player.getRotation(); Vector3d playerLoc = player.getLocation().getPosition();
private void sendUpdateSelf() { receiver.getTabList().removeEntry(receiver.getUniqueId()); receiver.getTabList().addEntry(TabListEntry.builder() .displayName(receiver.getDisplayNameData().displayName().get()) .latency(receiver.getConnection().getLatency()) .list(receiver.getTabList()) .gameMode(receiver.getGameModeData().type().get()) .profile(receiver.getProfile()) .build()); Location<World> oldLocation = receiver.getLocation(); Vector3d rotation = receiver.getRotation(); World receiverWorld = receiver.getWorld(); Sponge.getServer().getWorlds() .stream() .filter(world -> !world.equals(receiverWorld)) .findFirst() .ifPresent(world -> { receiver.setLocation(world.getSpawnLocation()); receiver.setLocationAndRotation(oldLocation, rotation); }); } }
private void actOnJoinEvent(ClientConnectionEvent.Join event) { Player player = event.getTargetEntity(); UUID uuid = player.getUniqueId(); long time = System.currentTimeMillis(); SpongeAFKListener.AFK_TRACKER.performedAction(uuid, time); String world = player.getWorld().getName(); Optional<GameMode> gameMode = player.getGameModeData().get(Keys.GAME_MODE); String gm = gameMode.map(mode -> mode.getName().toUpperCase()).orElse("ADVENTURE"); InetAddress address = player.getConnection().getAddress().getAddress(); String playerName = player.getName(); String displayName = player.getDisplayNameData().displayName().get().toPlain(); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); processing.submitCritical(() -> sessionCache.cacheSession(uuid, new Session(uuid, serverInfo.getServerUUID(), time, world, gm))); runnableFactory.create("Player Register: " + uuid, processors.player().registerProcessor(uuid, () -> time, playerName, gatheringGeolocations ? processors.player().ipUpdateProcessor(uuid, address, time) : null, processors.player().nameProcessor(uuid, playerName, displayName), processors.info().playerPageUpdateProcessor(uuid) ) ).runTaskAsynchronously(); }
return; String world = player.getWorld().getName(); if (!PS.get().hasPlotArea(world)) { return;
return; Location loc = SpongeUtil.getLocation(player.getWorld().getName(), bloc.get()); PlotArea area = loc.getPlotArea(); if (area == null) {
live.setLocation(new Location<>(live.getWorld(), req.getPosition()));
World world = ((Player) src).getWorld();