Added ResourcePack related packets, along with sending and recieving them, and added PlayerResourcePackStatusEvent to simplify reading the incoming packets for plugins.

This commit is contained in:
GamerDuck123
2021-11-15 21:02:12 -05:00
parent d460ca735b
commit 92a4a85b50
11 changed files with 257 additions and 0 deletions
@@ -18,6 +18,7 @@ import com.loohp.limbo.server.packets.PacketPlayOutChat;
import com.loohp.limbo.server.packets.PacketPlayOutGameState;
import com.loohp.limbo.server.packets.PacketPlayOutHeldItemChange;
import com.loohp.limbo.server.packets.PacketPlayOutPositionAndLook;
import com.loohp.limbo.server.packets.PacketPlayOutResourcePackSend;
import com.loohp.limbo.server.packets.PacketPlayOutRespawn;
import com.loohp.limbo.utils.GameMode;
@@ -259,5 +260,17 @@ public class Player extends LivingEntity implements CommandSender {
}
}
}
public void setResourcePack(String url, String hash, boolean forced, BaseComponent[] promptmessage) {
try {
PacketPlayOutResourcePackSend packsend = new PacketPlayOutResourcePackSend(url, hash, forced,
(promptmessage != null || !ComponentSerializer.toString(promptmessage).equalsIgnoreCase("")) ? true : false,
ComponentSerializer.toString(promptmessage));
clientConnection.sendPacket(packsend);
} catch (IOException e) {
e.printStackTrace();
}
}
}