Commits

Doc authored and md_5 committed b7a2ed41c0e
SPIGOT-7530, #947: Add Player#removeResourcePack
No tags

src/main/java/org/bukkit/entity/Player.java

Modified
1405 1405 * this request is sent for the very first time from a given server, the
1406 1406 * client will first display a confirmation GUI to the player before
1407 1407 * proceeding with the download.
1408 1408 * <p>
1409 1409 * Notes:
1410 1410 * <ul>
1411 1411 * <li>Players can disable server resources on their client, in which
1412 1412 * case this method will have no affect on them. Use the
1413 1413 * {@link PlayerResourcePackStatusEvent} to figure out whether or not
1414 1414 * the player loaded the pack!
1415 - * <li>There is no concept of resetting resource packs back to default
1416 - * within Minecraft, so players will have to relog to do so or you
1417 - * have to send an empty pack.
1415 + * <li>To remove a resource pack you can use
1416 + * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
1418 1417 * <li>The request is sent with empty string as the hash when the hash is
1419 1418 * not provided. This might result in newer versions not loading the
1420 1419 * pack correctly.
1421 1420 * </ul>
1422 1421 *
1423 1422 * @param url The URL from which the client will download the resource
1424 1423 * pack. The string must contain only US-ASCII characters and should
1425 1424 * be encoded as per RFC 1738.
1426 1425 * @param hash The sha1 hash sum of the resource pack file which is used
1427 1426 * to apply a cached version of the pack directly without downloading
1449 1448 * this request is sent for the very first time from a given server, the
1450 1449 * client will first display a confirmation GUI to the player before
1451 1450 * proceeding with the download.
1452 1451 * <p>
1453 1452 * Notes:
1454 1453 * <ul>
1455 1454 * <li>Players can disable server resources on their client, in which
1456 1455 * case this method will have no affect on them. Use the
1457 1456 * {@link PlayerResourcePackStatusEvent} to figure out whether or not
1458 1457 * the player loaded the pack!
1459 - * <li>There is no concept of resetting resource packs back to default
1460 - * within Minecraft, so players will have to relog to do so or you
1461 - * have to send an empty pack.
1458 + * <li>To remove a resource pack you can use
1459 + * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
1462 1460 * <li>The request is sent with empty string as the hash when the hash is
1463 1461 * not provided. This might result in newer versions not loading the
1464 1462 * pack correctly.
1465 1463 * </ul>
1466 1464 *
1467 1465 * @param url The URL from which the client will download the resource
1468 1466 * pack. The string must contain only US-ASCII characters and should
1469 1467 * be encoded as per RFC 1738.
1470 1468 * @param hash The sha1 hash sum of the resource pack file which is used
1471 1469 * to apply a cached version of the pack directly without downloading
1494 1492 * this request is sent for the very first time from a given server, the
1495 1493 * client will first display a confirmation GUI to the player before
1496 1494 * proceeding with the download.
1497 1495 * <p>
1498 1496 * Notes:
1499 1497 * <ul>
1500 1498 * <li>Players can disable server resources on their client, in which
1501 1499 * case this method will have no affect on them. Use the
1502 1500 * {@link PlayerResourcePackStatusEvent} to figure out whether or not
1503 1501 * the player loaded the pack!
1504 - * <li>There is no concept of resetting resource packs back to default
1505 - * within Minecraft, so players will have to relog to do so or you
1506 - * have to send an empty pack.
1502 + * <li>To remove a resource pack you can use
1503 + * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
1507 1504 * <li>The request is sent with empty string as the hash when the hash is
1508 1505 * not provided. This might result in newer versions not loading the
1509 1506 * pack correctly.
1510 1507 * </ul>
1511 1508 *
1512 1509 * @param url The URL from which the client will download the resource
1513 1510 * pack. The string must contain only US-ASCII characters and should
1514 1511 * be encoded as per RFC 1738.
1515 1512 * @param hash The sha1 hash sum of the resource pack file which is used
1516 1513 * to apply a cached version of the pack directly without downloading
1540 1537 * this request is sent for the very first time from a given server, the
1541 1538 * client will first display a confirmation GUI to the player before
1542 1539 * proceeding with the download.
1543 1540 * <p>
1544 1541 * Notes:
1545 1542 * <ul>
1546 1543 * <li>Players can disable server resources on their client, in which
1547 1544 * case this method will have no affect on them. Use the
1548 1545 * {@link PlayerResourcePackStatusEvent} to figure out whether or not
1549 1546 * the player loaded the pack!
1550 - * <li>There is no concept of resetting resource packs back to default
1551 - * within Minecraft, so players will have to relog to do so or you
1552 - * have to send an empty pack.
1547 + * <li>To remove a resource pack you can use
1548 + * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
1553 1549 * <li>The request is sent with empty string as the hash when the hash is
1554 1550 * not provided. This might result in newer versions not loading the
1555 1551 * pack correctly.
1556 1552 * </ul>
1557 1553 *
1558 1554 * @param id Unique resource pack ID.
1559 1555 * @param url The URL from which the client will download the resource
1560 1556 * pack. The string must contain only US-ASCII characters and should
1561 1557 * be encoded as per RFC 1738.
1562 1558 * @param hash The sha1 hash sum of the resource pack file which is used
1566 1562 * @param force If true, the client will be disconnected from the server
1567 1563 * when it declines to use the resource pack.
1568 1564 * @throws IllegalArgumentException Thrown if the URL is null.
1569 1565 * @throws IllegalArgumentException Thrown if the URL is too long. The
1570 1566 * length restriction is an implementation specific arbitrary value.
1571 1567 * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
1572 1568 * long.
1573 1569 */
1574 1570 public void setResourcePack(@NotNull UUID id, @NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
1575 1571
1572 + /**
1573 + * Request that the player's client remove a resource pack sent by the
1574 + * server.
1575 + *
1576 + * @param id the id of the resource pack.
1577 + * @throws IllegalArgumentException If the ID is null.
1578 + */
1579 + public void removeResourcePack(@NotNull UUID id);
1580 +
1581 + /**
1582 + * Request that the player's client remove all loaded resource pack sent by
1583 + * the server.
1584 + */
1585 + public void removeResourcePacks();
1586 +
1576 1587 /**
1577 1588 * Gets the Scoreboard displayed to this player
1578 1589 *
1579 1590 * @return The current scoreboard seen by this player
1580 1591 */
1581 1592 @NotNull
1582 1593 public Scoreboard getScoreboard();
1583 1594
1584 1595 /**
1585 1596 * Sets the player's visible Scoreboard.

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut