예제 #1
0
 public boolean isOnline() {
   for (Object obj : server.getHandle().field_72404_b) {
     net.minecraft.entity.player.EntityPlayerMP player =
         (net.minecraft.entity.player.EntityPlayerMP) obj;
     if (player.func_70005_c_().equalsIgnoreCase(getName())) {
       return true;
     }
   }
   return false;
 }
예제 #2
0
  public void setPlayerListName(String name) {
    String oldName = getHandle().listName;

    if (name == null) {
      name = getName();
    }

    if (oldName.equals(name)) {
      return;
    }

    if (name.length() > 16) {
      throw new IllegalArgumentException(
          "Player list names can only be a maximum of 16 characters long");
    }

    // Collisions will make for invisible people
    for (int i = 0; i < server.getHandle().field_72404_b.size(); ++i) {
      if (((net.minecraft.entity.player.EntityPlayerMP) server.getHandle().field_72404_b.get(i))
          .listName.equals(name)) {
        throw new IllegalArgumentException(
            name + " is already assigned as a player list name for someone");
      }
    }

    getHandle().listName = name;

    // Change the name on the client side
    net.minecraft.network.packet.Packet201PlayerInfo oldpacket =
        new net.minecraft.network.packet.Packet201PlayerInfo(oldName, false, 9999);
    net.minecraft.network.packet.Packet201PlayerInfo packet =
        new net.minecraft.network.packet.Packet201PlayerInfo(name, true, getHandle().field_71138_i);
    for (int i = 0; i < server.getHandle().field_72404_b.size(); ++i) {
      net.minecraft.entity.player.EntityPlayerMP entityplayer =
          (net.minecraft.entity.player.EntityPlayerMP) server.getHandle().field_72404_b.get(i);
      if (entityplayer.field_71135_a == null) continue;

      if (entityplayer.getBukkitEntity().canSee(this)) {
        entityplayer.field_71135_a.func_72567_b(oldpacket);
        entityplayer.field_71135_a.func_72567_b(packet);
      }
    }
  }
예제 #3
0
  public void readExtraData(net.minecraft.nbt.NBTTagCompound nbttagcompound) {
    hasPlayedBefore = true;
    if (nbttagcompound.func_74764_b("bukkit")) {
      net.minecraft.nbt.NBTTagCompound data = nbttagcompound.func_74775_l("bukkit");

      if (data.func_74764_b("firstPlayed")) {
        firstPlayed = data.func_74763_f("firstPlayed");
        lastPlayed = data.func_74763_f("lastPlayed");
      }

      if (data.func_74764_b("newExp")) {
        net.minecraft.entity.player.EntityPlayerMP handle = getHandle();
        handle.newExp = data.func_74762_e("newExp");
        handle.newTotalExp = data.func_74762_e("newTotalExp");
        handle.newLevel = data.func_74762_e("newLevel");
        handle.expToDrop = data.func_74762_e("expToDrop");
        handle.keepLevel = data.func_74767_n("keepLevel");
      }
    }
  }
예제 #4
0
 public void setWalkSpeed(float value) {
   validateSpeed(value);
   net.minecraft.entity.player.EntityPlayerMP player = getHandle();
   player.field_71075_bZ.field_75097_g = value / 2f;
   player.func_71016_p();
 }