Compare commits
9 commits
master
...
experiment
Author | SHA1 | Date | |
---|---|---|---|
|
216b704363 | ||
|
e41d44fa87 | ||
|
122c9d3843 | ||
|
fe7043e19e | ||
|
43484eb340 | ||
|
af7f0c49f3 | ||
|
3889ffb436 | ||
|
5914f600f4 | ||
|
9e7f6c3f7e |
2757 changed files with 201538 additions and 255653 deletions
|
@ -29,8 +29,6 @@ ij_java_names_count_to_use_import_on_demand = 999999
|
|||
ij_java_imports_layout = *,|,$*
|
||||
ij_java_generate_final_locals = true
|
||||
ij_java_generate_final_parameters = true
|
||||
ij_java_method_parameters_new_line_after_left_paren = true
|
||||
ij_java_method_parameters_right_paren_on_new_line = true
|
||||
|
||||
[test-plugin/**/*.java]
|
||||
ij_java_use_fq_class_names = false
|
||||
|
|
|
@ -44,10 +44,10 @@ body:
|
|||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -5,7 +5,7 @@ contact_links:
|
|||
about: Suggest an idea for Paper
|
||||
- name: PaperMC Discord
|
||||
url: https://discord.gg/papermc
|
||||
about: If you are having issues with spark or have other minor issues, come ask us on our Discord server!
|
||||
about: If you are having issues with timings or have other minor issues, come ask us on our Discord server!
|
||||
- name: Exploit Report
|
||||
url: https://discord.gg/papermc
|
||||
about: |
|
||||
|
|
10
.github/ISSUE_TEMPLATE/performance-problem.yml
vendored
10
.github/ISSUE_TEMPLATE/performance-problem.yml
vendored
|
@ -10,9 +10,9 @@ body:
|
|||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Profile link
|
||||
description: We ask that all profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
|
||||
placeholder: "Example: https://spark.lucko.me/XsN0hxGfsi"
|
||||
label: Timings or Profile link
|
||||
description: We ask that all timings/profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
|
||||
placeholder: "Example: https://timings.aikar.co/?id=6b48586fbbdd48e585ca0ebb07c59dd0"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
@ -56,10 +56,10 @@ body:
|
|||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
|
@ -44,10 +44,10 @@ body:
|
|||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
|
@ -24,12 +24,7 @@ jobs:
|
|||
java: [21]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- if: ${{ github.event_name == 'push' }}
|
||||
uses: actions/checkout@v4
|
||||
- if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: actions/checkout@v4
|
||||
- name: JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
|
|
@ -56,6 +56,7 @@ split into different directories which target certain parts of the code. These
|
|||
directories are:
|
||||
|
||||
- `Paper-API` - Modifications to `Spigot-API`/`Bukkit`;
|
||||
- `Paper-MojangAPI` - An API for [Mojang's Brigadier](https://github.com/Mojang/brigadier);
|
||||
- `Paper-Server` - Modifications to `Spigot`/`CraftBukkit`.
|
||||
|
||||
Because the entire structure is based on patches and git, a basic understanding
|
||||
|
@ -96,9 +97,7 @@ Your commit will be converted into a patch that you can then PR into Paper.
|
|||
|
||||
## Modifying Patches
|
||||
|
||||
Modifying previous patches is a bit more complex.
|
||||
Similar to adding patches, the methods to modify a patch are applied inside
|
||||
the `Paper-Server` and/or `Paper-API` folders.
|
||||
Modifying previous patches is a bit more complex:
|
||||
|
||||
### Method 1
|
||||
|
||||
|
@ -249,17 +248,6 @@ instead of adding a new import to the top of the file. If you are using a type a
|
|||
can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future
|
||||
patch conflicts in the import section of the file.
|
||||
|
||||
### Nullability annotations
|
||||
|
||||
We are in the process of switching nullability annotation libraries, so you might need to use one or the other:
|
||||
|
||||
**For classes we add**: Fields, method parameters and return types that are nullable should be marked via the
|
||||
`@Nullable` annotation from `org.jspecify.annotations`. Whenever you create a new class, add `@NullMarked`, meaning types
|
||||
are assumed to be non-null by default. For less obvious placing such as on generics or arrays, see the [JSpecify docs](https://jspecify.dev/docs/user-guide/).
|
||||
|
||||
**For classes added by upstream**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These
|
||||
will be replaced later.
|
||||
|
||||
```java
|
||||
import org.bukkit.event.Event;
|
||||
// don't add import here, use FQN like below
|
||||
|
|
|
@ -64,5 +64,4 @@ Oliwier Miodun <naczs@blueflow.pl>
|
|||
aerulion <aerulion@gmail.com>
|
||||
Lukas Planz <lukas.planz@web.de>
|
||||
granny <contact@granny.dev>
|
||||
mja00 <me@mja00.dev>
|
||||
```
|
||||
|
|
|
@ -40,7 +40,7 @@ How To (Plugin Developers)
|
|||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
@ -53,7 +53,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
java {
|
||||
|
|
14
SECURITY.md
14
SECURITY.md
|
@ -1,14 +0,0 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We generally only fully support the latest version, the same applies to exploits such as server crashes and item
|
||||
duplication bugs. In the transition period during larger Minecraft updates, we may still backport important fixes to the
|
||||
last minor or major release.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
For any issues that are NOT duplication bugs, server/client crashes, or otherwise serious exploits, please open an issue
|
||||
through the [Issues tab](https://github.com/PaperMC/Paper/issues).
|
||||
For exploits, please [join our Discord](https://discord.gg/papermc) and see the [#paper-exploit-report channel](https://discord.com/channels/289587909051416579/1208749386348101682) for
|
||||
further instructions.
|
|
@ -21,7 +21,7 @@ c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chu
|
|||
|
||||
# See mappings-patch.tiny
|
||||
c net/minecraft/server/level/ChunkMap net/minecraft/server/level/PlayerChunkMap
|
||||
f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager G
|
||||
f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager F
|
||||
|
||||
# The method is made public by Spigot, which then causes accidental overrides
|
||||
c net/minecraft/world/entity/Entity net/minecraft/world/entity/Entity
|
||||
|
|
|
@ -11,7 +11,7 @@ import kotlin.io.path.*
|
|||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("io.papermc.paperweight.core") version "1.7.3"
|
||||
id("io.papermc.paperweight.core") version "1.7.1"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
@ -67,8 +67,8 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
paramMappings("net.fabricmc:yarn:1.21.1+build.3:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
|
||||
paramMappings("net.fabricmc:yarn:1.20.6+build.1:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
group=io.papermc.paper
|
||||
version=1.21.1-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.1
|
||||
version=1.20.6-R0.1-SNAPSHOT
|
||||
mcVersion=1.20.6
|
||||
|
||||
# Set to true while updating Minecraft version
|
||||
updatingMinecraft=false
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
2
gradlew
vendored
2
gradlew
vendored
|
@ -55,7 +55,7 @@
|
|||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
|
|
@ -31,10 +31,12 @@ import org.bukkit.entity.Ocelot;
|
|||
import org.bukkit.entity.Panda;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Phantom;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.PolarBear;
|
||||
import org.bukkit.entity.PufferFish;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Raider;
|
||||
import org.bukkit.entity.Ravager;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.entity.SkeletonHorse;
|
||||
|
@ -44,6 +46,7 @@ import org.bukkit.entity.Spider;
|
|||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.TraderLlama;
|
||||
import org.bukkit.entity.Turtle;
|
||||
import org.bukkit.entity.Vex;
|
||||
import org.bukkit.entity.Vindicator;
|
||||
|
@ -51,7 +54,8 @@ import org.bukkit.entity.WanderingTrader;
|
|||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for Mob Goals.
|
||||
|
@ -66,7 +70,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
|
||||
|
||||
|
@ -326,6 +330,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
|||
|
||||
GoalKey<PolarBear> POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class);
|
||||
|
||||
GoalKey<PolarBear> POLAR_BEAR_PANIC = create("polar_bear_panic", PolarBear.class);
|
||||
|
||||
GoalKey<PufferFish> PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class);
|
||||
|
||||
GoalKey<Rabbit> RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class);
|
||||
|
@ -400,8 +406,6 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
|||
|
||||
GoalKey<Tameable> SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> TAMABLE_ANIMAL_PANIC = create("tamable_animal_panic", Tameable.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_BREED = create("turtle_breed", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_GO_HOME = create("turtle_go_home", Turtle.class);
|
||||
|
@ -432,12 +436,694 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
|||
|
||||
GoalKey<Wolf> WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class);
|
||||
|
||||
GoalKey<Wolf> WOLF_PANIC = create("wolf_panic", Wolf.class);
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK = create("zombie_attack", Zombie.class);
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
||||
|
||||
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
|
||||
final @NonNull Class<T> type) {
|
||||
/**
|
||||
* Removed in 1.20.2
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "1.20.2"
|
||||
)
|
||||
GoalKey<Vindicator> VINDICATOR_MELEE_ATTACK = create("vindicator_melee_attack", Vindicator.class);
|
||||
|
||||
/**
|
||||
* Removed in 1.20.2
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "1.20.2"
|
||||
)
|
||||
GoalKey<Ravager> RAVAGER_MELEE_ATTACK = create("ravager_melee_attack", Ravager.class);
|
||||
|
||||
/**
|
||||
* Removed in 1.20.2
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "1.20.2"
|
||||
)
|
||||
GoalKey<Rabbit> EVIL_RABBIT_ATTACK = create("evil_rabbit_attack", Rabbit.class);
|
||||
|
||||
/**
|
||||
* Removed in 1.16
|
||||
*/
|
||||
@Deprecated(
|
||||
forRemoval = true,
|
||||
since = "1.16"
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PigZombie> ANGER = create("anger", PigZombie.class);
|
||||
|
||||
/**
|
||||
* Removed in 1.16
|
||||
*/
|
||||
@Deprecated(
|
||||
forRemoval = true,
|
||||
since = "1.16"
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PigZombie> ANGER_OTHER = create("anger_other", PigZombie.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Blaze> BLAZE_FIREBALL = create("blaze_fireball", Blaze.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Cat> TEMPT_CHANCE = create("tempt_chance", Cat.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Dolphin> DOLPHIN_PLAY_WITH_ITEMS = create("dolphin_play_with_items", Dolphin.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Drowned> DROWNED_GOTO_BEACH = create("drowned_goto_beach", Drowned.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> DROWNED_GOTO_WATER = create("drowned_goto_water", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Enderman> ENDERMAN_PICKUP_BLOCK = create("enderman_pickup_block", Enderman.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Enderman> ENDERMAN_PLACE_BLOCK = create("enderman_place_block", Enderman.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Enderman> PLAYER_WHO_LOOKED_AT_TARGET = create("player_who_looked_at_target", Enderman.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Evoker> EVOKER_CAST_SPELL = create("evoker_cast_spell", Evoker.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_DEFEND_TRUSTED = create("fox_defend_trusted", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_FACEPLANT = create("fox_faceplant", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_PERCH_AND_SEARCH = create("fox_perch_and_search", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_SLEEP = create("fox_sleep", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_SEEK_SHELTER = create("fox_seek_shelter", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fox> FOX_STALK_PREY = create("fox_stalk_prey", Fox.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Ghast> GHAST_ATTACK_TARGET = create("ghast_attack_target", Ghast.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Ghast> GHAST_IDLE_MOVE = create("ghast_idle_move", Ghast.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Ghast> GHAST_MOVE_TOWARDS_TARGET = create("ghast_move_towards_target", Ghast.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Spellcaster> SPELLCASTER_CAST_SPELL = create("spellcaster_cast_spell", Spellcaster.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<TraderLlama> LLAMATRADER_DEFENDED_WANDERING_TRADER = create("llamatrader_defended_wandering_trader", TraderLlama.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Panda> PANDA_HURT_BY_TARGET = create("panda_hurt_by_target", Panda.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PolarBear> POLARBEAR_ATTACK_PLAYERS = create("polarbear_attack_players", PolarBear.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PolarBear> POLARBEAR_HURT_BY = create("polarbear_hurt_by", PolarBear.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PolarBear> POLARBEAR_MELEE = create("polarbear_melee", PolarBear.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<PolarBear> POLARBEAR_PANIC = create("polarbear_panic", PolarBear.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Rabbit> EAT_CARROTS = create("eat_carrots", Rabbit.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Rabbit> KILLER_RABBIT_MELEE_ATTACK = create("killer_rabbit_melee_attack", Rabbit.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Rabbit> RABBIT_AVOID_TARGET = create("rabbit_avoid_target", Rabbit.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Raider> RAIDER_HOLD_GROUND = create("raider_hold_ground", Raider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Raider> RAIDER_OBTAIN_BANNER = create("raider_obtain_banner", Raider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Shulker> SHULKER_DEFENSE = create("shulker_defense", Shulker.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Shulker> SHULKER_NEAREST = create("shulker_nearest", Shulker.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Silverfish> SILVERFISH_HIDE_IN_BLOCK = create("silverfish_hide_in_block", Silverfish.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Silverfish> SILVERFISH_WAKE_OTHERS = create("silverfish_wake_others", Silverfish.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Slime> SLIME_IDLE = create("slime_idle", Slime.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Slime> SLIME_NEAREST_PLAYER = create("slime_nearest_player", Slime.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Slime> SLIME_RANDOM_JUMP = create("slime_random_jump", Slime.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Spider> SPIDER_MELEE_ATTACK = create("spider_melee_attack", Spider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Spider> SPIDER_NEAREST_ATTACKABLE_TARGET = create("spider_nearest_attackable_target", Spider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Squid> SQUID = create("squid", Squid.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Turtle> TURTLE_GOTO_WATER = create("turtle_goto_water", Turtle.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Turtle> TURTLE_TEMPT = create("turtle_tempt", Turtle.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Vex> VEX_COPY_TARGET_OF_OWNER = create("vex_copy_target_of_owner", Vex.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<WanderingTrader> VILLAGERTRADER_WANDER_TO_POSITION = create("villagertrader_wander_to_position", WanderingTrader.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<RangedEntity> ARROW_ATTACK = create("arrow_attack", RangedEntity.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> AVOID_TARGET = create("avoid_target", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Monster> BOW_SHOOT = create("bow_shoot", Monster.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> BREATH = create("breath", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Cat> CAT_SIT_ON_BED = create("cat_sit_on_bed", Cat.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Monster> CROSSBOW_ATTACK = create("crossbow_attack", Monster.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> DOOR_OPEN = create("door_open", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> EAT_TILE = create("eat_tile", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Fish> FISH_SCHOOL = create("fish_school", Fish.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> FOLLOW_ENTITY = create("follow_entity", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<SkeletonHorse> HORSE_TRAP = create("horse_trap", SkeletonHorse.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> HURT_BY_TARGET = create("hurt_by_target", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Cat> JUMP_ON_BLOCK = create("jump_on_block", Cat.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> LEAP_AT_TARGET = create("leap_at_target", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Llama> LLAMA_FOLLOW = create("llama_follow", Llama.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> MOVE_TOWARDS_TARGET = create("move_towards_target", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> NEAREST_ATTACKABLE_TARGET = create("nearest_attackable_target", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Raider> NEAREST_ATTACKABLE_TARGET_WITCH = create("nearest_attackable_target_witch", Raider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> NEAREST_VILLAGE = create("nearest_village", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Tameable> OWNER_HURT_BY_TARGET = create("owner_hurt_by_target", Tameable.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Tameable> OWNER_HURT_TARGET = create("owner_hurt_target", Tameable.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Parrot> PERCH = create("perch", Parrot.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Raider> RAID = create("raid", Raider.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> RANDOM_FLY = create("random_fly", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> RANDOM_LOOKAROUND = create("random_lookaround", Mob.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> RANDOM_STROLL_LAND = create("random_stroll_land", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> RANDOM_SWIM = create("random_swim", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Tameable> RANDOM_TARGET_NON_TAMED = create("random_target_non_tamed", Tameable.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Tameable> SIT = create("sit", Tameable.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> STROLL_VILLAGE = create("stroll_village", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<AbstractHorse> TAME = create("tame", AbstractHorse.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> WATER = create("water", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Dolphin> WATER_JUMP = create("water_jump", Dolphin.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Creature> STROLL_VILLAGE_GOLEM = create("stroll_village_golem", Creature.class);
|
||||
|
||||
@Deprecated(
|
||||
forRemoval = true
|
||||
)
|
||||
@ApiStatus.ScheduledForRemoval(
|
||||
inVersion = "1.21"
|
||||
)
|
||||
GoalKey<Mob> UNIVERSAL_ANGER_RESET = create("universal_anger_reset", Mob.class);
|
||||
|
||||
private static <T extends Mob> @NotNull GoalKey<T> create(final @NotNull String key,
|
||||
final @NotNull Class<T> type) {
|
||||
return GoalKey.of(type, NamespacedKey.minecraft(key));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,343 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BANNER_PATTERN}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class BannerPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:base}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> BASE = create(key("base"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:border}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> BORDER = create(key("border"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bricks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> BRICKS = create(key("bricks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:circle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> CIRCLE = create(key("circle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:creeper}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> CREEPER = create(key("creeper"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cross}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> CROSS = create(key("cross"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:curly_border}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> CURLY_BORDER = create(key("curly_border"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:diagonal_left}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> DIAGONAL_LEFT = create(key("diagonal_left"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:diagonal_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> DIAGONAL_RIGHT = create(key("diagonal_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:diagonal_up_left}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> DIAGONAL_UP_LEFT = create(key("diagonal_up_left"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:diagonal_up_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> DIAGONAL_UP_RIGHT = create(key("diagonal_up_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> FLOW = create(key("flow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flower}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> FLOWER = create(key("flower"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:globe}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> GLOBE = create(key("globe"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:gradient}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> GRADIENT = create(key("gradient"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:gradient_up}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> GRADIENT_UP = create(key("gradient_up"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:guster}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> GUSTER = create(key("guster"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:half_horizontal}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> HALF_HORIZONTAL = create(key("half_horizontal"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:half_horizontal_bottom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> HALF_HORIZONTAL_BOTTOM = create(key("half_horizontal_bottom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:half_vertical}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> HALF_VERTICAL = create(key("half_vertical"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:half_vertical_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> HALF_VERTICAL_RIGHT = create(key("half_vertical_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mojang}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> MOJANG = create(key("mojang"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:piglin}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> PIGLIN = create(key("piglin"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:rhombus}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> RHOMBUS = create(key("rhombus"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:skull}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SKULL = create(key("skull"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:small_stripes}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SMALL_STRIPES = create(key("small_stripes"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:square_bottom_left}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SQUARE_BOTTOM_LEFT = create(key("square_bottom_left"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:square_bottom_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SQUARE_BOTTOM_RIGHT = create(key("square_bottom_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:square_top_left}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SQUARE_TOP_LEFT = create(key("square_top_left"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:square_top_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> SQUARE_TOP_RIGHT = create(key("square_top_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:straight_cross}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRAIGHT_CROSS = create(key("straight_cross"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_bottom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_BOTTOM = create(key("stripe_bottom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_center}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_CENTER = create(key("stripe_center"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_downleft}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_DOWNLEFT = create(key("stripe_downleft"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_downright}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_DOWNRIGHT = create(key("stripe_downright"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_left}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_LEFT = create(key("stripe_left"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_middle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_MIDDLE = create(key("stripe_middle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_right}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_RIGHT = create(key("stripe_right"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stripe_top}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> STRIPE_TOP = create(key("stripe_top"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:triangle_bottom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> TRIANGLE_BOTTOM = create(key("triangle_bottom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:triangle_top}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> TRIANGLE_TOP = create(key("triangle_top"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:triangles_bottom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> TRIANGLES_BOTTOM = create(key("triangles_bottom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:triangles_top}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PatternType> TRIANGLES_TOP = create(key("triangles_top"));
|
||||
|
||||
private BannerPatternKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link PatternType} in the registry {@code minecraft:banner_pattern}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<PatternType> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BIOME}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class BiomeKeys {
|
||||
/**
|
||||
|
@ -478,13 +478,13 @@ public final class BiomeKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
|
||||
* Creates a key for {@link Biome} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Biome> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<Biome> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.BIOME, key);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,112 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#CAT_VARIANT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class CatVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:all_black}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> ALL_BLACK = create(key("all_black"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:black}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> BLACK = create(key("black"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:british_shorthair}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> BRITISH_SHORTHAIR = create(key("british_shorthair"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:calico}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> CALICO = create(key("calico"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jellie}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> JELLIE = create(key("jellie"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:persian}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> PERSIAN = create(key("persian"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ragdoll}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> RAGDOLL = create(key("ragdoll"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:red}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> RED = create(key("red"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:siamese}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> SIAMESE = create(key("siamese"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:tabby}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> TABBY = create(key("tabby"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:white}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Cat.Type> WHITE = create(key("white"));
|
||||
|
||||
private CatVariantKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Cat.Type> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.CAT_VARIANT, key);
|
||||
}
|
||||
}
|
|
@ -6,9 +6,10 @@ import io.papermc.paper.generated.GeneratedFrom;
|
|||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
|
||||
|
@ -23,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class DamageTypeKeys {
|
||||
/**
|
||||
|
@ -47,13 +48,6 @@ public final class DamageTypeKeys {
|
|||
*/
|
||||
public static final TypedKey<DamageType> CACTUS = create(key("cactus"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:campfire}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> CAMPFIRE = create(key("campfire"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cramming}
|
||||
*
|
||||
|
@ -339,6 +333,8 @@ public final class DamageTypeKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<DamageType> WIND_CHARGE = create(key("wind_charge"));
|
||||
|
||||
/**
|
||||
|
@ -359,13 +355,13 @@ public final class DamageTypeKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
|
||||
* Creates a key for {@link DamageType} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<DamageType> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@ import io.papermc.paper.generated.GeneratedFrom;
|
|||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
|
@ -23,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentKeys {
|
||||
/**
|
||||
|
@ -59,6 +60,8 @@ public final class EnchantmentKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<Enchantment> BREACH = create(key("breach"));
|
||||
|
||||
/**
|
||||
|
@ -73,6 +76,8 @@ public final class EnchantmentKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<Enchantment> DENSITY = create(key("density"));
|
||||
|
||||
/**
|
||||
|
@ -318,12 +323,14 @@ public final class EnchantmentKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<Enchantment> WIND_BURST = create(key("wind_burst"));
|
||||
|
||||
private EnchantmentKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) {
|
||||
private static @NotNull TypedKey<Enchantment> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#FROG_VARIANT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class FrogVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:cold}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Frog.Variant> COLD = create(key("cold"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:temperate}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Frog.Variant> TEMPERATE = create(key("temperate"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:warm}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Frog.Variant> WARM = create(key("warm"));
|
||||
|
||||
private FrogVariantKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Frog.Variant> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.FROG_VARIANT, key);
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class GameEventKeys {
|
||||
/**
|
||||
|
@ -449,7 +449,7 @@ public final class GameEventKeys {
|
|||
private GameEventKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) {
|
||||
private static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.GAME_EVENT, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class InstrumentKeys {
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ public final class InstrumentKeys {
|
|||
private InstrumentKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) {
|
||||
private static @NotNull TypedKey<MusicInstrument> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.INSTRUMENT, key);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,175 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.JukeboxSong;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#JUKEBOX_SONG}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class JukeboxSongKeys {
|
||||
/**
|
||||
* {@code minecraft:11}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> ELEVEN = create(key("11"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:13}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> THIRTEEN = create(key("13"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:5}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> FIVE = create(key("5"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:blocks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> BLOCKS = create(key("blocks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cat}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> CAT = create(key("cat"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:chirp}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> CHIRP = create(key("chirp"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:creator}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> CREATOR = create(key("creator"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:creator_music_box}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> CREATOR_MUSIC_BOX = create(key("creator_music_box"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:far}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> FAR = create(key("far"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mall}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> MALL = create(key("mall"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mellohi}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> MELLOHI = create(key("mellohi"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:otherside}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> OTHERSIDE = create(key("otherside"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:pigstep}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> PIGSTEP = create(key("pigstep"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:precipice}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> PRECIPICE = create(key("precipice"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:relic}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> RELIC = create(key("relic"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stal}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> STAL = create(key("stal"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:strad}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> STRAD = create(key("strad"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wait}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> WAIT = create(key("wait"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ward}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<JukeboxSong> WARD = create(key("ward"));
|
||||
|
||||
private JukeboxSongKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link JukeboxSong} in the registry {@code minecraft:jukebox_song}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<JukeboxSong> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
|
||||
}
|
||||
}
|
|
@ -1,280 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#MAP_DECORATION_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class MapDecorationTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:banner_black}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_BLACK = create(key("banner_black"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_blue}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_BLUE = create(key("banner_blue"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_brown}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_BROWN = create(key("banner_brown"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_cyan}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_CYAN = create(key("banner_cyan"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_gray}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_GRAY = create(key("banner_gray"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_green}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_GREEN = create(key("banner_green"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_light_blue}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_LIGHT_BLUE = create(key("banner_light_blue"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_light_gray}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_LIGHT_GRAY = create(key("banner_light_gray"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_lime}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_LIME = create(key("banner_lime"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_magenta}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_MAGENTA = create(key("banner_magenta"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_orange}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_ORANGE = create(key("banner_orange"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_pink}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_PINK = create(key("banner_pink"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_purple}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_PURPLE = create(key("banner_purple"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_red}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_RED = create(key("banner_red"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_white}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_WHITE = create(key("banner_white"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:banner_yellow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BANNER_YELLOW = create(key("banner_yellow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:blue_marker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> BLUE_MARKER = create(key("blue_marker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:frame}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> FRAME = create(key("frame"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jungle_temple}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> JUNGLE_TEMPLE = create(key("jungle_temple"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mansion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> MANSION = create(key("mansion"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:monument}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> MONUMENT = create(key("monument"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:player}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> PLAYER = create(key("player"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:player_off_limits}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> PLAYER_OFF_LIMITS = create(key("player_off_limits"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:player_off_map}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> PLAYER_OFF_MAP = create(key("player_off_map"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:red_marker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> RED_MARKER = create(key("red_marker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:red_x}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> RED_X = create(key("red_x"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swamp_hut}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> SWAMP_HUT = create(key("swamp_hut"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:target_point}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> TARGET_POINT = create(key("target_point"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:target_x}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> TARGET_X = create(key("target_x"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trial_chambers}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> TRIAL_CHAMBERS = create(key("trial_chambers"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_desert}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> VILLAGE_DESERT = create(key("village_desert"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> VILLAGE_PLAINS = create(key("village_plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_savanna}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> VILLAGE_SAVANNA = create(key("village_savanna"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_snowy}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> VILLAGE_SNOWY = create(key("village_snowy"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MapCursor.Type> VILLAGE_TAIGA = create(key("village_taiga"));
|
||||
|
||||
private MapDecorationTypeKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<MapCursor.Type> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.MAP_DECORATION_TYPE, key);
|
||||
}
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#MENU}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class MenuTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:anvil}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> ANVIL = create(key("anvil"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:beacon}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> BEACON = create(key("beacon"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:blast_furnace}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> BLAST_FURNACE = create(key("blast_furnace"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:brewing_stand}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> BREWING_STAND = create(key("brewing_stand"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cartography_table}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> CARTOGRAPHY_TABLE = create(key("cartography_table"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:crafter_3x3}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> CRAFTER_3X3 = create(key("crafter_3x3"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:crafting}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> CRAFTING = create(key("crafting"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:enchantment}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> ENCHANTMENT = create(key("enchantment"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:furnace}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> FURNACE = create(key("furnace"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_3x3}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_3X3 = create(key("generic_3x3"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x1}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X1 = create(key("generic_9x1"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x2}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X2 = create(key("generic_9x2"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x3}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X3 = create(key("generic_9x3"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x4}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X4 = create(key("generic_9x4"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x5}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X5 = create(key("generic_9x5"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_9x6}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GENERIC_9X6 = create(key("generic_9x6"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:grindstone}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> GRINDSTONE = create(key("grindstone"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hopper}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> HOPPER = create(key("hopper"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lectern}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> LECTERN = create(key("lectern"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:loom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> LOOM = create(key("loom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:merchant}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> MERCHANT = create(key("merchant"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shulker_box}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> SHULKER_BOX = create(key("shulker_box"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:smithing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> SMITHING = create(key("smithing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:smoker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> SMOKER = create(key("smoker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stonecutter}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MenuType> STONECUTTER = create(key("stonecutter"));
|
||||
|
||||
private MenuTypeKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<MenuType> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.MENU, key);
|
||||
}
|
||||
}
|
|
@ -6,9 +6,10 @@ import io.papermc.paper.generated.GeneratedFrom;
|
|||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
|
||||
|
@ -23,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class MobEffectKeys {
|
||||
/**
|
||||
|
@ -115,6 +116,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> INFESTED = create(key("infested"));
|
||||
|
||||
/**
|
||||
|
@ -185,6 +188,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> OOZING = create(key("oozing"));
|
||||
|
||||
/**
|
||||
|
@ -199,6 +204,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> RAID_OMEN = create(key("raid_omen"));
|
||||
|
||||
/**
|
||||
|
@ -255,6 +262,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> TRIAL_OMEN = create(key("trial_omen"));
|
||||
|
||||
/**
|
||||
|
@ -283,6 +292,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> WEAVING = create(key("weaving"));
|
||||
|
||||
/**
|
||||
|
@ -290,6 +301,8 @@ public final class MobEffectKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged"));
|
||||
|
||||
/**
|
||||
|
@ -302,7 +315,7 @@ public final class MobEffectKeys {
|
|||
private MobEffectKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) {
|
||||
private static @NotNull TypedKey<PotionEffectType> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.MOB_EFFECT, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@ import io.papermc.paper.generated.GeneratedFrom;
|
|||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
|
||||
|
@ -23,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureKeys {
|
||||
/**
|
||||
|
@ -227,6 +228,8 @@ public final class StructureKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<Structure> TRIAL_CHAMBERS = create(key("trial_chambers"));
|
||||
|
||||
/**
|
||||
|
@ -268,13 +271,13 @@ public final class StructureKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
|
||||
* Creates a key for {@link Structure} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Structure> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<Structure> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureTypeKeys {
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ public final class StructureTypeKeys {
|
|||
private StructureTypeKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) {
|
||||
private static @NotNull TypedKey<StructureType> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimMaterialKeys {
|
||||
/**
|
||||
|
@ -100,13 +100,13 @@ public final class TrimMaterialKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
|
||||
* Creates a key for {@link TrimMaterial} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<TrimMaterial> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@ import io.papermc.paper.generated.GeneratedFrom;
|
|||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
|
||||
|
@ -23,7 +24,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimPatternKeys {
|
||||
/**
|
||||
|
@ -31,6 +32,8 @@ public final class TrimPatternKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<TrimPattern> BOLT = create(key("bolt"));
|
||||
|
||||
/**
|
||||
|
@ -59,6 +62,8 @@ public final class TrimPatternKeys {
|
|||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
|
||||
public static final TypedKey<TrimPattern> FLOW = create(key("flow"));
|
||||
|
||||
/**
|
||||
|
@ -156,13 +161,13 @@ public final class TrimPatternKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
|
||||
* Creates a key for {@link TrimPattern} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<TrimPattern> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#VILLAGER_PROFESSION}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class VillagerProfessionKeys {
|
||||
/**
|
||||
* {@code minecraft:armorer}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> ARMORER = create(key("armorer"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:butcher}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> BUTCHER = create(key("butcher"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cartographer}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> CARTOGRAPHER = create(key("cartographer"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cleric}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> CLERIC = create(key("cleric"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:farmer}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> FARMER = create(key("farmer"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fisherman}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> FISHERMAN = create(key("fisherman"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fletcher}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> FLETCHER = create(key("fletcher"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:leatherworker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> LEATHERWORKER = create(key("leatherworker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:librarian}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> LIBRARIAN = create(key("librarian"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mason}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> MASON = create(key("mason"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:nitwit}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> NITWIT = create(key("nitwit"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:none}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> NONE = create(key("none"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shepherd}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> SHEPHERD = create(key("shepherd"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:toolsmith}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> TOOLSMITH = create(key("toolsmith"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:weaponsmith}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Profession> WEAPONSMITH = create(key("weaponsmith"));
|
||||
|
||||
private VillagerProfessionKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Villager.Profession> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.VILLAGER_PROFESSION, key);
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#VILLAGER_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class VillagerTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:desert}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> DESERT = create(key("desert"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jungle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> JUNGLE = create(key("jungle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> PLAINS = create(key("plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:savanna}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> SAVANNA = create(key("savanna"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> SNOW = create(key("snow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swamp}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> SWAMP = create(key("swamp"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Villager.Type> TAIGA = create(key("taiga"));
|
||||
|
||||
private VillagerTypeKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Villager.Type> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.VILLAGER_TYPE, key);
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
|
|||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class WolfVariantKeys {
|
||||
/**
|
||||
|
@ -93,13 +93,13 @@ public final class WolfVariantKeys {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
|
||||
* Creates a key for {@link Wolf.Variant} in a registry.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) {
|
||||
public static @NotNull TypedKey<Wolf.Variant> create(final @NotNull Key key) {
|
||||
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,323 +0,0 @@
|
|||
package io.papermc.paper.registry.keys.tags;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentTagKeys {
|
||||
/**
|
||||
* {@code #minecraft:curse}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> CURSE = create(key("curse"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:double_trade_price}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/armor}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/boots}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/bow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/crossbow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/mining}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/riptide}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:in_enchanting_table}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:non_treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_mob_spawn_equipment}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_random_loot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_traded_equipment}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_bee_spawns_when_mining}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_decorated_pot_shattering}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_ice_melting}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_infested_spawns}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:smelts_loot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:tooltip_order}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:tradeable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/desert_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/desert_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/jungle_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_JUNGLE_COMMON = create(key("trades/jungle_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/jungle_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/plains_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/plains_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/savanna_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/savanna_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/snow_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/snow_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/swamp_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/swamp_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/taiga_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/taiga_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
|
||||
|
||||
private EnchantmentTagKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
|
||||
*
|
||||
* @param key the tag key's key
|
||||
* @return a new tag key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) {
|
||||
return TagKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,6 @@
|
|||
package io.papermc.generator;
|
||||
|
||||
import io.papermc.generator.types.GeneratedKeyType;
|
||||
import io.papermc.generator.types.GeneratedTagKeyType;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.types.goal.MobGoalGenerator;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
|
@ -9,65 +8,35 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.bukkit.JukeboxSong;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.BlockType;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public interface Generators {
|
||||
|
||||
SourceGenerator[] API = {
|
||||
// built-ins
|
||||
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false),
|
||||
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
|
||||
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
|
||||
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
|
||||
simpleKey("BlockTypeKeys", BlockType.class, Registries.BLOCK, RegistryKey.BLOCK, false),
|
||||
simpleKey("ItemTypeKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM, false),
|
||||
simpleKey("CatVariantKeys", Cat.Type.class, Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, false),
|
||||
simpleKey("FrogVariantKeys", Frog.Variant.class, Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, false),
|
||||
simpleKey("VillagerProfessionKeys", Villager.Profession.class, Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, false),
|
||||
simpleKey("VillagerTypeKeys", Villager.Type.class, Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, false),
|
||||
simpleKey("MapDecorationTypeKeys", MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, false),
|
||||
simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false),
|
||||
|
||||
// data-driven
|
||||
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
|
||||
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
|
||||
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
|
||||
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
|
||||
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
|
||||
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
|
||||
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
|
||||
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
|
||||
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
|
||||
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
|
||||
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
|
||||
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
|
||||
simpleKey("JukeboxSongKeys", JukeboxSong.class, Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, true),
|
||||
simpleKey("BannerPatternKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, true),
|
||||
|
||||
// tags
|
||||
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
|
||||
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
|
||||
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
|
||||
};
|
||||
|
||||
private static <T, A> SourceGenerator simpleKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
|
||||
return new GeneratedKeyType<>(className, apiType, "io.papermc.paper.registry.keys", registryKey, apiRegistryKey, publicCreateKeyMethod);
|
||||
}
|
||||
|
||||
private static <T, A> SourceGenerator simpleTagKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey) {
|
||||
return new GeneratedTagKeyType<>(className, apiType, "io.papermc.paper.registry.keys.tags", registryKey, apiRegistryKey, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,22 @@
|
|||
package io.papermc.generator;
|
||||
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.utils.TagCollector;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.LayeredRegistryAccess;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.RegistryDataLoader;
|
||||
import net.minecraft.server.Bootstrap;
|
||||
import net.minecraft.server.RegistryLayer;
|
||||
import net.minecraft.server.ReloadableServerResources;
|
||||
import net.minecraft.server.WorldLoader;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import org.apache.commons.io.file.PathUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -31,7 +24,6 @@ public final class Main {
|
|||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
|
||||
public static final Map<TagKey<?>, String> EXPERIMENTAL_TAGS;
|
||||
|
||||
static {
|
||||
SharedConstants.tryDetectVersion();
|
||||
|
@ -44,10 +36,6 @@ public final class Main {
|
|||
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
||||
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||
REGISTRY_ACCESS = layers.compositeAccess().freeze();
|
||||
final ReloadableServerResources datapack = ReloadableServerResources.loadResources(resourceManager, layers, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
|
||||
datapack.updateRegistryTags();
|
||||
|
||||
EXPERIMENTAL_TAGS = TagCollector.grabExperimental(resourceManager);
|
||||
}
|
||||
|
||||
private Main() {
|
||||
|
|
|
@ -28,9 +28,12 @@ import net.minecraft.core.Holder;
|
|||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistrySetBuilder;
|
||||
import net.minecraft.data.registries.UpdateOneTwentyOneRegistries;
|
||||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.flag.FeatureElement;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
@ -51,7 +54,8 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
|
||||
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
|
||||
|
||||
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
|
||||
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = UpdateOneTwentyOneRegistries.BUILDER.entries.stream()
|
||||
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
|
||||
|
||||
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
|
||||
static {
|
||||
|
@ -70,7 +74,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
}
|
||||
|
||||
private static final String CREATE_JAVADOC = """
|
||||
Creates a key for {@link $T} in the registry {@code $L}.
|
||||
Creates a key for {@link $T} in a registry.
|
||||
|
||||
@param key the value's key in the registry
|
||||
@return a new typed key
|
||||
|
@ -100,7 +104,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
.returns(returnType.annotated(NOT_NULL));
|
||||
if (this.publicCreateKeyMethod) {
|
||||
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType);
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
@ -135,15 +139,15 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
.initializer("$N(key($S))", createMethod.build(), keyPath)
|
||||
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
|
||||
if (experimental.contains(key)) {
|
||||
fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21));
|
||||
} else {
|
||||
allExperimental = false;
|
||||
}
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
}
|
||||
if (allExperimental) {
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21));
|
||||
createMethod.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.UPDATE_1_21));
|
||||
} else {
|
||||
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||
}
|
||||
|
@ -160,7 +164,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
|
||||
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
|
||||
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> {
|
||||
return false; // Update for Experimental API
|
||||
return ((FeatureElement) v).requiredFeatures().contains(FeatureFlags.UPDATE_1_21);
|
||||
});
|
||||
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
|
||||
}
|
||||
|
@ -188,6 +192,8 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
|||
@Override
|
||||
protected JavaFile.Builder file(final JavaFile.Builder builder) {
|
||||
return builder
|
||||
.addStaticImport(Key.class, "key");
|
||||
.skipJavaLangImports(true)
|
||||
.addStaticImport(Key.class, "key")
|
||||
.indent(" ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
package io.papermc.generator.types;
|
||||
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import io.papermc.generator.Main;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
|
||||
import static com.squareup.javapoet.TypeSpec.classBuilder;
|
||||
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
|
||||
import static io.papermc.generator.utils.Annotations.NOT_NULL;
|
||||
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static javax.lang.model.element.Modifier.FINAL;
|
||||
import static javax.lang.model.element.Modifier.PRIVATE;
|
||||
import static javax.lang.model.element.Modifier.PUBLIC;
|
||||
import static javax.lang.model.element.Modifier.STATIC;
|
||||
|
||||
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
|
||||
|
||||
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
|
||||
static {
|
||||
final Map<RegistryKey<?>, String> map = new HashMap<>();
|
||||
try {
|
||||
for (final Field field : RegistryKey.class.getFields()) {
|
||||
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
|
||||
continue;
|
||||
}
|
||||
map.put((RegistryKey<?>) field.get(null), field.getName());
|
||||
}
|
||||
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
|
||||
} catch (final ReflectiveOperationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String CREATE_JAVADOC = """
|
||||
Creates a tag key for {@link $T} in the registry {@code $L}.
|
||||
|
||||
@param key the tag key's key
|
||||
@return a new tag key
|
||||
""";
|
||||
|
||||
private final Class<A> apiType;
|
||||
private final ResourceKey<? extends Registry<T>> registryKey;
|
||||
private final RegistryKey<A> apiRegistryKey;
|
||||
private final boolean publicCreateKeyMethod;
|
||||
|
||||
public GeneratedTagKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
|
||||
super(keysClassName, pkg);
|
||||
this.apiType = apiType;
|
||||
this.registryKey = registryKey;
|
||||
this.apiRegistryKey = apiRegistryKey;
|
||||
this.publicCreateKeyMethod = publicCreateKeyMethod;
|
||||
}
|
||||
|
||||
private MethodSpec.Builder createMethod(final TypeName returnType) {
|
||||
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
|
||||
|
||||
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
|
||||
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
|
||||
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
|
||||
.addParameter(keyParam)
|
||||
.addCode("return $T.create($T.$L, $N);", TagKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
|
||||
.returns(returnType.annotated(NOT_NULL));
|
||||
if (this.publicCreateKeyMethod) {
|
||||
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
private TypeSpec.Builder keyHolderType() {
|
||||
return classBuilder(this.className)
|
||||
.addModifiers(PUBLIC, FINAL)
|
||||
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
|
||||
.addAnnotations(Annotations.CLASS_HEADER)
|
||||
.addMethod(MethodSpec.constructorBuilder()
|
||||
.addModifiers(PRIVATE)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeSpec getTypeSpec() {
|
||||
final TypeName tagKey = ParameterizedTypeName.get(TagKey.class, this.apiType);
|
||||
|
||||
final TypeSpec.Builder typeBuilder = this.keyHolderType();
|
||||
final MethodSpec.Builder createMethod = this.createMethod(tagKey);
|
||||
|
||||
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
|
||||
|
||||
final AtomicBoolean allExperimental = new AtomicBoolean(true);
|
||||
registry.getTagNames().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
|
||||
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
|
||||
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
|
||||
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), "#" + nmsTagKey.location());
|
||||
if (Main.EXPERIMENTAL_TAGS.containsKey(nmsTagKey)) {
|
||||
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.TRADE_REBALANCE)); // Update for Experimental API
|
||||
} else {
|
||||
allExperimental.set(false);
|
||||
}
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
});
|
||||
if (allExperimental.get()) {
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
} else {
|
||||
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||
}
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaFile.Builder file(final JavaFile.Builder builder) {
|
||||
return builder
|
||||
.addStaticImport(Key.class, "key");
|
||||
}
|
||||
}
|
|
@ -71,6 +71,95 @@ public class MobGoalGenerator extends SimpleGenerator {
|
|||
|
||||
private static final String CLASS_HEADER = Javadocs.getVersionDependentClassHeader("Mob Goals");
|
||||
|
||||
private static final DeprecatedEntry[] DEPRECATED_ENTRIES = {
|
||||
//<editor-fold defaultstate="collapsed" desc="legacy entries">
|
||||
new DeprecatedEntry(Vindicator.class, "vindicator_melee_attack", null, "1.20.2"),
|
||||
new DeprecatedEntry(Ravager.class, "ravager_melee_attack", null, "1.20.2"),
|
||||
new DeprecatedEntry(Rabbit.class, "evil_rabbit_attack", null, "1.20.2"),
|
||||
new DeprecatedEntry(PigZombie.class, "anger", "1.21", "1.16"),
|
||||
new DeprecatedEntry(PigZombie.class, "anger_other", "1.21", "1.16"),
|
||||
new DeprecatedEntry(Blaze.class, "blaze_fireball", "1.21", null),
|
||||
new DeprecatedEntry(Cat.class, "tempt_chance", "1.21", null),
|
||||
new DeprecatedEntry(Dolphin.class, "dolphin_play_with_items", "1.21", null),
|
||||
new DeprecatedEntry(Drowned.class, "drowned_goto_beach", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "drowned_goto_water", "1.21", null),
|
||||
new DeprecatedEntry(Enderman.class, "enderman_pickup_block", "1.21", null),
|
||||
new DeprecatedEntry(Enderman.class, "enderman_place_block", "1.21", null),
|
||||
new DeprecatedEntry(Enderman.class, "player_who_looked_at_target", "1.21", null),
|
||||
new DeprecatedEntry(Evoker.class, "evoker_cast_spell", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_defend_trusted", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_faceplant", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_perch_and_search", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_sleep", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_seek_shelter", "1.21", null),
|
||||
new DeprecatedEntry(Fox.class, "fox_stalk_prey", "1.21", null),
|
||||
new DeprecatedEntry(Ghast.class, "ghast_attack_target", "1.21", null),
|
||||
new DeprecatedEntry(Ghast.class, "ghast_idle_move", "1.21", null),
|
||||
new DeprecatedEntry(Ghast.class, "ghast_move_towards_target", "1.21", null),
|
||||
new DeprecatedEntry(Spellcaster.class, "spellcaster_cast_spell", "1.21", null),
|
||||
new DeprecatedEntry(TraderLlama.class, "llamatrader_defended_wandering_trader", "1.21", null),
|
||||
new DeprecatedEntry(Panda.class, "panda_hurt_by_target", "1.21", null),
|
||||
new DeprecatedEntry(PolarBear.class, "polarbear_attack_players", "1.21", null),
|
||||
new DeprecatedEntry(PolarBear.class, "polarbear_hurt_by", "1.21", null),
|
||||
new DeprecatedEntry(PolarBear.class, "polarbear_melee", "1.21", null),
|
||||
new DeprecatedEntry(PolarBear.class, "polarbear_panic", "1.21", null),
|
||||
new DeprecatedEntry(Rabbit.class, "eat_carrots", "1.21", null),
|
||||
new DeprecatedEntry(Rabbit.class, "killer_rabbit_melee_attack", "1.21", null),
|
||||
new DeprecatedEntry(Rabbit.class, "rabbit_avoid_target", "1.21", null),
|
||||
new DeprecatedEntry(Raider.class, "raider_hold_ground", "1.21", null),
|
||||
new DeprecatedEntry(Raider.class, "raider_obtain_banner", "1.21", null),
|
||||
new DeprecatedEntry(Shulker.class, "shulker_defense", "1.21", null),
|
||||
new DeprecatedEntry(Shulker.class, "shulker_nearest", "1.21", null),
|
||||
new DeprecatedEntry(Silverfish.class, "silverfish_hide_in_block", "1.21", null),
|
||||
new DeprecatedEntry(Silverfish.class, "silverfish_wake_others", "1.21", null),
|
||||
new DeprecatedEntry(Slime.class, "slime_idle", "1.21", null),
|
||||
new DeprecatedEntry(Slime.class, "slime_nearest_player", "1.21", null),
|
||||
new DeprecatedEntry(Slime.class, "slime_random_jump", "1.21", null),
|
||||
new DeprecatedEntry(Spider.class, "spider_melee_attack", "1.21", null),
|
||||
new DeprecatedEntry(Spider.class, "spider_nearest_attackable_target", "1.21", null),
|
||||
new DeprecatedEntry(Squid.class, "squid", "1.21", null),
|
||||
new DeprecatedEntry(Turtle.class, "turtle_goto_water", "1.21", null),
|
||||
new DeprecatedEntry(Turtle.class, "turtle_tempt", "1.21", null),
|
||||
new DeprecatedEntry(Vex.class, "vex_copy_target_of_owner", "1.21", null),
|
||||
new DeprecatedEntry(WanderingTrader.class, "villagertrader_wander_to_position", "1.21", null),
|
||||
new DeprecatedEntry(RangedEntity.class, "arrow_attack", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "avoid_target", "1.21", null),
|
||||
new DeprecatedEntry(Monster.class, "bow_shoot", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "breath", "1.21", null),
|
||||
new DeprecatedEntry(Cat.class, "cat_sit_on_bed", "1.21", null),
|
||||
new DeprecatedEntry(Monster.class, "crossbow_attack", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "door_open", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "eat_tile", "1.21", null),
|
||||
new DeprecatedEntry(Fish.class, "fish_school", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "follow_entity", "1.21", null),
|
||||
new DeprecatedEntry(SkeletonHorse.class, "horse_trap", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "hurt_by_target", "1.21", null),
|
||||
new DeprecatedEntry(Cat.class, "jump_on_block", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "leap_at_target", "1.21", null),
|
||||
new DeprecatedEntry(Llama.class, "llama_follow", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "move_towards_target", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "nearest_attackable_target", "1.21", null),
|
||||
new DeprecatedEntry(Raider.class, "nearest_attackable_target_witch", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "nearest_village", "1.21", null),
|
||||
new DeprecatedEntry(Tameable.class, "owner_hurt_by_target", "1.21", null),
|
||||
new DeprecatedEntry(Tameable.class, "owner_hurt_target", "1.21", null),
|
||||
new DeprecatedEntry(Parrot.class, "perch", "1.21", null),
|
||||
new DeprecatedEntry(Raider.class, "raid", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "random_fly", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "random_lookaround", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "random_stroll_land", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "random_swim", "1.21", null),
|
||||
new DeprecatedEntry(Tameable.class, "random_target_non_tamed", "1.21", null),
|
||||
new DeprecatedEntry(Tameable.class, "sit", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "stroll_village", "1.21", null),
|
||||
new DeprecatedEntry(AbstractHorse.class, "tame", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "water", "1.21", null),
|
||||
new DeprecatedEntry(Dolphin.class, "water_jump", "1.21", null),
|
||||
new DeprecatedEntry(Creature.class, "stroll_village_golem", "1.21", null),
|
||||
new DeprecatedEntry(Mob.class, "universal_anger_reset", "1.21", null)
|
||||
//</editor-fold>
|
||||
};
|
||||
|
||||
public MobGoalGenerator(final String keysClassName, final String pkg) {
|
||||
super(keysClassName, pkg);
|
||||
}
|
||||
|
@ -127,12 +216,33 @@ public class MobGoalGenerator extends SimpleGenerator {
|
|||
typeBuilder.addField(fieldBuilder.build());
|
||||
}
|
||||
|
||||
for (final DeprecatedEntry value : DEPRECATED_ENTRIES) {
|
||||
TypeName typedKey = ParameterizedTypeName.get(GoalKey.class, value.entity);
|
||||
NamespacedKey key = NamespacedKey.minecraft(value.entryName);
|
||||
|
||||
String keyPath = key.getKey();
|
||||
String fieldName = Formatting.formatKeyAsField(keyPath);
|
||||
FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||
.addAnnotation(Annotations.deprecatedVersioned(value.removedVersion, value.removalVersion != null))
|
||||
.initializer("$N($S, $T.class)", createMethod.build(), keyPath, value.entity);
|
||||
|
||||
if (value.removedVersion != null) {
|
||||
fieldBuilder.addJavadoc("Removed in $L", value.removedVersion);
|
||||
}
|
||||
if (value.removalVersion != null) {
|
||||
fieldBuilder.addAnnotation(Annotations.scheduledRemoval(value.removalVersion));
|
||||
}
|
||||
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
}
|
||||
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaFile.Builder file(JavaFile.Builder builder) {
|
||||
return builder;
|
||||
return builder
|
||||
.skipJavaLangImports(true);
|
||||
}
|
||||
|
||||
record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion,
|
||||
|
|
|
@ -1,35 +1,30 @@
|
|||
package io.papermc.generator.utils;
|
||||
|
||||
import com.squareup.javapoet.AnnotationSpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class Annotations {
|
||||
|
||||
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
|
||||
final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
|
||||
annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
|
||||
if (requiredFeatureFlag != null) {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
|
||||
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.Requires requiredFeatureFlag) {
|
||||
return List.of(
|
||||
AnnotationSpec.builder(ApiStatus.Experimental.class).build(),
|
||||
AnnotationSpec.builder(MinecraftExperimental.class)
|
||||
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name())
|
||||
.build());
|
||||
} else {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
|
||||
}
|
||||
return annotationSpecs;
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
|
||||
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
|
||||
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, boolean forRemoval) {
|
||||
AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
|
||||
if (forRemoval) {
|
||||
annotationSpec.addMember("forRemoval", "$L", true);
|
||||
annotationSpec.addMember("forRemoval", "$L", forRemoval);
|
||||
}
|
||||
if (version != null) {
|
||||
annotationSpec.addMember("since", "$S", version);
|
||||
|
@ -46,7 +41,7 @@ public final class Annotations {
|
|||
|
||||
@ApiStatus.Experimental
|
||||
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
|
||||
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NonNull.class).build();
|
||||
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NotNull.class).build();
|
||||
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
|
||||
.addMember("value", "$S", "unused")
|
||||
.addMember("value", "$S", "SpellCheckingInspection")
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.papermc.generator.utils;
|
|||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import io.papermc.generator.Main;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package io.papermc.generator.utils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
|
@ -13,22 +11,8 @@ public final class Formatting {
|
|||
|
||||
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
|
||||
|
||||
private static final Map<String, String> MANUAL_OVERRIDES = Map.of(
|
||||
"5", "five",
|
||||
"11", "eleven",
|
||||
"13", "thirteen"
|
||||
);
|
||||
public static String formatKeyAsField(String path) {
|
||||
return ILLEGAL_FIELD_CHARACTERS.matcher(MANUAL_OVERRIDES.getOrDefault(path, path).toUpperCase(Locale.ROOT)).replaceAll("_");
|
||||
}
|
||||
|
||||
public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
|
||||
int tagsIndex = resourcePath.indexOf(tagDir);
|
||||
int dotIndex = resourcePath.lastIndexOf('.');
|
||||
if (tagsIndex == -1 || dotIndex == -1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
|
||||
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
|
||||
}
|
||||
|
||||
public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
package io.papermc.generator.utils;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.papermc.generator.Main;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.packs.PackResources;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.repository.BuiltInPackSource;
|
||||
import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// collect all the tags by grabbing the json from the data-packs
|
||||
// another (probably) way is to hook into the data generator like the typed keys generator
|
||||
public final class TagCollector {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public static Map<TagKey<?>, String> grabExperimental(final MultiPackResourceManager resourceManager) {
|
||||
Map<TagKey<?>, String> result = new IdentityHashMap<>();
|
||||
|
||||
// collect all vanilla tags
|
||||
Multimap<ResourceKey<? extends Registry<?>>, String> vanillaTags = HashMultimap.create();
|
||||
PackResources vanillaPack = resourceManager.listPacks()
|
||||
.filter(packResources -> packResources.packId().equals(BuiltInPackSource.VANILLA_ID))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
collectFromPack(vanillaPack, (entry, path) -> vanillaTags.put(entry.key(), path));
|
||||
|
||||
// then distinct with other data-pack tags to know for sure newly created tags and so experimental one
|
||||
resourceManager.listPacks().forEach(pack -> {
|
||||
String packId = pack.packId();
|
||||
if (packId.equals(BuiltInPackSource.VANILLA_ID)) return;
|
||||
|
||||
collectFromPack(pack, (entry, path) -> {
|
||||
if (vanillaTags.get(entry.key()).contains(path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
result.put(entry.value().getTagNames()
|
||||
.filter(tagKey -> tagKey.location().getPath().equals(path))
|
||||
.findFirst()
|
||||
.orElseThrow(), packId);
|
||||
});
|
||||
});
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
|
||||
private static void collectFromPack(PackResources pack, BiConsumer<RegistryAccess.RegistryEntry<?>, String> output) {
|
||||
Set<String> namespaces = pack.getNamespaces(PackType.SERVER_DATA);
|
||||
|
||||
for (String namespace : namespaces) {
|
||||
Main.REGISTRY_ACCESS.registries().forEach(entry -> {
|
||||
// this is probably expensive but can't find another way around and data-pack loader has similar logic
|
||||
// the issue is that registry key can have parent/key (and custom folder too) but tag key can also have parent/key so parsing become a mess
|
||||
// without having at least one of the two values
|
||||
String tagDir = Registries.tagsDirPath(entry.key());
|
||||
pack.listResources(PackType.SERVER_DATA, namespace, tagDir, (id, supplier) -> {
|
||||
Formatting.formatTagKey(tagDir, id.getPath()).ifPresentOrElse(path -> output.accept(entry, path), () -> {
|
||||
LOGGER.warn("Unable to parse the path: {}/{}/{}.json in the data-pack {} into a tag key", namespace, tagDir, id.getPath(), pack.packId());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private TagCollector() {
|
||||
}
|
||||
}
|
|
@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..6271e2bad0ed937c2c46a8c8fdf186c4
|
|||
+}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
deleted file mode 100644
|
||||
index 2c5ac393cffbe61330c5aa95115e7e906c0775d3..0000000000000000000000000000000000000000
|
||||
index bea9ac450de7ec05f9752d253743e95d79c1cd14..0000000000000000000000000000000000000000
|
||||
--- a/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,267 +0,0 @@
|
||||
|
@ -135,7 +135,7 @@ index 2c5ac393cffbe61330c5aa95115e7e906c0775d3..00000000000000000000000000000000
|
|||
-
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
- <version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
- <version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
- <packaging>jar</packaging>
|
||||
-
|
||||
- <name>Spigot-API</name>
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Build system changes
|
|||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..78aadebda145fe83327ceb430c4b38f9a8e45a2b 100644
|
||||
index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..a918fd14c95e714e935758d60bccd72755e00b11 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -18,15 +18,27 @@ dependencies {
|
||||
@@ -18,15 +18,26 @@ dependencies {
|
||||
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
|
||||
api("org.yaml:snakeyaml:2.2")
|
||||
api("org.joml:joml:1.10.5")
|
||||
|
@ -32,12 +32,11 @@ index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..78aadebda145fe83327ceb430c4b38f9
|
|||
+ compileOnlyApi(checkerQual)
|
||||
+ testCompileOnly(checkerQual)
|
||||
+ // Paper end
|
||||
+ api("org.jspecify:jspecify:1.0.0") // Paper - add jspecify
|
||||
+
|
||||
testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
@@ -69,8 +81,13 @@ tasks.withType<Javadoc> {
|
||||
@@ -69,8 +80,12 @@ tasks.withType<Javadoc> {
|
||||
options.links(
|
||||
"https://guava.dev/releases/32.1.2-jre/api/docs/",
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||
|
@ -47,12 +46,11 @@ index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..78aadebda145fe83327ceb430c4b38f9
|
|||
+ // Paper start - add missing javadoc links
|
||||
+ "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
||||
+ "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
||||
+ "https://jspecify.dev/docs/api/",
|
||||
+ // Paper end
|
||||
)
|
||||
options.tags("apiNote:a:API Note:")
|
||||
|
||||
@@ -89,3 +106,14 @@ tasks.withType<Javadoc> {
|
||||
@@ -89,3 +104,14 @@ tasks.withType<Javadoc> {
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
|
|||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 78aadebda145fe83327ceb430c4b38f9a8e45a2b..8c7a5be5193ae397ec324d78566edce90608ed57 100644
|
||||
index a918fd14c95e714e935758d60bccd72755e00b11..768024b2b4584fd7dd86f068c0e79c89ffc5faa1 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -107,6 +107,12 @@ tasks.test {
|
||||
@@ -105,6 +105,12 @@ tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa7ecefe86 100644
|
||||
index 64e7aef6220097edefdff3b98a771b988365930d..a899f63eb2ce58b3cf708e91819cbbdeffda5d9f 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -29,7 +29,13 @@ public class AnnotationTest {
|
||||
|
@ -103,19 +103,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
};
|
||||
|
||||
@Test
|
||||
@@ -61,20 +77,60 @@ public class AnnotationTest {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ // Paper start - skip class if it's @NullMarked
|
||||
+ if (isClassNullMarked(clazz)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - skip class if it's @NullMarked
|
||||
+
|
||||
for (MethodNode method : clazz.methods) {
|
||||
if (!isMethodIncluded(clazz, method, foundClasses)) {
|
||||
continue;
|
||||
@@ -67,14 +83,40 @@ public class AnnotationTest {
|
||||
}
|
||||
|
||||
if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) {
|
||||
|
@ -144,16 +132,8 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
if (mustBeAnnotated(paramTypes[i]) ^ isWellAnnotated(method.invisibleParameterAnnotations == null ? null : method.invisibleParameterAnnotations[i])) {
|
||||
+ // Paper start
|
||||
+ if (method.invisibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ continue dancing;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (method.visibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.visibleTypeAnnotations) {
|
||||
+ if (method.invisibleTypeAnnotations != null || method.visibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : java.util.Objects.requireNonNullElse(method.invisibleTypeAnnotations, method.visibleTypeAnnotations)) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ continue dancing;
|
||||
|
@ -164,7 +144,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
ParameterNode paramNode = parameters == null ? null : parameters.get(i);
|
||||
String paramName = paramNode == null ? null : paramNode.name;
|
||||
|
||||
@@ -91,13 +147,18 @@ public class AnnotationTest {
|
||||
@@ -91,13 +133,18 @@ public class AnnotationTest {
|
||||
|
||||
Collections.sort(errors);
|
||||
|
||||
|
@ -187,20 +167,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
||||
@@ -125,6 +186,12 @@ public class AnnotationTest {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - skip class if it's @NullMarked
|
||||
+ private static boolean isClassNullMarked(@NotNull ClassNode clazz) {
|
||||
+ return clazz.visibleAnnotations != null && clazz.visibleAnnotations.stream().anyMatch(node -> "Lorg/jspecify/annotations/NullMarked;".equals(node.desc));
|
||||
+ }
|
||||
+ // Paper end - skip class if it's @NullMarked
|
||||
+
|
||||
private static boolean isClassIncluded(@NotNull ClassNode clazz, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic or deprecated classes and annotations, since their members can't be null
|
||||
if ((clazz.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED | Opcodes.ACC_ANNOTATION)) != 0) {
|
||||
@@ -140,6 +207,11 @@ public class AnnotationTest {
|
||||
@@ -140,6 +187,11 @@ public class AnnotationTest {
|
||||
// Exceptions are excluded
|
||||
return false;
|
||||
}
|
||||
|
@ -212,7 +179,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
|
||||
for (String excludedClass : EXCLUDED_CLASSES) {
|
||||
if (excludedClass.equals(clazz.name)) {
|
||||
@@ -152,7 +224,7 @@ public class AnnotationTest {
|
||||
@@ -152,7 +204,7 @@ public class AnnotationTest {
|
||||
|
||||
private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic and deprecated methods
|
||||
|
@ -221,7 +188,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa
|
|||
return false;
|
||||
}
|
||||
|
||||
@@ -170,11 +242,30 @@ public class AnnotationTest {
|
||||
@@ -170,11 +222,30 @@ public class AnnotationTest {
|
||||
if ("<init>".equals(method.name) && isAnonymous(clazz)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ Currently includes generated key holder classes for types
|
|||
used in the Registry Modification API
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 8c7a5be5193ae397ec324d78566edce90608ed57..877ea06c0ea8c8c0c73d23fbb996f6692c100d98 100644
|
||||
index 768024b2b4584fd7dd86f068c0e79c89ffc5faa1..f11a22ab01e97e51619c96f2d8a78a99297efc59 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -1,6 +1,7 @@
|
||||
|
@ -18,7 +18,7 @@ index 8c7a5be5193ae397ec324d78566edce90608ed57..877ea06c0ea8c8c0c73d23fbb996f669
|
|||
}
|
||||
|
||||
java {
|
||||
@@ -46,6 +47,22 @@ dependencies {
|
||||
@@ -45,6 +46,22 @@ dependencies {
|
||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ index 8c7a5be5193ae397ec324d78566edce90608ed57..877ea06c0ea8c8c0c73d23fbb996f669
|
|||
configure<PublishingExtension> {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
@@ -123,3 +140,14 @@ tasks.check {
|
||||
@@ -121,3 +138,14 @@ tasks.check {
|
||||
dependsOn(scanJar)
|
||||
}
|
||||
// Paper end
|
||||
|
@ -85,17 +85,16 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96f150c49a
|
||||
index 0000000000000000000000000000000000000000..7b79bf33074355020e0b3b5ef40c7f2e6ba644b4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||
@@ -0,0 +1,179 @@
|
||||
@@ -0,0 +1,141 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.bukkit.Art;
|
||||
+import org.bukkit.Fluid;
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.MusicInstrument;
|
||||
+import org.bukkit.Particle;
|
||||
+import org.bukkit.Sound;
|
||||
|
@ -114,14 +113,12 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+import org.bukkit.generator.structure.Structure;
|
||||
+import org.bukkit.generator.structure.StructureType;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.bukkit.inventory.MenuType;
|
||||
+import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
+import org.bukkit.map.MapCursor;
|
||||
+import org.bukkit.potion.PotionEffectType;
|
||||
+import org.bukkit.potion.PotionType;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+import static io.papermc.paper.registry.RegistryKeyImpl.create;
|
||||
+
|
||||
|
@ -138,7 +135,6 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+ * @param <T> the value type
|
||||
+ */
|
||||
+@SuppressWarnings("unused")
|
||||
+@NullMarked
|
||||
+public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
+
|
||||
+ /* ******************* *
|
||||
|
@ -160,6 +156,11 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+ */
|
||||
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
|
||||
+ /**
|
||||
+ * Built-in registry for enchantments.
|
||||
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
|
||||
+ */
|
||||
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
|
||||
+ /**
|
||||
+ * Built-in registry for potion effect types (mob effects).
|
||||
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
|
||||
+ */
|
||||
|
@ -174,36 +175,6 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+ */
|
||||
+ @ApiStatus.Internal
|
||||
+ RegistryKey<ItemType> ITEM = create("item");
|
||||
+ /**
|
||||
+ * Built-in registry for cat variants.
|
||||
+ * @see io.papermc.paper.registry.keys.CatVariantKeys
|
||||
+ */
|
||||
+ RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
|
||||
+ /**
|
||||
+ * Built-in registry for frog variants.
|
||||
+ * @see io.papermc.paper.registry.keys.FrogVariantKeys
|
||||
+ */
|
||||
+ RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
|
||||
+ /**
|
||||
+ * Built-in registry for villager professions.
|
||||
+ * @see io.papermc.paper.registry.keys.VillagerProfessionKeys
|
||||
+ */
|
||||
+ RegistryKey<Villager.Profession> VILLAGER_PROFESSION = create("villager_profession");
|
||||
+ /**
|
||||
+ * Built-in registry for villager types.
|
||||
+ * @see io.papermc.paper.registry.keys.VillagerTypeKeys
|
||||
+ */
|
||||
+ RegistryKey<Villager.Type> VILLAGER_TYPE = create("villager_type");
|
||||
+ /**
|
||||
+ * Built-in registry for map decoration types.
|
||||
+ * @see io.papermc.paper.registry.keys.MapDecorationTypeKeys
|
||||
+ */
|
||||
+ RegistryKey<MapCursor.Type> MAP_DECORATION_TYPE = create("map_decoration_type");
|
||||
+ /**
|
||||
+ * Built-in registry for menu types.
|
||||
+ * @see io.papermc.paper.registry.keys.MenuTypeKeys
|
||||
+ */
|
||||
+ RegistryKey<MenuType> MENU = create("menu");
|
||||
+
|
||||
+
|
||||
+ /* ********************** *
|
||||
|
@ -235,25 +206,10 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+ */
|
||||
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
|
||||
+ /**
|
||||
+ * Data-driven registry for wolf variants.
|
||||
+ * Data-driven registry for wolf variants
|
||||
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
|
||||
+ */
|
||||
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
||||
+ /**
|
||||
+ * Data-driven registry for enchantments.
|
||||
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
|
||||
+ */
|
||||
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
|
||||
+ /**
|
||||
+ * Data-driven registry for jukebox songs.
|
||||
+ * @see io.papermc.paper.registry.keys.JukeboxSongKeys
|
||||
+ */
|
||||
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
|
||||
+ /**
|
||||
+ * Data-driven registry for banner patterns.
|
||||
+ * @see io.papermc.paper.registry.keys.BannerPatternKeys
|
||||
+ */
|
||||
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
|
||||
+
|
||||
+
|
||||
+ /* ******************* *
|
||||
|
@ -261,30 +217,34 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96
|
|||
+ * ******************* */
|
||||
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
|
||||
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
|
||||
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
|
||||
+ RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
|
||||
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
|
||||
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
|
||||
+ RegistryKey<PotionType> POTION = create("potion");
|
||||
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
|
||||
+ RegistryKey<Villager.Profession> VILLAGER_PROFESSION = create("villager_profession");
|
||||
+ RegistryKey<Villager.Type> VILLAGER_TYPE = create("villager_type");
|
||||
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
|
||||
+ RegistryKey<Fluid> FLUID = create("fluid");
|
||||
+ RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
|
||||
+ RegistryKey<MapCursor.Type> MAP_DECORATION_TYPE = create("map_decoration_type");
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..80e3e64f47ac55a4978c9e5b430e2f2d1c871d1b
|
||||
index 0000000000000000000000000000000000000000..791813220b2504214b1adecc69093cd600fb0f8c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||
@@ -0,0 +1,26 @@
|
||||
@@ -0,0 +1,24 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import com.google.common.collect.Sets;
|
||||
+import java.util.Set;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import org.intellij.lang.annotations.Subst;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@NullMarked
|
||||
+record RegistryKeyImpl<T>(Key key) implements RegistryKey<T> {
|
||||
+record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
|
||||
+
|
||||
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
|
||||
+
|
||||
|
@ -302,16 +262,16 @@ index 0000000000000000000000000000000000000000..80e3e64f47ac55a4978c9e5b430e2f2d
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188c43d148f
|
||||
index 0000000000000000000000000000000000000000..6f5a062ba7ee7173468ecea3c1855a233bf3855e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -0,0 +1,44 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a key for a value in a specific registry.
|
||||
|
@ -319,7 +279,6 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
|
|||
+ * @param <T> the value type for the registry
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
|
||||
+
|
||||
+ /**
|
||||
|
@ -328,7 +287,7 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
|
|||
+ * @return the value's key
|
||||
+ */
|
||||
+ @Override
|
||||
+ Key key();
|
||||
+ @NotNull Key key();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the registry key for the value this key
|
||||
|
@ -336,7 +295,7 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
|
|||
+ *
|
||||
+ * @return the registry key
|
||||
+ */
|
||||
+ RegistryKey<T> registryKey();
|
||||
+ @NotNull RegistryKey<T> registryKey();
|
||||
+
|
||||
+ /**
|
||||
+ * Create a typed key from a key and a registry key.
|
||||
|
@ -347,32 +306,33 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
|
|||
+ * @return a new key for the value key and registry key
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
+ static <T> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
|
||||
+ return new TypedKeyImpl<>(key, registryKey);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..99375deaa6b90b33cd6a77e0df651236d304874e
|
||||
index 0000000000000000000000000000000000000000..1a97b3359c4ece5c29131da7c3f208aaa8fab66e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||
@@ -0,0 +1,8 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@NullMarked
|
||||
+record TypedKeyImpl<T>(Key key, RegistryKey<T> registryKey) implements TypedKey<T> {
|
||||
+record TypedKeyImpl<T>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
index a86b87e4c3332202e40e484c3f9c6562b419c70f..305532968f9f7dd497c77259ed147ea2f081bc74 100644
|
||||
index b6f4810e387c22c4a70609ea1d605130245689a5..03824ae54e1bdb8b14f79b3c5e0294ae725e43f8 100644
|
||||
--- a/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
+++ b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
@@ -47,5 +47,6 @@ public @interface MinecraftExperimental {
|
||||
@@ -47,6 +47,6 @@ public @interface MinecraftExperimental {
|
||||
@ApiStatus.Internal
|
||||
public enum Requires {
|
||||
|
||||
+ BUNDLE, TRADE_REBALANCE // Paper
|
||||
- UPDATE_1_21
|
||||
+ UPDATE_1_21, BUNDLE, TRADE_REBALANCE // Paper
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,25 +6,22 @@ Subject: [PATCH] Paper Utils
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fbcd82b513b4cb9839f9d2b38d9c6c73148e30a6
|
||||
index 0000000000000000000000000000000000000000..9db0056ab94145819628b3ad8d8d26130d117fcf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
|
||||
@@ -0,0 +1,19 @@
|
||||
@@ -0,0 +1,16 @@
|
||||
+package com.destroystokyo.paper.util;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public final class SneakyThrow {
|
||||
+public class SneakyThrow {
|
||||
+
|
||||
+ public static void sneaky(final Throwable exception) {
|
||||
+ SneakyThrow.throwSneaky(exception);
|
||||
+ public static void sneaky(@NotNull Throwable exception) {
|
||||
+ SneakyThrow.<RuntimeException>throwSneaky(exception);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ private static <T extends Throwable> void throwSneaky(final Throwable exception) throws T {
|
||||
+ private static <T extends Throwable> void throwSneaky(@NotNull Throwable exception) throws T {
|
||||
+ throw (T) exception;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors.
|
|||
Uses method handles for private or static methods.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 74f0e2b812c1e2e922b136fefe505fc8cbe33e83..1f627e81622e77b81b1228a467fbb9e6fd979e7a 100644
|
||||
index 106d4d5756dc579c446699106f52462085ea9a52..d6252c1ff21c92bf0d232d5bfdf828d1d2ce38c0 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -47,6 +47,9 @@ dependencies {
|
||||
|
@ -21,138 +21,127 @@ index 74f0e2b812c1e2e922b136fefe505fc8cbe33e83..1f627e81622e77b81b1228a467fbb9e6
|
|||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5a702481d28d90cb503faad0d9b9c3231bbff940
|
||||
index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656bedd9a994
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public class MethodHandleEventExecutor implements EventExecutor {
|
||||
+
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public MethodHandleEventExecutor(final Class<? extends Event> eventClass, final MethodHandle handle) {
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ this.handle = handle;
|
||||
+ }
|
||||
+
|
||||
+ public MethodHandleEventExecutor(final Class<? extends Event> eventClass, final Method m) {
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (final IllegalAccessException e) {
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(final Listener listener, final Event event) throws EventException {
|
||||
+ if (!this.eventClass.isInstance(event)) return;
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ this.handle.invoke(listener, event);
|
||||
+ } catch (final Throwable t) {
|
||||
+ handle.invoke(listener, event);
|
||||
+ } catch (Throwable t) {
|
||||
+ SneakyThrow.sneaky(t);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bbdb5b472df116b71c459bdc6cc4b74267ea0f5e
|
||||
index 0000000000000000000000000000000000000000..827f2b27f70a7ec0bc11d039305c3e58c02a4ef4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,44 @@
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public class StaticMethodHandleEventExecutor implements EventExecutor {
|
||||
+
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public StaticMethodHandleEventExecutor(final Class<? extends Event> eventClass, final Method m) {
|
||||
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
|
||||
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (final IllegalAccessException e) {
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(final Listener listener, final Event event) throws EventException {
|
||||
+ if (!this.eventClass.isInstance(event)) return;
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ this.handle.invoke(event);
|
||||
+ } catch (final Throwable throwable) {
|
||||
+ handle.invoke(event);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ SneakyThrow.sneaky(throwable);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..abfcb6e8383ff311940d82afe4ff990649a082dc
|
||||
index 0000000000000000000000000000000000000000..084c31af1a7ba32bb4c3dc8f16f67fd09ce0b6a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
@@ -0,0 +1,59 @@
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.objectweb.asm.ClassWriter;
|
||||
+import org.objectweb.asm.Type;
|
||||
+import org.objectweb.asm.commons.GeneratorAdapter;
|
||||
+
|
||||
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
+import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
|
||||
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
+import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
|
||||
+import static org.objectweb.asm.Opcodes.V1_8;
|
||||
+import static org.objectweb.asm.Opcodes.*;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public final class ASMEventExecutorGenerator {
|
||||
+public class ASMEventExecutorGenerator {
|
||||
+
|
||||
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
|
||||
+
|
||||
+ public static byte[] generateEventExecutor(final Method m, final String name) {
|
||||
+ final ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[]{Type.getInternalName(EventExecutor.class)});
|
||||
+ @NotNull
|
||||
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
|
||||
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
|
||||
+ // Generate constructor
|
||||
+ GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
|
||||
+ methodGenerator.loadThis();
|
||||
|
@ -180,25 +169,22 @@ index 0000000000000000000000000000000000000000..abfcb6e8383ff311940d82afe4ff9906
|
|||
+ }
|
||||
+
|
||||
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static String generateName() {
|
||||
+ final int id = NEXT_ID.getAndIncrement();
|
||||
+ int id = NEXT_ID.getAndIncrement();
|
||||
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..581561fbd32c81ab1774ba8f0b7f3cec9392d99a
|
||||
index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7a4389dc4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
@@ -0,0 +1,35 @@
|
||||
@@ -0,0 +1,34 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public interface ClassDefiner {
|
||||
+
|
||||
+ /**
|
||||
|
@ -206,7 +192,7 @@ index 0000000000000000000000000000000000000000..581561fbd32c81ab1774ba8f0b7f3cec
|
|||
+ *
|
||||
+ * @return if classes bypass access checks
|
||||
+ */
|
||||
+ default boolean isBypassAccessChecks() {
|
||||
+ public default boolean isBypassAccessChecks() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
@ -220,79 +206,79 @@ index 0000000000000000000000000000000000000000..581561fbd32c81ab1774ba8f0b7f3cec
|
|||
+ * @throws ClassFormatError if the class data is invalid
|
||||
+ * @throws NullPointerException if any of the arguments are null
|
||||
+ */
|
||||
+ Class<?> defineClass(ClassLoader parentLoader, String name, byte[] data);
|
||||
+ @NotNull
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
|
||||
+
|
||||
+ static ClassDefiner getInstance() {
|
||||
+ @NotNull
|
||||
+ public static ClassDefiner getInstance() {
|
||||
+ return SafeClassDefiner.INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..48bcc72293c2a31b6e2dd2dcd6a79d618c72a137
|
||||
index 0000000000000000000000000000000000000000..abcc966d8ee01d73c1d1480237ab46fa0ab55fdc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
@@ -0,0 +1,66 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import com.google.common.collect.MapMaker;
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import com.google.common.collect.MapMaker;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class SafeClassDefiner implements ClassDefiner {
|
||||
+
|
||||
+ /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
|
||||
+
|
||||
+ private SafeClassDefiner() {
|
||||
+ }
|
||||
+ private SafeClassDefiner() {}
|
||||
+
|
||||
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Class<?> defineClass(final ClassLoader parentLoader, final String name, final byte[] data) {
|
||||
+ final GeneratedClassLoader loader = this.loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
|
||||
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
|
||||
+ synchronized (loader.getClassLoadingLock(name)) {
|
||||
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
|
||||
+ final Class<?> c = loader.define(name, data);
|
||||
+ Class<?> c = loader.define(name, data);
|
||||
+ assert c.getName().equals(name);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class GeneratedClassLoader extends ClassLoader {
|
||||
+
|
||||
+ static {
|
||||
+ ClassLoader.registerAsParallelCapable();
|
||||
+ }
|
||||
+
|
||||
+ protected GeneratedClassLoader(final ClassLoader parent) {
|
||||
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
|
||||
+ super(parent);
|
||||
+ }
|
||||
+
|
||||
+ private Class<?> define(final String name, final byte[] data) {
|
||||
+ synchronized (this.getClassLoadingLock(name)) {
|
||||
+ assert !this.hasClass(name);
|
||||
+ final Class<?> c = this.defineClass(name, data, 0, data.length);
|
||||
+ this.resolveClass(c);
|
||||
+ private Class<?> define(@NotNull String name, byte[] data) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ assert !hasClass(name);
|
||||
+ Class<?> c = defineClass(name, data, 0, data.length);
|
||||
+ resolveClass(c);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Object getClassLoadingLock(final String name) {
|
||||
+ @NotNull
|
||||
+ public Object getClassLoadingLock(@NotNull String name) {
|
||||
+ return super.getClassLoadingLock(name);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasClass(final String name) {
|
||||
+ synchronized (this.getClassLoadingLock(name)) {
|
||||
+ public boolean hasClass(@NotNull String name) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ try {
|
||||
+ Class.forName(name);
|
||||
+ return true;
|
||||
+ } catch (final ClassNotFoundException e) {
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
|
|||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 1f627e81622e77b81b1228a467fbb9e6fd979e7a..3c50362de25617d878ef58f14f67c240005ff624 100644
|
||||
index a0c6f2c36fa4c16787616a79b5d996523c274fe0..effad8017bff46e2651af01f1789cb8dd08a49d5 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -52,7 +52,7 @@ dependencies {
|
||||
|
@ -17,7 +17,7 @@ index 1f627e81622e77b81b1228a467fbb9e6fd979e7a..3c50362de25617d878ef58f14f67c240
|
|||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
|
||||
@@ -141,6 +141,7 @@ tasks.withType<Javadoc> {
|
||||
@@ -138,6 +138,7 @@ tasks.withType<Javadoc> {
|
||||
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
|
||||
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
|
||||
// Paper end
|
||||
|
@ -27,26 +27,26 @@ index 1f627e81622e77b81b1228a467fbb9e6fd979e7a..3c50362de25617d878ef58f14f67c240
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/PermissionManager.java b/src/main/java/io/papermc/paper/plugin/PermissionManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1dac94e481
|
||||
index 0000000000000000000000000000000000000000..cdbc93b317b3bab47bf6552c29cfbb2c27846933
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/PermissionManager.java
|
||||
@@ -0,0 +1,166 @@
|
||||
@@ -0,0 +1,171 @@
|
||||
+package io.papermc.paper.plugin;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.permissions.Permissible;
|
||||
+import org.bukkit.permissions.Permission;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+/**
|
||||
+ * A permission manager implementation to keep backwards compatibility partially alive with existing plugins that used
|
||||
+ * the bukkit one before.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface PermissionManager {
|
||||
+
|
||||
+ /**
|
||||
|
@ -55,7 +55,8 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param name Name of the permission
|
||||
+ * @return Permission, or null if none
|
||||
+ */
|
||||
+ @Nullable Permission getPermission(String name);
|
||||
+ @Nullable
|
||||
+ Permission getPermission(@NotNull String name);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a {@link Permission} to this plugin manager.
|
||||
|
@ -67,7 +68,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @throws IllegalArgumentException Thrown when a permission with the same
|
||||
+ * name already exists
|
||||
+ */
|
||||
+ void addPermission(Permission perm);
|
||||
+ void addPermission(@NotNull Permission perm);
|
||||
+
|
||||
+ /**
|
||||
+ * Removes a {@link Permission} registration from this plugin manager.
|
||||
|
@ -80,7 +81,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ *
|
||||
+ * @param perm Permission to remove
|
||||
+ */
|
||||
+ void removePermission(Permission perm);
|
||||
+ void removePermission(@NotNull Permission perm);
|
||||
+
|
||||
+ /**
|
||||
+ * Removes a {@link Permission} registration from this plugin manager.
|
||||
|
@ -93,7 +94,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ *
|
||||
+ * @param name Permission to remove
|
||||
+ */
|
||||
+ void removePermission(String name);
|
||||
+ void removePermission(@NotNull String name);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the default permissions for the given op status
|
||||
|
@ -101,6 +102,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param op Which set of default permissions to get
|
||||
+ * @return The default permissions
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<Permission> getDefaultPermissions(boolean op);
|
||||
+
|
||||
+ /**
|
||||
|
@ -111,7 +113,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ *
|
||||
+ * @param perm Permission to recalculate
|
||||
+ */
|
||||
+ void recalculatePermissionDefaults(Permission perm);
|
||||
+ void recalculatePermissionDefaults(@NotNull Permission perm);
|
||||
+
|
||||
+ /**
|
||||
+ * Subscribes the given Permissible for information about the requested
|
||||
|
@ -123,7 +125,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param permission Permission to subscribe to
|
||||
+ * @param permissible Permissible subscribing
|
||||
+ */
|
||||
+ void subscribeToPermission(String permission, Permissible permissible);
|
||||
+ void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible);
|
||||
+
|
||||
+ /**
|
||||
+ * Unsubscribes the given Permissible for information about the requested
|
||||
|
@ -132,7 +134,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param permission Permission to unsubscribe from
|
||||
+ * @param permissible Permissible subscribing
|
||||
+ */
|
||||
+ void unsubscribeFromPermission(String permission, Permissible permissible);
|
||||
+ void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a set containing all subscribed {@link Permissible}s to the given
|
||||
|
@ -141,7 +143,8 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param permission Permission to query for
|
||||
+ * @return Set containing all subscribed permissions
|
||||
+ */
|
||||
+ Set<Permissible> getPermissionSubscriptions(String permission);
|
||||
+ @NotNull
|
||||
+ Set<Permissible> getPermissionSubscriptions(@NotNull String permission);
|
||||
+
|
||||
+ /**
|
||||
+ * Subscribes to the given Default permissions by operator status
|
||||
|
@ -152,7 +155,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param op Default list to subscribe to
|
||||
+ * @param permissible Permissible subscribing
|
||||
+ */
|
||||
+ void subscribeToDefaultPerms(boolean op, Permissible permissible);
|
||||
+ void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible);
|
||||
+
|
||||
+ /**
|
||||
+ * Unsubscribes from the given Default permissions by operator status
|
||||
|
@ -160,7 +163,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param op Default list to unsubscribe from
|
||||
+ * @param permissible Permissible subscribing
|
||||
+ */
|
||||
+ void unsubscribeFromDefaultPerms(boolean op, Permissible permissible);
|
||||
+ void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a set containing all subscribed {@link Permissible}s to the given
|
||||
|
@ -169,6 +172,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ * @param op Default list to query for
|
||||
+ * @return Set containing all subscribed permissions
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<Permissible> getDefaultPermSubscriptions(boolean op);
|
||||
+
|
||||
+ /**
|
||||
|
@ -178,6 +182,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ *
|
||||
+ * @return Set containing all current registered permissions
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<Permission> getPermissions();
|
||||
+
|
||||
+ /**
|
||||
|
@ -187,7 +192,7 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+ *
|
||||
+ * @param perm permission
|
||||
+ */
|
||||
+ void addPermissions(List<Permission> perm);
|
||||
+ void addPermissions(@NotNull List<Permission> perm);
|
||||
+
|
||||
+ /**
|
||||
+ * Clears the current registered permissinos.
|
||||
|
@ -199,29 +204,27 @@ index 0000000000000000000000000000000000000000..c78ada48e27c5552529fe8d5bc23db1d
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4c47414fc08e1183b1e59369bacc4d7f7042f262
|
||||
index 0000000000000000000000000000000000000000..08f2050356acaf74e3210416760e3873c2dafd2c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
|
||||
@@ -0,0 +1,16 @@
|
||||
@@ -0,0 +1,14 @@
|
||||
+package io.papermc.paper.plugin.bootstrap;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin
|
||||
+ * instantiation logic.
|
||||
+ * A bootstrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
|
||||
+ * A boostrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
|
||||
+ * like the plugin's configuration or logger during the plugins bootstrap.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface BootstrapContext extends PluginProviderContext {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e6696dcd8049e869bd1733f7c67ff802c54d7c37
|
||||
index 0000000000000000000000000000000000000000..288c078da3d3ca78d02caa4e3565ac7cf89f9f9f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java
|
||||
@@ -0,0 +1,41 @@
|
||||
|
@ -230,10 +233,10 @@ index 0000000000000000000000000000000000000000..e6696dcd8049e869bd1733f7c67ff802
|
|||
+import io.papermc.paper.plugin.provider.util.ProviderUtil;
|
||||
+import org.bukkit.plugin.java.JavaPlugin;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A plugin bootstrap is meant for loading certain parts of the plugin before the server is loaded.
|
||||
+ * A plugin boostrap is meant for loading certain parts of the plugin before the server is loaded.
|
||||
+ * <p>
|
||||
+ * Plugin bootstrapping allows values to be initialized in certain parts of the server that might not be allowed
|
||||
+ * when the server is running.
|
||||
|
@ -242,9 +245,8 @@ index 0000000000000000000000000000000000000000..e6696dcd8049e869bd1733f7c67ff802
|
|||
+ * <p>
|
||||
+ * <b>All calls to Bukkit may throw a NullPointerExceptions or return null unexpectedly. You should only call api methods that are explicitly documented to work in the bootstrapper</b>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.OverrideOnly
|
||||
+@ApiStatus.Experimental
|
||||
+public interface PluginBootstrap {
|
||||
+
|
||||
+ /**
|
||||
|
@ -252,7 +254,7 @@ index 0000000000000000000000000000000000000000..e6696dcd8049e869bd1733f7c67ff802
|
|||
+ *
|
||||
+ * @param context the server provided context
|
||||
+ */
|
||||
+ void bootstrap(BootstrapContext context);
|
||||
+ void bootstrap(@NotNull BootstrapContext context);
|
||||
+
|
||||
+ /**
|
||||
+ * Called by the server to instantiate your main class.
|
||||
|
@ -262,33 +264,34 @@ index 0000000000000000000000000000000000000000..e6696dcd8049e869bd1733f7c67ff802
|
|||
+ * @param context the server created bootstrap object
|
||||
+ * @return the server requested instance of the plugins main class.
|
||||
+ */
|
||||
+ default JavaPlugin createPlugin(final PluginProviderContext context) {
|
||||
+ @NotNull
|
||||
+ default JavaPlugin createPlugin(@NotNull PluginProviderContext context) {
|
||||
+ return ProviderUtil.loadClass(context.getConfiguration().getMainClass(), JavaPlugin.class, this.getClass().getClassLoader());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..19bb302ab264b72306d9bd15e9c40ade6dde7ee7
|
||||
index 0000000000000000000000000000000000000000..2c14693155de3654d5ca011c63e13e4a1abf2080
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
|
||||
@@ -0,0 +1,48 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+package io.papermc.paper.plugin.bootstrap;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import java.nio.file.Path;
|
||||
+import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+/**
|
||||
+ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin
|
||||
+ * instantiation logic.
|
||||
+ * A bootstrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
|
||||
+ * A boostrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
|
||||
+ * like the plugin's configuration or logger during the plugins bootstrap.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+@ApiStatus.Experimental
|
||||
+public interface PluginProviderContext {
|
||||
+
|
||||
+ /**
|
||||
|
@ -296,6 +299,7 @@ index 0000000000000000000000000000000000000000..19bb302ab264b72306d9bd15e9c40ade
|
|||
+ *
|
||||
+ * @return the plugin's configuration
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ PluginMeta getConfiguration();
|
||||
+
|
||||
+ /**
|
||||
|
@ -303,6 +307,7 @@ index 0000000000000000000000000000000000000000..19bb302ab264b72306d9bd15e9c40ade
|
|||
+ *
|
||||
+ * @return the previously described path
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Path getDataDirectory();
|
||||
+
|
||||
+ /**
|
||||
|
@ -310,6 +315,7 @@ index 0000000000000000000000000000000000000000..19bb302ab264b72306d9bd15e9c40ade
|
|||
+ *
|
||||
+ * @return the logger instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ ComponentLogger getLogger();
|
||||
+
|
||||
+ /**
|
||||
|
@ -317,32 +323,33 @@ index 0000000000000000000000000000000000000000..19bb302ab264b72306d9bd15e9c40ade
|
|||
+ *
|
||||
+ * @return the previously described path
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Path getPluginSource();
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c85670bad8
|
||||
index 0000000000000000000000000000000000000000..bcf91d048d84144f6acf9bfd2095df9ada2e585f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
||||
@@ -0,0 +1,186 @@
|
||||
@@ -0,0 +1,203 @@
|
||||
+package io.papermc.paper.plugin.configuration;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import org.bukkit.permissions.Permission;
|
||||
+import org.bukkit.permissions.PermissionDefault;
|
||||
+import org.bukkit.plugin.PluginLoadOrder;
|
||||
+import org.bukkit.plugin.java.JavaPlugin;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * This class acts as an abstraction for a plugin configuration.
|
||||
+ */
|
||||
+@ApiStatus.Experimental // Subject to change!
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+@ApiStatus.Experimental // Subject to change!
|
||||
+public interface PluginMeta {
|
||||
+
|
||||
+ /**
|
||||
|
@ -362,6 +369,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return the name of the plugin
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getName();
|
||||
+
|
||||
+ /**
|
||||
|
@ -369,6 +377,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return a descriptive name of the plugin and respective version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ default String getDisplayName() {
|
||||
+ return this.getName() + " v" + this.getVersion();
|
||||
+ }
|
||||
|
@ -379,6 +388,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return the fully qualified class name of the plugin's main class.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getMainClass();
|
||||
+
|
||||
+ /**
|
||||
|
@ -387,6 +397,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ * @return the plugin load order
|
||||
+ * @see PluginLoadOrder for further details regards the available load orders.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ PluginLoadOrder getLoadOrder();
|
||||
+
|
||||
+ /**
|
||||
|
@ -396,6 +407,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return the string representation of the plugin's version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getVersion();
|
||||
+
|
||||
+ /**
|
||||
|
@ -406,7 +418,8 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ * @return the specific overwrite of the logger prefix as defined by the plugin. If the plugin did not define a
|
||||
+ * custom logger prefix, this method will return null
|
||||
+ */
|
||||
+ @Nullable String getLoggerPrefix();
|
||||
+ @Nullable
|
||||
+ String getLoggerPrefix();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides a list of dependencies that are required for this plugin to load.
|
||||
|
@ -417,6 +430,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return an immutable list of required dependency names
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getPluginDependencies();
|
||||
+
|
||||
+ /**
|
||||
|
@ -429,6 +443,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return immutable list of soft dependencies
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getPluginSoftDependencies();
|
||||
+
|
||||
+ /**
|
||||
|
@ -441,6 +456,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return immutable list of plugins to load before this plugin
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getLoadBeforePlugins();
|
||||
+
|
||||
+ /**
|
||||
|
@ -450,6 +466,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return immutable list of provided plugins/dependencies
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getProvidedPlugins();
|
||||
+
|
||||
+ /**
|
||||
|
@ -458,6 +475,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return an immutable list of the plugin's authors
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getAuthors();
|
||||
+
|
||||
+ /**
|
||||
|
@ -466,6 +484,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return an immutable list of the plugin's contributors
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ List<String> getContributors();
|
||||
+
|
||||
+ /**
|
||||
|
@ -474,7 +493,8 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return description or null if the plugin did not define a human readable description.
|
||||
+ */
|
||||
+ @Nullable String getDescription();
|
||||
+ @Nullable
|
||||
+ String getDescription();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the website for the plugin or the plugin's author.
|
||||
|
@ -482,7 +502,8 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ *
|
||||
+ * @return a string representation of the website that serves as the main hub for this plugin/its author.
|
||||
+ */
|
||||
+ @Nullable String getWebsite();
|
||||
+ @Nullable
|
||||
+ String getWebsite();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the list of permissions that are defined via the plugin meta instance.
|
||||
|
@ -490,6 +511,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ * @return an immutable list of permissions
|
||||
+ */
|
||||
+ // TODO: Do we even want this? Why not just use the bootstrapper
|
||||
+ @NotNull
|
||||
+ List<Permission> getPermissions();
|
||||
+
|
||||
+ /**
|
||||
|
@ -499,6 +521,7 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ * @see #getPermissions()
|
||||
+ */
|
||||
+ // TODO: Do we even want this? Why not just use the bootstrapper
|
||||
+ @NotNull
|
||||
+ PermissionDefault getPermissionDefault();
|
||||
+
|
||||
+ /**
|
||||
|
@ -509,7 +532,8 @@ index 0000000000000000000000000000000000000000..3c768d5ccf490e962d9638e92d4ea7c8
|
|||
+ * @return the version string made up of the major and minor version (e.g. 1.18 or 1.19). Minor versions like 1.18.2
|
||||
+ * are unified to their major release version (in this example 1.18)
|
||||
+ */
|
||||
+ @Nullable String getAPIVersion();
|
||||
+ @Nullable
|
||||
+ String getAPIVersion();
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/package-info.java b/src/main/java/io/papermc/paper/plugin/configuration/package-info.java
|
||||
|
@ -528,10 +552,10 @@ index 0000000000000000000000000000000000000000..ddb3076124365d0d1a5caa32d4dcb1f4
|
|||
+package io.papermc.paper.plugin.configuration;
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ddb768057cdfd9202e4386494fd5f643692c73a1
|
||||
index 0000000000000000000000000000000000000000..28cbc09b7c1ded1f4515969cef4a669adac85703
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/PluginClasspathBuilder.java
|
||||
@@ -0,0 +1,37 @@
|
||||
@@ -0,0 +1,38 @@
|
||||
+package io.papermc.paper.plugin.loader;
|
||||
+
|
||||
+import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
|
||||
|
@ -539,15 +563,14 @@ index 0000000000000000000000000000000000000000..ddb768057cdfd9202e4386494fd5f643
|
|||
+import io.papermc.paper.plugin.loader.library.LibraryStore;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A mutable builder that may be used to collect and register all {@link ClassPathLibrary} instances a
|
||||
+ * {@link PluginLoader} aims to provide to its plugin at runtime.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+@ApiStatus.Experimental
|
||||
+public interface PluginClasspathBuilder {
|
||||
+
|
||||
+ /**
|
||||
|
@ -564,21 +587,23 @@ index 0000000000000000000000000000000000000000..ddb768057cdfd9202e4386494fd5f643
|
|||
+ * @see io.papermc.paper.plugin.loader.library.impl.JarLibrary
|
||||
+ * @see io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Contract("_ -> this")
|
||||
+ PluginClasspathBuilder addLibrary(ClassPathLibrary classPathLibrary);
|
||||
+ PluginClasspathBuilder addLibrary(@NotNull ClassPathLibrary classPathLibrary);
|
||||
+
|
||||
+ @NotNull
|
||||
+ PluginProviderContext getContext();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java b/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c2d029e4474cc00c84e5b3f7fceec4c3f30b486b
|
||||
index 0000000000000000000000000000000000000000..c9e31f78ff6ff969436c6d99755845786c4d383f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/PluginLoader.java
|
||||
@@ -0,0 +1,31 @@
|
||||
@@ -0,0 +1,30 @@
|
||||
+package io.papermc.paper.plugin.loader;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A plugin loader is responsible for creating certain aspects of a plugin before it is created.
|
||||
|
@ -590,9 +615,8 @@ index 0000000000000000000000000000000000000000..c2d029e4474cc00c84e5b3f7fceec4c3
|
|||
+ * It should be noted that this class will be called from a different classloader, this will cause any static values
|
||||
+ * set in this class/any other classes loaded not to persist when the plugin loads.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.OverrideOnly
|
||||
+@ApiStatus.Experimental
|
||||
+public interface PluginLoader {
|
||||
+
|
||||
+ /**
|
||||
|
@ -603,24 +627,23 @@ index 0000000000000000000000000000000000000000..c2d029e4474cc00c84e5b3f7fceec4c3
|
|||
+ * @param classpathBuilder a mutable classpath builder that may be used to register custom runtime dependencies
|
||||
+ * for the plugin the loader was registered for.
|
||||
+ */
|
||||
+ void classloader(PluginClasspathBuilder classpathBuilder);
|
||||
+ void classloader(@NotNull PluginClasspathBuilder classpathBuilder);
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java b/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8a07333a592056bab1d26d811316bb5ea5f30e18
|
||||
index 0000000000000000000000000000000000000000..1347b535d90c2c281c184d0459e7ac59c0350c9f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/library/ClassPathLibrary.java
|
||||
@@ -0,0 +1,21 @@
|
||||
@@ -0,0 +1,20 @@
|
||||
+package io.papermc.paper.plugin.loader.library;
|
||||
+
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * The classpath library interface represents libraries that are capable of registering themselves via
|
||||
+ * {@link #register(LibraryStore)} on any given {@link LibraryStore}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface ClassPathLibrary {
|
||||
+
|
||||
+ /**
|
||||
|
@ -631,7 +654,7 @@ index 0000000000000000000000000000000000000000..8a07333a592056bab1d26d811316bb5e
|
|||
+ * @param store the library store instance to register this library into
|
||||
+ * @throws LibraryLoadingException if library loading failed for this classpath library
|
||||
+ */
|
||||
+ void register(LibraryStore store) throws LibraryLoadingException;
|
||||
+ void register(@NotNull LibraryStore store) throws LibraryLoadingException;
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/LibraryLoadingException.java b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryLoadingException.java
|
||||
new file mode 100644
|
||||
|
@ -656,15 +679,16 @@ index 0000000000000000000000000000000000000000..79ba423a364b50588f3ee87fdc69155c
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..93ef8e369a158c25bc4fdd553faf13c1826ad872
|
||||
index 0000000000000000000000000000000000000000..0546fa1e9dcd7155086a8650806a8c086b6fc458
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/library/LibraryStore.java
|
||||
@@ -0,0 +1,26 @@
|
||||
+package io.papermc.paper.plugin.loader.library;
|
||||
+
|
||||
+import java.nio.file.Path;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a storage that stores library jars.
|
||||
|
@ -675,7 +699,6 @@ index 0000000000000000000000000000000000000000..93ef8e369a158c25bc4fdd553faf13c1
|
|||
+ * @see io.papermc.paper.plugin.loader.PluginLoader
|
||||
+ */
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+public interface LibraryStore {
|
||||
+
|
||||
+ /**
|
||||
|
@ -683,12 +706,12 @@ index 0000000000000000000000000000000000000000..93ef8e369a158c25bc4fdd553faf13c1
|
|||
+ *
|
||||
+ * @param library path to the libraries jar file on the disk
|
||||
+ */
|
||||
+ void addLibrary(Path library);
|
||||
+ void addLibrary(@NotNull Path library);
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java b/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9efcd9a62d6439eb27fc4e08498b4b7fbbdecb3c
|
||||
index 0000000000000000000000000000000000000000..e3da0d67cab01e1233dccde1a12ff25961ee79fb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/library/impl/JarLibrary.java
|
||||
@@ -0,0 +1,45 @@
|
||||
|
@ -697,9 +720,10 @@ index 0000000000000000000000000000000000000000..9efcd9a62d6439eb27fc4e08498b4b7f
|
|||
+import io.papermc.paper.plugin.loader.library.ClassPathLibrary;
|
||||
+import io.papermc.paper.plugin.loader.library.LibraryLoadingException;
|
||||
+import io.papermc.paper.plugin.loader.library.LibraryStore;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A simple jar library implementation of the {@link ClassPathLibrary} that allows {@link io.papermc.paper.plugin.loader.PluginLoader}s to
|
||||
|
@ -714,7 +738,6 @@ index 0000000000000000000000000000000000000000..9efcd9a62d6439eb27fc4e08498b4b7f
|
|||
+ * <p>
|
||||
+ * The jar library implementation will error if the file does not exist at the specified path.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class JarLibrary implements ClassPathLibrary {
|
||||
+
|
||||
+ private final Path path;
|
||||
|
@ -724,12 +747,12 @@ index 0000000000000000000000000000000000000000..9efcd9a62d6439eb27fc4e08498b4b7f
|
|||
+ *
|
||||
+ * @param path the path, relative to the JVMs start directory.
|
||||
+ */
|
||||
+ public JarLibrary(final Path path) {
|
||||
+ public JarLibrary(@NotNull Path path) {
|
||||
+ this.path = path;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void register(final LibraryStore store) throws LibraryLoadingException {
|
||||
+ public void register(@NotNull LibraryStore store) throws LibraryLoadingException {
|
||||
+ if (Files.notExists(this.path)) {
|
||||
+ throw new LibraryLoadingException("Could not find library at " + this.path);
|
||||
+ }
|
||||
|
@ -739,7 +762,7 @@ index 0000000000000000000000000000000000000000..9efcd9a62d6439eb27fc4e08498b4b7f
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0bc3b03831
|
||||
index 0000000000000000000000000000000000000000..70f352630de71f575d1aea5a3126da19a94791ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java
|
||||
@@ -0,0 +1,133 @@
|
||||
|
@ -748,9 +771,6 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+import io.papermc.paper.plugin.loader.library.ClassPathLibrary;
|
||||
+import io.papermc.paper.plugin.loader.library.LibraryLoadingException;
|
||||
+import io.papermc.paper.plugin.loader.library.LibraryStore;
|
||||
+import java.io.File;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
||||
+import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
+import org.eclipse.aether.RepositorySystem;
|
||||
|
@ -771,10 +791,14 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+import org.eclipse.aether.transfer.TransferCancelledException;
|
||||
+import org.eclipse.aether.transfer.TransferEvent;
|
||||
+import org.eclipse.aether.transport.http.HttpTransporterFactory;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.slf4j.Logger;
|
||||
+import org.slf4j.LoggerFactory;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * The maven library resolver acts as a resolver for yet to be resolved jar libraries that may be pulled from a
|
||||
+ * remote maven repository.
|
||||
|
@ -789,13 +813,12 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ * "central", "default", "https://repo1.maven.org/maven2/"
|
||||
+ * ).build());
|
||||
+ * }</pre>
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * Plugins may create and register a {@link MavenLibraryResolver} after configuring it.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class MavenLibraryResolver implements ClassPathLibrary {
|
||||
+
|
||||
+ private static final Logger LOGGER = LoggerFactory.getLogger("MavenLibraryResolver");
|
||||
+ private static final Logger logger = LoggerFactory.getLogger("MavenLibraryResolver");
|
||||
+
|
||||
+ private final RepositorySystem repository;
|
||||
+ private final DefaultRepositorySystemSession session;
|
||||
|
@ -811,7 +834,7 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ * submitting the {@link MavenLibraryResolver} to the {@link io.papermc.paper.plugin.loader.PluginClasspathBuilder}.
|
||||
+ */
|
||||
+ public MavenLibraryResolver() {
|
||||
+ final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
+ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
+ locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
+ locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
|
||||
+
|
||||
|
@ -823,8 +846,8 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ this.session.setLocalRepositoryManager(this.repository.newLocalRepositoryManager(this.session, new LocalRepository("libraries")));
|
||||
+ this.session.setTransferListener(new AbstractTransferListener() {
|
||||
+ @Override
|
||||
+ public void transferInitiated(final TransferEvent event) throws TransferCancelledException {
|
||||
+ LOGGER.info("Downloading {}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
|
||||
+ public void transferInitiated(@NotNull TransferEvent event) throws TransferCancelledException {
|
||||
+ logger.info("Downloading {}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
|
||||
+ }
|
||||
+ });
|
||||
+ this.session.setReadOnly();
|
||||
|
@ -837,7 +860,7 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ * @param dependency the definition of the dependency the maven library resolver should resolve when running
|
||||
+ * @see MavenLibraryResolver#addRepository(RemoteRepository)
|
||||
+ */
|
||||
+ public void addDependency(final Dependency dependency) {
|
||||
+ public void addDependency(@NotNull Dependency dependency) {
|
||||
+ this.dependencies.add(dependency);
|
||||
+ }
|
||||
+
|
||||
|
@ -847,9 +870,9 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ * repository.
|
||||
+ *
|
||||
+ * @param remoteRepository the configuration that defines the maven repository this library resolver should fetch
|
||||
+ * dependencies from
|
||||
+ * dependencies from
|
||||
+ */
|
||||
+ public void addRepository(final RemoteRepository remoteRepository) {
|
||||
+ public void addRepository(@NotNull RemoteRepository remoteRepository) {
|
||||
+ this.repositories.add(remoteRepository);
|
||||
+ }
|
||||
+
|
||||
|
@ -860,32 +883,32 @@ index 0000000000000000000000000000000000000000..107705db2d82b7c191e5e625ec888e0b
|
|||
+ * @throws LibraryLoadingException if resolving a dependency failed
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void register(final LibraryStore store) throws LibraryLoadingException {
|
||||
+ final List<RemoteRepository> repos = this.repository.newResolutionRepositories(this.session, this.repositories);
|
||||
+ public void register(@NotNull LibraryStore store) throws LibraryLoadingException {
|
||||
+ List<RemoteRepository> repos = this.repository.newResolutionRepositories(this.session, this.repositories);
|
||||
+
|
||||
+ final DependencyResult result;
|
||||
+ DependencyResult result;
|
||||
+ try {
|
||||
+ result = this.repository.resolveDependencies(this.session, new DependencyRequest(new CollectRequest((Dependency) null, this.dependencies, repos), null));
|
||||
+ } catch (final DependencyResolutionException ex) {
|
||||
+ } catch (DependencyResolutionException ex) {
|
||||
+ throw new LibraryLoadingException("Error resolving libraries", ex);
|
||||
+ }
|
||||
+
|
||||
+ for (final ArtifactResult artifact : result.getArtifactResults()) {
|
||||
+ final File file = artifact.getArtifact().getFile();
|
||||
+ for (ArtifactResult artifact : result.getArtifactResults()) {
|
||||
+ File file = artifact.getArtifact().getFile();
|
||||
+ store.addLibrary(file.toPath());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..75fe408ec742319c3cba2461b33b2a6e8b22d231
|
||||
index 0000000000000000000000000000000000000000..64e46fdfa4d404cb08c67a456e5990b729296b98
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java
|
||||
@@ -0,0 +1,35 @@
|
||||
@@ -0,0 +1,34 @@
|
||||
+package io.papermc.paper.plugin.provider.classloader;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * The class loader access interface is an <b>internal</b> representation of a class accesses' ability to see types
|
||||
|
@ -896,7 +919,6 @@ index 0000000000000000000000000000000000000000..75fe408ec742319c3cba2461b33b2a6e
|
|||
+ * is owned by a direct or transitive dependency of the plugin, preventing the plugin for accidentally discovering and
|
||||
+ * using class types that are supplied by plugins/libraries the plugin did not actively define as a dependency.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public interface ClassLoaderAccess {
|
||||
+
|
||||
|
@ -919,18 +941,19 @@ index 0000000000000000000000000000000000000000..75fe408ec742319c3cba2461b33b2a6e
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7c23e0a1a38f8b89484aee160647f751088903cd
|
||||
index 0000000000000000000000000000000000000000..a21bdc57564aef7caf43dde3b2bcb2fc7f30461c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/ConfiguredPluginClassLoader.java
|
||||
@@ -0,0 +1,70 @@
|
||||
@@ -0,0 +1,71 @@
|
||||
+package io.papermc.paper.plugin.provider.classloader;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import java.io.Closeable;
|
||||
+import org.bukkit.plugin.java.JavaPlugin;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.io.Closeable;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * The configured plugin class loader represents an <b>internal</b> abstraction over the classloaders used by the server
|
||||
|
@ -939,7 +962,6 @@ index 0000000000000000000000000000000000000000..7c23e0a1a38f8b89484aee160647f751
|
|||
+ * It implements {@link Closeable} to define the ability to shutdown and close the classloader that implements this
|
||||
+ * interface.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public interface ConfiguredPluginClassLoader extends Closeable {
|
||||
+
|
||||
|
@ -965,7 +987,7 @@ index 0000000000000000000000000000000000000000..7c23e0a1a38f8b89484aee160647f751
|
|||
+ * @see ClassLoader#loadClass(String)
|
||||
+ * @see Class#forName(String, boolean, ClassLoader)
|
||||
+ */
|
||||
+ Class<?> loadClass(String name,
|
||||
+ Class<?> loadClass(@NotNull String name,
|
||||
+ boolean resolve,
|
||||
+ boolean checkGlobal,
|
||||
+ boolean checkLibraries) throws ClassNotFoundException;
|
||||
|
@ -991,7 +1013,8 @@ index 0000000000000000000000000000000000000000..7c23e0a1a38f8b89484aee160647f751
|
|||
+ * that is used by the underlying classloader
|
||||
+ * @return classloader
|
||||
+ */
|
||||
+ @Nullable PluginClassLoaderGroup getGroup();
|
||||
+ @Nullable
|
||||
+ PluginClassLoaderGroup getGroup();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorage.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/PaperClassLoaderStorage.java
|
||||
new file mode 100644
|
||||
|
@ -1116,16 +1139,15 @@ index 0000000000000000000000000000000000000000..2c0e5ba6f8eba7a632180491843071b8
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dd3bfbf8a30c9ac6a82dcbdf879bbf120d920e20
|
||||
index 0000000000000000000000000000000000000000..885151cb932d9b8c09a7887edc879e154225f416
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/PluginClassLoaderGroup.java
|
||||
@@ -0,0 +1,66 @@
|
||||
@@ -0,0 +1,65 @@
|
||||
+package io.papermc.paper.plugin.provider.classloader;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * A plugin classloader group represents a group of classloaders that a plugins classloader may access.
|
||||
|
@ -1133,7 +1155,6 @@ index 0000000000000000000000000000000000000000..dd3bfbf8a30c9ac6a82dcbdf879bbf12
|
|||
+ * An example of this would be a classloader group that holds all direct and transitive dependencies a plugin declared,
|
||||
+ * allowing a plugins classloader to access classes included in these dependencies via this group.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public interface PluginClassLoaderGroup {
|
||||
+
|
||||
|
@ -1151,7 +1172,8 @@ index 0000000000000000000000000000000000000000..dd3bfbf8a30c9ac6a82dcbdf879bbf12
|
|||
+ * will be returned.
|
||||
+ * @see ConfiguredPluginClassLoader#loadClass(String, boolean, boolean, boolean)
|
||||
+ */
|
||||
+ @Nullable Class<?> getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester);
|
||||
+ @Nullable
|
||||
+ Class<?> getClassByName(String name, boolean resolve, ConfiguredPluginClassLoader requester);
|
||||
+
|
||||
+ /**
|
||||
+ * Removes a configured plugin classloader from this class loader group.
|
||||
|
@ -1188,15 +1210,15 @@ index 0000000000000000000000000000000000000000..dd3bfbf8a30c9ac6a82dcbdf879bbf12
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java b/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..338dc25d5161b7378dd17b17d6f603c92eb0a894
|
||||
index 0000000000000000000000000000000000000000..44d630c3eb2670c36134b9907519dc986b3761b4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/entrypoint/DependencyContext.java
|
||||
@@ -0,0 +1,49 @@
|
||||
@@ -0,0 +1,48 @@
|
||||
+package io.papermc.paper.plugin.provider.entrypoint;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A dependency context is a read-only abstraction of a type/concept that can resolve dependencies between plugins.
|
||||
|
@ -1204,7 +1226,6 @@ index 0000000000000000000000000000000000000000..338dc25d5161b7378dd17b17d6f603c9
|
|||
+ * This may for example be the server wide plugin manager itself, capable of validating if a dependency exists between
|
||||
+ * two {@link PluginMeta} instances, however the implementation is not limited to such a concrete use-case.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public interface DependencyContext {
|
||||
+
|
||||
|
@ -1224,7 +1245,7 @@ index 0000000000000000000000000000000000000000..338dc25d5161b7378dd17b17d6f603c9
|
|||
+ * @param depend the potential transitive dependency of the {@code plugin} parameter.
|
||||
+ * @return a simple boolean flag indicating if {@code plugin} considers {@code depend} as a transitive dependency.
|
||||
+ */
|
||||
+ boolean isTransitiveDependency(PluginMeta plugin, PluginMeta depend);
|
||||
+ boolean isTransitiveDependency(@NotNull PluginMeta plugin, @NotNull PluginMeta depend);
|
||||
+
|
||||
+ /**
|
||||
+ * Computes if this dependency context is aware of a dependency that provides/matches the passed identifier.
|
||||
|
@ -1238,30 +1259,29 @@ index 0000000000000000000000000000000000000000..338dc25d5161b7378dd17b17d6f603c9
|
|||
+ * @return a plain boolean flag indicating if this dependency context is aware of a potential dependency with the
|
||||
+ * passed identifier.
|
||||
+ */
|
||||
+ boolean hasDependency(String pluginIdentifier);
|
||||
+ boolean hasDependency(@NotNull String pluginIdentifier);
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java b/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..48a67c1b6070292dbf4ea3081f89b530207f9f6d
|
||||
index 0000000000000000000000000000000000000000..6bf3d212a6156ad9ab0e82d1ca0a04f83f6e4b83
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/util/ProviderUtil.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,78 @@
|
||||
+package io.papermc.paper.plugin.provider.util;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * An <b>internal</b> utility type that holds logic for loading a provider-like type from a classloaders.
|
||||
+ * Provides, at least in the context of this utility, define themselves as implementations of a specific parent
|
||||
+ * interface/type, e.g. {@link org.bukkit.plugin.java.JavaPlugin} and implement a no-args constructor.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public final class ProviderUtil {
|
||||
+public class ProviderUtil {
|
||||
+
|
||||
+ /**
|
||||
+ * Loads the class found at the provided fully qualified class name from the passed classloader, creates a new
|
||||
|
@ -1274,7 +1294,8 @@ index 0000000000000000000000000000000000000000..48a67c1b6070292dbf4ea3081f89b530
|
|||
+ * @param <T> the generic type of the parent class the created object will be cast to
|
||||
+ * @return the object instantiated from the class found at the provided FQN, cast to the parent type
|
||||
+ */
|
||||
+ public static <T> T loadClass(final String clazz, final Class<T> classType, final ClassLoader loader) {
|
||||
+ @NotNull
|
||||
+ public static <T> T loadClass(@NotNull String clazz, @NotNull Class<T> classType, @NotNull ClassLoader loader) {
|
||||
+ return loadClass(clazz, classType, loader, null);
|
||||
+ }
|
||||
+
|
||||
|
@ -1291,29 +1312,30 @@ index 0000000000000000000000000000000000000000..48a67c1b6070292dbf4ea3081f89b530
|
|||
+ * @return the object instantiated from the class found at the provided fully qualified class name, cast to the
|
||||
+ * parent type
|
||||
+ */
|
||||
+ public static <T> T loadClass(final String clazz, final Class<T> classType, final ClassLoader loader, final @Nullable Runnable onError) {
|
||||
+ @NotNull
|
||||
+ public static <T> T loadClass(@NotNull String clazz, @NotNull Class<T> classType, @NotNull ClassLoader loader, @Nullable Runnable onError) {
|
||||
+ try {
|
||||
+ final T clazzInstance;
|
||||
+ T clazzInstance;
|
||||
+
|
||||
+ try {
|
||||
+ final Class<?> jarClass = Class.forName(clazz, true, loader);
|
||||
+ Class<?> jarClass = Class.forName(clazz, true, loader);
|
||||
+
|
||||
+ final Class<? extends T> pluginClass;
|
||||
+ Class<? extends T> pluginClass;
|
||||
+ try {
|
||||
+ pluginClass = jarClass.asSubclass(classType);
|
||||
+ } catch (final ClassCastException ex) {
|
||||
+ } catch (ClassCastException ex) {
|
||||
+ throw new ClassCastException("class '%s' does not extend '%s'".formatted(clazz, classType));
|
||||
+ }
|
||||
+
|
||||
+ clazzInstance = pluginClass.getDeclaredConstructor().newInstance();
|
||||
+ } catch (final IllegalAccessException exception) {
|
||||
+ } catch (IllegalAccessException exception) {
|
||||
+ throw new RuntimeException("No public constructor");
|
||||
+ } catch (final InstantiationException exception) {
|
||||
+ } catch (InstantiationException exception) {
|
||||
+ throw new RuntimeException("Abnormal class instantiation", exception);
|
||||
+ }
|
||||
+
|
||||
+ return clazzInstance;
|
||||
+ } catch (final Throwable e) {
|
||||
+ } catch (Throwable e) {
|
||||
+ if (onError != null) {
|
||||
+ onError.run();
|
||||
+ }
|
||||
|
@ -1325,10 +1347,10 @@ index 0000000000000000000000000000000000000000..48a67c1b6070292dbf4ea3081f89b530
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 9ba1a4e838538ecd55f4f8e50ffb0c5f1f474382..d8b346fe0f9634218954fe818d53272a0896af9c 100644
|
||||
index baf49da3dd46039da2f24a4af8b1b8617bb25501..7cf61228754527ddaa6b39b5f1426e0527cdaac9 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -141,4 +141,14 @@ public interface UnsafeValues {
|
||||
@@ -137,4 +137,14 @@ public interface UnsafeValues {
|
||||
|
||||
@ApiStatus.Internal
|
||||
<B extends Keyed> B get(Registry<B> registry, NamespacedKey key);
|
||||
|
|
|
@ -6,27 +6,25 @@ Subject: [PATCH] Add Position
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c358bfdefc9bc7598dbd0d89a6b0b8a9408b5bb3
|
||||
index 0000000000000000000000000000000000000000..f0fdabce4af640da2a406412e67020761ded3ac1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
@@ -0,0 +1,100 @@
|
||||
@@ -0,0 +1,98 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Axis;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with integers.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ *
|
||||
+ * @see FinePosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface BlockPosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -55,17 +53,17 @@ index 0000000000000000000000000000000000000000..c358bfdefc9bc7598dbd0d89a6b0b8a9
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition toBlock() {
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition offset(final int x, final int y, final int z) {
|
||||
+ default @NotNull BlockPosition offset(int x, int y, int z) {
|
||||
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final double x, final double y, final double z) {
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
|
@ -76,7 +74,7 @@ index 0000000000000000000000000000000000000000..c358bfdefc9bc7598dbd0d89a6b0b8a9
|
|||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default BlockPosition offset(final BlockFace blockFace) {
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
|
||||
+ return this.offset(blockFace, 1);
|
||||
+ }
|
||||
+
|
||||
|
@ -89,7 +87,7 @@ index 0000000000000000000000000000000000000000..c358bfdefc9bc7598dbd0d89a6b0b8a9
|
|||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default BlockPosition offset(final BlockFace blockFace, final int amount) {
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
|
||||
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
|
||||
+ }
|
||||
+
|
||||
|
@ -102,7 +100,7 @@ index 0000000000000000000000000000000000000000..c358bfdefc9bc7598dbd0d89a6b0b8a9
|
|||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default BlockPosition offset(final Axis axis, final int amount) {
|
||||
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
|
||||
+ return amount == 0 ? this : switch (axis) {
|
||||
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
|
||||
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
|
||||
|
@ -122,25 +120,24 @@ index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a8
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b9c0065d8a9dedc3bd1a2d8bfbedfbc7f952ff93
|
||||
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
@@ -0,0 +1,57 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.util.NumberConversions;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with doubles.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ *
|
||||
+ * @see BlockPosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface FinePosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -169,17 +166,17 @@ index 0000000000000000000000000000000000000000..b9c0065d8a9dedc3bd1a2d8bfbedfbc7
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition toBlock() {
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final int x, final int y, final int z) {
|
||||
+ default @NotNull FinePosition offset(int x, int y, int z) {
|
||||
+ return this.offset((double) x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final double x, final double y, final double z) {
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
|
||||
+ }
|
||||
+}
|
||||
|
@ -195,10 +192,10 @@ index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda81
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06750700c4
|
||||
index 0000000000000000000000000000000000000000..26bc5a0fa67855af87c8fd4cd8229b4d9f242740
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/Position.java
|
||||
@@ -0,0 +1,192 @@
|
||||
@@ -0,0 +1,191 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
|
@ -206,7 +203,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
|
||||
|
@ -214,7 +211,6 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface Position {
|
||||
+
|
||||
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
|
||||
|
@ -291,7 +287,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ Position offset(int x, int y, int z);
|
||||
+ @NotNull Position offset(int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
|
@ -301,7 +297,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ FinePosition offset(double x, double y, double z);
|
||||
+ @NotNull FinePosition offset(double x, double y, double z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a new position at the center of the block position this represents
|
||||
|
@ -309,7 +305,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a new center position
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default FinePosition toCenter() {
|
||||
+ default @NotNull FinePosition toCenter() {
|
||||
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
|
||||
+ }
|
||||
+
|
||||
|
@ -320,7 +316,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return the block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ BlockPosition toBlock();
|
||||
+ @NotNull BlockPosition toBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Converts this position to a vector
|
||||
|
@ -328,7 +324,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a new vector
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default Vector toVector() {
|
||||
+ default @NotNull Vector toVector() {
|
||||
+ return new Vector(this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
|
@ -339,7 +335,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a new location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default Location toLocation(final World world) {
|
||||
+ default @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
|
@ -352,7 +348,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static BlockPosition block(final int x, final int y, final int z) {
|
||||
+ static @NotNull BlockPosition block(int x, int y, int z) {
|
||||
+ return new BlockPositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
|
@ -363,7 +359,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static BlockPosition block(final Location location) {
|
||||
+ static @NotNull BlockPosition block(@NotNull Location location) {
|
||||
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
|
@ -376,7 +372,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static FinePosition fine(final double x, final double y, final double z) {
|
||||
+ static @NotNull FinePosition fine(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
|
@ -387,7 +383,7 @@ index 0000000000000000000000000000000000000000..0e6a6a6738353b118e0ed093994dda06
|
|||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static FinePosition fine(final Location location) {
|
||||
+ static @NotNull FinePosition fine(@NotNull Location location) {
|
||||
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -8,10 +8,10 @@ expose isRunning
|
|||
|
||||
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3e747abde6fefae90f1c15cb00158bc5303cbe50
|
||||
index 0000000000000000000000000000000000000000..36b8fe86335df851f9c85d6bb2a91368b4d945d1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
@@ -0,0 +1,89 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+package co.aikar.timings;
|
||||
+
|
||||
+import static co.aikar.timings.TimingsManager.*;
|
||||
|
@ -19,9 +19,6 @@ index 0000000000000000000000000000000000000000..3e747abde6fefae90f1c15cb00158bc5
|
|||
+import org.bukkit.Bukkit;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public class FullServerTickHandler extends TimingHandler {
|
||||
+ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null);
|
||||
|
@ -103,10 +100,10 @@ index 0000000000000000000000000000000000000000..3e747abde6fefae90f1c15cb00158bc5
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..42e7e712403676171d34d5f2be27e48e7a071ebd
|
||||
index 0000000000000000000000000000000000000000..81671cf40feeed2844ee8d92348d48062aaf2c46
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/NullTimingHandler.java
|
||||
@@ -0,0 +1,72 @@
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * This file is licensed under the MIT License (MIT).
|
||||
+ *
|
||||
|
@ -135,9 +132,6 @@ index 0000000000000000000000000000000000000000..42e7e712403676171d34d5f2be27e48e
|
|||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public final class NullTimingHandler implements Timing {
|
||||
+ public static final Timing NULL = new NullTimingHandler();
|
||||
|
@ -181,10 +175,10 @@ index 0000000000000000000000000000000000000000..42e7e712403676171d34d5f2be27e48e
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a3ad690691eb5537a565d7ba684354acfec5ee2d
|
||||
index 0000000000000000000000000000000000000000..be275c25664e0c76123371c6c8fac601f87fa492
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java
|
||||
@@ -0,0 +1,87 @@
|
||||
@@ -0,0 +1,84 @@
|
||||
+/*
|
||||
+ * This file is licensed under the MIT License (MIT).
|
||||
+ *
|
||||
|
@ -221,9 +215,6 @@ index 0000000000000000000000000000000000000000..a3ad690691eb5537a565d7ba684354ac
|
|||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public class TimedEventExecutor implements EventExecutor {
|
||||
+
|
||||
|
@ -274,7 +265,7 @@ index 0000000000000000000000000000000000000000..a3ad690691eb5537a565d7ba684354ac
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2ca7c44f0
|
||||
index 0000000000000000000000000000000000000000..7514fad26f955329f8bf17ff17db75f0c8301ee5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/Timing.java
|
||||
@@ -0,0 +1,86 @@
|
||||
|
@ -309,7 +300,7 @@ index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2
|
|||
+/**
|
||||
+ * Provides an ability to time sections of code within the Minecraft Server
|
||||
+ *
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ * @deprecated Timings will likely be replaced with Spark in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public interface Timing extends AutoCloseable {
|
||||
|
@ -726,10 +717,10 @@ index 0000000000000000000000000000000000000000..199789d56d22fcb1b77ebd56805cc28a
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3d4390f263e52aafa24b306b1fd20d088a4ffcd7
|
||||
index 0000000000000000000000000000000000000000..065991e7a7f6119797ea315a56836ba17dd17d05
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
@@ -0,0 +1,357 @@
|
||||
@@ -0,0 +1,352 @@
|
||||
+/*
|
||||
+ * This file is licensed under the MIT License (MIT).
|
||||
+ *
|
||||
|
@ -782,11 +773,6 @@ index 0000000000000000000000000000000000000000..3d4390f263e52aafa24b306b1fd20d08
|
|||
+import static co.aikar.timings.TimingsManager.MINUTE_REPORTS;
|
||||
+import static co.aikar.util.JSONUtil.*;
|
||||
+
|
||||
+/**
|
||||
+ * Internal.
|
||||
+ *
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+@SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"})
|
||||
+public class TimingHistory {
|
||||
|
@ -1275,10 +1261,10 @@ index 0000000000000000000000000000000000000000..df142a89b8c43acb81eb383eac0ef048
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e81d0bc309de877ed2b5da6122f55c162e9b5f10
|
||||
index 0000000000000000000000000000000000000000..9812d668ad945aba486fbf6d5bf83c4292cb5d03
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||
@@ -0,0 +1,331 @@
|
||||
@@ -0,0 +1,337 @@
|
||||
+/*
|
||||
+ * This file is licensed under the MIT License (MIT).
|
||||
+ *
|
||||
|
@ -1322,7 +1308,7 @@ index 0000000000000000000000000000000000000000..e81d0bc309de877ed2b5da6122f55c16
|
|||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ * @deprecated Timings will likely be replaced with Spark in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+@SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"})
|
||||
|
@ -1440,17 +1426,23 @@ index 0000000000000000000000000000000000000000..e81d0bc309de877ed2b5da6122f55c16
|
|||
+
|
||||
+ public static Component deprecationMessage() {
|
||||
+ return Component.text()
|
||||
+ .color(TextColor.color(0xffc93a))
|
||||
+ .color(TextColor.color(0xf3ef91))
|
||||
+ .append(Component.text("[!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future."))
|
||||
+ .append(Component.newline())
|
||||
+ .append(Component.text(" We recommend migrating to the spark profiler."))
|
||||
+ .append(
|
||||
+ Component.text(" We recommend installing the spark profiler as a replacement: ")
|
||||
+ .append(
|
||||
+ Component.text()
|
||||
+ .content("https://spark.lucko.me/")
|
||||
+ .clickEvent(ClickEvent.openUrl("https://spark.lucko.me/")))
|
||||
+ )
|
||||
+ .append(Component.newline())
|
||||
+ .append(
|
||||
+ Component.text(" For more information please visit: ")
|
||||
+ .append(
|
||||
+ Component.text()
|
||||
+ .content("https://github.com/PaperMC/Paper/discussions/10565")
|
||||
+ .clickEvent(ClickEvent.openUrl("https://github.com/PaperMC/Paper/discussions/10565")))
|
||||
+ .content("https://github.com/PaperMC/Paper/issues/8948")
|
||||
+ .clickEvent(ClickEvent.openUrl("https://github.com/PaperMC/Paper/issues/8948")))
|
||||
+ )
|
||||
+ .build();
|
||||
+ }
|
||||
|
@ -1612,10 +1604,10 @@ index 0000000000000000000000000000000000000000..e81d0bc309de877ed2b5da6122f55c16
|
|||
+
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..95d87c9dbf2b237787294dfbe7fed87a36e6dedf
|
||||
index 0000000000000000000000000000000000000000..e801e79fa57c44b2e5d359647c920f88064826f1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
@@ -0,0 +1,126 @@
|
||||
@@ -0,0 +1,124 @@
|
||||
+/*
|
||||
+ * This file is licensed under the MIT License (MIT).
|
||||
+ *
|
||||
|
@ -1654,9 +1646,7 @@ index 0000000000000000000000000000000000000000..95d87c9dbf2b237787294dfbe7fed87a
|
|||
+
|
||||
+import static net.kyori.adventure.text.Component.text;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public class TimingsCommand extends BukkitCommand {
|
||||
+ private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste", "verbon", "verboff");
|
||||
|
@ -1744,7 +1734,7 @@ index 0000000000000000000000000000000000000000..95d87c9dbf2b237787294dfbe7fed87a
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e72ad05abada04426e32a73d02b21cb69079d268
|
||||
index 0000000000000000000000000000000000000000..5e1558ca3ffeeaf2645fa003965474a442d650bf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsManager.java
|
||||
@@ -0,0 +1,192 @@
|
||||
|
@ -1790,7 +1780,7 @@ index 0000000000000000000000000000000000000000..e72ad05abada04426e32a73d02b21cb6
|
|||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ * @deprecated Timings will likely be replaced with Spark in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public final class TimingsManager {
|
||||
|
@ -1942,10 +1932,10 @@ index 0000000000000000000000000000000000000000..e72ad05abada04426e32a73d02b21cb6
|
|||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..df066d6f8d55afbc0c1897c486d638657a5f8df9
|
||||
index 0000000000000000000000000000000000000000..3af5b8ea795311582044c712de50d29412024b77
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
@@ -0,0 +1,90 @@
|
||||
@@ -0,0 +1,87 @@
|
||||
+package co.aikar.timings;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
|
@ -1960,9 +1950,6 @@ index 0000000000000000000000000000000000000000..df066d6f8d55afbc0c1897c486d63865
|
|||
+
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+@SuppressWarnings("WeakerAccess")
|
||||
+public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender {
|
||||
|
@ -2864,10 +2851,10 @@ index 0000000000000000000000000000000000000000..3e61a926620a67daec3af54b72a1b911
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index fe6c43405e3f11272c1ff015f1dcd47129a68d41..8d729fb196d83e01e4652fb1f77f5cab7b57cc31 100644
|
||||
index 6425151b7003a1376977717dca6172efa1864648..e23be80c0ee7d7979b7c62ebce97ed0b2a0e146b 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -870,7 +870,6 @@ public final class Bukkit {
|
||||
@@ -866,7 +866,6 @@ public final class Bukkit {
|
||||
*/
|
||||
public static void reload() {
|
||||
server.reload();
|
||||
|
@ -2876,10 +2863,10 @@ index fe6c43405e3f11272c1ff015f1dcd47129a68d41..8d729fb196d83e01e4652fb1f77f5cab
|
|||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index fa6ad07214d5e38866bf6bee9139c6c938e9f51a..57c9b560c77a56588870598acb543469040ceec1 100644
|
||||
index 3bf7db7eac81e3cc6f5c6700637d10d1b4b7a47b..77f8b0889cd7039bf041fc052fba33b60aa77e17 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1960,6 +1960,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1947,6 +1947,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
@ -2907,48 +2894,40 @@ index fa6ad07214d5e38866bf6bee9139c6c938e9f51a..57c9b560c77a56588870598acb543469
|
|||
* Sends the component to the player
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index d8b346fe0f9634218954fe818d53272a0896af9c..12ef99f1c91b92a133611c5f5aeaaeebd02ce232 100644
|
||||
index 7cf61228754527ddaa6b39b5f1426e0527cdaac9..9082e67324f810857db26bb89ecea7e9f866f80d 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -40,6 +40,11 @@ public interface UnsafeValues {
|
||||
@@ -40,6 +40,7 @@ public interface UnsafeValues {
|
||||
net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException;
|
||||
// Paper end
|
||||
|
||||
+ /**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ void reportTimings(); // Paper
|
||||
Material toLegacy(Material material);
|
||||
|
||||
Material fromLegacy(Material material);
|
||||
@@ -151,4 +156,12 @@ public interface UnsafeValues {
|
||||
@@ -147,4 +148,12 @@ public interface UnsafeValues {
|
||||
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ * Server name to report to timings v2
|
||||
+ * @return name
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ String getTimingsServerName();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/BufferedCommandSender.java b/src/main/java/org/bukkit/command/BufferedCommandSender.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..45ed63797b13e114bf3795c80a6c3967d8eb2351
|
||||
index 0000000000000000000000000000000000000000..f9a00aecca5ec41b460bf41dfe1c69694768cf98
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/command/BufferedCommandSender.java
|
||||
@@ -0,0 +1,25 @@
|
||||
@@ -0,0 +1,21 @@
|
||||
+package org.bukkit.command;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public class BufferedCommandSender implements MessageCommandSender {
|
||||
+ private final StringBuffer buffer = new StringBuffer();
|
||||
+ @Override
|
||||
|
@ -2967,28 +2946,20 @@ index 0000000000000000000000000000000000000000..45ed63797b13e114bf3795c80a6c3967
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index f3cdf13f22aa789ee8cc235b61fda4035b254219..17d3da22e8fcdf73a587b17a0cdac3b23ded3567 100644
|
||||
index f3cdf13f22aa789ee8cc235b61fda4035b254219..33c0a60e71f4bd29966c10ea60b22f14e56c1de4 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -33,7 +33,16 @@ public abstract class Command {
|
||||
@@ -33,7 +33,8 @@ public abstract class Command {
|
||||
protected String usageMessage;
|
||||
private String permission;
|
||||
private net.kyori.adventure.text.Component permissionMessage; // Paper
|
||||
- public org.spigotmc.CustomTimingsHandler timings; // Spigot
|
||||
+ /**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public co.aikar.timings.Timing timings; // Paper
|
||||
+ /**
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ @NotNull public String getTimingName() {return getName();} // Paper
|
||||
|
||||
protected Command(@NotNull String name) {
|
||||
this(name, "", "/" + name, new ArrayList<String>());
|
||||
@@ -47,7 +56,6 @@ public abstract class Command {
|
||||
@@ -47,7 +48,6 @@ public abstract class Command {
|
||||
this.usageMessage = (usageMessage == null) ? "/" + name : usageMessage;
|
||||
this.aliases = aliases;
|
||||
this.activeAliases = new ArrayList<String>(aliases);
|
||||
|
@ -2996,7 +2967,7 @@ index f3cdf13f22aa789ee8cc235b61fda4035b254219..17d3da22e8fcdf73a587b17a0cdac3b2
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -245,7 +253,6 @@ public abstract class Command {
|
||||
@@ -245,7 +245,6 @@ public abstract class Command {
|
||||
}
|
||||
this.nextLabel = name;
|
||||
if (!isRegistered()) {
|
||||
|
@ -3029,10 +3000,10 @@ index d6c8938b1e13b63116b7b0e074ea8ef5997f8dc3..a6ad94ef98a1df1d2842635d850bc990
|
|||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/MessageCommandSender.java b/src/main/java/org/bukkit/command/MessageCommandSender.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..946d2f0ef37c6cf895caf8d3c6963c7889e0567b
|
||||
index 0000000000000000000000000000000000000000..9d263ab3afb938c215c0b64d9171345fca6ceb2c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/command/MessageCommandSender.java
|
||||
@@ -0,0 +1,138 @@
|
||||
@@ -0,0 +1,135 @@
|
||||
+package org.bukkit.command;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
|
@ -3050,10 +3021,7 @@ index 0000000000000000000000000000000000000000..946d2f0ef37c6cf895caf8d3c6963c78
|
|||
+
|
||||
+/**
|
||||
+ * For when all you care about is just messaging
|
||||
+ *
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true)
|
||||
+public interface MessageCommandSender extends CommandSender {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -3484,10 +3452,10 @@ index 516d7fc7812aac343782861d0d567f54aa578c2a..00000000000000000000000000000000
|
|||
- // Spigot end
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 5bcec42a91859002409cab9756999e5adc4c867f..3594b0eb4068c83c93efe948a8ef4ba217edce17 100644
|
||||
index c7d3d938534ac11fe420418655dae689c58fbe12..776a3ce9a6c106fbe96cc6399b9ee2cd81b10c76 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2731,7 +2731,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2726,7 +2726,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@Deprecated // Paper
|
||||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
|
|
@ -7,10 +7,10 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
|||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 6ecab28705afc0e3652677b516d8a5398e8b2666..db51751d2dc1ac419e8fac32466ad3a7727fa2fe 100644
|
||||
index e23be80c0ee7d7979b7c62ebce97ed0b2a0e146b..336c0fb1fcde9efb7cb8d15a9fad8c4cbcf28744 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -83,6 +83,20 @@ public final class Bukkit {
|
||||
@@ -82,6 +82,20 @@ public final class Bukkit {
|
||||
return server;
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,10 @@ index 6ecab28705afc0e3652677b516d8a5398e8b2666..db51751d2dc1ac419e8fac32466ad3a7
|
|||
* Attempts to set the {@link Server} singleton.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index f4b2ad91c7a46af5fc16f31369d155e4e3ab3aae..638e98416fdf7ac065abe058d625b1c924be5abb 100644
|
||||
index 77f8b0889cd7039bf041fc052fba33b60aa77e17..09012ce27344c60730b9c5fcde85712a8e7a69fb 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -68,6 +68,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -67,6 +67,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 3594b0eb4068c83c93efe948a8ef4ba217edce17..1ba2f706a62ee6962451305b1895654453b485cd 100644
|
||||
index 776a3ce9a6c106fbe96cc6399b9ee2cd81b10c76..966a5626eac9305c88b1fe35d12c5fc6e28348d4 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2583,6 +2583,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2578,6 +2578,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@Deprecated // Paper
|
||||
public String getLocale();
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add getTPS method
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index d978c72cdbc10792f852a4ba372518073893d02b..5780003631beae773231afe3afc6b834bfe1f84d 100644
|
||||
index 336c0fb1fcde9efb7cb8d15a9fad8c4cbcf28744..ea5f1b4085fd2ec355c4c8036f3bc729e30fd1b7 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2108,6 +2108,17 @@ public final class Bukkit {
|
||||
@@ -2093,6 +2093,17 @@ public final class Bukkit {
|
||||
return server.getEntity(uuid);
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ index d978c72cdbc10792f852a4ba372518073893d02b..5780003631beae773231afe3afc6b834
|
|||
* Get the advancement specified by this key.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 8949b8e29ae7f412481291630a5cb7b5b8809842..ba28d9f3213ca4b5f15178dc637bff37a8896edc 100644
|
||||
index 09012ce27344c60730b9c5fcde85712a8e7a69fb..e37649ce4b3981f2cff96b64ed3bd4093c015346 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1797,6 +1797,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1784,6 +1784,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Nullable
|
||||
Entity getEntity(@NotNull UUID uuid);
|
||||
|
||||
|
|
|
@ -10,21 +10,18 @@ Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..023cc52a9e28e1238c7452c0f3f577f2850fd861
|
||||
index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c716339346
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
@@ -0,0 +1,47 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.util;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+@NullMarked
|
||||
+public interface VersionFetcher {
|
||||
+
|
||||
+ /**
|
||||
+ * Amount of time to cache results for in milliseconds
|
||||
+ * <p>
|
||||
|
@ -42,9 +39,9 @@ index 0000000000000000000000000000000000000000..023cc52a9e28e1238c7452c0f3f577f2
|
|||
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
|
||||
+ * @return the message to show when requesting a version
|
||||
+ */
|
||||
+ Component getVersionMessage(String serverVersion);
|
||||
+ @NotNull
|
||||
+ Component getVersionMessage(@NotNull String serverVersion);
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ class DummyVersionFetcher implements VersionFetcher {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -52,8 +49,9 @@ index 0000000000000000000000000000000000000000..023cc52a9e28e1238c7452c0f3f577f2
|
|||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Component getVersionMessage(final String serverVersion) {
|
||||
+ public Component getVersionMessage(@NotNull String serverVersion) {
|
||||
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
|
||||
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
|
||||
+ new Throwable().printStackTrace();
|
||||
|
@ -63,10 +61,10 @@ index 0000000000000000000000000000000000000000..023cc52a9e28e1238c7452c0f3f577f2
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed03059790
|
||||
index 0000000000000000000000000000000000000000..9df9d09aa477d4cd3c496ba0933c816df1ef0964
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -0,0 +1,122 @@
|
||||
@@ -0,0 +1,121 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import java.time.Instant;
|
||||
|
@ -75,12 +73,11 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.util.Services;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Information about the current server build.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface ServerBuildInfo {
|
||||
+ /**
|
||||
|
@ -93,7 +90,7 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+ *
|
||||
+ * @return the {@code ServerBuildInfo}
|
||||
+ */
|
||||
+ static ServerBuildInfo buildInfo() {
|
||||
+ static @NotNull ServerBuildInfo buildInfo() {
|
||||
+ //<editor-fold defaultstate="collapsed" desc="Holder">
|
||||
+ final class Holder {
|
||||
+ static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServerBuildInfo.class);
|
||||
|
@ -107,7 +104,7 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+ *
|
||||
+ * @return the brand id of the server (e.g. "papermc:paper")
|
||||
+ */
|
||||
+ Key brandId();
|
||||
+ @NotNull Key brandId();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the current server supports the specified brand.
|
||||
|
@ -116,56 +113,56 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+ * @return {@code true} if the server supports the specified brand
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ boolean isBrandCompatible(final Key brandId);
|
||||
+ boolean isBrandCompatible(final @NotNull Key brandId);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the brand name of the server.
|
||||
+ *
|
||||
+ * @return the brand name of the server (e.g. "Paper")
|
||||
+ */
|
||||
+ String brandName();
|
||||
+ @NotNull String brandName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Minecraft version id.
|
||||
+ *
|
||||
+ * @return the Minecraft version id (e.g. "1.20.4", "1.20.2-pre2", "23w31a")
|
||||
+ */
|
||||
+ String minecraftVersionId();
|
||||
+ @NotNull String minecraftVersionId();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Minecraft version name.
|
||||
+ *
|
||||
+ * @return the Minecraft version name (e.g. "1.20.4", "1.20.2 Pre-release 2", "23w31a")
|
||||
+ */
|
||||
+ String minecraftVersionName();
|
||||
+ @NotNull String minecraftVersionName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the build number.
|
||||
+ *
|
||||
+ * @return the build number
|
||||
+ */
|
||||
+ OptionalInt buildNumber();
|
||||
+ @NotNull OptionalInt buildNumber();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the build time.
|
||||
+ *
|
||||
+ * @return the build time
|
||||
+ */
|
||||
+ Instant buildTime();
|
||||
+ @NotNull Instant buildTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the git commit branch.
|
||||
+ *
|
||||
+ * @return the git commit branch
|
||||
+ */
|
||||
+ Optional<String> gitBranch();
|
||||
+ @NotNull Optional<String> gitBranch();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the git commit hash.
|
||||
+ *
|
||||
+ * @return the git commit hash
|
||||
+ */
|
||||
+ Optional<String> gitCommit();
|
||||
+ @NotNull Optional<String> gitCommit();
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a string representation of the server build information.
|
||||
|
@ -173,7 +170,7 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+ * @param representation the type of representation
|
||||
+ * @return a string
|
||||
+ */
|
||||
+ String asString(final StringRepresentation representation);
|
||||
+ @NotNull String asString(final @NotNull StringRepresentation representation);
|
||||
+
|
||||
+ /**
|
||||
+ * String representation types.
|
||||
|
@ -191,10 +188,10 @@ index 0000000000000000000000000000000000000000..652ff54e7c50412503725d628bfe72ed
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/JarManifests.java b/src/main/java/io/papermc/paper/util/JarManifests.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7915a70d676b1205dcae39259f670af258a1ab9b
|
||||
index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b306076343
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/util/JarManifests.java
|
||||
@@ -0,0 +1,38 @@
|
||||
@@ -0,0 +1,37 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
|
@ -205,10 +202,9 @@ index 0000000000000000000000000000000000000000..7915a70d676b1205dcae39259f670af2
|
|||
+import java.util.WeakHashMap;
|
||||
+import java.util.jar.Manifest;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+public final class JarManifests {
|
||||
+ private JarManifests() {
|
||||
|
@ -216,7 +212,7 @@ index 0000000000000000000000000000000000000000..7915a70d676b1205dcae39259f670af2
|
|||
+
|
||||
+ private static final Map<ClassLoader, Manifest> MANIFESTS = Collections.synchronizedMap(new WeakHashMap<>());
|
||||
+
|
||||
+ public static @Nullable Manifest manifest(final Class<?> clazz) {
|
||||
+ public static @Nullable Manifest manifest(final @NotNull Class<?> clazz) {
|
||||
+ return MANIFESTS.computeIfAbsent(clazz.getClassLoader(), classLoader -> {
|
||||
+ final String classLocation = "/" + clazz.getName().replace(".", "/") + ".class";
|
||||
+ final URL resource = clazz.getResource(classLocation);
|
||||
|
@ -234,10 +230,10 @@ index 0000000000000000000000000000000000000000..7915a70d676b1205dcae39259f670af2
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99810d5e8c 100644
|
||||
index ea5f1b4085fd2ec355c4c8036f3bc729e30fd1b7..f4bf442b065e93b49a7e17658f73d7569d644b25 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -110,13 +110,26 @@ public final class Bukkit {
|
||||
@@ -109,13 +109,26 @@ public final class Bukkit {
|
||||
}
|
||||
|
||||
Bukkit.server = server;
|
||||
|
@ -265,7 +261,7 @@ index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99
|
|||
*/
|
||||
@NotNull
|
||||
public static String getName() {
|
||||
@@ -127,6 +140,7 @@ public final class Bukkit {
|
||||
@@ -126,6 +139,7 @@ public final class Bukkit {
|
||||
* Gets the version string of this server implementation.
|
||||
*
|
||||
* @return version of this server implementation
|
||||
|
@ -273,7 +269,7 @@ index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99
|
|||
*/
|
||||
@NotNull
|
||||
public static String getVersion() {
|
||||
@@ -143,6 +157,20 @@ public final class Bukkit {
|
||||
@@ -142,6 +156,20 @@ public final class Bukkit {
|
||||
return server.getBukkitVersion();
|
||||
}
|
||||
|
||||
|
@ -295,10 +291,10 @@ index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99
|
|||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ba28d9f3213ca4b5f15178dc637bff37a8896edc..8a07f21eeb04fb54032ce377a1478f60303e1824 100644
|
||||
index e37649ce4b3981f2cff96b64ed3bd4093c015346..7c646d1bb8b011c156b0688f9396bbcbba43d077 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -120,6 +120,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -119,6 +119,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public String getBukkitVersion();
|
||||
|
||||
|
@ -316,12 +312,12 @@ index ba28d9f3213ca4b5f15178dc637bff37a8896edc..8a07f21eeb04fb54032ce377a1478f60
|
|||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 12ef99f1c91b92a133611c5f5aeaaeebd02ce232..6e67fdb091a006d2d13bc2d93db4d55348af4c8f 100644
|
||||
index 9082e67324f810857db26bb89ecea7e9f866f80d..da997507b96908027c49dabc6daf7c787dcad95d 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -163,5 +163,12 @@ public interface UnsafeValues {
|
||||
@@ -155,5 +155,12 @@ public interface UnsafeValues {
|
||||
* @return name
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
String getTimingsServerName();
|
||||
+
|
||||
+ /**
|
||||
|
|
72
patches/api/0017-Add-PlayerLocaleChangeEvent.patch
Normal file
72
patches/api/0017-Add-PlayerLocaleChangeEvent.patch
Normal file
|
@ -0,0 +1,72 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Isaac Moore <rmsy@me.com>
|
||||
Date: Mon, 29 Feb 2016 18:02:25 -0600
|
||||
Subject: [PATCH] Add PlayerLocaleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..57f6c47e4e759abf0af9aa8962551225cc12246c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the locale of the player is changed.
|
||||
+ *
|
||||
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class PlayerLocaleChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String oldLocale;
|
||||
+ private final String newLocale;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerLocaleChangeEvent(final @NotNull Player player, final @Nullable String oldLocale, final @NotNull String newLocale) {
|
||||
+ super(player);
|
||||
+ this.oldLocale = oldLocale;
|
||||
+ this.newLocale = newLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player switched from.
|
||||
+ *
|
||||
+ * @return player's old locale
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getOldLocale() {
|
||||
+ return this.oldLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player is changed to.
|
||||
+ *
|
||||
+ * @return player's new locale
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getNewLocale() {
|
||||
+ return this.newLocale;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,167 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 18:05:37 -0600
|
||||
Subject: [PATCH] Add view distance API
|
||||
|
||||
Add per player no-tick, tick, and send view distances.
|
||||
|
||||
Also add send/no-tick view distance to World.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 9732929b666b0a5e1a2a41c8e8794cc4f2535e41..0a3a66e04f8785874f10a76603bff46469543688 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2968,6 +2968,66 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@NotNull
|
||||
public Set<FeatureFlag> getFeatureFlags();
|
||||
|
||||
+ // Paper start - view distance api
|
||||
+ /**
|
||||
+ * Sets the view distance for this world.
|
||||
+ * @param viewDistance view distance in [2, 32]
|
||||
+ */
|
||||
+ void setViewDistance(int viewDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the simulation distance for this world.
|
||||
+ * @param simulationDistance simulation distance in [2, 32]
|
||||
+ */
|
||||
+ void setSimulationDistance(int simulationDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the no-tick view distance for this world.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @return The no-tick view distance for this world.
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-tick view distance for this world.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32]
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this world.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players in this world.
|
||||
+ * </p>
|
||||
+ * @return The sending view distance for this world.
|
||||
+ */
|
||||
+ int getSendViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the sending view distance for this world.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players in this world.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ */
|
||||
+ void setSendViewDistance(int viewDistance);
|
||||
+ // Paper end - view distance api
|
||||
+
|
||||
/**
|
||||
* Gets all generated structures that intersect the chunk at the given
|
||||
* coordinates. <br>
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 1ba2f706a62ee6962451305b1895654453b485cd..7d530bd0e4d833da760d1cf82aba966b7fb480b1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2597,6 +2597,82 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param affects Whether the player can affect mob spawning
|
||||
*/
|
||||
public void setAffectsSpawning(boolean affects);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the view distance for this player
|
||||
+ *
|
||||
+ * @return the player's view distance
|
||||
+ * @see org.bukkit.World#getViewDistance()
|
||||
+ */
|
||||
+ public int getViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the view distance for this player
|
||||
+ *
|
||||
+ * @param viewDistance the player's view distance
|
||||
+ * @see org.bukkit.World#setViewDistance(int)
|
||||
+ */
|
||||
+ public void setViewDistance(int viewDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the simulation distance for this player
|
||||
+ *
|
||||
+ * @return the player's simulation distance
|
||||
+ */
|
||||
+ public int getSimulationDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the simulation distance for this player
|
||||
+ *
|
||||
+ * @param simulationDistance the player's new simulation distance
|
||||
+ */
|
||||
+ public void setSimulationDistance(int simulationDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the no-ticking view distance for this player.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @return The no-tick view distance for this player.
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-ticking view distance for this player.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this player.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players.
|
||||
+ * </p>
|
||||
+ * @return The sending view distance for this player.
|
||||
+ */
|
||||
+ public int getSendViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the sending view distance for this player.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ */
|
||||
+ public void setSendViewDistance(int viewDistance);
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -1,100 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 18:09:40 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..741d0e73bc635a545c94c4b1254cee8f41ba8925
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -0,0 +1,88 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon effect is being applied to a player.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final boolean primary;
|
||||
+ private PotionEffect effect;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconEffectEvent(final Block block, final PotionEffect effect, final Player player, final boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
+ this.player = player;
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
+ * @return Potion effect
|
||||
+ */
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return this.effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the potion effect that will be applied.
|
||||
+ *
|
||||
+ * @param effect Potion effect
|
||||
+ */
|
||||
+ public void setEffect(final PotionEffect effect) {
|
||||
+ this.effect = effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player who the potion effect is being applied to.
|
||||
+ *
|
||||
+ * @return Affected player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return {@code true} if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
167
patches/api/0018-Add-view-distance-API.patch
Normal file
167
patches/api/0018-Add-view-distance-API.patch
Normal file
|
@ -0,0 +1,167 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 18:05:37 -0600
|
||||
Subject: [PATCH] Add view distance API
|
||||
|
||||
Add per player no-tick, tick, and send view distances.
|
||||
|
||||
Also add send/no-tick view distance to World.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 9732929b666b0a5e1a2a41c8e8794cc4f2535e41..0a3a66e04f8785874f10a76603bff46469543688 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2968,6 +2968,66 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@NotNull
|
||||
public Set<FeatureFlag> getFeatureFlags();
|
||||
|
||||
+ // Paper start - view distance api
|
||||
+ /**
|
||||
+ * Sets the view distance for this world.
|
||||
+ * @param viewDistance view distance in [2, 32]
|
||||
+ */
|
||||
+ void setViewDistance(int viewDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the simulation distance for this world.
|
||||
+ * @param simulationDistance simulation distance in [2, 32]
|
||||
+ */
|
||||
+ void setSimulationDistance(int simulationDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the no-tick view distance for this world.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @return The no-tick view distance for this world.
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-tick view distance for this world.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32]
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this world.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players in this world.
|
||||
+ * </p>
|
||||
+ * @return The sending view distance for this world.
|
||||
+ */
|
||||
+ int getSendViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the sending view distance for this world.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players in this world.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ */
|
||||
+ void setSendViewDistance(int viewDistance);
|
||||
+ // Paper end - view distance api
|
||||
+
|
||||
/**
|
||||
* Gets all generated structures that intersect the chunk at the given
|
||||
* coordinates. <br>
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 966a5626eac9305c88b1fe35d12c5fc6e28348d4..b5179b6f8f65d39198c0b80e4be9aca17ca866da 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2592,6 +2592,82 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param affects Whether the player can affect mob spawning
|
||||
*/
|
||||
public void setAffectsSpawning(boolean affects);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the view distance for this player
|
||||
+ *
|
||||
+ * @return the player's view distance
|
||||
+ * @see org.bukkit.World#getViewDistance()
|
||||
+ */
|
||||
+ public int getViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the view distance for this player
|
||||
+ *
|
||||
+ * @param viewDistance the player's view distance
|
||||
+ * @see org.bukkit.World#setViewDistance(int)
|
||||
+ */
|
||||
+ public void setViewDistance(int viewDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the simulation distance for this player
|
||||
+ *
|
||||
+ * @return the player's simulation distance
|
||||
+ */
|
||||
+ public int getSimulationDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the simulation distance for this player
|
||||
+ *
|
||||
+ * @param simulationDistance the player's new simulation distance
|
||||
+ */
|
||||
+ public void setSimulationDistance(int simulationDistance);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the no-ticking view distance for this player.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @return The no-tick view distance for this player.
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-ticking view distance for this player.
|
||||
+ * <p>
|
||||
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
|
||||
+ * be set to tick.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this player.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players.
|
||||
+ * </p>
|
||||
+ * @return The sending view distance for this player.
|
||||
+ */
|
||||
+ public int getSendViewDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the sending view distance for this player.
|
||||
+ * <p>
|
||||
+ * Sending view distance is the view distance where chunks will load in for players.
|
||||
+ * </p>
|
||||
+ * @param viewDistance view distance in [2, 32] or -1
|
||||
+ */
|
||||
+ public void setSendViewDistance(int viewDistance);
|
||||
// Paper end
|
||||
|
||||
/**
|
103
patches/api/0019-Add-BeaconEffectEvent.patch
Normal file
103
patches/api/0019-Add-BeaconEffectEvent.patch
Normal file
|
@ -0,0 +1,103 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 18:09:40 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7270c1feece2dc15a4a0503c4bca93a1288f8f13
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -0,0 +1,91 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon effect is being applied to a player.
|
||||
+ */
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final boolean primary;
|
||||
+ private PotionEffect effect;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
+ this.player = player;
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
+ * @return Potion effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return this.effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the potion effect that will be applied.
|
||||
+ *
|
||||
+ * @param effect Potion effect
|
||||
+ */
|
||||
+ public void setEffect(@NotNull PotionEffect effect) {
|
||||
+ this.effect = effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player who the potion effect is being applied to.
|
||||
+ *
|
||||
+ * @return Affected player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return {@code true} if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,50 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
||||
Subject: [PATCH] Expose server CommandMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index a005d5f8879262c763d8c4fbd09b9a99810d5e8c..26f3ac9c15ff554becfe8ea53a48f67b2de60ed6 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2337,6 +2337,19 @@ public final class Bukkit {
|
||||
return server.getUnsafe();
|
||||
}
|
||||
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
+ return server.getCommandMap();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 8a07f21eeb04fb54032ce377a1478f60303e1824..d78481bf17818415524f14417caf86d5684b2235 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1817,6 +1817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public double[] getTPS();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.command.CommandMap getCommandMap();
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
32
patches/api/0020-Add-PlayerInitialSpawnEvent.patch
Normal file
32
patches/api/0020-Add-PlayerInitialSpawnEvent.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Anton <anxuiz.nx@gmail.com>
|
||||
Date: Mon, 29 Feb 2016 18:13:58 -0600
|
||||
Subject: [PATCH] Add PlayerInitialSpawnEvent
|
||||
|
||||
For modifying a player's initial spawn location as they join the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..49e97ae79facceca5fc44c84c3d5f342d64cabc2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
@@ -0,0 +1,19 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
|
||||
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerInitialSpawnEvent(@NotNull Player player, @NotNull Location spawnLocation) {
|
||||
+ super(player, spawnLocation);
|
||||
+ }
|
||||
+}
|
|
@ -1,124 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 19:54:32 -0600
|
||||
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
|
||||
|
||||
Change Javadoc to be accurate
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index fe074fe9553f61bdd72b64830532a78415348781..4c5327da1468cb1f9af00a99e7e79f578c47ee2a 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -472,6 +472,30 @@ public final class Bukkit {
|
||||
return server.broadcastMessage(message);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ server.broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ server.broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 9545da2adacaf0bd719c2baef929588cd1042d25..19b75704ed9eee0c929df417e1e5d0ea3718e2f8 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -383,6 +383,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Deprecated // Paper
|
||||
public int broadcastMessage(@NotNull String message);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7d530bd0e4d833da760d1cf82aba966b7fb480b1..f9bacbfa223826b3b54525648080fda306a1ec36 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1214,6 +1214,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void sendMap(@NotNull MapView map);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to the player
|
||||
+ *
|
||||
+ * @param component the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().sendMessage(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the player
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(components);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the specified screen position of this player
|
||||
+ *
|
||||
+ * @param position the screen position
|
||||
+ * @param components the components to send
|
||||
+ */
|
||||
+ public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(position, components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Send a hurt animation. This fakes incoming damage towards the player from
|
||||
* the given yaw relative to the player's direction.
|
|
@ -1,581 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:24:35 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..95a5a59e6bd88345177fca0b12008ddd689cb448
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import com.destroystokyo.paper.exception.ServerException;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called whenever an exception is thrown in a recoverable section of the server.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ServerExceptionEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ServerException exception;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerExceptionEvent(final ServerException exception) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.exception = exception;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the wrapped exception that was thrown.
|
||||
+ *
|
||||
+ * @return Exception thrown
|
||||
+ */
|
||||
+ public ServerException getException() {
|
||||
+ return this.exception;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6fb39af0479a818f7f1465bcdfe505ab4ff7da1a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a command throws an exception
|
||||
+ */
|
||||
+public class ServerCommandException extends ServerException {
|
||||
+
|
||||
+ private final Command command;
|
||||
+ private final CommandSender commandSender;
|
||||
+ private final String[] arguments;
|
||||
+
|
||||
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing command
|
||||
+ */
|
||||
+ public Command getCommand() {
|
||||
+ return command;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command sender which executed the command request
|
||||
+ *
|
||||
+ * @return command sender of exception thrown command request
|
||||
+ */
|
||||
+ public CommandSender getCommandSender() {
|
||||
+ return commandSender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the arguments which threw the exception for the command
|
||||
+ *
|
||||
+ * @return arguments of exception thrown command request
|
||||
+ */
|
||||
+ public String[] getArguments() {
|
||||
+ return arguments;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..410b24139535cd5d8439ad581c43c61b5757fbf6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Exception thrown when a server event listener throws an exception
|
||||
+ */
|
||||
+public class ServerEventException extends ServerPluginException {
|
||||
+
|
||||
+ private final Listener listener;
|
||||
+ private final Event event;
|
||||
+
|
||||
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the listener which threw the exception
|
||||
+ *
|
||||
+ * @return event listener
|
||||
+ */
|
||||
+ public Listener getListener() {
|
||||
+ return listener;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the event which caused the exception
|
||||
+ *
|
||||
+ * @return event
|
||||
+ */
|
||||
+ public Event getEvent() {
|
||||
+ return event;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c06ea3942447d4824b83ff839cb449fb818dede1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all exceptions that are thrown by the server.
|
||||
+ */
|
||||
+public class ServerException extends Exception {
|
||||
+
|
||||
+ public ServerException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2c3effca7c9d6c904cbe248d312b74e2cd360acf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import java.util.logging.Level;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when the internal server throws a recoverable exception.
|
||||
+ */
|
||||
+public class ServerInternalException extends ServerException {
|
||||
+
|
||||
+ public ServerInternalException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+
|
||||
+ public static void reportInternalException(Throwable cause) {
|
||||
+ try {
|
||||
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
||||
+ ;
|
||||
+ } catch (Throwable t) {
|
||||
+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow!
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f016ba3b1b62e554a9bacbb9635f2dbe441b3c4e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
|
||||
+ */
|
||||
+public class ServerPluginEnableDisableException extends ServerPluginException {
|
||||
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..be3f92e3c6bcefe8b78da701b75121275001882e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
|
||||
+ */
|
||||
+public class ServerPluginException extends ServerException {
|
||||
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ private final Plugin responsiblePlugin;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the plugin which is directly responsible for the exception being thrown
|
||||
+ *
|
||||
+ * @return plugin which is responsible for the exception throw
|
||||
+ */
|
||||
+ public Plugin getResponsiblePlugin() {
|
||||
+ return responsiblePlugin;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when an incoming plugin message channel throws an exception
|
||||
+ */
|
||||
+public class ServerPluginMessageException extends ServerPluginException {
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final String channel;
|
||||
+ private final byte[] data;
|
||||
+
|
||||
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the channel to which the error occurred from receiving data from
|
||||
+ *
|
||||
+ * @return exception channel
|
||||
+ */
|
||||
+ public String getChannel() {
|
||||
+ return channel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data to which the error occurred from
|
||||
+ *
|
||||
+ * @return exception data
|
||||
+ */
|
||||
+ public byte[] getData() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player which the plugin message causing the exception originated from
|
||||
+ *
|
||||
+ * @return exception player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d0b2d4a9b3e5bdeec0e4ea7ab69858d86aa3715
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
@@ -0,0 +1,37 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a plugin's scheduler fails with an exception
|
||||
+ */
|
||||
+public class ServerSchedulerException extends ServerPluginException {
|
||||
+
|
||||
+ private final BukkitTask task;
|
||||
+
|
||||
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
|
||||
+ super(message, cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
|
||||
+ super(cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the task which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing task
|
||||
+ */
|
||||
+ public BukkitTask getTask() {
|
||||
+ return task;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078cd9521a1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a tab-complete request throws an exception
|
||||
+ */
|
||||
+public class ServerTabCompleteException extends ServerCommandException {
|
||||
+
|
||||
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 36fc2c35395c72f8b81a2a2f3265fd205384ce26..c7fa1d235cea78bda4656ed66b8d42b119cc50fb 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -156,11 +156,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
} // target.timings.stopTiming(); // Spigot // Paper
|
||||
} catch (CommandException ex) {
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
|
||||
// return true as command was handled
|
||||
@@ -239,7 +242,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index e7b1895d3918487d711afcbe41d76863d85c0a62..003bece642b682985625db93cad93026352bfc66 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -528,7 +528,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
|
||||
}
|
||||
|
||||
HandlerList.bakeAll();
|
||||
@@ -551,32 +552,37 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
HandlerList.unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getMessenger().unregisterIncomingPluginChannel(plugin);
|
||||
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -589,6 +595,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void clearPlugins() {
|
||||
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
|
||||
@@ -654,7 +667,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
|
||||
+ // Paper start - error reporting
|
||||
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
50
patches/api/0021-Expose-server-CommandMap.patch
Normal file
50
patches/api/0021-Expose-server-CommandMap.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
||||
Subject: [PATCH] Expose server CommandMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index f4bf442b065e93b49a7e17658f73d7569d644b25..db217a9486e327b4340a54d65439055d86f363cc 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2322,6 +2322,19 @@ public final class Bukkit {
|
||||
return server.getUnsafe();
|
||||
}
|
||||
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
+ return server.getCommandMap();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 7c646d1bb8b011c156b0688f9396bbcbba43d077..69153de6847bb8740803e5f731a0586d41a0eed3 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1804,6 +1804,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public double[] getTPS();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.command.CommandMap getCommandMap();
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
|
@ -0,0 +1,124 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 19:54:32 -0600
|
||||
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
|
||||
|
||||
Change Javadoc to be accurate
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index db217a9486e327b4340a54d65439055d86f363cc..25f506c344883d00a63ee2b5a998d3ff3ffd6cd5 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -471,6 +471,30 @@ public final class Bukkit {
|
||||
return server.broadcastMessage(message);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ server.broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ server.broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 69153de6847bb8740803e5f731a0586d41a0eed3..65d68716e1ff8277c534399621cf961ddf312509 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -382,6 +382,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Deprecated // Paper
|
||||
public int broadcastMessage(@NotNull String message);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 5d5d37e2ebbbe4d2641177c7d174059ba29bb688..881c75e84ef31390a3519549985af2711e2828b5 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1216,6 +1216,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void sendMap(@NotNull MapView map);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to the player
|
||||
+ *
|
||||
+ * @param component the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().sendMessage(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the player
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(components);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the specified screen position of this player
|
||||
+ *
|
||||
+ * @param position the screen position
|
||||
+ * @param components the components to send
|
||||
+ */
|
||||
+ public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(position, components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Send a hurt animation. This fakes incoming damage towards the player from
|
||||
* the given yaw relative to the player's direction.
|
583
patches/api/0023-Add-exception-reporting-event.patch
Normal file
583
patches/api/0023-Add-exception-reporting-event.patch
Normal file
|
@ -0,0 +1,583 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:24:35 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc010f66957
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import com.destroystokyo.paper.exception.ServerException;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called whenever an exception is thrown in a recoverable section of the server.
|
||||
+ */
|
||||
+public class ServerExceptionEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ServerException exception;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerExceptionEvent(@NotNull ServerException exception) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.exception = exception;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the wrapped exception that was thrown.
|
||||
+ *
|
||||
+ * @return Exception thrown
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ServerException getException() {
|
||||
+ return this.exception;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6fb39af0479a818f7f1465bcdfe505ab4ff7da1a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a command throws an exception
|
||||
+ */
|
||||
+public class ServerCommandException extends ServerException {
|
||||
+
|
||||
+ private final Command command;
|
||||
+ private final CommandSender commandSender;
|
||||
+ private final String[] arguments;
|
||||
+
|
||||
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing command
|
||||
+ */
|
||||
+ public Command getCommand() {
|
||||
+ return command;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command sender which executed the command request
|
||||
+ *
|
||||
+ * @return command sender of exception thrown command request
|
||||
+ */
|
||||
+ public CommandSender getCommandSender() {
|
||||
+ return commandSender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the arguments which threw the exception for the command
|
||||
+ *
|
||||
+ * @return arguments of exception thrown command request
|
||||
+ */
|
||||
+ public String[] getArguments() {
|
||||
+ return arguments;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..410b24139535cd5d8439ad581c43c61b5757fbf6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Exception thrown when a server event listener throws an exception
|
||||
+ */
|
||||
+public class ServerEventException extends ServerPluginException {
|
||||
+
|
||||
+ private final Listener listener;
|
||||
+ private final Event event;
|
||||
+
|
||||
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the listener which threw the exception
|
||||
+ *
|
||||
+ * @return event listener
|
||||
+ */
|
||||
+ public Listener getListener() {
|
||||
+ return listener;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the event which caused the exception
|
||||
+ *
|
||||
+ * @return event
|
||||
+ */
|
||||
+ public Event getEvent() {
|
||||
+ return event;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c06ea3942447d4824b83ff839cb449fb818dede1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all exceptions that are thrown by the server.
|
||||
+ */
|
||||
+public class ServerException extends Exception {
|
||||
+
|
||||
+ public ServerException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2c3effca7c9d6c904cbe248d312b74e2cd360acf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import java.util.logging.Level;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when the internal server throws a recoverable exception.
|
||||
+ */
|
||||
+public class ServerInternalException extends ServerException {
|
||||
+
|
||||
+ public ServerInternalException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+
|
||||
+ public static void reportInternalException(Throwable cause) {
|
||||
+ try {
|
||||
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
||||
+ ;
|
||||
+ } catch (Throwable t) {
|
||||
+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow!
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f016ba3b1b62e554a9bacbb9635f2dbe441b3c4e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
|
||||
+ */
|
||||
+public class ServerPluginEnableDisableException extends ServerPluginException {
|
||||
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..be3f92e3c6bcefe8b78da701b75121275001882e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
|
||||
+ */
|
||||
+public class ServerPluginException extends ServerException {
|
||||
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ private final Plugin responsiblePlugin;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the plugin which is directly responsible for the exception being thrown
|
||||
+ *
|
||||
+ * @return plugin which is responsible for the exception throw
|
||||
+ */
|
||||
+ public Plugin getResponsiblePlugin() {
|
||||
+ return responsiblePlugin;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when an incoming plugin message channel throws an exception
|
||||
+ */
|
||||
+public class ServerPluginMessageException extends ServerPluginException {
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final String channel;
|
||||
+ private final byte[] data;
|
||||
+
|
||||
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the channel to which the error occurred from receiving data from
|
||||
+ *
|
||||
+ * @return exception channel
|
||||
+ */
|
||||
+ public String getChannel() {
|
||||
+ return channel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data to which the error occurred from
|
||||
+ *
|
||||
+ * @return exception data
|
||||
+ */
|
||||
+ public byte[] getData() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player which the plugin message causing the exception originated from
|
||||
+ *
|
||||
+ * @return exception player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d0b2d4a9b3e5bdeec0e4ea7ab69858d86aa3715
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
@@ -0,0 +1,37 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a plugin's scheduler fails with an exception
|
||||
+ */
|
||||
+public class ServerSchedulerException extends ServerPluginException {
|
||||
+
|
||||
+ private final BukkitTask task;
|
||||
+
|
||||
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
|
||||
+ super(message, cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
|
||||
+ super(cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the task which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing task
|
||||
+ */
|
||||
+ public BukkitTask getTask() {
|
||||
+ return task;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078cd9521a1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a tab-complete request throws an exception
|
||||
+ */
|
||||
+public class ServerTabCompleteException extends ServerCommandException {
|
||||
+
|
||||
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 36fc2c35395c72f8b81a2a2f3265fd205384ce26..c7fa1d235cea78bda4656ed66b8d42b119cc50fb 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -156,11 +156,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
} // target.timings.stopTiming(); // Spigot // Paper
|
||||
} catch (CommandException ex) {
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
|
||||
// return true as command was handled
|
||||
@@ -239,7 +242,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index e7b1895d3918487d711afcbe41d76863d85c0a62..003bece642b682985625db93cad93026352bfc66 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -528,7 +528,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
|
||||
}
|
||||
|
||||
HandlerList.bakeAll();
|
||||
@@ -551,32 +552,37 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
HandlerList.unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getMessenger().unregisterIncomingPluginChannel(plugin);
|
||||
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -589,6 +595,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void clearPlugins() {
|
||||
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
|
||||
@@ -654,7 +667,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
|
||||
+ // Paper start - error reporting
|
||||
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,569 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Mon, 29 Feb 2016 20:02:40 -0600
|
||||
Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
Co-authored-by: Fruxz <cedricspitzer@outlook.de>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..20a028450667edf102b59b6b50ac6e890f2c34ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Title.java
|
||||
@@ -0,0 +1,420 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import net.md_5.bungee.api.chat.BaseComponent;
|
||||
+import net.md_5.bungee.api.chat.TextComponent;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkArgument;
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+import static com.google.common.base.Preconditions.checkState;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a title to may be sent to a {@link Player}.
|
||||
+ *
|
||||
+ * <p>A title can be sent without subtitle text.</p>
|
||||
+ *
|
||||
+ * @deprecated use {@link net.kyori.adventure.title.Title}
|
||||
+ */
|
||||
+@Deprecated(since = "1.16.5")
|
||||
+public final class Title {
|
||||
+
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to fade in.
|
||||
+ */
|
||||
+ public static final int DEFAULT_FADE_IN = 20;
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to stay.
|
||||
+ */
|
||||
+ public static final int DEFAULT_STAY = 200;
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to fade out.
|
||||
+ */
|
||||
+ public static final int DEFAULT_FADE_OUT = 20;
|
||||
+
|
||||
+ private final BaseComponent[] title;
|
||||
+ private final BaseComponent[] subtitle;
|
||||
+ private final int fadeIn;
|
||||
+ private final int stay;
|
||||
+ private final int fadeOut;
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent[] title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull String title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent[] title, @Nullable BaseComponent[] subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull String title, @Nullable String subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ * @throws IllegalArgumentException if any of the times are negative
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ this(
|
||||
+ new BaseComponent[]{checkNotNull(title, "title")},
|
||||
+ subtitle == null ? null : new BaseComponent[]{subtitle},
|
||||
+ fadeIn,
|
||||
+ stay,
|
||||
+ fadeOut
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ * @throws IllegalArgumentException if any of the times are negative
|
||||
+ */
|
||||
+ public Title(@Nullable BaseComponent[] title, @NotNull BaseComponent[] subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
|
||||
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
|
||||
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
|
||||
+ this.title = checkNotNull(title, "title");
|
||||
+ this.subtitle = subtitle;
|
||||
+ this.fadeIn = fadeIn;
|
||||
+ this.stay = stay;
|
||||
+ this.fadeOut = fadeOut;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} constrctors.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ */
|
||||
+ public Title(@NotNull String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ this(
|
||||
+ TextComponent.fromLegacyText(checkNotNull(title, "title")),
|
||||
+ subtitle == null ? null : TextComponent.fromLegacyText(subtitle),
|
||||
+ fadeIn,
|
||||
+ stay,
|
||||
+ fadeOut
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the text of this title
|
||||
+ *
|
||||
+ * @return the text
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BaseComponent[] getTitle() {
|
||||
+ return this.title;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the text of this title's subtitle
|
||||
+ *
|
||||
+ * @return the text
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public BaseComponent[] getSubtitle() {
|
||||
+ return this.subtitle;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to fade in.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to fade in
|
||||
+ */
|
||||
+ public int getFadeIn() {
|
||||
+ return this.fadeIn;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to stay.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to stay
|
||||
+ */
|
||||
+ public int getStay() {
|
||||
+ return this.stay;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to fade out.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to fade out
|
||||
+ */
|
||||
+ public int getFadeOut() {
|
||||
+ return this.fadeOut;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to an player
|
||||
+ *
|
||||
+ * @param player the receiver of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Player player) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to the defined players
|
||||
+ *
|
||||
+ * @param players the receivers of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Collection<? extends Player> players) {
|
||||
+ for (Player player : players) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to the defined players
|
||||
+ *
|
||||
+ * @param players the receivers of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Player[] players) {
|
||||
+ for (Player player : players) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to all online players
|
||||
+ */
|
||||
+ public void broadcast() {
|
||||
+ send(Bukkit.getOnlinePlayers());
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static Builder builder() {
|
||||
+ return new Builder();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A builder for creating titles
|
||||
+ */
|
||||
+ public static final class Builder {
|
||||
+
|
||||
+ private BaseComponent[] title;
|
||||
+ private BaseComponent[] subtitle;
|
||||
+ private int fadeIn = DEFAULT_FADE_IN;
|
||||
+ private int stay = DEFAULT_STAY;
|
||||
+ private int fadeOut = DEFAULT_FADE_OUT;
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull BaseComponent title) {
|
||||
+ return this.title(new BaseComponent[]{checkNotNull(title, "title")});
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull BaseComponent[] title) {
|
||||
+ this.title = checkNotNull(title, "title");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull String title) {
|
||||
+ return this.title(TextComponent.fromLegacyText(checkNotNull(title, "title")));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable BaseComponent subtitle) {
|
||||
+ return this.subtitle(subtitle == null ? null : new BaseComponent[]{subtitle});
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable BaseComponent[] subtitle) {
|
||||
+ this.subtitle = subtitle;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable String subtitle) {
|
||||
+ return this.subtitle(subtitle == null ? null : TextComponent.fromLegacyText(subtitle));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to fade in
|
||||
+ *
|
||||
+ * @param fadeIn the number of ticks to fade in
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder fadeIn(int fadeIn) {
|
||||
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
|
||||
+ this.fadeIn = fadeIn;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to stay.
|
||||
+ *
|
||||
+ * @param stay the number of ticks to stay
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder stay(int stay) {
|
||||
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
|
||||
+ this.stay = stay;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to fade out.
|
||||
+ *
|
||||
+ * @param fadeOut the number of ticks to fade out
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder fadeOut(int fadeOut) {
|
||||
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
|
||||
+ this.fadeOut = fadeOut;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title based on the values in the builder.
|
||||
+ *
|
||||
+ * @return a title from the values in this builder
|
||||
+ * @throws IllegalStateException if title isn't specified
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Title build() {
|
||||
+ checkState(title != null, "Title not specified");
|
||||
+ return new Title(this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index f9bacbfa223826b3b54525648080fda306a1ec36..a0317801b5a41d523324c1482356f26935f6a330 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1248,6 +1248,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
spigot().sendMessage(position, components);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ * @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent[] header, @Nullable net.md_5.bungee.api.chat.BaseComponent[] footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ * @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent header, @Nullable net.md_5.bungee.api.chat.BaseComponent footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the times for titles displayed to the player
|
||||
+ *
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the subtitle of titles displayed to the player
|
||||
+ *
|
||||
+ * @param subtitle Subtitle to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the subtitle of titles displayed to the player
|
||||
+ *
|
||||
+ * @param subtitle Subtitle to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ *
|
||||
+ * @param title Title to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ *
|
||||
+ * @param title Title to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title, @Nullable net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title, @Nullable net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the title to the player, overriding any previously displayed title.
|
||||
+ *
|
||||
+ * <p>This method overrides any previous title, use {@link #updateTitle(com.destroystokyo.paper.Title)} to change the existing one.</p>
|
||||
+ *
|
||||
+ * @param title the title to send
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendTitle(@NotNull com.destroystokyo.paper.Title title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the title to the player, overriding any previously displayed title.
|
||||
+ *
|
||||
+ * <p>This method doesn't override previous titles, but changes their values.</p>
|
||||
+ *
|
||||
+ * @param title the title to send
|
||||
+ * @throws NullPointerException if title is null
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void updateTitle(@NotNull com.destroystokyo.paper.Title title);
|
||||
+
|
||||
+ /**
|
||||
+ * Hide any title that is currently visible to the player
|
||||
+ *
|
||||
+ * @deprecated use {@link #clearTitle()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void hideTitle();
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -1,83 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: mrapple <tony@oc.tc>
|
||||
Date: Sun, 25 Nov 2012 13:47:27 -0600
|
||||
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
||||
|
||||
Upstream added methods for this so the original methods
|
||||
are now deprecated
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index b5a302ba913d2de97f1bcd7c60fd5cd4f245d275..cafa79f80eec5ec6d8d31d40cc2b46acc06831f9 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -243,12 +243,44 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
public int getArrowsInBody();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the amount of arrows in the entity's body.
|
||||
+ * <p>
|
||||
+ * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}.
|
||||
+ *
|
||||
+ * @param count amount of arrows in entity's body
|
||||
+ */
|
||||
+ default void setArrowsInBody(final int count) {
|
||||
+ this.setArrowsInBody(count, false);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Set the amount of arrows in the entity's body.
|
||||
*
|
||||
* @param count amount of arrows in entity's body
|
||||
+ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event
|
||||
*/
|
||||
- public void setArrowsInBody(int count);
|
||||
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
|
||||
+
|
||||
+ // Paper start - Add methods for working with arrows stuck in living entities
|
||||
+ /**
|
||||
+ * Sets the amount of ticks before the next arrow gets removed from the entities body.
|
||||
+ * <p>
|
||||
+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
|
||||
+ *
|
||||
+ * @param ticks Amount of ticks
|
||||
+ */
|
||||
+ void setNextArrowRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the amount of ticks before the next arrow gets removed from the entities body.
|
||||
+ *
|
||||
+ * @return ticks Amount of ticks
|
||||
+ */
|
||||
+ int getNextArrowRemoval();
|
||||
+ // Paper end - Add methods for working with arrows stuck in living entities
|
||||
|
||||
/**
|
||||
* Returns the living entity's current maximum no damage ticks.
|
||||
@@ -787,4 +819,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @return Whether the entity is invisible
|
||||
*/
|
||||
public boolean isInvisible();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the number of arrows stuck in this entity
|
||||
+ * @return Number of arrows stuck
|
||||
+ * @deprecated use {@link #getArrowsInBody()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ int getArrowsStuck();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the number of arrows stuck in this entity
|
||||
+ *
|
||||
+ * @param arrows Number of arrows to stick in this entity
|
||||
+ * @deprecated use {@link #setArrowsInBody(int, boolean)}. <b>This method previously fired {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} so if
|
||||
+ * you want to retain exact functionality, pass {@code true} for {@code fireEvent}.</b>
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setArrowsStuck(int arrows);
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 4 Apr 2015 22:59:54 -0400
|
||||
Subject: [PATCH] Complete resource pack API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index a0317801b5a41d523324c1482356f26935f6a330..47c792202e8cc6d97fcb5e9bed98d327ecc5ab2b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2212,6 +2212,180 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - more resource pack API
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash) {
|
||||
+ this.setResourcePack(url, hash, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash, final boolean required) {
|
||||
+ this.setResourcePack(url, hash, required, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @param resourcePackPrompt A Prompt to be displayed in the client request
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash, final boolean required, final net.kyori.adventure.text.@Nullable Component resourcePackPrompt) {
|
||||
+ this.setResourcePack(UUID.nameUUIDFromBytes(url.getBytes(java.nio.charset.StandardCharsets.UTF_8)), url, hash, resourcePackPrompt, required);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param uuid Unique resource pack ID.
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param resourcePackPrompt A Prompt to be displayed in the client request
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull UUID uuid, final @NotNull String url, final @NotNull String hash, final net.kyori.adventure.text.@Nullable Component resourcePackPrompt, final boolean required) {
|
||||
+ this.sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest.resourcePackRequest()
|
||||
+ .required(required)
|
||||
+ .replace(true)
|
||||
+ .prompt(resourcePackPrompt)
|
||||
+ .packs(net.kyori.adventure.resource.ResourcePackInfo.resourcePackInfo(uuid, java.net.URI.create(url), hash))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the most recent resource pack status from the player.
|
||||
+ *
|
||||
+ * @return the most recent status or null
|
||||
+ */
|
||||
+ org.bukkit.event.player.PlayerResourcePackStatusEvent.@Nullable Status getResourcePackStatus();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the most recent pack hash from the player.
|
||||
+ *
|
||||
+ * @return the most recent hash or null
|
||||
+ * @deprecated This is no longer sent from the client and will always be null
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.13.2")
|
||||
+ @org.jetbrains.annotations.Contract("-> null")
|
||||
+ default @Nullable String getResourcePackHash() {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the last resource pack status from the player
|
||||
+ * was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}.
|
||||
+ *
|
||||
+ * @return true if last status was successfully loaded
|
||||
+ */
|
||||
+ default boolean hasResourcePack() {
|
||||
+ return this.getResourcePackStatus() == org.bukkit.event.player.PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED;
|
||||
+ }
|
||||
+ // Paper end - more resource pack API
|
||||
+
|
||||
/**
|
||||
* Request that the player's client download and include another resource pack.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
index e2c4f9a0456cef345772d57b4d9c6e7d9598dd53..e4c32b21ab013703a6a1b07a1ad564d914ebe83f 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
@@ -21,6 +21,16 @@ public class PlayerResourcePackStatusEvent extends PlayerEvent {
|
||||
this.status = resourcePackStatus;
|
||||
}
|
||||
|
||||
+ // Paper start - add hash (not used anymore)
|
||||
+ /**
|
||||
+ * @deprecated Hash does not seem to ever be set
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public String getHash() {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the unique ID of this pack.
|
||||
*
|
569
patches/api/0026-Player-Tab-List-and-Title-APIs.patch
Normal file
569
patches/api/0026-Player-Tab-List-and-Title-APIs.patch
Normal file
|
@ -0,0 +1,569 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Mon, 29 Feb 2016 20:02:40 -0600
|
||||
Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
Co-authored-by: Fruxz <cedricspitzer@outlook.de>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..20a028450667edf102b59b6b50ac6e890f2c34ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Title.java
|
||||
@@ -0,0 +1,420 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import net.md_5.bungee.api.chat.BaseComponent;
|
||||
+import net.md_5.bungee.api.chat.TextComponent;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkArgument;
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+import static com.google.common.base.Preconditions.checkState;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a title to may be sent to a {@link Player}.
|
||||
+ *
|
||||
+ * <p>A title can be sent without subtitle text.</p>
|
||||
+ *
|
||||
+ * @deprecated use {@link net.kyori.adventure.title.Title}
|
||||
+ */
|
||||
+@Deprecated(since = "1.16.5")
|
||||
+public final class Title {
|
||||
+
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to fade in.
|
||||
+ */
|
||||
+ public static final int DEFAULT_FADE_IN = 20;
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to stay.
|
||||
+ */
|
||||
+ public static final int DEFAULT_STAY = 200;
|
||||
+ /**
|
||||
+ * The default number of ticks for the title to fade out.
|
||||
+ */
|
||||
+ public static final int DEFAULT_FADE_OUT = 20;
|
||||
+
|
||||
+ private final BaseComponent[] title;
|
||||
+ private final BaseComponent[] subtitle;
|
||||
+ private final int fadeIn;
|
||||
+ private final int stay;
|
||||
+ private final int fadeOut;
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent[] title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values and no subtitle.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ public Title(@NotNull String title) {
|
||||
+ this(title, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent[] title, @Nullable BaseComponent[] subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title with the default time values.
|
||||
+ *
|
||||
+ * <p>Times use default values.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ */
|
||||
+ public Title(@NotNull String title, @Nullable String subtitle) {
|
||||
+ this(title, subtitle, DEFAULT_FADE_IN, DEFAULT_STAY, DEFAULT_FADE_OUT);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ * @throws IllegalArgumentException if any of the times are negative
|
||||
+ */
|
||||
+ public Title(@NotNull BaseComponent title, @Nullable BaseComponent subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ this(
|
||||
+ new BaseComponent[]{checkNotNull(title, "title")},
|
||||
+ subtitle == null ? null : new BaseComponent[]{subtitle},
|
||||
+ fadeIn,
|
||||
+ stay,
|
||||
+ fadeOut
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ * @throws IllegalArgumentException if any of the times are negative
|
||||
+ */
|
||||
+ public Title(@Nullable BaseComponent[] title, @NotNull BaseComponent[] subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
|
||||
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
|
||||
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
|
||||
+ this.title = checkNotNull(title, "title");
|
||||
+ this.subtitle = subtitle;
|
||||
+ this.fadeIn = fadeIn;
|
||||
+ this.stay = stay;
|
||||
+ this.fadeOut = fadeOut;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new title.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} constrctors.</p>
|
||||
+ *
|
||||
+ * @param title the main text of the title
|
||||
+ * @param subtitle the secondary text of the title
|
||||
+ * @param fadeIn the number of ticks for the title to fade in
|
||||
+ * @param stay the number of ticks for the title to stay on screen
|
||||
+ * @param fadeOut the number of ticks for the title to fade out
|
||||
+ */
|
||||
+ public Title(@NotNull String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
+ this(
|
||||
+ TextComponent.fromLegacyText(checkNotNull(title, "title")),
|
||||
+ subtitle == null ? null : TextComponent.fromLegacyText(subtitle),
|
||||
+ fadeIn,
|
||||
+ stay,
|
||||
+ fadeOut
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the text of this title
|
||||
+ *
|
||||
+ * @return the text
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BaseComponent[] getTitle() {
|
||||
+ return this.title;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the text of this title's subtitle
|
||||
+ *
|
||||
+ * @return the text
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public BaseComponent[] getSubtitle() {
|
||||
+ return this.subtitle;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to fade in.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to fade in
|
||||
+ */
|
||||
+ public int getFadeIn() {
|
||||
+ return this.fadeIn;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to stay.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to stay
|
||||
+ */
|
||||
+ public int getStay() {
|
||||
+ return this.stay;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks to fade out.
|
||||
+ *
|
||||
+ * <p>The returned value is never negative.</p>
|
||||
+ *
|
||||
+ * @return the number of ticks to fade out
|
||||
+ */
|
||||
+ public int getFadeOut() {
|
||||
+ return this.fadeOut;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to an player
|
||||
+ *
|
||||
+ * @param player the receiver of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Player player) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to the defined players
|
||||
+ *
|
||||
+ * @param players the receivers of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Collection<? extends Player> players) {
|
||||
+ for (Player player : players) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to the defined players
|
||||
+ *
|
||||
+ * @param players the receivers of the title
|
||||
+ */
|
||||
+ public void send(@NotNull Player[] players) {
|
||||
+ for (Player player : players) {
|
||||
+ player.sendTitle(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the title directly to all online players
|
||||
+ */
|
||||
+ public void broadcast() {
|
||||
+ send(Bukkit.getOnlinePlayers());
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static Builder builder() {
|
||||
+ return new Builder();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A builder for creating titles
|
||||
+ */
|
||||
+ public static final class Builder {
|
||||
+
|
||||
+ private BaseComponent[] title;
|
||||
+ private BaseComponent[] subtitle;
|
||||
+ private int fadeIn = DEFAULT_FADE_IN;
|
||||
+ private int stay = DEFAULT_STAY;
|
||||
+ private int fadeOut = DEFAULT_FADE_OUT;
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull BaseComponent title) {
|
||||
+ return this.title(new BaseComponent[]{checkNotNull(title, "title")});
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull BaseComponent[] title) {
|
||||
+ this.title = checkNotNull(title, "title");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the title to the given text.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
|
||||
+ *
|
||||
+ * @param title the title text
|
||||
+ * @return this builder instance
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder title(@NotNull String title) {
|
||||
+ return this.title(TextComponent.fromLegacyText(checkNotNull(title, "title")));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable BaseComponent subtitle) {
|
||||
+ return this.subtitle(subtitle == null ? null : new BaseComponent[]{subtitle});
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable BaseComponent[] subtitle) {
|
||||
+ this.subtitle = subtitle;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the subtitle to the given text.
|
||||
+ *
|
||||
+ * <p>It is recommended to the {@link BaseComponent} methods.</p>
|
||||
+ *
|
||||
+ * @param subtitle the title text
|
||||
+ * @return this builder instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder subtitle(@Nullable String subtitle) {
|
||||
+ return this.subtitle(subtitle == null ? null : TextComponent.fromLegacyText(subtitle));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to fade in
|
||||
+ *
|
||||
+ * @param fadeIn the number of ticks to fade in
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder fadeIn(int fadeIn) {
|
||||
+ checkArgument(fadeIn >= 0, "Negative fadeIn: %s", fadeIn);
|
||||
+ this.fadeIn = fadeIn;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to stay.
|
||||
+ *
|
||||
+ * @param stay the number of ticks to stay
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder stay(int stay) {
|
||||
+ checkArgument(stay >= 0, "Negative stay: %s", stay);
|
||||
+ this.stay = stay;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of ticks for the title to fade out.
|
||||
+ *
|
||||
+ * @param fadeOut the number of ticks to fade out
|
||||
+ * @return this builder instance
|
||||
+ * @throws IllegalArgumentException if it is negative
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder fadeOut(int fadeOut) {
|
||||
+ checkArgument(fadeOut >= 0, "Negative fadeOut: %s", fadeOut);
|
||||
+ this.fadeOut = fadeOut;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a title based on the values in the builder.
|
||||
+ *
|
||||
+ * @return a title from the values in this builder
|
||||
+ * @throws IllegalStateException if title isn't specified
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Title build() {
|
||||
+ checkState(title != null, "Title not specified");
|
||||
+ return new Title(this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 881c75e84ef31390a3519549985af2711e2828b5..fc8c807ae9793452bbf3fbab5e72d05676e6fa83 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1250,6 +1250,131 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
spigot().sendMessage(position, components);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ * @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent[] header, @Nullable net.md_5.bungee.api.chat.BaseComponent[] footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ * @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setPlayerListHeaderFooter(@Nullable net.md_5.bungee.api.chat.BaseComponent header, @Nullable net.md_5.bungee.api.chat.BaseComponent footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the times for titles displayed to the player
|
||||
+ *
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the subtitle of titles displayed to the player
|
||||
+ *
|
||||
+ * @param subtitle Subtitle to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Update the subtitle of titles displayed to the player
|
||||
+ *
|
||||
+ * @param subtitle Subtitle to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ *
|
||||
+ * @param title Title to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ *
|
||||
+ * @param title Title to set
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] title, @Nullable net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void showTitle(@Nullable net.md_5.bungee.api.chat.BaseComponent title, @Nullable net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the title to the player, overriding any previously displayed title.
|
||||
+ *
|
||||
+ * <p>This method overrides any previous title, use {@link #updateTitle(com.destroystokyo.paper.Title)} to change the existing one.</p>
|
||||
+ *
|
||||
+ * @param title the title to send
|
||||
+ * @throws NullPointerException if the title is null
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendTitle(@NotNull com.destroystokyo.paper.Title title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the title to the player, overriding any previously displayed title.
|
||||
+ *
|
||||
+ * <p>This method doesn't override previous titles, but changes their values.</p>
|
||||
+ *
|
||||
+ * @param title the title to send
|
||||
+ * @throws NullPointerException if title is null
|
||||
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void updateTitle(@NotNull com.destroystokyo.paper.Title title);
|
||||
+
|
||||
+ /**
|
||||
+ * Hide any title that is currently visible to the player
|
||||
+ *
|
||||
+ * @deprecated use {@link #clearTitle()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void hideTitle();
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -0,0 +1,83 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: mrapple <tony@oc.tc>
|
||||
Date: Sun, 25 Nov 2012 13:47:27 -0600
|
||||
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
||||
|
||||
Upstream added methods for this so the original methods
|
||||
are now deprecated
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 67115810d5e837f154c3accd92dbb5e4192d264f..32e89741ffd895e31af0104a0126c2f72742a1bb 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -243,12 +243,44 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
public int getArrowsInBody();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the amount of arrows in the entity's body.
|
||||
+ * <p>
|
||||
+ * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}.
|
||||
+ *
|
||||
+ * @param count amount of arrows in entity's body
|
||||
+ */
|
||||
+ default void setArrowsInBody(final int count) {
|
||||
+ this.setArrowsInBody(count, false);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Set the amount of arrows in the entity's body.
|
||||
*
|
||||
* @param count amount of arrows in entity's body
|
||||
+ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event
|
||||
*/
|
||||
- public void setArrowsInBody(int count);
|
||||
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
|
||||
+
|
||||
+ // Paper start - Add methods for working with arrows stuck in living entities
|
||||
+ /**
|
||||
+ * Sets the amount of ticks before the next arrow gets removed from the entities body.
|
||||
+ * <p>
|
||||
+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick.
|
||||
+ *
|
||||
+ * @param ticks Amount of ticks
|
||||
+ */
|
||||
+ void setNextArrowRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the amount of ticks before the next arrow gets removed from the entities body.
|
||||
+ *
|
||||
+ * @return ticks Amount of ticks
|
||||
+ */
|
||||
+ int getNextArrowRemoval();
|
||||
+ // Paper end - Add methods for working with arrows stuck in living entities
|
||||
|
||||
/**
|
||||
* Returns the living entity's current maximum no damage ticks.
|
||||
@@ -777,4 +809,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @return Whether the entity is invisible
|
||||
*/
|
||||
public boolean isInvisible();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the number of arrows stuck in this entity
|
||||
+ * @return Number of arrows stuck
|
||||
+ * @deprecated use {@link #getArrowsInBody()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ int getArrowsStuck();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the number of arrows stuck in this entity
|
||||
+ *
|
||||
+ * @param arrows Number of arrows to stick in this entity
|
||||
+ * @deprecated use {@link #setArrowsInBody(int, boolean)}. <b>This method previously fired {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} so if
|
||||
+ * you want to retain exact functionality, pass {@code true} for {@code fireEvent}.</b>
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setArrowsStuck(int arrows);
|
||||
+ // Paper end
|
||||
}
|
212
patches/api/0028-Complete-resource-pack-API.patch
Normal file
212
patches/api/0028-Complete-resource-pack-API.patch
Normal file
|
@ -0,0 +1,212 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 4 Apr 2015 22:59:54 -0400
|
||||
Subject: [PATCH] Complete resource pack API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index fc8c807ae9793452bbf3fbab5e72d05676e6fa83..93ff1e91c41273aa1b1cffe7c15b546f3a44d6b7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2207,6 +2207,180 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - more resource pack API
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash) {
|
||||
+ this.setResourcePack(url, hash, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash, final boolean required) {
|
||||
+ this.setResourcePack(url, hash, required, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @param resourcePackPrompt A Prompt to be displayed in the client request
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull String url, final @NotNull String hash, final boolean required, final net.kyori.adventure.text.@Nullable Component resourcePackPrompt) {
|
||||
+ this.setResourcePack(UUID.nameUUIDFromBytes(url.getBytes(java.nio.charset.StandardCharsets.UTF_8)), url, hash, resourcePackPrompt, required);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached the same
|
||||
+ * resource pack in the past, it will perform a quick timestamp check
|
||||
+ * over the network to determine if the resource pack has changed and
|
||||
+ * needs to be downloaded again. When this request is sent for the very
|
||||
+ * first time from a given server, the client will first display a
|
||||
+ * confirmation GUI to the player before proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them.
|
||||
+ * <li>To remove a resource pack you can use
|
||||
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param uuid Unique resource pack ID.
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash A 40 character hexadecimal and lowercase SHA-1 digest of
|
||||
+ * the resource pack file.
|
||||
+ * @param resourcePackPrompt A Prompt to be displayed in the client request
|
||||
+ * @param required Marks if the resource pack should be required by the client
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ */
|
||||
+ default void setResourcePack(final @NotNull UUID uuid, final @NotNull String url, final @NotNull String hash, final net.kyori.adventure.text.@Nullable Component resourcePackPrompt, final boolean required) {
|
||||
+ this.sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest.resourcePackRequest()
|
||||
+ .required(required)
|
||||
+ .replace(true)
|
||||
+ .prompt(resourcePackPrompt)
|
||||
+ .packs(net.kyori.adventure.resource.ResourcePackInfo.resourcePackInfo(uuid, java.net.URI.create(url), hash))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the most recent resource pack status from the player.
|
||||
+ *
|
||||
+ * @return the most recent status or null
|
||||
+ */
|
||||
+ org.bukkit.event.player.PlayerResourcePackStatusEvent.@Nullable Status getResourcePackStatus();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the most recent pack hash from the player.
|
||||
+ *
|
||||
+ * @return the most recent hash or null
|
||||
+ * @deprecated This is no longer sent from the client and will always be null
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.13.2")
|
||||
+ @org.jetbrains.annotations.Contract("-> null")
|
||||
+ default @Nullable String getResourcePackHash() {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the last resource pack status from the player
|
||||
+ * was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}.
|
||||
+ *
|
||||
+ * @return true if last status was successfully loaded
|
||||
+ */
|
||||
+ default boolean hasResourcePack() {
|
||||
+ return this.getResourcePackStatus() == org.bukkit.event.player.PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED;
|
||||
+ }
|
||||
+ // Paper end - more resource pack API
|
||||
+
|
||||
/**
|
||||
* Request that the player's client download and include another resource pack.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
index e2c4f9a0456cef345772d57b4d9c6e7d9598dd53..e4c32b21ab013703a6a1b07a1ad564d914ebe83f 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
||||
@@ -21,6 +21,16 @@ public class PlayerResourcePackStatusEvent extends PlayerEvent {
|
||||
this.status = resourcePackStatus;
|
||||
}
|
||||
|
||||
+ // Paper start - add hash (not used anymore)
|
||||
+ /**
|
||||
+ * @deprecated Hash does not seem to ever be set
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public String getHash() {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the unique ID of this pack.
|
||||
*
|
|
@ -1,86 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William <admin@domnian.com>
|
||||
Date: Fri, 18 Mar 2016 03:28:07 -0400
|
||||
Subject: [PATCH] Add command to reload permissions.yml and require confirm to
|
||||
reload
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index bd3fa2bcee24ab7e8f740722f55ed6294fdb294a..d9f84c4a5bc5609e7d9fd0970696a46a32f3f5ff 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2372,6 +2372,13 @@ public final class Bukkit {
|
||||
public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
return server.getCommandMap();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Reload the Permissions in permissions.yml
|
||||
+ */
|
||||
+ public static void reloadPermissions() {
|
||||
+ server.reloadPermissions();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 067eb3a5f5676f3b1b3f49a65df9c4054c48a1e7..990d0d02d1bd95886126efe08e8107322e3199d5 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2078,4 +2078,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
Spigot spigot();
|
||||
// Spigot end
|
||||
+
|
||||
+ void reloadPermissions(); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..5fa9d648bc780e874f658597f1a24715bccac5cb 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -13,15 +13,35 @@ public class ReloadCommand extends BukkitCommand {
|
||||
public ReloadCommand(@NotNull String name) {
|
||||
super(name);
|
||||
this.description = "Reloads the server configuration and plugins";
|
||||
- this.usageMessage = "/reload";
|
||||
+ this.usageMessage = "/reload [permissions]"; // Paper
|
||||
this.setPermission("bukkit.command.reload");
|
||||
this.setAliases(Arrays.asList("rl"));
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
+ // Paper start - Reload permissions.yml & require confirm
|
||||
+ boolean confirmed = System.getProperty("LetMeReload") != null;
|
||||
+ if (args.length == 1) {
|
||||
+ if (args[0].equalsIgnoreCase("permissions")) {
|
||||
+ Bukkit.getServer().reloadPermissions();
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Permissions successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN));
|
||||
+ return true;
|
||||
+ } else if ("confirm".equalsIgnoreCase(args[0])) {
|
||||
+ confirmed = true;
|
||||
+ } else {
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!confirmed) {
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Are you sure you wish to reload your server? Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /reload. To confirm, please type ", net.kyori.adventure.text.format.NamedTextColor.RED).append(net.kyori.adventure.text.Component.text("/reload confirm", net.kyori.adventure.text.format.NamedTextColor.YELLOW)));
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins.");
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
Bukkit.reload();
|
||||
@@ -33,6 +53,6 @@ public class ReloadCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
|
||||
- return Collections.emptyList();
|
||||
+ return java.util.Collections.singletonList("permissions"); // Paper
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William <admin@domnian.com>
|
||||
Date: Fri, 18 Mar 2016 03:28:07 -0400
|
||||
Subject: [PATCH] Add command to reload permissions.yml and require confirm to
|
||||
reload
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 25f506c344883d00a63ee2b5a998d3ff3ffd6cd5..8dc5b43e937405070d9bdbd914fcdec243e59983 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2357,6 +2357,13 @@ public final class Bukkit {
|
||||
public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
return server.getCommandMap();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Reload the Permissions in permissions.yml
|
||||
+ */
|
||||
+ public static void reloadPermissions() {
|
||||
+ server.reloadPermissions();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 65d68716e1ff8277c534399621cf961ddf312509..47766c5312a402e3329a1d4bc5e5e0c05f2b007f 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2065,4 +2065,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
Spigot spigot();
|
||||
// Spigot end
|
||||
+
|
||||
+ void reloadPermissions(); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..5fa9d648bc780e874f658597f1a24715bccac5cb 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -13,15 +13,35 @@ public class ReloadCommand extends BukkitCommand {
|
||||
public ReloadCommand(@NotNull String name) {
|
||||
super(name);
|
||||
this.description = "Reloads the server configuration and plugins";
|
||||
- this.usageMessage = "/reload";
|
||||
+ this.usageMessage = "/reload [permissions]"; // Paper
|
||||
this.setPermission("bukkit.command.reload");
|
||||
this.setAliases(Arrays.asList("rl"));
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
+ // Paper start - Reload permissions.yml & require confirm
|
||||
+ boolean confirmed = System.getProperty("LetMeReload") != null;
|
||||
+ if (args.length == 1) {
|
||||
+ if (args[0].equalsIgnoreCase("permissions")) {
|
||||
+ Bukkit.getServer().reloadPermissions();
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Permissions successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN));
|
||||
+ return true;
|
||||
+ } else if ("confirm".equalsIgnoreCase(args[0])) {
|
||||
+ confirmed = true;
|
||||
+ } else {
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!confirmed) {
|
||||
+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Are you sure you wish to reload your server? Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /reload. To confirm, please type ", net.kyori.adventure.text.format.NamedTextColor.RED).append(net.kyori.adventure.text.Component.text("/reload confirm", net.kyori.adventure.text.format.NamedTextColor.YELLOW)));
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins.");
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
Bukkit.reload();
|
||||
@@ -33,6 +53,6 @@ public class ReloadCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
|
||||
- return Collections.emptyList();
|
||||
+ return java.util.Collections.singletonList("permissions"); // Paper
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:26:34 -0400
|
||||
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..11f8540a4752cf4d2112eff48bcca3b935c9f8b1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
@@ -0,0 +1,44 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being added to the world for any reason (including a chunk loading).
|
||||
+ * <p>
|
||||
+ * Not to be confused with {@link CreatureSpawnEvent}
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityAddToWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityAddToWorldEvent(final Entity entity, final World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The world that the entity is being added to
|
||||
+ */
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5ad5632d4d47d8b42e4f2af19c0fe6cf94ac5643
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being removed from a world for any reason (including a chunk unloading).
|
||||
+ * Note: The entity is updated prior to this event being called, as such, the entity's world may not be equal to {@link #getWorld()}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityRemoveFromWorldEvent(final Entity entity, final World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The world that the entity is being removed from
|
||||
+ */
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
index e32df91d911bae42c8137c6f952a6ac6a94d27e0..8ed5d1ccc44951089999db360219b556db89b4ba 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
+import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -11,8 +12,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* This event should only be used for monitoring. The result
|
||||
* of modifying the entity during or after this event is unspecified.
|
||||
* This event is not called for a {@link org.bukkit.entity.Player}.
|
||||
+ * @deprecated use {@link EntityRemoveFromWorldEvent} instead
|
||||
*/
|
||||
-@ApiStatus.Experimental
|
||||
+@Deprecated(forRemoval = true)
|
||||
public class EntityRemoveEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -112,5 +114,6 @@ public class EntityRemoveEvent extends EntityEvent {
|
||||
* When the chunk an entity is in gets unloaded.
|
||||
*/
|
||||
UNLOAD,
|
||||
+ DISCARD
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 21:15:34 -0400
|
||||
Subject: [PATCH] EntityPathfindEvent
|
||||
|
||||
Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8624e0a528985c9b118f5e8a0f33d3286af2fc36
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
@@ -0,0 +1,84 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity decides to start moving towards a location.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entities actual movement. Only when it
|
||||
+ * is choosing to start moving to a location.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityPathfindEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final @Nullable Entity targetEntity;
|
||||
+ private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPathfindEvent(final Entity entity, final Location location, final @Nullable Entity targetEntity) {
|
||||
+ super(entity);
|
||||
+ this.targetEntity = targetEntity;
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Entity that is pathfinding.
|
||||
+ *
|
||||
+ * @return The Entity that is pathfinding.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If the Entity is trying to pathfind to an entity, this is the entity in relation.
|
||||
+ * <br>
|
||||
+ * Otherwise, this will return {@code null}.
|
||||
+ *
|
||||
+ * @return The entity target or {@code null}
|
||||
+ */
|
||||
+ public @Nullable Entity getTargetEntity() {
|
||||
+ return this.targetEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Location of where the entity is about to move to.
|
||||
+ * <br>
|
||||
+ * Note that if the target happened to of been an entity
|
||||
+ *
|
||||
+ * @return Location of where the entity is trying to pathfind to.
|
||||
+ */
|
||||
+ public Location getLoc() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
135
patches/api/0033-Entity-AddTo-RemoveFrom-World-Events.patch
Normal file
135
patches/api/0033-Entity-AddTo-RemoveFrom-World-Events.patch
Normal file
|
@ -0,0 +1,135 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:26:34 -0400
|
||||
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1d8e3c93a139bba11affca74b742269f24300d2c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being added to the world for any reason (including a chunk loading).
|
||||
+ * <p>
|
||||
+ * Not to be confused with {@link CreatureSpawnEvent}
|
||||
+ */
|
||||
+public class EntityAddToWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityAddToWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The world that the entity is being added to
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d75e6a8334c7408ea8c3f155414fc14dc427f190
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityRemoveFromWorldEvent.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being removed from a world for any reason (including a chunk unloading).
|
||||
+ * Note: The entity is updated prior to this event being called, as such, the entity's world may not be equal to {@link #getWorld()}.
|
||||
+ */
|
||||
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The world that the entity is being removed from
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
index e32df91d911bae42c8137c6f952a6ac6a94d27e0..8ed5d1ccc44951089999db360219b556db89b4ba 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityRemoveEvent.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
+import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -11,8 +12,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* This event should only be used for monitoring. The result
|
||||
* of modifying the entity during or after this event is unspecified.
|
||||
* This event is not called for a {@link org.bukkit.entity.Player}.
|
||||
+ * @deprecated use {@link EntityRemoveFromWorldEvent} instead
|
||||
*/
|
||||
-@ApiStatus.Experimental
|
||||
+@Deprecated(forRemoval = true)
|
||||
public class EntityRemoveEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -112,5 +114,6 @@ public class EntityRemoveEvent extends EntityEvent {
|
||||
* When the chunk an entity is in gets unloaded.
|
||||
*/
|
||||
UNLOAD,
|
||||
+ DISCARD
|
||||
}
|
||||
}
|
100
patches/api/0034-EntityPathfindEvent.patch
Normal file
100
patches/api/0034-EntityPathfindEvent.patch
Normal file
|
@ -0,0 +1,100 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 21:15:34 -0400
|
||||
Subject: [PATCH] EntityPathfindEvent
|
||||
|
||||
Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8267e8f1f0ade29a284831069e1268ee4b29e109
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityPathfindEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity decides to start moving towards a location.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entities actual movement. Only when it
|
||||
+ * is choosing to start moving to a location.
|
||||
+ */
|
||||
+public class EntityPathfindEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private final Entity targetEntity;
|
||||
+ @NotNull private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPathfindEvent(@NotNull Entity entity, @NotNull Location location, @Nullable Entity targetEntity) {
|
||||
+ super(entity);
|
||||
+ this.targetEntity = targetEntity;
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Entity that is pathfinding.
|
||||
+ *
|
||||
+ * @return The Entity that is pathfinding.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If the Entity is trying to pathfind to an entity, this is the entity in relation.
|
||||
+ * <br>
|
||||
+ * Otherwise this will return {@code null}.
|
||||
+ *
|
||||
+ * @return The entity target or {@code null}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getTargetEntity() {
|
||||
+ return this.targetEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Location of where the entity is about to move to.
|
||||
+ * <br>
|
||||
+ * Note that if the target happened to of been an entity
|
||||
+ *
|
||||
+ * @return Location of where the entity is trying to pathfind to.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLoc() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,101 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 05:08:36 -0400
|
||||
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
||||
|
||||
Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with
|
||||
virtual entities/entities that are not actually known to the server.
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9ff2bbf7f99df45cc626cad60bec4d14a8a04e3e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
@@ -0,0 +1,85 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an event that is called when a player right-clicks an unknown entity.
|
||||
+ * Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
|
||||
+ * <br>
|
||||
+ * This event may be called multiple times per interaction with different interaction hands
|
||||
+ * and with or without the clicked position.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int entityId;
|
||||
+ private final boolean attack;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private final @Nullable Vector clickedPosition;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerUseUnknownEntityEvent(final Player player, final int entityId, final boolean attack, final EquipmentSlot hand, final @Nullable Vector clickedPosition) {
|
||||
+ super(player);
|
||||
+ this.entityId = entityId;
|
||||
+ this.attack = attack;
|
||||
+ this.hand = hand;
|
||||
+ this.clickedPosition = clickedPosition;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity id of the unknown entity that was interacted with.
|
||||
+ *
|
||||
+ * @return the entity id of the entity that was interacted with
|
||||
+ */
|
||||
+ public int getEntityId() {
|
||||
+ return this.entityId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the interaction was an attack.
|
||||
+ *
|
||||
+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity
|
||||
+ */
|
||||
+ public boolean isAttack() {
|
||||
+ return this.attack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the hand used to perform this interaction.
|
||||
+ *
|
||||
+ * @return the hand used to interact
|
||||
+ */
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the position relative to the entity that was clicked, or {@code null} if not available.
|
||||
+ * See {@link PlayerInteractAtEntityEvent} for more details.
|
||||
+ *
|
||||
+ * @return the position relative to the entity that was clicked, or {@code null} if not available
|
||||
+ * @see PlayerInteractAtEntityEvent
|
||||
+ */
|
||||
+ public @Nullable Vector getClickedRelativePosition() {
|
||||
+ return this.clickedPosition != null ? this.clickedPosition.clone() : null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,270 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 13 Apr 2016 20:20:18 -0700
|
||||
Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
handshaking logic themselves
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aea04fb357f5728195fd9c9bdcd6304a0b953c45
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -0,0 +1,257 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import java.util.UUID;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired during a player handshake.
|
||||
+ * <p>
|
||||
+ * If there are no listeners listening to this event, the logic default
|
||||
+ * to your server platform will be run.
|
||||
+ *
|
||||
+ * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String originalHandshake;
|
||||
+ private final String originalSocketAddressHostname;
|
||||
+ private @Nullable String serverHostname;
|
||||
+ private @Nullable String socketAddressHostname;
|
||||
+ private @Nullable UUID uniqueId;
|
||||
+ private @Nullable String propertiesJson;
|
||||
+ private boolean failed;
|
||||
+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW);
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(final String originalHandshake, final boolean cancelled) {
|
||||
+ this(originalHandshake, "127.0.0.1", cancelled);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(final String originalHandshake, final String originalSocketAddressHostname, final boolean cancelled) {
|
||||
+ super(true);
|
||||
+ this.originalHandshake = originalHandshake;
|
||||
+ this.originalSocketAddressHostname = originalSocketAddressHostname;
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if this event is cancelled.
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * @return {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this event is cancelled.
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * @param cancel {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original handshake string.
|
||||
+ *
|
||||
+ * @return the original handshake string
|
||||
+ */
|
||||
+ public String getOriginalHandshake() {
|
||||
+ return this.originalHandshake;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original socket address hostname.
|
||||
+ *
|
||||
+ * <p>This does not include the port.</p>
|
||||
+ * <p>In cases where this event is manually fired and the plugin wasn't updated yet, the default is {@code "127.0.0.1"}.</p>
|
||||
+ *
|
||||
+ * @return the original socket address hostname
|
||||
+ */
|
||||
+ public String getOriginalSocketAddressHostname() {
|
||||
+ return this.originalSocketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the server hostname string
|
||||
+ */
|
||||
+ public @Nullable String getServerHostname() {
|
||||
+ return this.serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param serverHostname the server hostname string
|
||||
+ */
|
||||
+ public void setServerHostname(final String serverHostname) {
|
||||
+ this.serverHostname = serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the socket address hostname string
|
||||
+ */
|
||||
+ public @Nullable String getSocketAddressHostname() {
|
||||
+ return this.socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param socketAddressHostname the socket address hostname string
|
||||
+ */
|
||||
+ public void setSocketAddressHostname(final String socketAddressHostname) {
|
||||
+ this.socketAddressHostname = socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the unique id.
|
||||
+ *
|
||||
+ * @return the unique id
|
||||
+ */
|
||||
+ public @Nullable UUID getUniqueId() {
|
||||
+ return this.uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the unique id.
|
||||
+ *
|
||||
+ * @param uniqueId the unique id
|
||||
+ */
|
||||
+ public void setUniqueId(final UUID uniqueId) {
|
||||
+ this.uniqueId = uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @return the profile properties, as JSON
|
||||
+ */
|
||||
+ public @Nullable String getPropertiesJson() {
|
||||
+ return this.propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if authentication failed.
|
||||
+ * <p>
|
||||
+ * When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.
|
||||
+ *
|
||||
+ * @return {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public boolean isFailed() {
|
||||
+ return this.failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if authentication failed and the client should be disconnected.
|
||||
+ * <p>
|
||||
+ * When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.
|
||||
+ *
|
||||
+ * @param failed {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public void setFailed(final boolean failed) {
|
||||
+ this.failed = failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @param propertiesJson the profile properties, as JSON
|
||||
+ */
|
||||
+ public void setPropertiesJson(final String propertiesJson) {
|
||||
+ this.propertiesJson = propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ */
|
||||
+ public Component failMessage() {
|
||||
+ return this.failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ */
|
||||
+ public void failMessage(final Component failMessage) {
|
||||
+ this.failMessage = failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public String getFailMessage() {
|
||||
+ return LegacyComponentSerializer.legacySection().serialize(this.failMessage());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setFailMessage(final String failMessage) {
|
||||
+ Preconditions.checkArgument(failMessage != null && !failMessage.isEmpty(), "fail message cannot be null or empty");
|
||||
+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
102
patches/api/0037-Add-PlayerUseUnknownEntityEvent.patch
Normal file
102
patches/api/0037-Add-PlayerUseUnknownEntityEvent.patch
Normal file
|
@ -0,0 +1,102 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 05:08:36 -0400
|
||||
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
||||
|
||||
Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with
|
||||
virtual entities/entities that are not actually known to the server.
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dbb635686e9108b9d3df5d373e6972cca07c0621
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
@@ -0,0 +1,86 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an event that is called when a player right-clicks an unknown entity.
|
||||
+ * Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
|
||||
+ * <br>
|
||||
+ * This event may be called multiple times per interaction with different interaction hands
|
||||
+ * and with or without the clicked position.
|
||||
+ */
|
||||
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int entityId;
|
||||
+ private final boolean attack;
|
||||
+ private final @NotNull EquipmentSlot hand;
|
||||
+ private final @Nullable Vector clickedPosition;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerUseUnknownEntityEvent(@NotNull Player player, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) {
|
||||
+ super(player);
|
||||
+ this.entityId = entityId;
|
||||
+ this.attack = attack;
|
||||
+ this.hand = hand;
|
||||
+ this.clickedPosition = clickedPosition;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity id of the unknown entity that was interacted with.
|
||||
+ *
|
||||
+ * @return the entity id of the entity that was interacted with
|
||||
+ */
|
||||
+ public int getEntityId() {
|
||||
+ return this.entityId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the interaction was an attack.
|
||||
+ *
|
||||
+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity
|
||||
+ */
|
||||
+ public boolean isAttack() {
|
||||
+ return this.attack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the hand used to perform this interaction.
|
||||
+ *
|
||||
+ * @return the hand used to interact
|
||||
+ */
|
||||
+ public @NotNull EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the position relative to the entity that was clicked, or {@code null} if not available.
|
||||
+ * See {@link PlayerInteractAtEntityEvent} for more details.
|
||||
+ *
|
||||
+ * @return the position relative to the entity that was clicked, or {@code null} if not available
|
||||
+ * @see PlayerInteractAtEntityEvent
|
||||
+ */
|
||||
+ public @Nullable Vector getClickedRelativePosition() {
|
||||
+ return this.clickedPosition != null ? this.clickedPosition.clone() : null;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,49 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Fri, 4 Mar 2016 03:13:18 -0500
|
||||
Subject: [PATCH] Arrow pickup rule API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
index 4d9938249684b7db01b78baf4eeeaa2e0638a963..493f81ba879d1eb29a32722da27e4ff7ce4c68a8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
@@ -186,4 +186,38 @@ public interface AbstractArrow extends Projectile {
|
||||
*/
|
||||
CREATIVE_ONLY
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link PickupRule} for this arrow.
|
||||
+ *
|
||||
+ * <p>This is generally {@link PickupRule#ALLOWED} only if the arrow was
|
||||
+ * <b>not</b> fired from a bow with the infinity enchantment.</p>
|
||||
+ *
|
||||
+ * @return The pickup rule
|
||||
+ * @deprecated Use {@link Arrow#getPickupStatus()} as an upstream compatible replacement for this function
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default PickupRule getPickupRule() {
|
||||
+ return PickupRule.valueOf(this.getPickupStatus().name());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the rule for which players can pickup this arrow as an item.
|
||||
+ *
|
||||
+ * @param rule The pickup rule
|
||||
+ * @deprecated Use {@link Arrow#setPickupStatus(PickupStatus)} with {@link PickupStatus} as an upstream compatible replacement for this function
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setPickupRule(PickupRule rule) {
|
||||
+ this.setPickupStatus(PickupStatus.valueOf(rule.name()));
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ enum PickupRule {
|
||||
+ DISALLOWED,
|
||||
+ ALLOWED,
|
||||
+ CREATIVE_ONLY;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,280 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 13 Apr 2016 20:20:18 -0700
|
||||
Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
handshaking logic themselves
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7c049bad187b94331f42f96833d1cf4ce03ef477
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -0,0 +1,267 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired during a player handshake.
|
||||
+ * <p>
|
||||
+ * If there are no listeners listening to this event, the logic default
|
||||
+ * to your server platform will be run.
|
||||
+ *
|
||||
+ * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
+ */
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final String originalHandshake;
|
||||
+ @NotNull private final String originalSocketAddressHostname;
|
||||
+ @Nullable private String serverHostname;
|
||||
+ @Nullable private String socketAddressHostname;
|
||||
+ @Nullable private UUID uniqueId;
|
||||
+ @Nullable private String propertiesJson;
|
||||
+ private boolean failed;
|
||||
+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW);
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
||||
+ this(originalHandshake, "127.0.0.1", cancelled);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled) {
|
||||
+ super(true);
|
||||
+ this.originalHandshake = originalHandshake;
|
||||
+ this.originalSocketAddressHostname = originalSocketAddressHostname;
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if this event is cancelled.
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * @return {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this event is cancelled.
|
||||
+ * <p>
|
||||
+ * When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.
|
||||
+ *
|
||||
+ * @param cancel {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original handshake string.
|
||||
+ *
|
||||
+ * @return the original handshake string
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalHandshake() {
|
||||
+ return this.originalHandshake;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original socket address hostname.
|
||||
+ *
|
||||
+ * <p>This does not include the port.</p>
|
||||
+ * <p>In cases where this event is manually fired and the plugin wasn't updated yet, the default is {@code "127.0.0.1"}.</p>
|
||||
+ *
|
||||
+ * @return the original socket address hostname
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalSocketAddressHostname() {
|
||||
+ return this.originalSocketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the server hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getServerHostname() {
|
||||
+ return this.serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param serverHostname the server hostname string
|
||||
+ */
|
||||
+ public void setServerHostname(@NotNull String serverHostname) {
|
||||
+ this.serverHostname = serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the socket address hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getSocketAddressHostname() {
|
||||
+ return this.socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param socketAddressHostname the socket address hostname string
|
||||
+ */
|
||||
+ public void setSocketAddressHostname(@NotNull String socketAddressHostname) {
|
||||
+ this.socketAddressHostname = socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the unique id.
|
||||
+ *
|
||||
+ * @return the unique id
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public UUID getUniqueId() {
|
||||
+ return this.uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the unique id.
|
||||
+ *
|
||||
+ * @param uniqueId the unique id
|
||||
+ */
|
||||
+ public void setUniqueId(@NotNull UUID uniqueId) {
|
||||
+ this.uniqueId = uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @return the profile properties, as JSON
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getPropertiesJson() {
|
||||
+ return this.propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if authentication failed.
|
||||
+ * <p>
|
||||
+ * When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.
|
||||
+ *
|
||||
+ * @return {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public boolean isFailed() {
|
||||
+ return this.failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if authentication failed and the client should be disconnected.
|
||||
+ * <p>
|
||||
+ * When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.
|
||||
+ *
|
||||
+ * @param failed {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public void setFailed(boolean failed) {
|
||||
+ this.failed = failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @param propertiesJson the profile properties, as JSON
|
||||
+ */
|
||||
+ public void setPropertiesJson(@NotNull String propertiesJson) {
|
||||
+ this.propertiesJson = propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Component failMessage() {
|
||||
+ return this.failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ */
|
||||
+ public void failMessage(@NotNull Component failMessage) {
|
||||
+ this.failMessage = failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ public String getFailMessage() {
|
||||
+ return LegacyComponentSerializer.legacySection().serialize(this.failMessage());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setFailMessage(@NotNull String failMessage) {
|
||||
+ Preconditions.checkArgument(failMessage != null && !failMessage.isEmpty(), "fail message cannot be null or empty");
|
||||
+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
49
patches/api/0039-Arrow-pickup-rule-API.patch
Normal file
49
patches/api/0039-Arrow-pickup-rule-API.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Fri, 4 Mar 2016 03:13:18 -0500
|
||||
Subject: [PATCH] Arrow pickup rule API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
index 9a0a1fa4b7a7e1e1174a75a388081b332d4bedbd..839e5b7df49f42b5fec7729997bef3370ba36d80 100644
|
||||
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
@@ -160,4 +160,38 @@ public interface AbstractArrow extends Projectile {
|
||||
*/
|
||||
CREATIVE_ONLY
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link PickupRule} for this arrow.
|
||||
+ *
|
||||
+ * <p>This is generally {@link PickupRule#ALLOWED} only if the arrow was
|
||||
+ * <b>not</b> fired from a bow with the infinity enchantment.</p>
|
||||
+ *
|
||||
+ * @return The pickup rule
|
||||
+ * @deprecated Use {@link Arrow#getPickupStatus()} as an upstream compatible replacement for this function
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default PickupRule getPickupRule() {
|
||||
+ return PickupRule.valueOf(this.getPickupStatus().name());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the rule for which players can pickup this arrow as an item.
|
||||
+ *
|
||||
+ * @param rule The pickup rule
|
||||
+ * @deprecated Use {@link Arrow#setPickupStatus(PickupStatus)} with {@link PickupStatus} as an upstream compatible replacement for this function
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void setPickupRule(PickupRule rule) {
|
||||
+ this.setPickupStatus(PickupStatus.valueOf(rule.name()));
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ enum PickupRule {
|
||||
+ DISALLOWED,
|
||||
+ ALLOWED,
|
||||
+ CREATIVE_ONLY;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,463 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 1 May 2016 15:19:49 -0400
|
||||
Subject: [PATCH] LootTable API
|
||||
|
||||
Provides API to control what Loot Table an object uses.
|
||||
|
||||
Also provides an Event to control if a lootable inventory should
|
||||
auto replenish for a player.
|
||||
|
||||
Provides methods to determine players looted state for an object
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6a03252d66a3e13c1960568ea23f6dcc673f34af
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableBlockInventory.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package com.destroystokyo.paper.loottable;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an Inventory that can generate loot, such as Chests inside of Fortresses and Mineshafts
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface LootableBlockInventory extends LootableInventory {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that is lootable
|
||||
+ * @return The Block
|
||||
+ */
|
||||
+ Block getBlock();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..31ca54dea65dc0363a0ff7991ba5be3b06533876
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableEntityInventory.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package com.destroystokyo.paper.loottable;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an Inventory that can generate loot, such as Minecarts inside of Mineshafts
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface LootableEntityInventory extends LootableInventory {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that is lootable
|
||||
+ * @return The Entity
|
||||
+ */
|
||||
+ Entity getEntity();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9fb621200fb3969e8e440341e906acc3547b4039
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventory.java
|
||||
@@ -0,0 +1,128 @@
|
||||
+package com.destroystokyo.paper.loottable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.loot.Lootable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an Inventory that contains a Loot Table associated to it that will
|
||||
+ * automatically fill on first open.
|
||||
+ * <p>
|
||||
+ * A new feature and API is provided to support automatically refreshing the contents
|
||||
+ * of the inventory based on that Loot Table after a configurable amount of time has passed.
|
||||
+ * <p>
|
||||
+ * The behavior of how the Inventory is filled based on the loot table may vary based
|
||||
+ * on Minecraft versions and the Loot Table feature.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface LootableInventory extends Lootable {
|
||||
+
|
||||
+ /**
|
||||
+ * Server owners have to enable whether an object in a world should refill
|
||||
+ *
|
||||
+ * @return If the world this inventory is currently in has Replenishable Lootables enabled
|
||||
+ */
|
||||
+ boolean isRefillEnabled();
|
||||
+
|
||||
+ /**
|
||||
+ * Whether this object has ever been filled
|
||||
+ *
|
||||
+ * @return Has ever been filled
|
||||
+ */
|
||||
+ boolean hasBeenFilled();
|
||||
+
|
||||
+ /**
|
||||
+ * Has this player ever looted this block
|
||||
+ *
|
||||
+ * @param player The player to check
|
||||
+ * @return Whether this player has looted this block
|
||||
+ */
|
||||
+ default boolean hasPlayerLooted(final Player player) {
|
||||
+ return this.hasPlayerLooted(player.getUniqueId());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this player can loot this block. Takes into account the "restrict player reloot" settings
|
||||
+ *
|
||||
+ * @param player the player to check
|
||||
+ * @return Whether this player can loot this block
|
||||
+ */
|
||||
+ boolean canPlayerLoot(UUID player);
|
||||
+
|
||||
+ /**
|
||||
+ * Has this player ever looted this block
|
||||
+ *
|
||||
+ * @param player The player to check
|
||||
+ * @return Whether this player has looted this block
|
||||
+ */
|
||||
+ boolean hasPlayerLooted(UUID player);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the timestamp, in milliseconds, of when the player last looted this object
|
||||
+ *
|
||||
+ * @param player The player to check
|
||||
+ * @return Timestamp last looted, or null if player has not looted this object
|
||||
+ */
|
||||
+ default @Nullable Long getLastLooted(final Player player) {
|
||||
+ return this.getLastLooted(player.getUniqueId());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the timestamp, in milliseconds, of when the player last looted this object
|
||||
+ *
|
||||
+ * @param player The player to check
|
||||
+ * @return Timestamp last looted, or null if player has not looted this object
|
||||
+ */
|
||||
+ @Nullable Long getLastLooted(UUID player);
|
||||
+
|
||||
+ /**
|
||||
+ * Change the state of whether a player has looted this block
|
||||
+ *
|
||||
+ * @param player The player to change state for
|
||||
+ * @param looted true to add player to looted list, false to remove
|
||||
+ * @return The previous state of whether the player had looted this or not
|
||||
+ */
|
||||
+ default boolean setHasPlayerLooted(final Player player, final boolean looted) {
|
||||
+ return this.setHasPlayerLooted(player.getUniqueId(), looted);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the state of whether a player has looted this block
|
||||
+ *
|
||||
+ * @param player The player to change state for
|
||||
+ * @param looted true to add player to looted list, false to remove
|
||||
+ * @return The previous state of whether the player had looted this or not
|
||||
+ */
|
||||
+ boolean setHasPlayerLooted(UUID player, boolean looted);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns Whether this object has been filled and now has a pending refill
|
||||
+ *
|
||||
+ * @return Has pending refill
|
||||
+ */
|
||||
+ boolean hasPendingRefill();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the timestamp in milliseconds that the Lootable object was last refilled
|
||||
+ *
|
||||
+ * @return -1 if it was never refilled, or timestamp in milliseconds
|
||||
+ */
|
||||
+ long getLastFilled();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the timestamp in milliseconds that the Lootable object will refill
|
||||
+ *
|
||||
+ * @return -1 if it is not scheduled for refill, or timestamp in milliseconds
|
||||
+ */
|
||||
+ long getNextRefill();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the timestamp in milliseconds of the next refill for this object
|
||||
+ *
|
||||
+ * @param refillAt timestamp in milliseconds. -1 to clear next refill
|
||||
+ * @return The previous scheduled time to refill, or -1 if was not scheduled
|
||||
+ */
|
||||
+ long setNextRefill(long refillAt);
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..994c2183db89fc40d5991d5e1906e4bd04db6291
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/LootableInventoryReplenishEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
+package com.destroystokyo.paper.loottable;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class LootableInventoryReplenishEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final LootableInventory inventory;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public LootableInventoryReplenishEvent(final Player player, final LootableInventory inventory) {
|
||||
+ super(player);
|
||||
+ this.inventory = inventory;
|
||||
+ }
|
||||
+
|
||||
+ public LootableInventory getInventory() {
|
||||
+ return this.inventory;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Barrel.java b/src/main/java/org/bukkit/block/Barrel.java
|
||||
index aa1bb7a1a1c94b0b029bb60026efbc7f55584dd7..d3789b2b7dd71d7c1872a0d84698d35a1884101b 100644
|
||||
--- a/src/main/java/org/bukkit/block/Barrel.java
|
||||
+++ b/src/main/java/org/bukkit/block/Barrel.java
|
||||
@@ -5,4 +5,4 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* Represents a captured state of a Barrel.
|
||||
*/
|
||||
-public interface Barrel extends Container, Lootable, Lidded { }
|
||||
+public interface Barrel extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory, Lidded { } // Paper
|
||||
diff --git a/src/main/java/org/bukkit/block/Chest.java b/src/main/java/org/bukkit/block/Chest.java
|
||||
index b451191312e4fb19f2131c2d0a0c0337953f6c7c..db6affbc78106b2d93b41953b624a0bca0ca1d72 100644
|
||||
--- a/src/main/java/org/bukkit/block/Chest.java
|
||||
+++ b/src/main/java/org/bukkit/block/Chest.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableBlockInventory; // Paper
|
||||
+import org.bukkit.Nameable; // Paper
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -7,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a chest.
|
||||
*/
|
||||
-public interface Chest extends Container, Lootable, Lidded {
|
||||
+public interface Chest extends Container, LootableBlockInventory, Lidded { // Paper
|
||||
|
||||
/**
|
||||
* Gets the inventory of the chest block represented by this block state.
|
||||
diff --git a/src/main/java/org/bukkit/block/Crafter.java b/src/main/java/org/bukkit/block/Crafter.java
|
||||
index e004920ec1e13daaa2f0969a5cf97b6a7de25df9..8d2dd78fc588a6817dfede8040b9909a7d5bde67 100644
|
||||
--- a/src/main/java/org/bukkit/block/Crafter.java
|
||||
+++ b/src/main/java/org/bukkit/block/Crafter.java
|
||||
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* Represents a captured state of a crafter.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
-public interface Crafter extends Container, Lootable {
|
||||
+public interface Crafter extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory { // Paper - LootTable API
|
||||
|
||||
/**
|
||||
* Gets the number of ticks which this block will remain in the crafting
|
||||
diff --git a/src/main/java/org/bukkit/block/Dispenser.java b/src/main/java/org/bukkit/block/Dispenser.java
|
||||
index 74cd194c9a98245dc52e7e352d7d6c046e1e5cf3..07af1a3f011d4b96275f919d302ac367198e923e 100644
|
||||
--- a/src/main/java/org/bukkit/block/Dispenser.java
|
||||
+++ b/src/main/java/org/bukkit/block/Dispenser.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.Nameable;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
@@ -8,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a dispenser.
|
||||
*/
|
||||
-public interface Dispenser extends Container, Nameable, Lootable {
|
||||
+public interface Dispenser extends Container, Nameable, LootableBlockInventory { // Paper
|
||||
|
||||
/**
|
||||
* Gets the BlockProjectileSource object for the dispenser.
|
||||
diff --git a/src/main/java/org/bukkit/block/Dropper.java b/src/main/java/org/bukkit/block/Dropper.java
|
||||
index 424392fb5ed4628199b0e73689522aa3c90740cb..c76202321e29ad67597ca3017eb8d9baf6787383 100644
|
||||
--- a/src/main/java/org/bukkit/block/Dropper.java
|
||||
+++ b/src/main/java/org/bukkit/block/Dropper.java
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a dropper.
|
||||
*/
|
||||
-public interface Dropper extends Container, Lootable {
|
||||
+public interface Dropper extends Container, LootableBlockInventory { // Paper
|
||||
|
||||
/**
|
||||
* Tries to drop a randomly selected item from the dropper's inventory,
|
||||
diff --git a/src/main/java/org/bukkit/block/Hopper.java b/src/main/java/org/bukkit/block/Hopper.java
|
||||
index 58e493099810fb8d4705ecd49b4a5e1e1949b87b..7ade312f180b7e30871d3a3240c76325cc369c26 100644
|
||||
--- a/src/main/java/org/bukkit/block/Hopper.java
|
||||
+++ b/src/main/java/org/bukkit/block/Hopper.java
|
||||
@@ -1,8 +1,9 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a hopper.
|
||||
*/
|
||||
-public interface Hopper extends Container, Lootable { }
|
||||
+public interface Hopper extends Container, LootableBlockInventory { } // Paper
|
||||
diff --git a/src/main/java/org/bukkit/block/ShulkerBox.java b/src/main/java/org/bukkit/block/ShulkerBox.java
|
||||
index 387b2892886e1ccb2bd928e5111fb9bd41d777ab..5dc5318b0a451937228a8a059dfec1cd9de389a6 100644
|
||||
--- a/src/main/java/org/bukkit/block/ShulkerBox.java
|
||||
+++ b/src/main/java/org/bukkit/block/ShulkerBox.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.loot.Lootable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -7,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a ShulkerBox.
|
||||
*/
|
||||
-public interface ShulkerBox extends Container, Lootable, Lidded {
|
||||
+public interface ShulkerBox extends Container, LootableBlockInventory, Lidded { // Paper
|
||||
|
||||
/**
|
||||
* Get the {@link DyeColor} corresponding to this ShulkerBox
|
||||
diff --git a/src/main/java/org/bukkit/entity/ChestBoat.java b/src/main/java/org/bukkit/entity/ChestBoat.java
|
||||
index 5b5c3be107fdaa6c55ceb1bca2c223ebc6ab7f43..4ebe1033c55dbd58d0794809435c935236fabcc2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ChestBoat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ChestBoat.java
|
||||
@@ -6,5 +6,5 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* A {@link Boat} with a chest.
|
||||
*/
|
||||
-public interface ChestBoat extends Boat, InventoryHolder, Lootable {
|
||||
+public interface ChestBoat extends Boat, InventoryHolder, com.destroystokyo.paper.loottable.LootableEntityInventory { // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
index 2926fa6071bc7640cc10280b5c3962b0ce7686f1..f3f62e13cc1b6172808c52f2d5f520f1f584e6db 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -61,4 +61,12 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
*/
|
||||
@Nullable
|
||||
public Sound getAmbientSound();
|
||||
+
|
||||
+ // Paper start - LootTable API
|
||||
+ @Override
|
||||
+ default void setLootTable(final @Nullable org.bukkit.loot.LootTable table, final long seed) {
|
||||
+ this.setLootTable(table);
|
||||
+ this.setSeed(seed);
|
||||
+ }
|
||||
+ // Paper end - LootTable API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
|
||||
index 937b99f8734d71b2ad33af142afbc251b81d9745..db69687a7ad4b18d17ab1677cae5d8dd4dcd3678 100644
|
||||
--- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
|
||||
+++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.entity.minecart;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableEntityInventory;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.loot.Lootable;
|
||||
@@ -7,7 +8,7 @@ import org.bukkit.loot.Lootable;
|
||||
/**
|
||||
* Represents a Minecart with a Hopper inside it
|
||||
*/
|
||||
-public interface HopperMinecart extends Minecart, InventoryHolder, Lootable {
|
||||
+public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntityInventory {
|
||||
|
||||
/**
|
||||
* Checks whether or not this Minecart will pick up
|
||||
diff --git a/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java b/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
|
||||
index 9ea403e6fd8e960d017660e0aec118abeda2c42b..238d118f7788b13cd86b7e9ea3a0fc38e2e09715 100644
|
||||
--- a/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
|
||||
+++ b/src/main/java/org/bukkit/entity/minecart/StorageMinecart.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.entity.minecart;
|
||||
|
||||
+import com.destroystokyo.paper.loottable.LootableEntityInventory;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.loot.Lootable;
|
||||
@@ -9,5 +10,5 @@ import org.bukkit.loot.Lootable;
|
||||
* minecarts} have their own inventory that can be accessed using methods
|
||||
* from the {@link InventoryHolder} interface.
|
||||
*/
|
||||
-public interface StorageMinecart extends Minecart, InventoryHolder, Lootable {
|
||||
+public interface StorageMinecart extends Minecart, InventoryHolder, LootableEntityInventory { // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/loot/Lootable.java b/src/main/java/org/bukkit/loot/Lootable.java
|
||||
index 24a3d989db3bc67e7afe8459a3d4bb132f448ea7..ad4b0fb7f55ed44dc74fb5a4bd36be6004231116 100644
|
||||
--- a/src/main/java/org/bukkit/loot/Lootable.java
|
||||
+++ b/src/main/java/org/bukkit/loot/Lootable.java
|
||||
@@ -36,6 +36,31 @@ public interface Lootable {
|
||||
@Nullable
|
||||
LootTable getLootTable();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the loot table and seed for a container or entity at the same time.
|
||||
+ *
|
||||
+ * @param table the Loot Table this {@link org.bukkit.block.Container} or {@link org.bukkit.entity.Mob} will have.
|
||||
+ * @param seed the seed to used to generate loot. Default is 0.
|
||||
+ */
|
||||
+ void setLootTable(final @Nullable LootTable table, final long seed);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether or not this object has a Loot Table
|
||||
+ * @return Has a loot table
|
||||
+ */
|
||||
+ default boolean hasLootTable() {
|
||||
+ return this.getLootTable() != null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clears the associated Loot Table to this object
|
||||
+ */
|
||||
+ default void clearLootTable() {
|
||||
+ this.setLootTable(null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Set the seed used when this Loot Table generates loot.
|
||||
*
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue