/**
   * Opens a Gui for the player.
   *
   * @param mod The mod associated with the gui
   * @param ID The ID number for the Gui
   * @param world The World
   * @param X X Position
   * @param Y Y Position
   * @param Z Z Position
   */
  public void openGui(BaseMod mod, int ID, World world, int x, int y, int z) {
    if (!(this instanceof EntityPlayerMP)) {
      return;
    }

    EntityPlayerMP player = (EntityPlayerMP) this;

    if (!(mod instanceof NetworkMod)) {
      return;
    }

    IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
    if (handler != null) {
      Container container = (Container) handler.getGuiElement(ID, player, world, x, y, z);
      if (container != null) {
        player.realGetNextWidowId();
        player.closeCraftingGui();
        PacketOpenGUI pkt =
            new PacketOpenGUI(
                player.getCurrentWindowIdField(),
                MinecraftForge.getModID((NetworkMod) mod),
                ID,
                x,
                y,
                z);
        player.playerNetServerHandler.sendPacket(pkt.getPacket());
        craftingInventory = container;
        craftingInventory.windowId = player.getCurrentWindowIdField();
        craftingInventory.onCraftGuiOpened(player);
      }
    }
  }
  public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) {
    if (par1Packet205ClientCommand.forceRespawn == 1) {
      if (playerEntity.playerHasConqueredTheEnd) {
        playerEntity = mcServer.getConfigurationManager().respawnPlayer(playerEntity, 0, true);
      } else if (playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) {
        if (mcServer.isSinglePlayer() && playerEntity.username.equals(mcServer.getServerOwner())) {
          playerEntity.serverForThisPlayer.kickPlayerFromServer(
              "You have died. Game over, man, it's game over!");
          mcServer.deleteWorldAndStopServer();
        } else {
          BanEntry banentry = new BanEntry(playerEntity.username);
          banentry.setBanReason("Death in Hardcore");
          mcServer.getConfigurationManager().getBannedPlayers().put(banentry);
          playerEntity.serverForThisPlayer.kickPlayerFromServer(
              "You have died. Game over, man, it's game over!");
        }
      } else {
        if (playerEntity.getHealth() > 0) {
          return;
        }

        playerEntity = mcServer.getConfigurationManager().respawnPlayer(playerEntity, 0, false);
      }
    }
  }
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length < 2) {
      throw new WrongUsageException("commands.message.usage", new Object[0]);
    } else {
      EntityPlayerMP var3 =
          MinecraftServer.getServer()
              .getConfigurationManager()
              .getPlayerForUsername(par2ArrayOfStr[0]);

      if (var3 == null) {
        throw new PlayerNotFoundException();
      } else if (var3 == par1ICommandSender) {
        throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
      } else {
        String var4 = joinString(par2ArrayOfStr, 1);
        var3.sendChatToPlayer(
            "\u00a77\u00a7o"
                + var3.translateString(
                    "commands.message.display.incoming",
                    new Object[] {par1ICommandSender.getCommandSenderName(), var4}));
        par1ICommandSender.sendChatToPlayer(
            "\u00a77\u00a7o"
                + par1ICommandSender.translateString(
                    "commands.message.display.outgoing",
                    new Object[] {var3.getCommandSenderName(), var4}));
      }
    }
  }
 public static MovingObjectPosition getTargetBlock(EntityPlayerMP thePlayer) {
   float par1 = 0.1F;
   Vec3 var4 = thePlayer.getPosition(256);
   Vec3 var5 = thePlayer.getLook(256);
   Vec3 var6 = var4.addVector(var5.xCoord * par1, var5.yCoord * par1, var5.zCoord * par1);
   return thePlayer.worldObj.rayTraceBlocks(var4, var6);
 }
  protected void func_72391_b(EntityPlayerMP p_72391_1_) {
    if (p_72391_1_.func_70005_c_().equals(this.func_72415_s().func_71214_G())) {
      this.field_72416_e = new NBTTagCompound();
      p_72391_1_.func_70109_d(this.field_72416_e);
    }

    super.func_72391_b(p_72391_1_);
  }
 public void func_72380_a(EntityPlayerMP p_72380_1_) {
   NBTTagCompound nbttagcompound = field_72400_f.field_71305_c[0].func_72912_H().func_76072_h();
   if (p_72380_1_.func_70005_c_().equals(field_72400_f.func_71214_G()) && nbttagcompound != null) {
     p_72380_1_.func_70020_e(nbttagcompound);
   } else {
     field_72412_k.func_75752_b(p_72380_1_);
   }
 }
 @Override
 public void onPlayerLogin(EntityPlayer player) {
   if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
     if (SimpleModsConfiguration.server.isDedicatedServer()) {
       if (!Permissions.playerData.getCompoundTag(player.username).hasKey("Rank")) {
         NBTTagCompound data = new NBTTagCompound();
         data.setString("Rank", Permissions.defaultRank);
         Permissions.playerData.setCompoundTag(player.username, data);
         player.addChatMessage(
             SimpleModsTranslation.welcomeMessageCoreDefaultRank.replaceAll(
                 "%d", Permissions.defaultRank));
         player.addChatMessage(SimpleModsTranslation.welcomeMessageCore);
         if (Permissions.rankData.getCompoundTag(Permissions.getRank(player)).hasKey("Spawn")) {
           data =
               Permissions.rankData
                   .getCompoundTag(Permissions.getRank(player))
                   .getCompoundTag("Spawn");
           Double X = data.getDouble("X");
           Double Y = data.getDouble("Y");
           Double Z = data.getDouble("Z");
           Float yaw = data.getFloat("yaw");
           Float pitch = data.getFloat("pitch");
           Integer dim = data.getInteger("Dim");
           if (player.dimension != dim)
             ModLoader.getMinecraftServerInstance()
                 .getConfigurationManager()
                 .transferPlayerToDimension(((EntityPlayerMP) player), dim);
           ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(X, Y, Z, yaw, pitch);
           player.sendChatToPlayer("Welcome to " + data.getString("name"));
         }
       }
     } else {
       if (!Permissions.playerData.getCompoundTag(player.username).hasKey("Rank")) {
         NBTTagCompound data = new NBTTagCompound();
         data.setString("Rank", Permissions.opRank);
         Permissions.playerData.setCompoundTag(player.username, data);
         if (Permissions.rankData.getCompoundTag(Permissions.getRank(player)).hasKey("Spawn")) {
           data =
               Permissions.rankData
                   .getCompoundTag(Permissions.getRank(player))
                   .getCompoundTag("Spawn");
           Double X = data.getDouble("X");
           Double Y = data.getDouble("Y");
           Double Z = data.getDouble("Z");
           Float yaw = data.getFloat("yaw");
           Float pitch = data.getFloat("pitch");
           Integer dim = data.getInteger("Dim");
           if (player.dimension != dim)
             ModLoader.getMinecraftServerInstance()
                 .getConfigurationManager()
                 .transferPlayerToDimension(((EntityPlayerMP) player), dim);
           ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(X, Y, Z, yaw, pitch);
           player.sendChatToPlayer("Welcome to " + data.getString("name"));
         }
       }
     }
   }
 }
 public List func_72382_j(String p_72382_1_) {
   ArrayList arraylist = new ArrayList();
   Iterator iterator = field_72404_b.iterator();
   do {
     if (!iterator.hasNext()) {
       break;
     }
     EntityPlayerMP entityplayermp = (EntityPlayerMP) iterator.next();
     if (entityplayermp.func_71114_r().equals(p_72382_1_)) {
       arraylist.add(entityplayermp);
     }
   } while (true);
   return arraylist;
 }
  public void handleChat(Packet3Chat par1Packet3Chat) {
    ModLoader.serverChat(this, par1Packet3Chat.message);

    if (playerEntity.getChatVisibility() == 2) {
      sendPacketToPlayer(new Packet3Chat("Cannot send chat message."));
      return;
    }

    String s = par1Packet3Chat.message;

    if (s.length() > 100) {
      kickPlayerFromServer("Chat message too long");
      return;
    }

    s = s.trim();

    for (int i = 0; i < s.length(); i++) {
      if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) {
        kickPlayerFromServer("Illegal characters in chat");
        return;
      }
    }

    if (s.startsWith("/")) {
      func_72566_d(s);
    } else {
      if (playerEntity.getChatVisibility() == 1) {
        sendPacketToPlayer(new Packet3Chat("Cannot send chat message."));
        return;
      }

      s =
          (new StringBuilder())
              .append("<")
              .append(playerEntity.username)
              .append("> ")
              .append(s)
              .toString();
      logger.info(s);
      mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(s, false));
    }

    chatSpamThresholdCount += 20;

    if (chatSpamThresholdCount > 200
        && !mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username)) {
      kickPlayerFromServer("disconnect.spam");
    }
  }
 /** runs registerPacket on the given Packet19EntityAction */
 public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction) {
   if (par1Packet19EntityAction.state == 1) {
     playerEntity.setSneaking(true);
   } else if (par1Packet19EntityAction.state == 2) {
     playerEntity.setSneaking(false);
   } else if (par1Packet19EntityAction.state == 4) {
     playerEntity.setSprinting(true);
   } else if (par1Packet19EntityAction.state == 5) {
     playerEntity.setSprinting(false);
   } else if (par1Packet19EntityAction.state == 3) {
     playerEntity.wakeUpPlayer(false, true, true);
     field_72587_r = false;
   }
 }
 private boolean isPlayerWatchingThisChunk(EntityPlayerMP par1EntityPlayerMP) {
   return par1EntityPlayerMP
       .getServerForPlayer()
       .getPlayerManager()
       .isPlayerWatchingChunk(
           par1EntityPlayerMP, this.myEntity.chunkCoordX, this.myEntity.chunkCoordZ);
 }
  /** run once each game tick */
  public void networkTick() {
    field_72584_h = false;
    currentTicks++;
    mcServer.theProfiler.startSection("packetflow");
    theNetworkManager.processReadPackets();
    mcServer.theProfiler.endStartSection("keepAlive");

    if ((long) currentTicks - ticksOfLastKeepAlive > 20L) {
      ticksOfLastKeepAlive = currentTicks;
      keepAliveTimeSent = System.nanoTime() / 0xf4240L;
      keepAliveRandomID = randomGenerator.nextInt();
      sendPacketToPlayer(new Packet0KeepAlive(keepAliveRandomID));
    }

    if (chatSpamThresholdCount > 0) {
      chatSpamThresholdCount--;
    }

    if (creativeItemCreationSpamThresholdTally > 0) {
      creativeItemCreationSpamThresholdTally--;
    }

    mcServer.theProfiler.endStartSection("playerTick");

    if (!field_72584_h && !playerEntity.playerHasConqueredTheEnd) {
      playerEntity.onUpdateEntity();
    }

    mcServer.theProfiler.endSection();
  }
 public NetServerHandler(
     MinecraftServer p_i5010_1_, INetworkManager p_i5010_2_, EntityPlayerMP p_i5010_3_) {
   this.field_72573_d = p_i5010_1_;
   this.field_72575_b = p_i5010_2_;
   p_i5010_2_.func_74425_a(this);
   this.field_72574_e = p_i5010_3_;
   p_i5010_3_.field_71135_a = this;
 }
 public void func_72367_e(EntityPlayerMP p_72367_1_) {
   func_72391_b(p_72367_1_);
   WorldServer worldserver = p_72367_1_.func_71121_q();
   worldserver.func_72900_e(p_72367_1_);
   worldserver.func_73040_p().func_72695_c(p_72367_1_);
   field_72404_b.remove(p_72367_1_);
   func_72384_a(new Packet201PlayerInfo(p_72367_1_.field_71092_bJ, false, 9999));
 }
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length < 1) {
      throw new WrongUsageException("commands.tp.usage", new Object[0]);
    } else {
      EntityPlayerMP var3;

      if (par2ArrayOfStr.length != 2 && par2ArrayOfStr.length != 4) {
        var3 = getCommandSenderAsPlayer(par1ICommandSender);
      } else {
        var3 = func_82359_c(par1ICommandSender, par2ArrayOfStr[0]);

        if (var3 == null) {
          throw new PlayerNotFoundException();
        }
      }

      if (par2ArrayOfStr.length != 3 && par2ArrayOfStr.length != 4) {
        if (par2ArrayOfStr.length == 1 || par2ArrayOfStr.length == 2) {
          EntityPlayerMP var11 =
              func_82359_c(par1ICommandSender, par2ArrayOfStr[par2ArrayOfStr.length - 1]);

          if (var11 == null) {
            throw new PlayerNotFoundException();
          }

          if (var11.worldObj != var3.worldObj) {
            notifyAdmins(par1ICommandSender, "commands.tp.notSameDimension", new Object[0]);
            return;
          }

          var3.mountEntity((Entity) null);
          var3.playerNetServerHandler.setPlayerLocation(
              var11.posX, var11.posY, var11.posZ, var11.rotationYaw, var11.rotationPitch);
          notifyAdmins(
              par1ICommandSender,
              "commands.tp.success",
              new Object[] {var3.getEntityName(), var11.getEntityName()});
        }
      } else if (var3.worldObj != null) {
        int var4 = par2ArrayOfStr.length - 3;
        double var5 = this.func_82368_a(par1ICommandSender, var3.posX, par2ArrayOfStr[var4++]);
        double var7 =
            this.func_82367_a(par1ICommandSender, var3.posY, par2ArrayOfStr[var4++], 0, 0);
        double var9 = this.func_82368_a(par1ICommandSender, var3.posZ, par2ArrayOfStr[var4++]);
        var3.mountEntity((Entity) null);
        var3.setPositionAndUpdate(var5, var7, var9);
        notifyAdmins(
            par1ICommandSender,
            "commands.tp.success.coordinates",
            new Object[] {
              var3.getEntityName(), Double.valueOf(var5), Double.valueOf(var7), Double.valueOf(var9)
            });
      }
    }
  }
 public void func_72375_a(EntityPlayerMP p_72375_1_, WorldServer p_72375_2_) {
   WorldServer worldserver = p_72375_1_.func_71121_q();
   if (p_72375_2_ != null) {
     p_72375_2_.func_73040_p().func_72695_c(p_72375_1_);
   }
   worldserver.func_73040_p().func_72683_a(p_72375_1_);
   worldserver.field_73059_b.func_73158_c(
       (int) p_72375_1_.field_70165_t >> 4, (int) p_72375_1_.field_70161_v >> 4);
 }
