Java Code Examples for org.bukkit.Location#setWorld()
The following examples show how to use
org.bukkit.Location#setWorld() .
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: ArenaListener.java From civcraft with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerRespawn(PlayerRespawnEvent event) { Resident resident = CivGlobal.getResident(event.getPlayer()); if (!resident.isInsideArena()) { return; } Arena arena = resident.getCurrentArena(); if (arena == null) { return; } Location loc = arena.getRespawnLocation(resident); if (loc != null) { CivMessage.send(resident, CivColor.LightGray+"Respawned in arena."); World world = Bukkit.getWorld(arena.getInstanceName()); loc.setWorld(world); resident.setLastKilledTime(new Date()); event.setRespawnLocation(loc); } }
Example 2
Source File: VersionUtils_1_14.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@Override public void handleNetherPortalEvent(PlayerPortalEvent event){ Location loc = event.getFrom(); MainConfiguration cfg = GameManager.getGameManager().getConfiguration(); if (event.getFrom().getWorld().getEnvironment() == World.Environment.NETHER){ loc.setWorld(Bukkit.getWorld(cfg.getOverworldUuid())); loc.setX(loc.getX() * 2d); loc.setZ(loc.getZ() * 2d); event.setTo(loc); }else{ loc.setWorld(Bukkit.getWorld(cfg.getNetherUuid())); loc.setX(loc.getX() / 2d); loc.setZ(loc.getZ() / 2d); event.setTo(loc); } }
Example 3
Source File: WarpBrush.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
@Override protected final void powder(final SnipeData v) { Player player = v.owner().getPlayer(); Location location = this.getLastBlock().getLocation(); Location playerLocation = player.getLocation(); location.setPitch(playerLocation.getPitch()); location.setYaw(playerLocation.getYaw()); location.setWorld(Bukkit.getWorld(location.getWorld().getName())); TaskManager.IMP.sync(new RunnableVal<Object>() { @Override public void run(Object value) { player.teleport(location); } }); }
Example 4
Source File: WarpBrush.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
@Override protected final void arrow(final SnipeData v) { Player player = v.owner().getPlayer(); Location location = this.getLastBlock().getLocation(); Location playerLocation = player.getLocation(); location.setPitch(playerLocation.getPitch()); location.setYaw(playerLocation.getYaw()); location.setWorld(Bukkit.getWorld(location.getWorld().getName())); TaskManager.IMP.sync(new RunnableVal<Object>() { @Override public void run(Object value) { player.teleport(location); } }); }
Example 5
Source File: CraftBlock.java From Thermos with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(x); loc.setY(y); loc.setZ(z); loc.setYaw(0); loc.setPitch(0); } return loc; }
Example 6
Source File: PlayerInfo.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
@Override public Location getIslandNetherLocation() { Location l = getIslandLocation(); World nether = uSkyBlock.getInstance().getWorldManager().getNetherWorld(); if (nether == null) { return null; } if (l != null) { l.setWorld(nether); l.setY(l.getY() / 2); } return l; }
Example 7
Source File: AsyncBlock.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public Location getLocation(Location loc) { if(loc != null) { loc.setWorld(this.getWorld()); loc.setX((double)this.x); loc.setY((double)this.y); loc.setZ((double)this.z); } return loc; }
Example 8
Source File: CraftBlockState.java From Thermos with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(world); loc.setX(x); loc.setY(y); loc.setZ(z); loc.setYaw(0); loc.setPitch(0); } return loc; }
Example 9
Source File: CraftEntity.java From Kettle with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(entity.posX); loc.setY(entity.posY); loc.setZ(entity.posZ); loc.setYaw(entity.getBukkitYaw()); loc.setPitch(entity.rotationPitch); } return loc; }
Example 10
Source File: CraftEntity.java From Thermos with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(entity.posX); loc.setY(entity.posY); loc.setZ(entity.posZ); loc.setYaw(entity.rotationYaw); loc.setPitch(entity.rotationPitch); } return loc; }
Example 11
Source File: MailboxLocations.java From NyaaUtils with MIT License | 5 votes |
public Location getMailboxLocation(UUID uuid) { if (uuid == null) return null; Location loc = locationMap.get(uuid); if (loc == null || loc.getWorld() == null || !getLoadedWorldsName().contains(loc.getWorld().getName().toLowerCase())) { return null; } loc.setWorld(Bukkit.getWorld(loc.getWorld().getName())); return loc; }
Example 12
Source File: BlockStateBlock.java From Skript with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public Location getLocation(final @Nullable Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(getX()); loc.setY(getY()); loc.setZ(getZ()); loc.setPitch(0); loc.setYaw(0); } return loc; }
Example 13
Source File: DelayedChangeBlock.java From Skript with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public Location getLocation(final @Nullable Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(getX()); loc.setY(getY()); loc.setZ(getZ()); loc.setPitch(0); loc.setYaw(0); } return loc; }
Example 14
Source File: ExprWorld.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public void change(Event e, @Nullable Object[] delta, Changer.ChangeMode mode) { if (!(getExpr().getAll(e) instanceof Location[] && delta != null)) return; for (final Location loc : (Location[]) getExpr().getAll(e)) { loc.setWorld((World) delta[0]); } }
Example 15
Source File: CraftBlockState.java From Kettle with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(world); loc.setX(x); loc.setY(y); loc.setZ(z); loc.setYaw(0); loc.setPitch(0); } return loc; }
Example 16
Source File: CraftBlock.java From Kettle with GNU General Public License v3.0 | 5 votes |
public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); loc.setX(x); loc.setY(y); loc.setZ(z); loc.setYaw(0); loc.setPitch(0); } return loc; }
Example 17
Source File: CommonLevelLogic.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
Location getNetherLocation(Location l) { Location netherLoc = l.clone(); netherLoc.setWorld(plugin.getWorldManager().getNetherWorld()); netherLoc.setY(Settings.nether_height); return netherLoc; }
Example 18
Source File: IslandLogic.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
private Location getNetherLocation(Location loc) { Location netherIsland = loc.clone(); netherIsland.setWorld(plugin.getWorldManager().getNetherWorld()); netherIsland.setY(loc.getY()/2); return netherIsland; }