protocolsupportpocketstuff.packet.play.ResourcePackRequestPacket

Here are the examples of the java api protocolsupportpocketstuff.packet.play.ResourcePackRequestPacket taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

17 Source : ResourcePackListener.java
with GNU Affero General Public License v3.0
from ProtocolSupport

@PocketPacketHandler
public void onResourceRequest(ConnectionImpl connection, ResourcePackRequestPacket packet) {
    plugin.debug("Sending part " + packet.getChunkIndex() + " of the " + packet.getPackId() + " res/beh pack");
    ArrayList<ResourcePack> packs = new ArrayList<ResourcePack>();
    packs.addAll(PocketStuffAPI.getResourcePackManager().getBehaviorPacks());
    packs.addAll(PocketStuffAPI.getResourcePackManager().getResourcePacks());
    Optional<ResourcePack> pack = packs.stream().filter(it -> it.getPackId().equals(packet.getPackId())).findFirst();
    if (!pack.isPresent()) {
        plugin.debug("Client requested pack " + packet.getPackId() + ", however I don't have it!");
        PocketCon.sendPocketPacket(connection, new DisconnectPacket(false, ChatColor.RED + "Got a resource pack chunk request for unknown pack with UUID " + packet.getPackId()));
        return;
    }
    PocketCon.sendPocketPacket(connection, new ResourcePackChunkDataPacket(packet.getPackId(), packet.getChunkIndex(), pack.get().getPackChunk(packet.getChunkIndex())));
}