Exemple #17
0
 public NetServerHandler(
     MinecraftServer par1MinecraftServer,
     NetworkManager par2NetworkManager,
     EntityPlayerMP par3EntityPlayerMP) {
   this.mcServer = par1MinecraftServer;
   this.netManager = par2NetworkManager;
   par2NetworkManager.setNetHandler(this);
   this.playerEntity = par3EntityPlayerMP;
   par3EntityPlayerMP.playerNetServerHandler = this;
 }
 public void setPlayerLocation(double par1, double par3, double par5, float par7, float par8) {
   field_72587_r = false;
   lastPosX = par1;
   lastPosY = par3;
   lastPosZ = par5;
   playerEntity.setPositionAndRotation(par1, par3, par5, par7, par8);
   playerEntity.serverForThisPlayer.sendPacketToPlayer(
       new Packet13PlayerLookMove(
           par1, par3 + 1.6200000047683716D, par3, par5, par7, par8, false));
 }
  public void handleUseEntity(Packet7UseEntity par1Packet7UseEntity) {
    WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension);
    Entity entity = worldserver.getEntityByID(par1Packet7UseEntity.targetEntity);

    if (entity != null) {
      boolean flag = playerEntity.canEntityBeSeen(entity);
      double d = 36D;

      if (!flag) {
        d = 9D;
      }

      if (playerEntity.getDistanceSqToEntity(entity) < d) {
        if (par1Packet7UseEntity.isLeftClick == 0) {
          playerEntity.interactWith(entity);
        } else if (par1Packet7UseEntity.isLeftClick == 1) {
          playerEntity.attackTargetEntityWithCurrentItem(entity);
        }
      }
    }
  }
 public NetServerHandler(
     MinecraftServer minecraftserver,
     NetworkManager networkmanager,
     EntityPlayerMP entityplayermp) {
   connectionClosed = false;
   hasMoved = true;
   field_10_k = new HashMap();
   mcServer = minecraftserver;
   netManager = networkmanager;
   networkmanager.setNetHandler(this);
   playerEntity = entityplayermp;
   entityplayermp.playerNetServerHandler = this;
 }
