当前位置: 首页>>代码示例>>Java>>正文


Java CraftWorld.getHandle方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.CraftWorld.getHandle方法的典型用法代码示例。如果您正苦于以下问题:Java CraftWorld.getHandle方法的具体用法?Java CraftWorld.getHandle怎么用?Java CraftWorld.getHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.CraftWorld的用法示例。


在下文中一共展示了CraftWorld.getHandle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: spawnIn

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
public void spawnIn(World world) {
    super.spawnIn(world);
    if (world == null) {
        this.dead = false;
        ChunkCoordinates position = null;
        if (this.spawnWorld != null && !this.spawnWorld.equals("")) {
            CraftWorld cworld = (CraftWorld) Bukkit.getServer().getWorld(this.spawnWorld);
            if (cworld != null && this.getBed() != null) {
                world = cworld.getHandle();
                position = EntityHuman.getBed(cworld.getHandle(), this.getBed(), false);
            }
        }
        if (world == null || position == null) {
            world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
            position = world.getSpawn();
        }
        this.world = world;
        this.setPosition(position.x + 0.5, position.y, position.z + 0.5);
    }
    this.dimension = ((WorldServer) this.world).dimension;
    this.playerInteractManager.a((WorldServer) world);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:23,代码来源:EntityPlayer.java

示例2: canBuild

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
    net.minecraft.world.WorldServer worldServer = world.getHandle();
    int spawnSize = Bukkit.getServer().getSpawnRadius();

    if (world.getHandle().provider.dimensionId != 0) return true;
    if (spawnSize <= 0) return true;
    if (((CraftServer) Bukkit.getServer()).getHandle().func_152603_m().func_152690_d()) return true;
    if (player.isOp()) return true;

    net.minecraft.util.ChunkCoordinates chunkcoordinates = worldServer.getSpawnPoint();

    int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.posX), Math.abs(z - chunkcoordinates.posZ));
    return distanceFromSpawn > spawnSize;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:15,代码来源:CraftEventFactory.java

示例3: canBuild

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
    WorldServer worldServer = world.getHandle();
    int spawnSize = Bukkit.getServer().getSpawnRadius();

    if (world.getHandle().dimension != 0) return true;
    if (spawnSize <= 0) return true;
    if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
    if (player.isOp()) return true;

    ChunkCoordinates chunkcoordinates = worldServer.getSpawn();

    int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
    return distanceFromSpawn > spawnSize;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:CraftEventFactory.java

示例4: b

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
public void b(NBTTagCompound nbttagcompound) {
    // CraftBukkit start
    if (this.map >= 10) {
        if (this.uniqueId == null) {
            for (org.bukkit.World world : server.getWorlds()) {
                CraftWorld cWorld = (CraftWorld) world;
                if (cWorld.getHandle().dimension == this.map) {
                    this.uniqueId = cWorld.getUID();
                    break;
                }
            }
        }
        /* Perform a second check to see if a matching world was found, this is a necessary
           change incase Maps are forcefully unlinked from a World and lack a UID.*/
        if (this.uniqueId != null) {
            nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
            nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
        }
    }
    // CraftBukkit end
    nbttagcompound.setByte("dimension", this.map);
    nbttagcompound.setInt("xCenter", this.centerX);
    nbttagcompound.setInt("zCenter", this.centerZ);
    nbttagcompound.setByte("scale", this.scale);
    nbttagcompound.setShort("width", (short) 128);
    nbttagcompound.setShort("height", (short) 128);
    nbttagcompound.setByteArray("colors", this.colors);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:29,代码来源:WorldMap.java

示例5: canBuild

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
    WorldServer worldServer = world.getHandle();
    int spawnSize = Bukkit.getServer().getSpawnRadius();

    if (world.getHandle().dimension != 0) return true;
    if (spawnSize <= 0) return true;
    if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
    if (player.isOp()) return true;

    BlockPosition chunkcoordinates = worldServer.getSpawn();

    int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.getX()), Math.abs(z - chunkcoordinates.getY()));
    return distanceFromSpawn > spawnSize;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:15,代码来源:CraftEventFactory.java

示例6: a

import org.bukkit.craftbukkit.CraftWorld; //导入方法依赖的package包/类
public void a(NBTTagCompound nbttagcompound) {
    // CraftBukkit start
    byte dimension = nbttagcompound.getByte("dimension");

    if (dimension >= 10) {
        long least = nbttagcompound.getLong("UUIDLeast");
        long most = nbttagcompound.getLong("UUIDMost");

        if (least != 0L && most != 0L) {
            this.uniqueId = new UUID(most, least);

            CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
            // Check if the stored world details are correct.
            if (world == null) {
                /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
                   This is to prevent them being corrupted with the wrong map data. */
                dimension = 127;
            } else {
                dimension = (byte) world.getHandle().dimension;
            }
        }
    }

    this.map = dimension;
    // CraftBukkit end
    this.centerX = nbttagcompound.getInt("xCenter");
    this.centerZ = nbttagcompound.getInt("zCenter");
    this.scale = nbttagcompound.getByte("scale");
    if (this.scale < 0) {
        this.scale = 0;
    }

    if (this.scale > 4) {
        this.scale = 4;
    }

    short short1 = nbttagcompound.getShort("width");
    short short2 = nbttagcompound.getShort("height");

    if (short1 == 128 && short2 == 128) {
        this.colors = nbttagcompound.getByteArray("colors");
    } else {
        byte[] abyte = nbttagcompound.getByteArray("colors");

        this.colors = new byte[16384];
        int i = (128 - short1) / 2;
        int j = (128 - short2) / 2;

        for (int k = 0; k < short2; ++k) {
            int l = k + j;

            if (l >= 0 || l < 128) {
                for (int i1 = 0; i1 < short1; ++i1) {
                    int j1 = i1 + i;

                    if (j1 >= 0 || j1 < 128) {
                        this.colors[j1 + l * 128] = abyte[i1 + k * short1];
                    }
                }
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:64,代码来源:WorldMap.java


注:本文中的org.bukkit.craftbukkit.CraftWorld.getHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。