Java Code Examples for com.sk89q.worldedit.internal.LocalWorldAdapter#adapt()

The following examples show how to use com.sk89q.worldedit.internal.LocalWorldAdapter#adapt() . 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: WorldEditListener.java    From FastAsyncWorldedit with GNU General Public License v3.0 7 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
    final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
    final World world = player.getWorld();
    final WorldEdit we = WorldEdit.getInstance();
    final Block clickedBlock = event.getBlock();
    final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
    if (we.handleBlockLeftClick(player, pos)) {
        event.setCancelled(true);
    }
    if (we.handleArmSwing(player)) {
        event.setCancelled(true);
    }
}
 
Example 2
Source File: LocationMaskedPlayerWrapper.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public WorldVector getPosition() {
    LocalWorld world;
    if (position.getExtent() instanceof LocalWorld) {
        world = (LocalWorld) position.getExtent();
    } else {
        world = LocalWorldAdapter.adapt((World) position.getExtent());
    }
    return new WorldVector(world, position.toVector());
}
 
Example 3
Source File: GPActor.java    From GriefPrevention with MIT License 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(this.getWorld()), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 4
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 5
Source File: SpongePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WorldVector getPosition() {
    Vector3d pos = this.player.getLocation().getPosition();
    return new WorldVector(LocalWorldAdapter.adapt(SpongeWorldEdit.inst().getAdapter().getWorld(this.player.getWorld())), pos.getX(), pos.getY(), pos.getZ());
}
 
Example 6
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 7
Source File: SpongePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WorldVector getPosition() {
    Vector3d pos = this.player.getLocation().getPosition();
    return new WorldVector(LocalWorldAdapter.adapt(SpongeWorldEdit.inst().getAdapter().getWorld(this.player.getWorld())), pos.getX(), pos.getY(), pos.getZ());
}
 
Example 8
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.world)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 9
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 10
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 11
Source File: ForgePlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public WorldVector getPosition() {
    return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.world)), this.player.posX, this.player.posY, this.player.posZ);
}
 
Example 12
Source File: TargetBlock.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor requiring a player, uses default values
 *
 * @param player player to work with
 */
public TargetBlock(LocalPlayer player) {
    this.world = LocalWorldAdapter.adapt(player.getWorld());
    this.setValues(player.getPosition(), player.getYaw(), player.getPitch(),
            300, 1.65, 0.2);
}
 
Example 13
Source File: TargetBlock.java    From FastAsyncWorldedit with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructor requiring a player, max distance and a checking distance
 *
 * @param player LocalPlayer to work with
 * @param maxDistance how far it checks for blocks
 * @param checkDistance how often to check for blocks, the smaller the more precise
 */
public TargetBlock(Player player, int maxDistance, double checkDistance) {
    this.world = LocalWorldAdapter.adapt(player.getWorld());
    this.setValues(player.getPosition(), player.getYaw(), player.getPitch(), maxDistance, 1.65, checkDistance);
}