Exemple #21
0
 void openRemoteGui(
     ModContainer mc, EntityPlayerMP player, int modGuiId, World world, int x, int y, int z) {
   IGuiHandler handler = serverGuiHandlers.get(mc);
   NetworkModHandler nmh = FMLNetworkHandler.instance().findNetworkModHandler(mc);
   if (handler != null && nmh != null) {
     Container container =
         (Container) handler.getServerGuiElement(modGuiId, player, world, x, y, z);
     if (container != null) {
       player.incrementWindowID();
       player.closeInventory();
       int windowId = player.currentWindowId;
       Packet250CustomPayload pkt = new Packet250CustomPayload();
       pkt.channel = "FML";
       pkt.data =
           FMLPacket.makePacket(Type.GUIOPEN, windowId, nmh.getNetworkId(), modGuiId, x, y, z);
       pkt.length = pkt.data.length;
       player.serverForThisPlayer.sendPacketToPlayer(pkt);
       player.craftingInventory = container;
       player.craftingInventory.windowId = windowId;
       player.craftingInventory.addCraftingToCrafters(player);
     }
   }
 }
 @Override
 public void onPlayerRespawn(EntityPlayer player) {
   MinecraftServer server = ModLoader.getMinecraftServerInstance();
   ChunkCoordinates var4 = ((EntityPlayerMP) player).getSpawnChunk();
   if (var4 == null) {
     if (Permissions.rankData.getCompoundTag(Permissions.getRank(player)).hasKey("Spawn")) {
       NBTTagCompound data =
           Permissions.rankData
               .getCompoundTag(Permissions.getRank(player))
               .getCompoundTag("Spawn");
       Double X = data.getDouble("X");
       Double Y = data.getDouble("Y");
       Double Z = data.getDouble("Z");
       Float yaw = data.getFloat("yaw");
       Float pitch = data.getFloat("pitch");
       Integer dim = data.getInteger("Dim");
       if (player.dimension != dim)
         server
             .getConfigurationManager()
             .transferPlayerToDimension(((EntityPlayerMP) player), dim);
       ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(X, Y, Z, yaw, pitch);
       player.sendChatToPlayer("Welcome to " + data.getString("name"));
     } else if (SimpleModsConfiguration.spawnOverride) {
       ChunkCoordinates coords = player.worldObj.getSpawnPoint();
       player.setPosition(coords.posX, coords.posY, coords.posZ);
       while (!server
           .worldServerForDimension(player.dimension)
           .getCollidingBoundingBoxes(player, player.boundingBox)
           .isEmpty()) {
         player.setPosition(player.posX, player.posY + 0.5D, player.posZ);
       }
       ((EntityPlayerMP) player)
           .playerNetServerHandler.setPlayerLocation(coords.posX, coords.posY, coords.posZ, 0, 0);
     }
   }
 }
  public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) {
    if (playerEntity.craftingInventory.windowId == par1Packet102WindowClick.window_Id
        && playerEntity.craftingInventory.isPlayerNotUsingContainer(playerEntity)) {
      ItemStack itemstack =
          playerEntity.craftingInventory.slotClick(
              par1Packet102WindowClick.inventorySlot,
              par1Packet102WindowClick.mouseClick,
              par1Packet102WindowClick.holdingShift,
              playerEntity);

      if (ItemStack.areItemStacksEqual(par1Packet102WindowClick.itemStack, itemstack)) {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet106Transaction(
                par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, true));
        playerEntity.playerInventoryBeingManipulated = true;
        playerEntity.craftingInventory.updateCraftingResults();
        playerEntity.sendInventoryToPlayer();
        playerEntity.playerInventoryBeingManipulated = false;
      } else {
        field_72586_s.addKey(
            playerEntity.craftingInventory.windowId,
            Short.valueOf(par1Packet102WindowClick.action));
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet106Transaction(
                par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, false));
        playerEntity.craftingInventory.setPlayerIsPresent(playerEntity, false);
        ArrayList arraylist = new ArrayList();

        for (int i = 0; i < playerEntity.craftingInventory.inventorySlots.size(); i++) {
          arraylist.add(((Slot) playerEntity.craftingInventory.inventorySlots.get(i)).getStack());
        }

        playerEntity.sendContainerAndContentsToPlayer(playerEntity.craftingInventory, arraylist);
      }
    }
  }
 public NetServerHandler(
     MinecraftServer par1MinecraftServer,
     NetworkManager par2NetworkManager,
     EntityPlayerMP par3EntityPlayerMP) {
   serverShuttingDown = false;
   chatSpamThresholdCount = 0;
   creativeItemCreationSpamThresholdTally = 0;
   field_72587_r = true;
   field_72586_s = new IntHashMap();
   mcServer = par1MinecraftServer;
   theNetworkManager = par2NetworkManager;
   par2NetworkManager.setNetHandler(this);
   playerEntity = par3EntityPlayerMP;
   par3EntityPlayerMP.serverForThisPlayer = this;
 }
  /** addToSendQueue. if it is a chat packet, check before sending it */
  public void sendPacketToPlayer(Packet par1Packet) {
    if (par1Packet instanceof Packet3Chat) {
      Packet3Chat packet3chat = (Packet3Chat) par1Packet;
      int i = playerEntity.getChatVisibility();

      if (i == 2) {
        return;
      }

      if (i == 1 && !packet3chat.func_73475_d()) {
        return;
      }
    }

    theNetworkManager.addToSendQueue(par1Packet);
  }
  public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
    if (p_71515_2_.length < 1) {
      throw new WrongUsageException("commands.tp.usage", new Object[0]);
    } else {
      MinecraftServer var3 = MinecraftServer.func_71276_C();
      EntityPlayerMP var4;
      if (p_71515_2_.length != 2 && p_71515_2_.length != 4) {
        var4 = (EntityPlayerMP) func_71521_c(p_71515_1_);
      } else {
        var4 = var3.func_71203_ab().func_72361_f(p_71515_2_[0]);
        if (var4 == null) {
          throw new PlayerNotFoundException();
        }
      }

      if (p_71515_2_.length != 3 && p_71515_2_.length != 4) {
        if (p_71515_2_.length == 1 || p_71515_2_.length == 2) {
          EntityPlayerMP var10 =
              var3.func_71203_ab().func_72361_f(p_71515_2_[p_71515_2_.length - 1]);
          if (var10 == null) {
            throw new PlayerNotFoundException();
          }

          var4.field_71135_a.func_72569_a(
              var10.field_70165_t,
              var10.field_70163_u,
              var10.field_70161_v,
              var10.field_70177_z,
              var10.field_70125_A);
          func_71522_a(
              p_71515_1_,
              "commands.tp.success",
              new Object[] {var4.func_70023_ak(), var10.func_70023_ak()});
        }
      } else if (var4.field_70170_p != null) {
        int var5 = p_71515_2_.length - 3;
        int var6 = 30000000;
        int var7 = func_71532_a(p_71515_1_, p_71515_2_[var5++], -var6, var6);
        int var8 = func_71532_a(p_71515_1_, p_71515_2_[var5++], 0, 256);
        int var9 = func_71532_a(p_71515_1_, p_71515_2_[var5++], -var6, var6);
        var4.func_70634_a(
            (double) ((float) var7 + 0.5F), (double) var8, (double) ((float) var9 + 0.5F));
        func_71522_a(
            p_71515_1_,
            "commands.tp.coordinates",
            new Object[] {
              var4.func_70023_ak(),
              Integer.valueOf(var7),
              Integer.valueOf(var8),
              Integer.valueOf(var9)
            });
      }
    }
  }
 public void func_72377_c(EntityPlayerMP p_72377_1_) {
   func_72384_a(new Packet201PlayerInfo(p_72377_1_.field_71092_bJ, true, 1000));
   field_72404_b.add(p_72377_1_);
   WorldServer worldserver;
   for (worldserver = field_72400_f.func_71218_a(p_72377_1_.field_71093_bK);
       !worldserver.func_72945_a(p_72377_1_, p_72377_1_.field_70121_D).isEmpty();
       p_72377_1_.func_70107_b(
           p_72377_1_.field_70165_t, p_72377_1_.field_70163_u + 1.0D, p_72377_1_.field_70161_v)) {}
   worldserver.func_72838_d(p_72377_1_);
   func_72375_a(p_72377_1_, null);
   EntityPlayerMP entityplayermp;
   for (Iterator iterator = field_72404_b.iterator();
       iterator.hasNext();
       p_72377_1_.field_71135_a.func_72567_b(
           new Packet201PlayerInfo(
               entityplayermp.field_71092_bJ, true, entityplayermp.field_71138_i))) {
     entityplayermp = (EntityPlayerMP) iterator.next();
   }
 }
 public void kickPlayerFromServer(String par1Str) {
   if (serverShuttingDown) {
     return;
   } else {
     playerEntity.mountEntityAndWakeUp();
     sendPacketToPlayer(new Packet255KickDisconnect(par1Str));
     theNetworkManager.serverShutdown();
     mcServer
         .getConfigurationManager()
         .sendPacketToAllPlayers(
             new Packet3Chat(
                 (new StringBuilder())
                     .append("\247e")
                     .append(playerEntity.username)
                     .append(" left the game.")
                     .toString()));
     mcServer.getConfigurationManager().func_72367_e(playerEntity);
     serverShuttingDown = true;
     return;
   }
 }
