예제 #1
0
파일: Map.java 프로젝트: rossmcnulty/Maplet
  public void render() {
    if (!viewers.isEmpty()) {
      activeMenu.draw(this);

      // Create packets outside of player loop
      List<Packet131ItemData> changed = new ArrayList<Packet131ItemData>();
      for (int column = 0; column < 128; column++) {
        byte[] data = new byte[131];
        data[1] = (byte) column;
        int index = 3;
        for (int i = column; i < pixels.length; i += 128) {
          data[index++] = pixels[i];
        }

        changed.add(new Packet131ItemData((short) 358, id, data));
      }

      // Send all changed columns to viewers
      for (Player player : viewers) {
        for (Packet131ItemData packet : changed) {
          ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
        }
      }
    }
  }
예제 #2
0
 /**
  * Sets a texture on a player, if the server is 1.3 or above
  *
  * @param player Player object
  * @param texture URI to texture
  */
 public static void setTexture(Player player, String texture) {
   if (Storm.wConfigs.get(player.getWorld().getName()).Force__Weather__Textures) {
     ((CraftPlayer) player)
         .getHandle()
         .playerConnection
         .sendPacket(new Packet250CustomPayload("MC|TPack", (texture + "\0" + 16).getBytes()));
   }
 }
예제 #3
0
 public static void playSound(Player to, String sound, Location loc, float volume, float data) {
   if (Storm.wConfigs.get(to.getWorld().getName()).Play__Weather__Sounds)
     ((CraftPlayer) to)
         .getHandle()
         .playerConnection
         .sendPacket(
             new Packet62NamedSoundEffect(
                 sound, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), volume, data));
 }