Package net.minecraft.server.v1_6_R3

Examples of net.minecraft.server.v1_6_R3.PlayerConnection


    }

    @Override
    protected void handlePacketAdd(Object o, Player owner) {
        if (o instanceof Packet20NamedEntitySpawn) {
            final Packet20NamedEntitySpawn packet = ((Packet20NamedEntitySpawn) o);
            final TagInfo info = this.handler.getNameForPacket20((String) null, packet.a, packet.b, owner);
            if (info != null) {
                packet.b = info.getName();
            }
        }
View Full Code Here


    public static void despawnNPC(HumanNPC npc, NPCRemoveReason reason) {
        if (getWorldServer(npc.getWorld()).getEntity(npc.getPlayer().getEntityId()) != npc.getHandle()
                || npc.getHandle().dead)
            return;
        Bukkit.getServer().getPluginManager().callEvent(new NPCRemoveEvent(npc, reason));
        PacketUtils.sendPacketToOnline(new Packet29DestroyEntity(npc.getHandle().id), null);
        npc.getHandle().die();
    }
View Full Code Here

                break;
        }
    }

    private void sendMetadataPacket() {
        PacketUtils.sendPacketNearby(getPlayer().getLocation(), 64, new Packet40EntityMetadata(this.npc.id,
                getWatcher(), true), getPlayer());
    }
View Full Code Here

    private void updateEquipment() {
        for (int i = 0; i < previousEquipment.length; i++) {
            net.minecraft.server.v1_6_R3.ItemStack previous = previousEquipment[i];
            net.minecraft.server.v1_6_R3.ItemStack current = getEquipment(i);
            if (previous != current) {
                PacketUtils.sendPacketNearby(getBukkitEntity().getLocation(), 64, new Packet5EntityEquipment(id, i,
                        current));
                previousEquipment[i] = current;
            }
        }
    }
View Full Code Here

  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;
View Full Code Here

  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);
View Full Code Here

            Messaging.log("Null location or world while spawning", name, "UID", UID
                    + ". Is the location unloaded or missing?");
            return null;
        }
        World ws = getWorldServer(loc.getWorld());
        final CraftNPC eh = new CraftNPC(getMinecraftServer(ws.getServer()), ws, name, new PlayerInteractManager(ws));
        eh.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
        Bukkit.getScheduler().scheduleSyncDelayedTask(Citizens.plugin, new Runnable() {
            @Override
            public void run() {
                eh.aA = loc.getYaw();
View Full Code Here

    public static HumanNPC spawnNPC(final Location loc, CreatureNPCType type) {
        try {
            String name = type.chooseRandomName();
            World ws = getWorldServer(loc.getWorld());
            final CraftNPC eh = type.getEntityConstructor().newInstance(getMinecraftServer(ws.getServer()), ws, name,
                    new PlayerInteractManager(ws));
            eh.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
            Bukkit.getScheduler().scheduleSyncDelayedTask(Citizens.plugin, new Runnable() {
                @Override
                public void run() {
                    eh.aA = loc.getYaw();
View Full Code Here

      setPlayerConnection(nm, cp.getHandle().playerConnection);
      Field handlerList = null;
      try {
        handlerList = ServerConnection.class.getDeclaredField("c");
        handlerList.setAccessible(true);
        ServerConnection sc = ((DedicatedServer) MinecraftServer.getServer()).ag();
        List rhandlerList = (List) handlerList.get(sc);
        rhandlerList.remove(oldHandler);
        rhandlerList.add(handler);
      } catch (NoSuchFieldException ex) {
        Logger.getLogger(SpoutCraftPlayer.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

  @Override
  public void openSignEditGUI(Sign sign) {
    if (sign != null && isSpoutCraftEnabled()) {
      sendPacket(new PacketOpenSignGUI(sign.getX(), sign.getY(), sign.getZ()));
      TileEntitySign tes = (TileEntitySign) ((CraftWorld) (sign.getBlock()).getWorld()).getTileEntityAt(sign.getX(), sign.getY(), sign.getZ()); // Found a hidden trace to The Elder Scrolls. Bethesda's Lawyers are right!
      tes.isEditable = true;
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.server.v1_6_R3.PlayerConnection

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.