Exemple #29
0
  /** returns a new explosion. Does initiation (at time of writing Explosion is not finished) */
  public Explosion newExplosion(
      Entity par1Entity,
      double par2,
      double par4,
      double par6,
      float par8,
      boolean par9,
      boolean par10) {
    Explosion var11 = new Explosion(this, par1Entity, par2, par4, par6, par8);
    var11.isFlaming = par9;
    var11.isSmoking = par10;
    var11.doExplosionA();
    var11.doExplosionB(false);

    if (!par10) {
      var11.affectedBlockPositions.clear();
    }

    Iterator var12 = this.playerEntities.iterator();

    while (var12.hasNext()) {
      EntityPlayer var13 = (EntityPlayer) var12.next();

      if (var13.getDistanceSq(par2, par4, par6) < 4096.0D) {
        ((EntityPlayerMP) var13)
            .playerNetServerHandler.sendPacketToPlayer(
                new Packet60Explosion(
                    par2,
                    par4,
                    par6,
                    par8,
                    var11.affectedBlockPositions,
                    (Vec3) var11.func_77277_b().get(var13)));
      }
    }

    return var11;
  }
  /** Handle a creative slot packet. */
  public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) {
    if (playerEntity.theItemInWorldManager.isCreative()) {
      boolean flag = par1Packet107CreativeSetSlot.slot < 0;
      ItemStack itemstack = par1Packet107CreativeSetSlot.itemStack;
      boolean flag1 =
          par1Packet107CreativeSetSlot.slot >= 1
              && par1Packet107CreativeSetSlot.slot < 36 + InventoryPlayer.func_70451_h();
      boolean flag2 =
          itemstack == null
              || itemstack.itemID < Item.itemsList.length
                  && itemstack.itemID >= 0
                  && Item.itemsList[itemstack.itemID] != null;
      boolean flag3 =
          itemstack == null
              || itemstack.getItemDamage() >= 0
                  && itemstack.getItemDamage() >= 0
                  && itemstack.stackSize <= 64
                  && itemstack.stackSize > 0;

      if (flag1 && flag2 && flag3) {
        if (itemstack == null) {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, null);
        } else {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, itemstack);
        }

        playerEntity.inventorySlots.setPlayerIsPresent(playerEntity, true);
      } else if (flag && flag2 && flag3 && creativeItemCreationSpamThresholdTally < 200) {
        creativeItemCreationSpamThresholdTally += 20;
        EntityItem entityitem = playerEntity.dropPlayerItem(itemstack);

        if (entityitem != null) {
          entityitem.func_70288_d();
        }
      }
    }
  }