Package org.bukkit.craftbukkit.v1_6_R3.entity

Examples of org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer


  /**
   * Updates the players food and health information.
   */
  public static void sendHealthFoodUpdatePacket(Player player)
  {
    CraftPlayer cplayer = (CraftPlayer)player;
    EntityPlayer eplayer = cplayer.getHandle();
    eplayer.playerConnection.sendPacket(new Packet8UpdateHealth(eplayer.getHealth(), eplayer.getFoodData().a(), eplayer.getFoodData().e()));
  }
View Full Code Here


    }
    return (SpoutCraftChunk) chunk;
  }

  public static boolean replaceBukkitChunk(org.bukkit.Chunk chunk) {
    CraftChunk handle = (CraftChunk) ((CraftChunk) chunk).getHandle().bukkitChunk;
    if (handle != null) {
      boolean replace = false;
      if (handle.getX() != chunk.getX()) {
        replace = true;
      }
      if (handle.getZ() != chunk.getZ()) {
        replace = true;
      }
      if (handle.getClass().hashCode() != SpoutCraftChunk.class.hashCode()) {
        replace = true;
      }
      org.bukkit.Chunk loopbackChunk = ((CraftChunk)chunk).getHandle().bukkitChunk;
      if (loopbackChunk != chunk) {
        replace = true;
View Full Code Here

    }
    return false;
  }

  public static void resetBukkitChunk(org.bukkit.Chunk chunk) {
    ((CraftChunk) chunk).getHandle().bukkitChunk = new CraftChunk(((CraftChunk) chunk).getHandle());
  }
View Full Code Here

    return true;
  }

  public static boolean resetPlayerConnection(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    CraftServer server = (CraftServer) Bukkit.getServer();

    if (cp.getHandle().playerConnection instanceof SpoutPlayerConnection) {
      PlayerConnection oldHandler = cp.getHandle().playerConnection;
      /*Set<ChunkCoordIntPair> chunkUpdateQueue = ((SpoutPlayerConnection) cp.getHandle().playerConnection).getChunkUpdateQueue();
      for (ChunkCoordIntPair c : chunkUpdateQueue) {
View Full Code Here

    return false;
  }

  public static boolean updatePlayerConnection(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    CraftServer server = (CraftServer) Bukkit.getServer();
    if (!(cp.getHandle().playerConnection instanceof SpoutPlayerConnection)) {
      PlayerConnection oldHandler = cp.getHandle().playerConnection;
      Location loc = player.getLocation();
      SpoutPlayerConnection handler = new SpoutPlayerConnection(MinecraftServer.getServer(), cp.getHandle().playerConnection.networkManager, cp.getHandle());
      /*for (Object o : cp.getHandle().playerChunkCoordIntPairs) {
View Full Code Here

  private static void replaceAllBukkitChunks(boolean reset) {
    List<World> worlds = Bukkit.getServer().getWorlds();
    for (World world : worlds) {
      try {
        CraftWorld cw = (CraftWorld) world;
        Field worldServer = CraftWorld.class.getDeclaredField("world");
        worldServer.setAccessible(true);
        ChunkProviderServer cps = ((WorldServer) worldServer.get(cw)).chunkProviderServer;
        for (Chunk c : cps.chunks.values()) {
                    if (reset) {
View Full Code Here

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    if (player != null) {
      CraftWorld cw = ((CraftWorld)player.getWorld());
      if (cw.getHandle().chunkProviderServer.unloadQueue.contains(chunkX, chunkZ)) {
        return;
      }
      if (!cw.getHandle().chunkProviderServer.isChunkLoaded(chunkX, chunkZ)) {
        return;
      }
      Chunk c = player.getWorld().getChunkAt(chunkX, chunkZ);
      if (c instanceof SpoutChunk) {
        SpoutChunk chunk = (SpoutChunk)c;
View Full Code Here

    }
    return true;
  }

  public static boolean resetPlayerConnection(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    CraftServer server = (CraftServer) Bukkit.getServer();

    if (cp.getHandle().playerConnection instanceof SpoutPlayerConnection) {
      PlayerConnection oldHandler = cp.getHandle().playerConnection;
      /*Set<ChunkCoordIntPair> chunkUpdateQueue = ((SpoutPlayerConnection) cp.getHandle().playerConnection).getChunkUpdateQueue();
      for (ChunkCoordIntPair c : chunkUpdateQueue) {
      cp.getHandle().chunkCoordIntPairQueue.add(c);
      }
      ((SpoutPlayerConnection) cp.getHandle().playerConnection).flushUnloadQueue();*/
      cp.getHandle().playerConnection.a();
      Location loc = player.getLocation();
      PlayerConnection handler = new PlayerConnection(MinecraftServer.getServer(), cp.getHandle().playerConnection.networkManager, cp.getHandle());
      handler.a(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
      cp.getHandle().playerConnection = handler;
      INetworkManager nm = cp.getHandle().playerConnection.networkManager;
      setPlayerConnection(nm, cp.getHandle().playerConnection);
      oldHandler.disconnected = true;
      return true;
    }
    return false;
  }
View Full Code Here

    }
    return false;
  }

  public static boolean updatePlayerConnection(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    CraftServer server = (CraftServer) Bukkit.getServer();
    if (!(cp.getHandle().playerConnection instanceof SpoutPlayerConnection)) {
      PlayerConnection oldHandler = cp.getHandle().playerConnection;
      Location loc = player.getLocation();
      SpoutPlayerConnection handler = new SpoutPlayerConnection(MinecraftServer.getServer(), cp.getHandle().playerConnection.networkManager, cp.getHandle());
      /*for (Object o : cp.getHandle().playerChunkCoordIntPairs) {
      ChunkCoordIntPair c = (ChunkCoordIntPair) o;
      handler.addActiveChunk(c);
      }*/
      handler.a(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
      cp.getHandle().playerConnection = handler;
      INetworkManager nm = cp.getHandle().playerConnection.networkManager;
      setPlayerConnection(nm, cp.getHandle().playerConnection);
      Field handlerList = null;
      try {
        handlerList = ServerConnection.class.getDeclaredField("c");
        handlerList.setAccessible(true);
        ServerConnection sc = ((DedicatedServer) MinecraftServer.getServer()).ag();
View Full Code Here

    return false;
  }

  public static boolean updateBukkitEntity(Player player) {
    if (!(player instanceof SpoutCraftPlayer)) {
      CraftPlayer cp = (CraftPlayer) player;
      EntityPlayer ep = cp.getHandle();
      return updateBukkitEntity(ep);
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.