mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-04 08:52:01 -05:00
Compare commits
138
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de2dcb1bfc | ||
|
|
1d0477aa9e | ||
|
|
5c5e9ed713 | ||
|
|
c9b7aabeeb | ||
|
|
f7ba4c16a2 | ||
|
|
0799f7f8c9 | ||
|
|
f11902627b | ||
|
|
bb10cf0d5b | ||
|
|
55bebded5f | ||
|
|
f728a121f7 | ||
|
|
2401035c89 | ||
|
|
174574d871 | ||
|
|
8a170a38c6 | ||
|
|
804dd0c3f0 | ||
|
|
ff31a2c997 | ||
|
|
2e549d651c | ||
|
|
7f9c79794e | ||
|
|
9d950517d9 | ||
|
|
4f4904928f | ||
|
|
4623163095 | ||
|
|
eb9098a546 | ||
|
|
e415f5e030 | ||
|
|
e3ba7b1dc8 | ||
|
|
05c2798ec0 | ||
|
|
02378ab582 | ||
|
|
67912d0827 | ||
|
|
e8a1f8fd68 | ||
|
|
1b9bf5c8e9 | ||
|
|
325f9071f0 | ||
|
|
d86d427405 | ||
|
|
2f1ce01e87 | ||
|
|
0d9bf08a23 | ||
|
|
e65c0765c6 | ||
|
|
ac9a1b2c72 | ||
|
|
0db5c93a3d | ||
|
|
2d602d68c1 | ||
|
|
2766dd30b1 | ||
|
|
03af8b4291 | ||
|
|
45fac22871 | ||
|
|
8c0b8396d6 | ||
|
|
bc68acd741 | ||
|
|
e13b4b3d41 | ||
|
|
a90108f43c | ||
|
|
dd585fda4d | ||
|
|
1b443e0ac8 | ||
|
|
29aeb6081b | ||
|
|
3bfa02fd65 | ||
|
|
09ee222482 | ||
|
|
22c663d327 | ||
|
|
4091869eed | ||
|
|
db93f621b3 | ||
|
|
7ec11b289e | ||
|
|
683e60c092 | ||
|
|
39887673fb | ||
|
|
dba08d2f25 | ||
|
|
be4b895635 | ||
|
|
b69f87e5ac | ||
|
|
f68a55a896 | ||
|
|
a0ded751dc | ||
|
|
a48059a2d4 | ||
|
|
06b855f0d3 | ||
|
|
56cab99fbf | ||
|
|
c927bd34ab | ||
|
|
b5eb5e0bfd | ||
|
|
4738ffe335 | ||
|
|
7ff575c99b | ||
|
|
ec0cd5c5ae | ||
|
|
6e1bb67eb1 | ||
|
|
cc7ee9aebd | ||
|
|
a2d844f71e | ||
|
|
6829d9e6cb | ||
|
|
03226a5838 | ||
|
|
fbec96a8fa | ||
|
|
abe55c5242 | ||
|
|
bd9daa8fba | ||
|
|
99867f8f92 | ||
|
|
c3ec3ae0c2 | ||
|
|
1a6b058db4 | ||
|
|
821b95fb15 | ||
|
|
b2d29a4fa8 | ||
|
|
46d4834e8e | ||
|
|
e3e060d74d | ||
|
|
d57def08de | ||
|
|
21a495c94c | ||
|
|
cc7b98af63 | ||
|
|
e63aca4337 | ||
|
|
16db242251 | ||
|
|
615e915d6b | ||
|
|
8097898e6d | ||
|
|
e8750e1c00 | ||
|
|
65ba985571 | ||
|
|
b3c6bcb83c | ||
|
|
a4b87cf896 | ||
|
|
bfb089d29d | ||
|
|
4728a906ed | ||
|
|
65c408ad2d | ||
|
|
2de3a930cc | ||
|
|
780818ff42 | ||
|
|
1dbde6108f | ||
|
|
1a7b626576 | ||
|
|
6e88e469fe | ||
|
|
371c96aa68 | ||
|
|
1d254ec493 | ||
|
|
60c8e563c2 | ||
|
|
ddb45eb495 | ||
|
|
a9d038271a | ||
|
|
6bc56abc92 | ||
|
|
288d43e108 | ||
|
|
ff3655a784 | ||
|
|
1c92a6c3a4 | ||
|
|
54024d3067 | ||
|
|
3d7125903d | ||
|
|
021713af28 | ||
|
|
769bc8c2a4 | ||
|
|
977da0dbb5 | ||
|
|
af5c198def | ||
|
|
c7dd4303da | ||
|
|
be053f7afd | ||
|
|
8832a8dd7b | ||
|
|
abfdaed87a | ||
|
|
c27ca36bf1 | ||
|
|
13eb8f29ca | ||
|
|
643a11a413 | ||
|
|
e5aa18b318 | ||
|
|
f83a0bae4f | ||
|
|
bfbe49cfa9 | ||
|
|
c0f1d039bb | ||
|
|
0fdc08858f | ||
|
|
8c95c89a45 | ||
|
|
f4eb9c2e63 | ||
|
|
d3ee2cfc67 | ||
|
|
5cbb5d6fa0 | ||
|
|
640efeeabe | ||
|
|
b23b725834 | ||
|
|
f6862603dd | ||
|
|
a091961346 | ||
|
|
d289ae1dfc | ||
|
|
08ca088b5d |
No files matched your search
@@ -14,11 +14,18 @@
|
||||
<property name="messageKey" value="annotation\.same\.line"/>
|
||||
<property name="arguments" value="^(?!(${type_use_annotations}))"/>
|
||||
</module>
|
||||
<module name="io.papermc.checkstyle.filters.BetterSuppressionSingleFilter">
|
||||
<!--Allows @deprecated on packages. Not in the javadoc spec (javadoc warns), but it is still rendered in the deprecation block and list-->
|
||||
<property name="checks" value="InappropriateJavadocBlockTagsOnPackage"/>
|
||||
<property name="messageKey" value="javadoc\.inappropriate\.tag"/>
|
||||
<property name="arguments" value="^deprecated$"/>
|
||||
</module>
|
||||
<module name="SuppressWarningsFilter"/>
|
||||
|
||||
<!--Javadoc Comments-->
|
||||
<module name="JavadocPackage"/>
|
||||
<!--Misc-->
|
||||
<module name="LineEnding"/>
|
||||
<module name="NewlineAtEndOfFile"/>
|
||||
<!--Whitespace-->
|
||||
<module name="FileTabCharacter"/>
|
||||
@@ -30,6 +37,12 @@
|
||||
<property name="optional" value="false"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter"/>
|
||||
<!--per-check variant: // CHECKSTYLE.OFF: CheckName ... // CHECKSTYLE.ON: CheckName-->
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
|
||||
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
|
||||
<property name="checkFormat" value="$1"/>
|
||||
</module>
|
||||
|
||||
<!--Annotations-->
|
||||
<module name="AnnotationOnSameLine">
|
||||
@@ -38,6 +51,7 @@
|
||||
</module>
|
||||
<module name="AnnotationUseStyle"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverrideOnRecordAccessor"/>
|
||||
|
||||
<!--Block Checks-->
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
@@ -55,7 +69,9 @@
|
||||
<!--Coding-->
|
||||
<module name="AvoidDoubleBraceInitialization"/>
|
||||
<module name="AvoidNoArgumentSuperConstructorCall"/>
|
||||
<module name="ConstructorsDeclarationGrouping"/>
|
||||
<module name="ConstructorsDeclarationGrouping">
|
||||
<property name="orderByIncreasingParameterCount" value="true"/>
|
||||
</module>
|
||||
<module name="CovariantEquals"/>
|
||||
<module name="DeclarationOrder">
|
||||
<property name="ignoreConstructors" value="true"/>
|
||||
@@ -63,6 +79,7 @@
|
||||
<module name="DefaultComesLast"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="ExpressionOverBlockLambda"/>
|
||||
<module name="FallThrough"/>
|
||||
<!-- Use non-final variables as an identifier of old code for now -->
|
||||
<!--<module name="FinalLocalVariable">
|
||||
@@ -82,10 +99,12 @@
|
||||
<module name="UnnecessaryNullCheckWithInstanceOf"/>
|
||||
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
|
||||
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
|
||||
<module name="UnnecessarySemicolonInEnumeration"/>
|
||||
<module name="UnnecessarySemicolonInTryWithResources"/>
|
||||
<module name="UnusedCatchParameterShouldBeUnnamed"/>
|
||||
<module name="UnusedLocalVariable"/>
|
||||
<module name="UnusedPrivateField"/>
|
||||
<module name="UnusedTryResourceShouldBeUnnamed"/>
|
||||
<module name="UseEnhancedSwitch"/>
|
||||
<module name="WhenShouldBeUsed"/>
|
||||
|
||||
<!--Headers--> <!--N/A-->
|
||||
@@ -114,9 +133,13 @@
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @see, @deprecated, @hidden"/>
|
||||
</module>
|
||||
<module name="InappropriateJavadocBlockTagsOnField"/>
|
||||
<module name="InappropriateJavadocBlockTagsOnPackage"/>
|
||||
<module name="InappropriateJavadocBlockTagsOnType"/>
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="JavadocBlockTagLocation"/>
|
||||
<module name="JavadocContentLocation"/>
|
||||
<module name="JavadocEndCommentDelimiter"/>
|
||||
<module name="JavadocLeadingAsteriskAlign"/>
|
||||
<module name="JavadocMethod">
|
||||
<!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
@@ -124,11 +147,11 @@
|
||||
</module>
|
||||
<module name="JavadocMissingLeadingAsterisk"/>
|
||||
<module name="JavadocMissingWhitespaceAfterAsterisk"/>
|
||||
<module name="JavadocStyle"/> <!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<module name="JavadocType"/> <!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
|
||||
<module name="SummaryJavadoc"/> <!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
|
||||
<!--Metrics--> <!--N/A-->
|
||||
|
||||
@@ -136,13 +159,21 @@
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="AvoidEscapedUnicodeCharacters"/>
|
||||
<module name="CommentsIndentation"/>
|
||||
<module name="HexLiteralCase"/>
|
||||
<!-- Overlaps with the configured FinalLocalVariable, but is more strict -->
|
||||
<!--<module name="FinalParameters">
|
||||
<property name="tokens" value="METHOD_DEF,CTOR_DEF,LITERAL_CATCH,FOR_EACH_CLAUSE,PATTERN_VARIABLE_DEF"/>
|
||||
</module>-->
|
||||
|
||||
<module name="NoCodeInFile"/>
|
||||
<module name="NumericalPrefixesInfixesSuffixesCharacterCase"/>
|
||||
<module name="OuterTypeFilename"/>
|
||||
<!--Leftover Paper/Spigot markers from when these sources were patches on top of upstream (suppressed for the patched paper-server/src/minecraft sources)-->
|
||||
<module name="TodoComment">
|
||||
<property name="id" value="PatchMarkerComment"/>
|
||||
<property name="format" value="(^|//)\s*(Paper|Spigot)\b"/>
|
||||
<message key="todo.match" value="Remove the leftover ''// Paper'' or ''// Spigot'' patch marker comment."/>
|
||||
</module>
|
||||
<module name="UpperEll"/>
|
||||
|
||||
<!--Modifiers-->
|
||||
@@ -180,6 +211,7 @@
|
||||
<!--Size Violations--> <!--N/A-->
|
||||
|
||||
<!--Whitespace-->
|
||||
<module name="ArrayBracketNoWhitespace"/>
|
||||
<module name="EmptyForInitializerPad"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
@@ -197,9 +229,11 @@
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
<module name="WhitespaceAround"/>
|
||||
<module name="WhitespaceBeforeEmptyBody"/>
|
||||
|
||||
<!--Custom-->
|
||||
<module name="JavadocAlignParameterDescription"/>
|
||||
<module name="JavadocParamTagOrder"/>
|
||||
<module name="NullabilityAnnotations"/>
|
||||
<module name="RedundantNullability"/>
|
||||
<module name="UnnecessaryFullyQualifiedImport"/>
|
||||
|
||||
@@ -3,5 +3,4 @@
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
<suppressions>
|
||||
<suppress checks="MissingJavadoc.*" files="src[\\/]test[\\/]java[^\\/]*[\\/].*"/>
|
||||
<suppress checks="JavadocPackage" files="src[\\/]test[\\/]java[^\\/]*[\\/].*"/>
|
||||
</suppressions>
|
||||
+13
-2
@@ -1,2 +1,13 @@
|
||||
* @PaperMC/paper-maintainers
|
||||
/.github/CODEOWNERS @PaperMC/core-team
|
||||
# default ownership
|
||||
* @papermc/paper-maintainers
|
||||
|
||||
# tooling
|
||||
/.github/workflows/ @papermc/tooling
|
||||
/gradle/ @papermc/tooling
|
||||
/paper-api/build.gradle.kts @papermc/tooling
|
||||
/paper-server/build.gradle.kts @papermc/tooling
|
||||
/build.gradle.kts @papermc/tooling
|
||||
/gradle.properties @papermc/tooling
|
||||
/settings.gradle.kts @papermc/tooling
|
||||
|
||||
/.github/CODEOWNERS @papermc/leadership-team
|
||||
@@ -5,14 +5,17 @@
|
||||
# of the PR relating to this action.
|
||||
|
||||
name: Build Paper
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
- labeled
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
detect-version:
|
||||
runs-on: namespace-profile-linux-small
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
issues: read
|
||||
outputs:
|
||||
version: ${{ steps.detect.outputs.version }}
|
||||
steps:
|
||||
- id: detect
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
// Capturing Groups:
|
||||
// 1 = Brand
|
||||
// 2 = Minecraft Version
|
||||
// 3 = Build Number
|
||||
// 4 = Git Branch/Commit
|
||||
// 5 = Build Time
|
||||
const NEW_PATTERN = /This server is running ([A-Za-z0-9]+) version ([\d\.]+)-(DEV|\d+)-(.*) \((.*)\) \(Implementing API version .*\)(?: \(Git: .*\))?/;
|
||||
|
||||
// Capturing Groups:
|
||||
// 1 = Brand
|
||||
// 2 = Minecraft Version
|
||||
const OLD_PATTERN = /This server is running ([A-Za-z0-9]+) version .* \(MC: ([^\)]+)\) \(Implementing API version .*\)(?: \(Git: .*\))?/;
|
||||
|
||||
if (!context.payload.issue.body) {
|
||||
core.info("Issue body is empty; unable to detect version.");
|
||||
return;
|
||||
}
|
||||
|
||||
let version;
|
||||
|
||||
const match = context.payload.issue.body.match(NEW_PATTERN);
|
||||
if (match && match.length === 6) {
|
||||
version = match[2];
|
||||
} else {
|
||||
const oldMatch = context.payload.issue.body.match(OLD_PATTERN);
|
||||
if (oldMatch) {
|
||||
version = oldMatch[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (!version) {
|
||||
core.info("Unable to determine the Minecraft version from the issue body.");
|
||||
return;
|
||||
}
|
||||
|
||||
core.info(`Detected Minecraft version: ${version}`);
|
||||
core.setOutput('version', version);
|
||||
|
||||
label-version:
|
||||
needs: detect-version
|
||||
if: needs.detect-version.outputs.version != ''
|
||||
runs-on: namespace-profile-linux-small
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const version = '${{ needs.detect-version.outputs.version }}';
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue.number,
|
||||
labels: [`version: ${version}`],
|
||||
});
|
||||
|
||||
core.info(`Added version label for ${version}.`);
|
||||
|
||||
check-support:
|
||||
needs:
|
||||
- detect-version
|
||||
- label-version
|
||||
if: needs.detect-version.outputs.version != ''
|
||||
runs-on: namespace-profile-linux-small
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const version = '${{ needs.detect-version.outputs.version }}';
|
||||
|
||||
const apiUrl = `https://fill.papermc.io/v3/projects/paper/versions/${encodeURIComponent(version)}`;
|
||||
core.info(`Fetching version information from ${apiUrl}`);
|
||||
|
||||
let supportStatus;
|
||||
let supportEnd;
|
||||
|
||||
try {
|
||||
const response = await fetch(apiUrl, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': `GitHub Actions (${context.repo.owner}/${context.repo.repo})`,
|
||||
},
|
||||
});
|
||||
|
||||
if (response.status === 404) {
|
||||
core.info(`Fill has no information for version ${version}.`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
core.error(`Fill returned HTTP ${response.status}: ${response.statusText}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
supportStatus = data?.version?.support?.status;
|
||||
supportEnd = data?.version?.support?.end;
|
||||
} catch (error) {
|
||||
core.warning(`Failed to fetch support information: ${error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
core.info(`Fill support status for ${version}: ${supportStatus}`);
|
||||
|
||||
// Only comment for deprecated or unsupported versions.
|
||||
let comment;
|
||||
|
||||
if (supportStatus === 'UNSUPPORTED') {
|
||||
comment =
|
||||
`⚠️ **Minecraft ${version} is unsupported.**\n\n` +
|
||||
`This version is no longer supported by PaperMC. ` +
|
||||
(supportEnd
|
||||
? `Support _ended_ on ${supportEnd}. `
|
||||
: '') +
|
||||
`Please consider upgrading to a supported Minecraft version.`;
|
||||
} else if (supportStatus === 'DEPRECATED') {
|
||||
comment =
|
||||
`⚠️ **Minecraft ${version} is deprecated.**\n\n` +
|
||||
`This version is deprecated by PaperMC. ` +
|
||||
(supportEnd
|
||||
? `Support will end on ${supportEnd}. `
|
||||
: '') +
|
||||
`Please consider upgrading to a supported Minecraft version.`;
|
||||
} else {
|
||||
core.info(`${version} is supported or has an unknown status.`);
|
||||
return;
|
||||
}
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue.number,
|
||||
body: comment,
|
||||
});
|
||||
|
||||
if (supportStatus === 'UNSUPPORTED') {
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue.number,
|
||||
name: 'status: needs triage',
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore - missing label is not an error
|
||||
}
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue.number,
|
||||
labels: ['resolution: unsupported'],
|
||||
});
|
||||
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.issue.number,
|
||||
state: 'closed',
|
||||
state_reason: 'not_planned',
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
name: Release 26.3
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -9,16 +10,23 @@ permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: release-26.3
|
||||
cancel-in-progress: false
|
||||
group: release-26.3
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# guard for manual dispatch
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
runs-on: namespace-profile-linux-default
|
||||
timeout-minutes: 30
|
||||
#env:
|
||||
# BUILD_NUMBER: ${{ github.run_number }}
|
||||
steps:
|
||||
- name: "environment"
|
||||
run: |
|
||||
echo "BUILD_NUMBER=$((129 + GITHUB_RUN_NUMBER))" >> "$GITHUB_ENV"
|
||||
echo "BUILD_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: "git / checkout"
|
||||
uses: namespacelabs/nscloud-checkout-action@66f2dc6f6c42a8ac6c4e53473c4840006822831e # v9.0.1
|
||||
with:
|
||||
@@ -26,18 +34,23 @@ jobs:
|
||||
|
||||
- uses: papermc/ci/setup-gradle@main
|
||||
|
||||
- name: "build number"
|
||||
run: echo "BUILD_NUMBER=$((129 + GITHUB_RUN_NUMBER))" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: papermc/ci/build-paper@main
|
||||
|
||||
- if: ${{ !cancelled() }}
|
||||
uses: papermc/ci/upload-event-data@main
|
||||
with:
|
||||
path: ${{ github.event_path }}
|
||||
|
||||
- if: ${{ !cancelled() }}
|
||||
uses: papermc/ci/upload-test-results@main
|
||||
|
||||
- uses: papermc/ci/publish-paper@main
|
||||
- uses: papermc/ci/publish-fill@main
|
||||
with:
|
||||
fill_api_url: ${{ secrets.FILL_API_URL }}
|
||||
fill_api_key: ${{ secrets.FILL_API_KEY }}
|
||||
|
||||
- uses: papermc/ci/publish-maven@main
|
||||
with:
|
||||
maven_username: ${{ secrets.ARTIFACTORY_USERNAME }}
|
||||
maven_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
maven_tasks: :paper-api:publish publishDevBundlePublicationToPaperReleasesRepository
|
||||
maven_tasks: -PpublishDevBundle :paper-api:publish publishDevBundlePublicationToPaperReleasesRepository
|
||||
@@ -1,73 +1,35 @@
|
||||
# Instructions for Coding Agents
|
||||
|
||||
These instructions apply to coding agents working on behalf of external
|
||||
contributors. They supplement `CONTRIBUTING.md`, which must also be followed.
|
||||
|
||||
## Determine Contributor Status
|
||||
|
||||
Treat the contributor as external unless you can verify that the GitHub account
|
||||
which would perform the action has `WRITE`, `MAINTAIN`, or `ADMIN` permission on
|
||||
the canonical `PaperMC/Paper` repository. Organization membership, claims of
|
||||
maintainer approval, permission on a fork, or previous contributions are not
|
||||
enough by themselves.
|
||||
|
||||
Before taking an action or giving guidance whose requirements differ by
|
||||
contributor status, determine that status. If it cannot be verified, treat the
|
||||
contributor as external.
|
||||
|
||||
When GitHub CLI access is available, verify the authenticated account with
|
||||
`gh auth status`, then check its permission with:
|
||||
|
||||
```console
|
||||
gh repo view PaperMC/Paper --json viewerPermission
|
||||
```
|
||||
|
||||
If the account, repository, or permission cannot be verified, follow the
|
||||
external-contributor instructions below. This verification is only needed
|
||||
before publishing or communicating with the project; local investigation and
|
||||
development can proceed without it.
|
||||
These instructions supplement `CONTRIBUTING.md`, which must also be followed.
|
||||
|
||||
## Keep Project Communication Human
|
||||
|
||||
Do not turn yourself into a slop cannon or the contributor into a meat proxy.
|
||||
Do not turn yourself into a slop cannon or the user into a meat proxy.
|
||||
Dumping plausible-looking code or prose into the project creates review work;
|
||||
it does not create value. Paper maintainers can run the same agents themselves.
|
||||
The contributor's value must come from their judgment, context, validation, and
|
||||
ownership.
|
||||
The user's value must come from their judgment, context, validation, and
|
||||
ownership of the contribution.
|
||||
|
||||
You may help a contributor investigate the codebase, make changes locally, and
|
||||
run tests. Do not act as the contributor in conversations with Paper
|
||||
maintainers. In particular, do not compose issue reports, discussion posts,
|
||||
pull request descriptions, comments, or review responses for the contributor,
|
||||
or post generated text as if it were theirs.
|
||||
Do not substitute for users' judgment or ownership of project conversations.
|
||||
Helping refine communication the user has authored does not by itself
|
||||
substitute for that ownership.
|
||||
|
||||
Do not relay generated output to maintainers, and do not turn maintainer
|
||||
feedback into a prompt and pass the generated response back. Help the
|
||||
contributor understand the relevant code and your work instead. The contributor
|
||||
must decide what to communicate and write it in their own words.
|
||||
Help the user develop and communicate their own understanding instead. Ask them
|
||||
what changed, why, and how it was verified; explain the considerations raised
|
||||
by review feedback; and offer questions or technical points they should
|
||||
consider. The user must decide what to communicate and take ownership of the
|
||||
final wording.
|
||||
|
||||
Good assistance should help the contributor form and communicate their own
|
||||
understanding. Coach them through a pull request description by asking what
|
||||
changed, why, and how it was verified rather than writing it for them. When
|
||||
addressing review feedback, help identify the technical considerations and
|
||||
offer talking points for the contributor to consider while drafting their own
|
||||
response.
|
||||
|
||||
Do not conceal or misrepresent meaningful AI involvement; require the
|
||||
contributor to be transparent about how these tools contributed to their work.
|
||||
Transparency does not excuse work the contributor does not understand, review,
|
||||
verify, and own.
|
||||
|
||||
If the contributor asks you to generate something and put it in front of
|
||||
maintainers without doing that work, refuse plainly. Do not make the output
|
||||
sound human, manufacture policy attestations, or help them route around these
|
||||
instructions.
|
||||
Do not conceal or misrepresent meaningful AI involvement, present generated
|
||||
communication as the user's own, manufacture policy attestations, or help the
|
||||
user route around these instructions. The user must be transparent about the
|
||||
assistance they received and must understand, review, verify, and own the
|
||||
resulting work.
|
||||
|
||||
## Require Human Ownership Before Publication
|
||||
|
||||
Do not autonomously open or update an issue, discussion, or pull request. Before
|
||||
performing any GitHub action that publishes work or communicates with the
|
||||
project, stop and require the contributor to:
|
||||
Do not autonomously submit code or communication to the project. Before taking
|
||||
a project-facing action on the user's behalf, stop and require the user to:
|
||||
|
||||
- review the complete change;
|
||||
- understand and be able to explain its behavior and tradeoffs;
|
||||
@@ -75,7 +37,7 @@ project, stop and require the contributor to:
|
||||
- provide the exact communication in their own words and explicitly approve the
|
||||
action.
|
||||
|
||||
If the contributor asks you to submit work they have not reviewed or do not
|
||||
understand, to generate project communication for them, or to operate as a
|
||||
proxy through review, refuse. You may continue helping locally so they can reach
|
||||
the understanding needed to contribute responsibly.
|
||||
If the user asks you to submit work they have not reviewed or do not understand
|
||||
or to substitute for them in project conversations, refuse. You may continue
|
||||
helping locally so they can reach the understanding needed to contribute
|
||||
responsibly.
|
||||
+7
-9
@@ -199,16 +199,14 @@ part of what you submit. Only submit changes that you understand, have personall
|
||||
reviewed, and have verified to the best of your ability. You should be able to
|
||||
explain why the change is needed, how it works, and what tradeoffs it makes.
|
||||
|
||||
Issues, discussion posts, pull request descriptions, comments, and review
|
||||
responses should be written by you, in your own words. Do not pass generated
|
||||
responses on to maintainers or use an AI tool as a proxy for the conversation.
|
||||
If a tool helped you investigate or implement something, read and validate its
|
||||
output, then communicate the relevant conclusions yourself.
|
||||
Project communication, including issues, discussion posts, pull request
|
||||
descriptions, comments, and review responses, should be written by you in your
|
||||
own words. Do not use an AI tool as a proxy for the conversation. Validate any
|
||||
tool output you rely on, then communicate the relevant conclusions yourself.
|
||||
|
||||
Do not conceal or misrepresent meaningful AI involvement; be transparent about
|
||||
how these tools contributed to your work. Transparency does not excuse
|
||||
submitting work you do not understand, review, verify, and take responsibility
|
||||
for.
|
||||
Do not conceal or misrepresent meaningful AI involvement. Be transparent about
|
||||
how these tools contributed to your work; that transparency does not replace
|
||||
your responsibility for the contribution.
|
||||
|
||||
Review is a collaborative process, not a way to outsource completion of a
|
||||
generated change to maintainers. Be prepared to answer questions about your
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Paper [](https://papermc.io/downloads/paper)
|
||||
[](https://github.com/PaperMC/Paper/actions)
|
||||
[](https://github.com/PaperMC/Paper/actions)
|
||||
[](https://discord.gg/papermc)
|
||||
[](https://github.com/sponsors/PaperMC)
|
||||
[](https://opencollective.com/papermc)
|
||||
@@ -91,6 +91,8 @@ You can find our collective [here](https://opencollective.com/papermc), or you c
|
||||
Special Thanks To:
|
||||
-------------
|
||||
|
||||
[](https://namespace.so/github-actions/?utm_source=oss&utm_campaign=papermc)
|
||||
|
||||
[](https://www.yourkit.com/)
|
||||
|
||||
[YourKit](https://www.yourkit.com/), makers of the outstanding java profiler, support open source projects of all kinds with their full featured [Java](https://www.yourkit.com/java/profiler) and [.NET](https://www.yourkit.com/.net/profiler) application profilers. We thank them for granting Paper an OSS license so that we can make our software the best it can be.
|
||||
|
||||
@@ -5,6 +5,7 @@ private-f net.minecraft.server.MinecraftServer connection
|
||||
private-f net.minecraft.server.MinecraftServer levels
|
||||
private-f net.minecraft.world.item.ItemStack components
|
||||
private-f net.minecraft.world.item.ItemStack item
|
||||
private-f net.minecraft.world.item.crafting.RecipeManager learnableRecipes
|
||||
private-f net.minecraft.world.level.block.entity.BeehiveBlockEntity stored
|
||||
protected net.minecraft.world.entity.LivingEntity skipDropExperience
|
||||
protected net.minecraft.world.level.Level thread
|
||||
@@ -24,6 +25,7 @@ public net.minecraft.network.Connection channel
|
||||
public net.minecraft.network.chat.contents.TranslatableContents PRIMITIVE_ARG_CODEC
|
||||
public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket <init>(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntityType;Lnet/minecraft/nbt/CompoundTag;)V
|
||||
public net.minecraft.network.syncher.SynchedEntityData getItem(Lnet/minecraft/network/syncher/EntityDataAccessor;)Lnet/minecraft/network/syncher/SynchedEntityData$DataItem;
|
||||
public net.minecraft.resources.RegistryOps <init>(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resources/RegistryOps$RegistryInfoLookup;)V
|
||||
public net.minecraft.resources.RegistryOps lookupProvider
|
||||
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
|
||||
public net.minecraft.server.Main forceUpgrade(Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lcom/mojang/datafixers/DataFixer;ZLjava/util/function/BooleanSupplier;Lnet/minecraft/core/RegistryAccess;Z)V
|
||||
@@ -166,6 +168,8 @@ public net.minecraft.world.entity.Display$TextDisplay setText(Lnet/minecraft/net
|
||||
public net.minecraft.world.entity.Display$TextDisplay setTextOpacity(B)V
|
||||
public net.minecraft.world.entity.Entity DATA_TICKS_FROZEN
|
||||
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
|
||||
public net.minecraft.world.entity.Entity getAirDrag()F
|
||||
public net.minecraft.world.entity.Entity getDefaultGravity()D
|
||||
public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String;
|
||||
public net.minecraft.world.entity.Entity getFireImmuneTicks()I
|
||||
public net.minecraft.world.entity.Entity getSharedFlag(I)Z
|
||||
@@ -392,6 +396,7 @@ public net.minecraft.world.entity.npc.villager.Villager updateDemand()V
|
||||
public net.minecraft.world.entity.npc.villager.Villager updateSpecialPrices(Lnet/minecraft/world/entity/player/Player;)V
|
||||
public net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
|
||||
public net.minecraft.world.entity.player.Inventory equipment
|
||||
public net.minecraft.world.entity.player.Player canCriticalAttack(Lnet/minecraft/world/entity/Entity;)Z
|
||||
public net.minecraft.world.entity.player.Player closeContainer()V
|
||||
public net.minecraft.world.entity.player.Player enchantmentSeed
|
||||
public net.minecraft.world.entity.player.Player hurtDir
|
||||
@@ -472,8 +477,10 @@ public net.minecraft.world.inventory.AbstractMountInventoryMenu mount
|
||||
public net.minecraft.world.inventory.AnvilMenu cost
|
||||
public net.minecraft.world.inventory.AnvilMenu itemName
|
||||
public net.minecraft.world.inventory.AnvilMenu repairItemCountCost
|
||||
public net.minecraft.world.inventory.BrewingStandMenu DATA_COUNT
|
||||
public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
|
||||
public net.minecraft.world.inventory.CraftingMenu access
|
||||
public net.minecraft.world.inventory.LecternMenu DATA_COUNT
|
||||
public net.minecraft.world.inventory.MerchantContainer selectionHint
|
||||
public net.minecraft.world.item.AdventureModePredicate predicates
|
||||
public net.minecraft.world.item.CrossbowItem FIREWORK_POWER
|
||||
|
||||
+3
-23
@@ -1,5 +1,3 @@
|
||||
import io.papermc.paperweight.checkstyle.PaperCheckstyleExt
|
||||
import io.papermc.paperweight.checkstyle.tasks.PaperCheckstyleTask
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
|
||||
@@ -11,6 +9,7 @@ subprojects {
|
||||
apply {
|
||||
plugin("java-library")
|
||||
plugin("maven-publish")
|
||||
plugin("io.papermc.paperweight.paper-checkstyle")
|
||||
}
|
||||
|
||||
extensions.configure<JavaPluginExtension> {
|
||||
@@ -19,27 +18,8 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val tempDisabled = setOf("paper-server", "paper-generator", "test-plugin")
|
||||
|
||||
if (name !in tempDisabled) {
|
||||
apply { plugin("io.papermc.paperweight.paper-checkstyle") }
|
||||
extensions.configure<PaperCheckstyleExt> {
|
||||
typeUseAnnotationsFile.set(rootProject.layout.projectDirectory.file(".checkstyle/type_use_annotations.txt"))
|
||||
}
|
||||
|
||||
/*tasks.withType<PaperCheckstyleTask>().configureEach {
|
||||
configDirectory = rootProject.layout.projectDirectory.dir(".checkstyle")
|
||||
// configFile = layout.projectDirectory.file(".checkstyle/checkstyle.xml").asFile // use the base file if not overwritten
|
||||
maxHeapSize = "2g"
|
||||
reports {
|
||||
xml.required = true
|
||||
html.required = true
|
||||
}
|
||||
}*/
|
||||
|
||||
dependencies {
|
||||
"checkstyle"(project(":paper-checkstyle"))
|
||||
}
|
||||
dependencies {
|
||||
"checkstyle"(project(":paper-checkstyle"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ mcVersion=26.3
|
||||
# This is the current API version for use in (paper-)plugin.yml files
|
||||
# During snapshot cycles this should be the anticipated version of the release target
|
||||
apiVersion=26.3
|
||||
channel=ALPHA
|
||||
channel=STABLE
|
||||
|
||||
# Set to true while updating Minecraft version
|
||||
updatingMinecraft=false
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<!--generated sources are written by the generator, so we don't control their format-->
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="[\\/]paper-api[\\/]src[\\/]generated[\\/]"/>
|
||||
</module>
|
||||
|
||||
<!--Single Suppression Filters-->
|
||||
<module name="io.papermc.checkstyle.filters.BetterSuppressionSingleFilter">
|
||||
<property name="checks" value="Javadoc(Method|Type)"/>
|
||||
|
||||
@@ -1,121 +1,59 @@
|
||||
paper-api/src/generated/java/com/destroystokyo/paper/entity/ai/
|
||||
paper-api/src/generated/java/io/papermc/paper/registry/keys/
|
||||
paper-api/src/generated/java/io/papermc/paper/registry/keys/tags/
|
||||
paper-api/src/main/java/co/aikar/timings/
|
||||
paper-api/src/main/java/co/aikar/util/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/block/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/brigadier/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/ai/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/villager/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/block/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/brigadier/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/entity/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/inventory/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/player/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/profile/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/server/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/exception/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/inventory/meta/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/loottable/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/network/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/profile/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/util/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/utils/
|
||||
paper-api/src/main/java/io/papermc/paper/advancement/
|
||||
paper-api/src/main/java/io/papermc/paper/annotation/
|
||||
paper-api/src/main/java/io/papermc/paper/ban/
|
||||
paper-api/src/main/java/io/papermc/paper/block/
|
||||
paper-api/src/main/java/io/papermc/paper/block/bed/
|
||||
paper-api/src/main/java/io/papermc/paper/block/fluid/
|
||||
paper-api/src/main/java/io/papermc/paper/block/fluid/type/
|
||||
paper-api/src/main/java/io/papermc/paper/brigadier/
|
||||
paper-api/src/main/java/io/papermc/paper/chat/
|
||||
paper-api/src/main/java/io/papermc/paper/command/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/position/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/predicate/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/range/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/selector/
|
||||
paper-api/src/main/java/io/papermc/paper/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/connection/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/attribute/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/blocksattacks/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/consumable/
|
||||
paper-api/src/main/java/io/papermc/paper/datapack/
|
||||
paper-api/src/main/java/io/papermc/paper/dialog/
|
||||
paper-api/src/main/java/io/papermc/paper/enchantments/
|
||||
paper-api/src/main/java/io/papermc/paper/entity/
|
||||
paper-api/src/main/java/io/papermc/paper/entity/poi/
|
||||
paper-api/src/main/java/io/papermc/paper/event/block/
|
||||
paper-api/src/main/java/io/papermc/paper/event/connection/
|
||||
paper-api/src/main/java/io/papermc/paper/event/connection/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/event/entity/
|
||||
paper-api/src/main/java/io/papermc/paper/event/executor/
|
||||
paper-api/src/main/java/io/papermc/paper/event/inventory/
|
||||
paper-api/src/main/java/io/papermc/paper/event/packet/
|
||||
paper-api/src/main/java/io/papermc/paper/event/player/
|
||||
paper-api/src/main/java/io/papermc/paper/event/server/
|
||||
paper-api/src/main/java/io/papermc/paper/event/world/
|
||||
paper-api/src/main/java/io/papermc/paper/event/world/border/
|
||||
paper-api/src/main/java/io/papermc/paper/generated/
|
||||
paper-api/src/main/java/io/papermc/paper/inventory/
|
||||
paper-api/src/main/java/io/papermc/paper/inventory/tooltip/
|
||||
paper-api/src/main/java/io/papermc/paper/item/
|
||||
paper-api/src/main/java/io/papermc/paper/persistence/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/bootstrap/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/library/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/library/impl/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/classloader/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/entrypoint/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/util/
|
||||
paper-api/src/main/java/io/papermc/paper/potion/
|
||||
paper-api/src/main/java/io/papermc/paper/raytracing/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/client/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/action/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/body/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/input/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/type/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/event/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/event/type/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/holder/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/set/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/tag/
|
||||
paper-api/src/main/java/io/papermc/paper/scoreboard/numbers/
|
||||
paper-api/src/main/java/io/papermc/paper/tag/
|
||||
paper-api/src/main/java/io/papermc/paper/text/
|
||||
paper-api/src/main/java/io/papermc/paper/threadedregions/
|
||||
paper-api/src/main/java/io/papermc/paper/threadedregions/scheduler/
|
||||
paper-api/src/main/java/io/papermc/paper/util/
|
||||
paper-api/src/main/java/io/papermc/paper/world/
|
||||
paper-api/src/main/java/io/papermc/paper/world/damagesource/
|
||||
paper-api/src/main/java/io/papermc/paper/world/flag/
|
||||
paper-api/src/main/java/org/bukkit/
|
||||
paper-api/src/main/java/org/bukkit/advancement/
|
||||
paper-api/src/main/java/org/bukkit/attribute/
|
||||
paper-api/src/main/java/org/bukkit/ban/
|
||||
paper-api/src/main/java/org/bukkit/block/
|
||||
paper-api/src/main/java/org/bukkit/block/banner/
|
||||
paper-api/src/main/java/org/bukkit/block/data/
|
||||
paper-api/src/main/java/org/bukkit/block/data/type/
|
||||
paper-api/src/main/java/org/bukkit/block/sign/
|
||||
paper-api/src/main/java/org/bukkit/block/spawner/
|
||||
paper-api/src/main/java/org/bukkit/block/structure/
|
||||
paper-api/src/main/java/org/bukkit/boss/
|
||||
paper-api/src/main/java/org/bukkit/command/
|
||||
@@ -128,12 +66,9 @@ paper-api/src/main/java/org/bukkit/damage/
|
||||
paper-api/src/main/java/org/bukkit/enchantments/
|
||||
paper-api/src/main/java/org/bukkit/entity/
|
||||
paper-api/src/main/java/org/bukkit/entity/boat/
|
||||
paper-api/src/main/java/org/bukkit/entity/memory/
|
||||
paper-api/src/main/java/org/bukkit/entity/minecart/
|
||||
paper-api/src/main/java/org/bukkit/event/
|
||||
paper-api/src/main/java/org/bukkit/event/block/
|
||||
paper-api/src/main/java/org/bukkit/event/command/
|
||||
paper-api/src/main/java/org/bukkit/event/enchantment/
|
||||
paper-api/src/main/java/org/bukkit/event/entity/
|
||||
paper-api/src/main/java/org/bukkit/event/hanging/
|
||||
paper-api/src/main/java/org/bukkit/event/inventory/
|
||||
@@ -151,51 +86,28 @@ paper-api/src/main/java/org/bukkit/inventory/meta/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/components/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/tags/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/trim/
|
||||
paper-api/src/main/java/org/bukkit/inventory/recipe/
|
||||
paper-api/src/main/java/org/bukkit/inventory/view/
|
||||
paper-api/src/main/java/org/bukkit/inventory/view/builder/
|
||||
paper-api/src/main/java/org/bukkit/loot/
|
||||
paper-api/src/main/java/org/bukkit/map/
|
||||
paper-api/src/main/java/org/bukkit/material/
|
||||
paper-api/src/main/java/org/bukkit/material/types/
|
||||
paper-api/src/main/java/org/bukkit/metadata/
|
||||
paper-api/src/main/java/org/bukkit/packs/
|
||||
paper-api/src/main/java/org/bukkit/permissions/
|
||||
paper-api/src/main/java/org/bukkit/persistence/
|
||||
paper-api/src/main/java/org/bukkit/plugin/
|
||||
paper-api/src/main/java/org/bukkit/plugin/java/
|
||||
paper-api/src/main/java/org/bukkit/plugin/messaging/
|
||||
paper-api/src/main/java/org/bukkit/potion/
|
||||
paper-api/src/main/java/org/bukkit/profile/
|
||||
paper-api/src/main/java/org/bukkit/projectiles/
|
||||
paper-api/src/main/java/org/bukkit/scheduler/
|
||||
paper-api/src/main/java/org/bukkit/scoreboard/
|
||||
paper-api/src/main/java/org/bukkit/spawner/
|
||||
paper-api/src/main/java/org/bukkit/structure/
|
||||
paper-api/src/main/java/org/bukkit/tag/
|
||||
paper-api/src/main/java/org/bukkit/util/
|
||||
paper-api/src/main/java/org/bukkit/util/io/
|
||||
paper-api/src/main/java/org/bukkit/util/noise/
|
||||
paper-api/src/main/java/org/bukkit/util/permissions/
|
||||
paper-api/src/main/java/org/spigotmc/
|
||||
paper-api/src/main/java/org/spigotmc/event/player/
|
||||
paper-api/src/test/java/com/destroystokyo/paper/
|
||||
paper-api/src/test/java/io/papermc/paper/adventure/
|
||||
paper-api/src/test/java/io/papermc/paper/registry/
|
||||
paper-api/src/test/java/io/papermc/paper/testing/
|
||||
paper-api/src/test/java/io/papermc/paper/util/
|
||||
paper-api/src/test/java/org/bukkit/
|
||||
paper-api/src/test/java/org/bukkit/configuration/
|
||||
paper-api/src/test/java/org/bukkit/configuration/file/
|
||||
paper-api/src/test/java/org/bukkit/conversations/
|
||||
paper-api/src/test/java/org/bukkit/event/
|
||||
paper-api/src/test/java/org/bukkit/materials/
|
||||
paper-api/src/test/java/org/bukkit/metadata/
|
||||
paper-api/src/test/java/org/bukkit/plugin/
|
||||
paper-api/src/test/java/org/bukkit/plugin/messaging/
|
||||
paper-api/src/test/java/org/bukkit/scoreboard/
|
||||
paper-api/src/test/java/org/bukkit/support/
|
||||
paper-api/src/test/java/org/bukkit/support/provider/
|
||||
paper-api/src/test/java/org/bukkit/support/test/
|
||||
paper-api/src/test/java/org/bukkit/util/
|
||||
paper-api/src/test/java/org/bukkit/util/io/
|
||||
@@ -183,11 +183,6 @@ val generateApiVersioningFile = tasks.register<GenerateApiVersioningFile>("gener
|
||||
|
||||
tasks.jar {
|
||||
from(generateApiVersioningFile.flatMap { it.outputFile })
|
||||
manifest {
|
||||
attributes(
|
||||
"Automatic-Module-Name" to "org.bukkit"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Services {
|
||||
|
||||
@@ -234,7 +234,8 @@ public class MaterialTags {
|
||||
* Covers all music disc items.
|
||||
*/
|
||||
public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs"))
|
||||
.startsWith("MUSIC_DISC_").lock();
|
||||
.startsWith("MUSIC_DISC_")
|
||||
.ensureSize("MUSIC_DISCS", 22).lock();
|
||||
|
||||
/**
|
||||
* Covers all ores.
|
||||
|
||||
@@ -2,63 +2,58 @@ package com.destroystokyo.paper.block;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents the sounds that a {@link Block} makes in certain situations
|
||||
* Represents the sounds that a {@link Block} makes in certain situations.
|
||||
* <p>
|
||||
* The sound group includes break, step, place, hit, and fall sounds.
|
||||
*
|
||||
* @deprecated use {@link org.bukkit.SoundGroup}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
public interface BlockSoundGroup {
|
||||
/**
|
||||
* Gets the sound that plays when breaking this block
|
||||
* Gets the sound that plays when breaking this block.
|
||||
*
|
||||
* @return The break sound
|
||||
* @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
Sound getBreakSound();
|
||||
|
||||
/**
|
||||
* Gets the sound that plays when stepping on this block
|
||||
* Gets the sound that plays when stepping on this block.
|
||||
*
|
||||
* @return The step sound
|
||||
* @deprecated use {@link org.bukkit.SoundGroup#getStepSound()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
Sound getStepSound();
|
||||
|
||||
/**
|
||||
* Gets the sound that plays when placing this block
|
||||
* Gets the sound that plays when placing this block.
|
||||
*
|
||||
* @return The place sound
|
||||
* @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
Sound getPlaceSound();
|
||||
|
||||
/**
|
||||
* Gets the sound that plays when hitting this block
|
||||
* Gets the sound that plays when hitting this block.
|
||||
*
|
||||
* @return The hit sound
|
||||
* @deprecated use {@link org.bukkit.SoundGroup#getHitSound()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
Sound getHitSound();
|
||||
|
||||
/**
|
||||
* Gets the sound that plays when this block falls
|
||||
* Gets the sound that plays when this block falls.
|
||||
*
|
||||
* @return The fall sound
|
||||
* @deprecated use {@link org.bukkit.SoundGroup#getFallSound()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
Sound getFallSound();
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package com.destroystokyo.paper.block;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents information about a targeted block
|
||||
* Represents information about a targeted block.
|
||||
*
|
||||
* @deprecated use {@link org.bukkit.util.RayTraceResult}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.19.3")
|
||||
@@ -14,42 +14,41 @@ public class TargetBlockInfo {
|
||||
private final Block block;
|
||||
private final BlockFace blockFace;
|
||||
|
||||
public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) {
|
||||
public TargetBlockInfo(final Block block, final BlockFace blockFace) {
|
||||
this.block = block;
|
||||
this.blockFace = blockFace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block that is targeted
|
||||
* Get the block that is targeted.
|
||||
*
|
||||
* @return Targeted block
|
||||
*/
|
||||
@NotNull
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
return this.block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the targeted BlockFace
|
||||
* Get the targeted BlockFace.
|
||||
*
|
||||
* @return Targeted blockface
|
||||
*/
|
||||
@NotNull
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
return this.blockFace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the relative Block to the targeted block on the side it is targeted at
|
||||
* Get the relative Block to the targeted block on the side it is targeted at.
|
||||
*
|
||||
* @return Block relative to targeted block
|
||||
*/
|
||||
@NotNull
|
||||
public Block getRelativeBlock() {
|
||||
return block.getRelative(blockFace);
|
||||
return this.block.getRelative(this.blockFace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether fluids are considered when targeting a block.
|
||||
*
|
||||
* @deprecated use {@link org.bukkit.FluidCollisionMode}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.19.3")
|
||||
@@ -60,7 +59,7 @@ public class TargetBlockInfo {
|
||||
|
||||
public final FluidCollisionMode bukkit;
|
||||
|
||||
FluidMode(FluidCollisionMode bukkit) {
|
||||
FluidMode(final FluidCollisionMode bukkit) {
|
||||
this.bukkit = bukkit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Deprecated block API, replaced by {@link org.bukkit.SoundGroup} and {@link org.bukkit.util.RayTraceResult}.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.block;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+1
-2
@@ -2,7 +2,6 @@ package com.destroystokyo.paper.brigadier;
|
||||
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
@@ -12,5 +11,5 @@ import java.util.function.Predicate;
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.20.6")
|
||||
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
||||
public interface BukkitBrigadierCommand<S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
||||
}
|
||||
+6
-7
@@ -4,22 +4,21 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A command source that exposes its Bukkit equivalents.
|
||||
*
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface BukkitBrigadierCommandSource {
|
||||
|
||||
@Nullable
|
||||
Entity getBukkitEntity();
|
||||
@Nullable Entity getBukkitEntity();
|
||||
|
||||
@Nullable
|
||||
World getBukkitWorld();
|
||||
@Nullable World getBukkitWorld();
|
||||
|
||||
@Nullable
|
||||
Location getBukkitLocation();
|
||||
@Nullable Location getBukkitLocation();
|
||||
|
||||
CommandSender getBukkitSender();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Deprecated Brigadier integration, replaced by {@link io.papermc.paper.command.brigadier.Commands}.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.brigadier;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -2,37 +2,39 @@ package com.destroystokyo.paper.entity;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.checkerframework.checker.index.qual.NonNegative;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Handles pathfinding operations for an Entity
|
||||
* Handles pathfinding operations for an Entity.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Pathfinder {
|
||||
|
||||
/**
|
||||
* Gets the entity that is controlled by this pathfinder.
|
||||
*
|
||||
* @return The entity that is controlled by this pathfinder
|
||||
*/
|
||||
Mob getEntity();
|
||||
|
||||
/**
|
||||
* Instructs the Entity to stop trying to navigate to its current desired location
|
||||
* Instructs the Entity to stop trying to navigate to its current desired location.
|
||||
*/
|
||||
void stopPathfinding();
|
||||
|
||||
/**
|
||||
* If the entity is currently trying to navigate to a destination, this will return true
|
||||
* If the entity is currently trying to navigate to a destination, this will return true.
|
||||
*
|
||||
* @return true if the entity is navigating to a destination
|
||||
*/
|
||||
boolean hasPath();
|
||||
|
||||
/**
|
||||
* Gets the path the entity is currently following.
|
||||
*
|
||||
* @return The location the entity is trying to navigate to, or null if there is no destination
|
||||
*/
|
||||
@Nullable PathResult getCurrentPath();
|
||||
@@ -44,7 +46,7 @@ public interface Pathfinder {
|
||||
* @param loc Location to navigate to
|
||||
* @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
|
||||
*/
|
||||
default @Nullable PathResult findPath(Location loc) {
|
||||
default @Nullable PathResult findPath(final Location loc) {
|
||||
return this.findPath(loc, 0);
|
||||
}
|
||||
|
||||
@@ -52,12 +54,12 @@ public interface Pathfinder {
|
||||
* Calculates a destination for the Entity to navigate to, but does not set it
|
||||
* as the current target. Useful for calculating what would happen before setting it.
|
||||
*
|
||||
* @param loc Location to navigate to
|
||||
* @param loc Location to navigate to
|
||||
* @param reachRange The <a href="https://cp-algorithms.com/geometry/manhattan-distance.html">Manhattan-distance</a> threshold
|
||||
* from the target position at which the path is considered reached, where {@code 0} requires the exact target position
|
||||
* @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
|
||||
*/
|
||||
@Nullable PathResult findPath(final Location loc, final @NonNegative int reachRange);
|
||||
@Nullable PathResult findPath(Location loc, @NonNegative int reachRange);
|
||||
|
||||
/**
|
||||
* Calculates a destination for the Entity to navigate to reach the target entity,
|
||||
@@ -72,8 +74,7 @@ public interface Pathfinder {
|
||||
* @param target the Entity to navigate to
|
||||
* @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
|
||||
*/
|
||||
@Nullable
|
||||
default PathResult findPath(LivingEntity target) {
|
||||
default @Nullable PathResult findPath(final LivingEntity target) {
|
||||
return this.findPath((Entity) target);
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ public interface Pathfinder {
|
||||
* @param target the Entity to navigate to
|
||||
* @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
|
||||
*/
|
||||
default @Nullable PathResult findPath(Entity target) {
|
||||
default @Nullable PathResult findPath(final Entity target) {
|
||||
return this.findPath(target, 0);
|
||||
}
|
||||
|
||||
@@ -104,12 +105,12 @@ public interface Pathfinder {
|
||||
* <p>
|
||||
* However, this behavior is not guaranteed, and is subject to the games behavior.
|
||||
*
|
||||
* @param target the Entity to navigate to
|
||||
* @param target the Entity to navigate to
|
||||
* @param reachRange The <a href="https://cp-algorithms.com/geometry/manhattan-distance.html">Manhattan-distance</a> threshold
|
||||
* from the target position at which the path is considered reached, where {@code 0} requires the exact target position
|
||||
* @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated
|
||||
*/
|
||||
@Nullable PathResult findPath(final Entity target, final @NonNegative int reachRange);
|
||||
@Nullable PathResult findPath(Entity target, @NonNegative int reachRange);
|
||||
|
||||
/**
|
||||
* Calculates a destination for the Entity to navigate to, and sets it with default speed
|
||||
@@ -118,7 +119,7 @@ public interface Pathfinder {
|
||||
* @param loc Location to navigate to
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(Location loc) {
|
||||
default boolean moveTo(final Location loc) {
|
||||
return this.moveTo(loc, 1);
|
||||
}
|
||||
|
||||
@@ -130,8 +131,8 @@ public interface Pathfinder {
|
||||
* @param speed Speed multiplier to navigate at, where 1 is 'normal'
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(Location loc, double speed) {
|
||||
PathResult path = this.findPath(loc);
|
||||
default boolean moveTo(final Location loc, final double speed) {
|
||||
final PathResult path = this.findPath(loc);
|
||||
return path != null && this.moveTo(path, speed);
|
||||
}
|
||||
|
||||
@@ -147,7 +148,7 @@ public interface Pathfinder {
|
||||
* @param target the Entity to navigate to
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(LivingEntity target) {
|
||||
default boolean moveTo(final LivingEntity target) {
|
||||
return this.moveTo(target, 1);
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ public interface Pathfinder {
|
||||
* @param speed Speed multiplier to navigate at, where 1 is 'normal'
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(LivingEntity target, double speed) {
|
||||
default boolean moveTo(final LivingEntity target, final double speed) {
|
||||
return this.moveTo((Entity) target, speed);
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ public interface Pathfinder {
|
||||
* @param target the Entity to navigate to
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(Entity target) {
|
||||
default boolean moveTo(final Entity target) {
|
||||
return this.moveTo(target, 1);
|
||||
}
|
||||
|
||||
@@ -197,8 +198,8 @@ public interface Pathfinder {
|
||||
* @param speed Speed multiplier to navigate at, where 1 is 'normal'
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(Entity target, double speed) {
|
||||
PathResult path = this.findPath(target);
|
||||
default boolean moveTo(final Entity target, final double speed) {
|
||||
final PathResult path = this.findPath(target);
|
||||
return path != null && this.moveTo(path, speed);
|
||||
}
|
||||
|
||||
@@ -209,13 +210,13 @@ public interface Pathfinder {
|
||||
* @param path The Path to start following
|
||||
* @return If the pathfinding was successfully started
|
||||
*/
|
||||
default boolean moveTo(PathResult path) {
|
||||
default boolean moveTo(final PathResult path) {
|
||||
return this.moveTo(path, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the result of a previous pathfinding calculation and sets it
|
||||
* as the active pathfinding,
|
||||
* as the active pathfinding.
|
||||
*
|
||||
* @param path The Path to start following
|
||||
* @param speed Speed multiplier to navigate at, where 1 is 'normal'
|
||||
@@ -231,7 +232,7 @@ public interface Pathfinder {
|
||||
boolean canOpenDoors();
|
||||
|
||||
/**
|
||||
* Allows this pathfinder to pass through closed doors, or not
|
||||
* Allows this pathfinder to pass through closed doors, or not.
|
||||
*
|
||||
* @param canOpenDoors if the mob can pass through closed doors, or not
|
||||
*/
|
||||
@@ -245,33 +246,33 @@ public interface Pathfinder {
|
||||
boolean canPassDoors();
|
||||
|
||||
/**
|
||||
* Allows this pathfinder to pass through open doors, or not
|
||||
* Allows this pathfinder to pass through open doors, or not.
|
||||
*
|
||||
* @param canPassDoors if the mob can pass through open doors, or not
|
||||
*/
|
||||
void setCanPassDoors(boolean canPassDoors);
|
||||
|
||||
/**
|
||||
* Checks if this pathfinder assumes that the mob can float
|
||||
* Checks if this pathfinder assumes that the mob can float.
|
||||
*
|
||||
* @return if this pathfinder assumes that the mob can float
|
||||
*/
|
||||
boolean canFloat();
|
||||
|
||||
/**
|
||||
* Makes this pathfinder assume that the mob can float, or not
|
||||
* Makes this pathfinder assume that the mob can float, or not.
|
||||
*
|
||||
* @param canFloat if the mob can float, or not
|
||||
*/
|
||||
void setCanFloat(boolean canFloat);
|
||||
|
||||
/**
|
||||
* Represents the result of a pathfinding calculation
|
||||
* Represents the result of a pathfinding calculation.
|
||||
*/
|
||||
interface PathResult {
|
||||
|
||||
/**
|
||||
* All currently calculated points to follow along the path to reach the destination location
|
||||
* All currently calculated points to follow along the path to reach the destination location.
|
||||
* <p>
|
||||
* Will return points the entity has already moved past, see {@link #getNextPointIndex()}
|
||||
*
|
||||
@@ -280,23 +281,29 @@ public interface Pathfinder {
|
||||
List<Location> getPoints();
|
||||
|
||||
/**
|
||||
* @return Returns the index of the current point along the points returned in {@link #getPoints()} the entity
|
||||
* Gets the index of the current point along the points returned in {@link #getPoints()} the entity
|
||||
* is trying to reach. This value will be higher than the maximum index of {@link #getPoints()} if this path finding is done.
|
||||
*
|
||||
* @return the index of the next point
|
||||
*/
|
||||
int getNextPointIndex();
|
||||
|
||||
/**
|
||||
* Gets the next location in the path points the entity is trying to reach.
|
||||
*
|
||||
* @return The next location in the path points the entity is trying to reach, or null if there is no next point
|
||||
*/
|
||||
@Nullable Location getNextPoint();
|
||||
|
||||
/**
|
||||
* Gets the closest point the path can get to the target location.
|
||||
*
|
||||
* @return The closest point the path can get to the target location
|
||||
*/
|
||||
@Nullable Location getFinalPoint();
|
||||
|
||||
/**
|
||||
* Checks whether the final point can be reached
|
||||
* Checks whether the final point can be reached.
|
||||
*
|
||||
* @return whether the final point can be reached
|
||||
* @see #getFinalPoint()
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.destroystokyo.paper.entity;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
/**
|
||||
* A mob that can perform ranged attacks.
|
||||
*/
|
||||
public interface RangedEntity extends Mob {
|
||||
|
||||
/**
|
||||
* Attack the specified entity using a ranged attack.
|
||||
*
|
||||
@@ -16,7 +18,7 @@ public interface RangedEntity extends Mob {
|
||||
void rangedAttack(LivingEntity target, float charge);
|
||||
|
||||
/**
|
||||
* Sets that the Entity is "charging" up an attack, by raising its hands
|
||||
* Sets that the Entity is "charging" up an attack, by raising its hands.
|
||||
*
|
||||
* @param raiseHands Whether the entities hands are raised to charge attack
|
||||
* @deprecated use {@link #setAggressive(boolean)}
|
||||
@@ -25,7 +27,8 @@ public interface RangedEntity extends Mob {
|
||||
void setChargingAttack(boolean raiseHands);
|
||||
|
||||
/**
|
||||
* Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack
|
||||
* Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack.
|
||||
*
|
||||
* @return If entities hands are raised
|
||||
* @deprecated use {@link #isHandRaised()}
|
||||
*/
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.destroystokyo.paper.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents information about a targeted entity
|
||||
* Represents information about a targeted entity.
|
||||
*
|
||||
* @deprecated use {@link org.bukkit.util.RayTraceResult}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.19.3")
|
||||
@@ -13,28 +13,26 @@ public class TargetEntityInfo {
|
||||
private final Entity entity;
|
||||
private final Vector hitVec;
|
||||
|
||||
public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) {
|
||||
public TargetEntityInfo(final Entity entity, final Vector hitVec) {
|
||||
this.entity = entity;
|
||||
this.hitVec = hitVec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entity that is targeted
|
||||
* Get the entity that is targeted.
|
||||
*
|
||||
* @return Targeted entity
|
||||
*/
|
||||
@NotNull
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position the entity is targeted at
|
||||
* Get the position the entity is targeted at.
|
||||
*
|
||||
* @return Targeted position
|
||||
*/
|
||||
@NotNull
|
||||
public Vector getHitVector() {
|
||||
return hitVec;
|
||||
return this.hitVec;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Entity pathfinding, ranged attack and targeting API.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.entity;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -3,20 +3,28 @@ package com.destroystokyo.paper.entity.villager;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.util.Set;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
/**
|
||||
* A reputation score for a player on a villager.
|
||||
*/
|
||||
@NullMarked
|
||||
public final class Reputation {
|
||||
|
||||
private final Map<ReputationType, Integer> reputation;
|
||||
|
||||
/**
|
||||
* Creates an empty reputation.
|
||||
*/
|
||||
public Reputation() {
|
||||
this(new EnumMap<>(ReputationType.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a reputation backed by the given map, so changes to the reputation are made to the map.
|
||||
*
|
||||
* @param reputation the reputation values by type
|
||||
*/
|
||||
public Reputation(final Map<ReputationType, Integer> reputation) {
|
||||
Preconditions.checkArgument(reputation != null, "reputation cannot be null");
|
||||
this.reputation = reputation;
|
||||
@@ -36,7 +44,7 @@ public final class Reputation {
|
||||
/**
|
||||
* Sets the reputation value for a specific {@link ReputationType}.
|
||||
*
|
||||
* @param type The {@link ReputationType type} of reputation to set.
|
||||
* @param type The {@link ReputationType type} of reputation to set.
|
||||
* @param value The value of the {@link ReputationType type}.
|
||||
*/
|
||||
public void setReputation(final ReputationType type, final int value) {
|
||||
@@ -53,4 +61,13 @@ public final class Reputation {
|
||||
public boolean hasReputationSet(final ReputationType type) {
|
||||
return this.reputation.containsKey(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a set of all {@link ReputationType types} that have a reputation value set.
|
||||
*
|
||||
* @return A set of {@link ReputationType types}.
|
||||
*/
|
||||
public @Unmodifiable Set<ReputationType> getReputationsSet() {
|
||||
return Set.copyOf(this.reputation.keySet());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for villagers.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.entity.villager;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+2
-2
@@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
|
||||
@@ -28,9 +27,10 @@ import org.jspecify.annotations.NullMarked;
|
||||
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
|
||||
*
|
||||
* <p>This is a draft/experimental API and is subject to change.</p>
|
||||
*
|
||||
* @param <S> the type of the command source
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public class AsyncPlayerSendCommandsEvent<S extends CommandSourceStack> extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
-2
@@ -7,7 +7,6 @@ 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;
|
||||
|
||||
/**
|
||||
* Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
|
||||
@@ -16,7 +15,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
* <p>
|
||||
* If the suggestions are empty after this event has been called, nothing will be sent to the client.
|
||||
*/
|
||||
@NullMarked
|
||||
public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
+19
-10
@@ -1,6 +1,7 @@
|
||||
package com.destroystokyo.paper.event.brigadier;
|
||||
|
||||
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommand;
|
||||
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
|
||||
import com.mojang.brigadier.tree.ArgumentCommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
@@ -9,7 +10,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.server.ServerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
|
||||
@@ -18,18 +19,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
* This is done at Plugin Enable time after commands have been registered, but may also
|
||||
* run at a later point in the server lifetime due to plugins, a server reload, etc.</p>
|
||||
*
|
||||
* @param <S> the type of the command source
|
||||
* @deprecated this event has been superseded by the Commands API and will be removed in a future release.
|
||||
* Listen to {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#COMMANDS} instead
|
||||
* Listen to {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#COMMANDS} instead
|
||||
*/
|
||||
@Deprecated(since = "1.20.6")
|
||||
@Warning(value = true, propagate = false)
|
||||
public class CommandRegisteredEvent<S extends com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
|
||||
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final String commandLabel;
|
||||
private final Command command;
|
||||
private final com.destroystokyo.paper.brigadier.BukkitBrigadierCommand<S> brigadierCommand;
|
||||
private final BukkitBrigadierCommand<S> brigadierCommand;
|
||||
private final RootCommandNode<S> root;
|
||||
private final ArgumentCommandNode<S, String> defaultArgs;
|
||||
private LiteralCommandNode<S> literal;
|
||||
@@ -37,7 +39,15 @@ public class CommandRegisteredEvent<S extends com.destroystokyo.paper.brigadier.
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public CommandRegisteredEvent(String commandLabel, com.destroystokyo.paper.brigadier.BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
|
||||
@ApiStatus.Internal
|
||||
public CommandRegisteredEvent(
|
||||
final String commandLabel,
|
||||
final BukkitBrigadierCommand<S> brigadierCommand,
|
||||
final Command command,
|
||||
final RootCommandNode<S> root,
|
||||
final LiteralCommandNode<S> literal,
|
||||
final ArgumentCommandNode<S, String> defaultArgs
|
||||
) {
|
||||
this.commandLabel = commandLabel;
|
||||
this.brigadierCommand = brigadierCommand;
|
||||
this.command = command;
|
||||
@@ -110,15 +120,15 @@ public class CommandRegisteredEvent<S extends com.destroystokyo.paper.brigadier.
|
||||
*
|
||||
* @param literal new node
|
||||
*/
|
||||
public void setLiteral(LiteralCommandNode<S> literal) {
|
||||
public void setLiteral(final LiteralCommandNode<S> literal) {
|
||||
this.literal = literal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this command should is treated as "raw".
|
||||
*
|
||||
* @see #setRawCommand(boolean)
|
||||
* @return whether this command is treated as "raw"
|
||||
* @see #setRawCommand(boolean)
|
||||
*/
|
||||
public boolean isRawCommand() {
|
||||
return this.rawCommand;
|
||||
@@ -152,16 +162,15 @@ public class CommandRegisteredEvent<S extends com.destroystokyo.paper.brigadier.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Events relating to the Brigadier command tree, such as the commands and suggestions sent to clients.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.event.brigadier;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+3
-5
@@ -5,11 +5,10 @@ import org.bukkit.inventory.GrindstoneInventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when an item is put in a slot for grinding in a Grindstone
|
||||
* Called when an item is put in a slot for grinding in a Grindstone.
|
||||
*
|
||||
* @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent}
|
||||
*/
|
||||
@@ -18,11 +17,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PrepareGrindstoneEvent extends PrepareResultEvent {
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
public PrepareGrindstoneEvent(final InventoryView inventory, final @Nullable ItemStack result) {
|
||||
super(inventory, result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GrindstoneInventory getInventory() {
|
||||
return (GrindstoneInventory) super.getInventory();
|
||||
|
||||
+1
-3
@@ -4,13 +4,11 @@ import org.bukkit.event.inventory.PrepareInventoryResultEvent;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when an item is put in an inventory containing a result slot
|
||||
* Called when an item is put in an inventory containing a result slot.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PrepareResultEvent extends PrepareInventoryResultEvent {
|
||||
|
||||
// HandlerList on PrepareInventoryResultEvent to ensure api compat
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Inventory events.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.event.inventory;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+16
-4
@@ -1,6 +1,8 @@
|
||||
package com.destroystokyo.paper.event.player;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -41,10 +43,10 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
|
||||
private final UUID playerUniqueId;
|
||||
private final String playerName;
|
||||
private final InetAddress ipAddress;
|
||||
private final SocketAddress ipAddress;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) {
|
||||
public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final SocketAddress ipAddress, final boolean async) {
|
||||
super(async);
|
||||
this.playerUniqueId = playerUniqueId;
|
||||
this.playerName = playerName;
|
||||
@@ -66,10 +68,20 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player's IP address.
|
||||
* Returns the player's socket address.
|
||||
*/
|
||||
public SocketAddress getSocketAddress() {
|
||||
return this.ipAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player's IP address, or the loopback address if the player
|
||||
* is connecting through a Unix domain socket and the proxy has not
|
||||
* forwarded the player's IP address yet.
|
||||
*/
|
||||
public InetAddress getIpAddress() {
|
||||
return this.ipAddress;
|
||||
if (this.ipAddress instanceof InetSocketAddress inet) return inet.getAddress();
|
||||
return InetAddress.getLoopbackAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
|
||||
@ApiStatus.Internal
|
||||
public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
|
||||
@NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
|
||||
super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
|
||||
super("", client.getSocketAddress(), motd, numPlayers, maxPlayers);
|
||||
this.client = client;
|
||||
this.numPlayers = numPlayers;
|
||||
this.version = version;
|
||||
|
||||
+15
-12
@@ -2,75 +2,78 @@ package com.destroystokyo.paper.inventory.meta;
|
||||
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Represents the meta of an armor stand item, which controls the armor stand that is spawned from it.
|
||||
*/
|
||||
public interface ArmorStandMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Gets whether the ArmorStand should be invisible when spawned
|
||||
* Gets whether the ArmorStand should be invisible when spawned.
|
||||
*
|
||||
* @return true if this should be invisible
|
||||
*/
|
||||
boolean isInvisible();
|
||||
|
||||
/**
|
||||
* Gets whether this ArmorStand should have no base plate when spawned
|
||||
* Gets whether this ArmorStand should have no base plate when spawned.
|
||||
*
|
||||
* @return true if it will not have a base plate
|
||||
*/
|
||||
boolean hasNoBasePlate();
|
||||
|
||||
/**
|
||||
* Gets whether this ArmorStand should show arms when spawned
|
||||
* Gets whether this ArmorStand should show arms when spawned.
|
||||
*
|
||||
* @return true if it will show arms
|
||||
*/
|
||||
boolean shouldShowArms();
|
||||
|
||||
/**
|
||||
* Gets whether this ArmorStand will be small when spawned
|
||||
* Gets whether this ArmorStand will be small when spawned.
|
||||
*
|
||||
* @return true if it will be small
|
||||
*/
|
||||
boolean isSmall();
|
||||
|
||||
/**
|
||||
* Gets whether this ArmorStand will be a marker when spawned
|
||||
* The exact details of this flag are an implementation detail
|
||||
* Gets whether this ArmorStand will be a marker when spawned.
|
||||
* The exact details of this flag are an implementation detail.
|
||||
*
|
||||
* @return true if it will be a marker
|
||||
*/
|
||||
boolean isMarker();
|
||||
|
||||
/**
|
||||
* Sets that this ArmorStand should be invisible when spawned
|
||||
* Sets that this ArmorStand should be invisible when spawned.
|
||||
*
|
||||
* @param invisible true if set invisible
|
||||
*/
|
||||
void setInvisible(boolean invisible);
|
||||
|
||||
/**
|
||||
* Sets that this ArmorStand should have no base plate when spawned
|
||||
* Sets that this ArmorStand should have no base plate when spawned.
|
||||
*
|
||||
* @param noBasePlate true if no base plate
|
||||
*/
|
||||
void setNoBasePlate(boolean noBasePlate);
|
||||
|
||||
/**
|
||||
* Sets that this ArmorStand should show arms when spawned
|
||||
* Sets that this ArmorStand should show arms when spawned.
|
||||
*
|
||||
* @param showArms true if show arms
|
||||
*/
|
||||
void setShowArms(boolean showArms);
|
||||
|
||||
/**
|
||||
* Sets that this ArmorStand should be small when spawned
|
||||
* Sets that this ArmorStand should be small when spawned.
|
||||
*
|
||||
* @param small true if small
|
||||
*/
|
||||
void setSmall(boolean small);
|
||||
|
||||
/**
|
||||
* Sets that this ArmorStand should be a marker when spawned
|
||||
* The exact details of this flag are an implementation detail
|
||||
* Sets that this ArmorStand should be a marker when spawned.
|
||||
* The exact details of this flag are an implementation detail.
|
||||
*
|
||||
* @param marker true if a marker
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Item meta types.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.inventory.meta;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.destroystokyo.paper.network;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.net.SocketAddress;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a client connected to the server.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface NetworkClient {
|
||||
|
||||
/**
|
||||
@@ -15,6 +14,15 @@ public interface NetworkClient {
|
||||
*
|
||||
* @return The client's socket address
|
||||
*/
|
||||
SocketAddress getSocketAddress();
|
||||
|
||||
/**
|
||||
* Returns an instance of {@link InetSocketAddress} associated with the
|
||||
* client's socket address.
|
||||
*
|
||||
* @return The client's {@link InetSocketAddress}, or the loopback address
|
||||
* if this is a Unix domain socket connection
|
||||
*/
|
||||
InetSocketAddress getAddress();
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for clients connecting to the server.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.network;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -8,7 +8,6 @@ import net.kyori.adventure.text.object.ObjectContents;
|
||||
import net.kyori.adventure.text.object.ObjectContentsLike;
|
||||
import net.kyori.adventure.text.object.PlayerHeadObjectContents;
|
||||
import org.bukkit.profile.PlayerTextures;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import static net.kyori.adventure.text.object.PlayerHeadObjectContents.property;
|
||||
@@ -16,40 +15,42 @@ import static net.kyori.adventure.text.object.PlayerHeadObjectContents.property;
|
||||
/**
|
||||
* Represents a players profile for the game, such as UUID, Name, and textures.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerHeadObjectContents.SkinSource, ObjectContentsLike {
|
||||
|
||||
/**
|
||||
* Gets the name of this profile.
|
||||
*
|
||||
* @return The players name, if set
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
String getName();
|
||||
@Nullable String getName();
|
||||
|
||||
/**
|
||||
* Sets this profiles Name
|
||||
* Sets this profiles Name.
|
||||
*
|
||||
* @param name The new Name
|
||||
* @return The previous Name
|
||||
* @deprecated create a new profile with {@link org.bukkit.Server#createProfile(UUID, String)} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.18.1")
|
||||
String setName(@Nullable String name);
|
||||
@Nullable String setName(@Nullable String name);
|
||||
|
||||
/**
|
||||
* Gets the unique identifier of this profile.
|
||||
*
|
||||
* @return The players unique identifier, if set
|
||||
*/
|
||||
@Nullable
|
||||
UUID getId();
|
||||
@Nullable UUID getId();
|
||||
|
||||
/**
|
||||
* Sets this profiles UUID
|
||||
* Sets this profiles UUID.
|
||||
*
|
||||
* @param uuid The new UUID
|
||||
* @return The previous UUID
|
||||
* @deprecated create a new profile with {@link org.bukkit.Server#createProfile(UUID, String)} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.18.1")
|
||||
@Nullable
|
||||
UUID setId(@Nullable UUID uuid);
|
||||
@Nullable UUID setId(@Nullable UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerTextures} of this profile.
|
||||
@@ -65,19 +66,21 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
* Copies the given textures.
|
||||
*
|
||||
* @param textures the textures to copy, or {@code null} to clear the
|
||||
* textures
|
||||
* textures
|
||||
*/
|
||||
@Override
|
||||
void setTextures(@Nullable PlayerTextures textures);
|
||||
|
||||
/**
|
||||
* Gets the properties of this profile.
|
||||
*
|
||||
* @return A Mutable set of this player's properties, such as textures.
|
||||
* Values specified here are subject to implementation details.
|
||||
* Values specified here are subject to implementation details.
|
||||
*/
|
||||
Set<ProfileProperty> getProperties();
|
||||
|
||||
/**
|
||||
* Check if the Profile has the specified property
|
||||
* Check if the Profile has the specified property.
|
||||
*
|
||||
* @param property Property name to check
|
||||
* @return If the property is set
|
||||
@@ -85,7 +88,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
boolean hasProperty(@Nullable String property);
|
||||
|
||||
/**
|
||||
* Sets a property. If the property already exists, the previous one will be replaced
|
||||
* Sets a property. If the property already exists, the previous one will be replaced.
|
||||
*
|
||||
* @param property Property to set.
|
||||
* @throws IllegalArgumentException if setting the property results in more than 16 properties
|
||||
@@ -93,7 +96,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
void setProperty(ProfileProperty property);
|
||||
|
||||
/**
|
||||
* Sets multiple properties. If any of the set properties already exist, it will be replaced
|
||||
* Sets multiple properties. If any of the set properties already exist, it will be replaced.
|
||||
*
|
||||
* @param properties The properties to set
|
||||
* @throws IllegalArgumentException if the number of properties exceeds 16
|
||||
@@ -101,7 +104,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
void setProperties(Collection<ProfileProperty> properties);
|
||||
|
||||
/**
|
||||
* Removes a specific property from this profile
|
||||
* Removes a specific property from this profile.
|
||||
*
|
||||
* @param property The property to remove
|
||||
* @return If a property was removed
|
||||
@@ -109,7 +112,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
boolean removeProperty(@Nullable String property);
|
||||
|
||||
/**
|
||||
* Removes a specific property from this profile
|
||||
* Removes a specific property from this profile.
|
||||
*
|
||||
* @param property The property to remove
|
||||
* @return If a property was removed
|
||||
@@ -119,7 +122,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all properties in the collection
|
||||
* Removes all properties in the collection.
|
||||
*
|
||||
* @param properties The properties to remove
|
||||
* @return If any property was removed
|
||||
@@ -135,11 +138,13 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all properties on this profile
|
||||
* Clears all properties on this profile.
|
||||
*/
|
||||
void clearProperties();
|
||||
|
||||
/**
|
||||
* Checks whether this profile has both a unique identifier and a name.
|
||||
*
|
||||
* @return If the profile is now complete (has UUID and Name)
|
||||
*/
|
||||
@Override
|
||||
@@ -203,7 +208,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
* <p>
|
||||
* Optionally will also fill textures.
|
||||
*
|
||||
* @param textures controls if we should fill the profile with texture properties
|
||||
* @param textures controls if we should fill the profile with texture properties
|
||||
* @param onlineMode Treat this server as online mode or not
|
||||
* @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
|
||||
*/
|
||||
@@ -216,7 +221,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
* properties (name, unique id, textures, etc.), and updates existing
|
||||
* properties (e.g. name, textures, etc.) to their official and up-to-date
|
||||
* values. This operation does not alter the current profile, but produces a
|
||||
* new updated {@link PlayerProfile}.
|
||||
* new updated {@code PlayerProfile}.
|
||||
* <p>
|
||||
* If no player exists for the unique id or name of this profile, this
|
||||
* operation yields a profile that is equal to the current profile, which
|
||||
@@ -241,7 +246,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
CompletableFuture<PlayerProfile> update();
|
||||
|
||||
/**
|
||||
* Whether this Profile has textures associated to it
|
||||
* Whether this Profile has textures associated to it.
|
||||
*
|
||||
* @return If it has a textures property
|
||||
*/
|
||||
@@ -262,6 +267,7 @@ public interface PlayerProfile extends org.bukkit.profile.PlayerProfile, PlayerH
|
||||
return ObjectContents.playerHead(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
@Override
|
||||
default void applySkinToPlayerHeadContents(final PlayerHeadObjectContents.Builder builder) {
|
||||
if (this.getProperties().isEmpty()) {
|
||||
|
||||
@@ -2,23 +2,34 @@ package com.destroystokyo.paper.profile;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Objects;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a property on a {@link PlayerProfile}
|
||||
* Represents a property on a {@link PlayerProfile}.
|
||||
*/
|
||||
@NullMarked
|
||||
public final class ProfileProperty {
|
||||
|
||||
private final String name;
|
||||
private final String value;
|
||||
private final @Nullable String signature;
|
||||
|
||||
/**
|
||||
* Creates an unsigned property.
|
||||
*
|
||||
* @param name the property name
|
||||
* @param value the property value
|
||||
*/
|
||||
public ProfileProperty(final String name, final String value) {
|
||||
this(name, value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a property.
|
||||
*
|
||||
* @param name the property name, at most 64 characters
|
||||
* @param value the property value, at most 32767 characters
|
||||
* @param signature the signature, at most 1024 characters, or {@code null} if unsigned
|
||||
*/
|
||||
public ProfileProperty(final String name, final String value, final @Nullable String signature) {
|
||||
this.name = Preconditions.checkNotNull(name, "ProfileProperty name can not be null");
|
||||
this.value = Preconditions.checkNotNull(value, "ProfileProperty value can not be null");
|
||||
@@ -29,6 +40,8 @@ public final class ProfileProperty {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this property.
|
||||
*
|
||||
* @return The property name, ie "textures"
|
||||
*/
|
||||
public String getName() {
|
||||
@@ -36,6 +49,8 @@ public final class ProfileProperty {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of this property.
|
||||
*
|
||||
* @return The property value, likely to be base64 encoded
|
||||
*/
|
||||
public String getValue() {
|
||||
@@ -43,13 +58,17 @@ public final class ProfileProperty {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A signature from Mojang for signed properties
|
||||
* Gets the signature of this property.
|
||||
*
|
||||
* @return A signature for signed properties
|
||||
*/
|
||||
public @Nullable String getSignature() {
|
||||
return this.signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this property is signed.
|
||||
*
|
||||
* @return If this property has a signature or not
|
||||
*/
|
||||
public boolean isSigned() {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for player profiles and their properties.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.profile;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -1,15 +1,18 @@
|
||||
package com.destroystokyo.paper.util;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Rethrows checked exceptions without declaring them.
|
||||
*
|
||||
* @hidden
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public final class SneakyThrow {
|
||||
|
||||
private SneakyThrow() {
|
||||
}
|
||||
|
||||
public static void sneaky(final Throwable exception) {
|
||||
SneakyThrow.throwSneaky(exception);
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@ 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;
|
||||
|
||||
@NullMarked
|
||||
/**
|
||||
* Provides the message shown by the {@code /version} command about whether the server is up to date.
|
||||
*/
|
||||
public interface VersionFetcher {
|
||||
|
||||
/**
|
||||
* Amount of time to cache results for in milliseconds
|
||||
* Amount of time to cache results for in milliseconds.
|
||||
* <p>
|
||||
* Negative values will never cache.
|
||||
*
|
||||
@@ -36,11 +37,13 @@ public interface VersionFetcher {
|
||||
* @deprecated {@code serverVersion} is not required
|
||||
*/
|
||||
@Deprecated
|
||||
default Component getVersionMessage(String serverVersion) {
|
||||
return getVersionMessage();
|
||||
default Component getVersionMessage(final String serverVersion) {
|
||||
return this.getVersionMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* A version fetcher used when the server does not provide one.
|
||||
*
|
||||
* @hidden
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Miscellaneous Paper utilities.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.util;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -5,19 +5,25 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PaperPluginLogger extends Logger {
|
||||
public final class PaperPluginLogger extends Logger {
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static Logger getLogger(final PluginDescriptionFile description) {
|
||||
return getLogger((PluginMeta) description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a logger for the given plugin and registers it with the {@link LogManager}.
|
||||
* <p>
|
||||
* If a logger with the same name is already registered, that logger is returned instead.
|
||||
*
|
||||
* @param meta the meta of the plugin to create the logger for
|
||||
* @return the logger for the plugin
|
||||
*/
|
||||
public static Logger getLogger(final PluginMeta meta) {
|
||||
Logger logger = new PaperPluginLogger(meta);
|
||||
if (!LogManager.getLogManager().addLogger(logger)) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Miscellaneous Paper utilities.
|
||||
*/
|
||||
@NullMarked
|
||||
package com.destroystokyo.paper.utils;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -5,14 +5,17 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
||||
import io.papermc.paper.datacomponent.item.ResolvableProfile;
|
||||
import io.papermc.paper.entity.poi.PoiType;
|
||||
import io.papermc.paper.persistence.PersistentDataKey;
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
import io.papermc.paper.world.damagesource.CombatEntry;
|
||||
import io.papermc.paper.world.damagesource.FallLocationType;
|
||||
import java.io.IOException;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
import net.kyori.adventure.util.Services;
|
||||
@@ -25,12 +28,14 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.damage.DamageEffect;
|
||||
import org.bukkit.damage.DamageSource;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.enchantments.EnchantmentOffer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -52,10 +57,11 @@ public interface InternalAPIBridge {
|
||||
* @return the instance.
|
||||
*/
|
||||
static InternalAPIBridge get() {
|
||||
//<editor-fold defaultstate="collapsed" desc="Holder">
|
||||
class Holder {
|
||||
|
||||
public static final InternalAPIBridge INSTANCE = Services.service(InternalAPIBridge.class).orElseThrow();
|
||||
public static final InternalAPIBridge INSTANCE = Services.service(ServiceLoader.load(InternalAPIBridge.class), InternalAPIBridge.class).orElseThrow();
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
@@ -69,14 +75,15 @@ public interface InternalAPIBridge {
|
||||
CombatEntry createCombatEntry(DamageSource damageSource, float damage, @Nullable FallLocationType fallLocationType, float fallDistance);
|
||||
|
||||
/**
|
||||
* Causes this predicate to be considered restricted.
|
||||
* Applying this to a command node prevents this command from being executed from an
|
||||
* unattended context, such as click events.
|
||||
* Allows overriding default restricted check.
|
||||
* Applying this to a command node forcefully prevents or permits this command to be
|
||||
* executed from an unattended context, such as click events.
|
||||
*
|
||||
* @param predicate wrapped predicate
|
||||
* @param predicate wrapped predicate
|
||||
* @param restricted restricted status of the predicate
|
||||
* @return wrapped predicate
|
||||
*/
|
||||
Predicate<CommandSourceStack> restricted(Predicate<CommandSourceStack> predicate);
|
||||
Predicate<CommandSourceStack> restricted(Predicate<CommandSourceStack> predicate, boolean restricted);
|
||||
|
||||
ResolvableProfile defaultMannequinProfile();
|
||||
|
||||
@@ -121,4 +128,8 @@ public interface InternalAPIBridge {
|
||||
Component resolveWithContext(Component component, @Nullable CommandSender context, @Nullable Entity scoreboardSubject, boolean bypassPermissions) throws IOException;
|
||||
|
||||
ComponentFlattener componentFlattener();
|
||||
|
||||
<C> PersistentDataKey<C> createPersistentDataKey(Key key, PersistentDataType<?, C> type);
|
||||
|
||||
@Nullable EnchantmentOffer[] rollEnchantmentOffers(ItemStack targetStack, int seed, int bookshelfCount, int offerAmount);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package io.papermc.paper;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.ServiceLoader;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.util.Services;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -25,7 +26,7 @@ public interface ServerBuildInfo {
|
||||
static ServerBuildInfo buildInfo() {
|
||||
//<editor-fold defaultstate="collapsed" desc="Holder">
|
||||
final class Holder {
|
||||
static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServerBuildInfo.class);
|
||||
static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServiceLoader.load(ServerBuildInfo.class), ServerBuildInfo.class);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.kyori.adventure.translation.Translatable;
|
||||
import net.kyori.adventure.util.Index;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -16,7 +15,6 @@ import org.jspecify.annotations.Nullable;
|
||||
* The display is used in the chat, in the toast messages and the advancements
|
||||
* screen.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface AdvancementDisplay {
|
||||
|
||||
/**
|
||||
@@ -65,7 +63,7 @@ public interface AdvancementDisplay {
|
||||
*
|
||||
* @return {@code true} if a message should be sent
|
||||
* @see org.bukkit.event.player.PlayerAdvancementDoneEvent#message() to edit
|
||||
* the message
|
||||
* the message
|
||||
*/
|
||||
boolean doesAnnounceToChat();
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for advancements.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.advancement;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Annotations that describe the API.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.annotation;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -3,26 +3,26 @@ package io.papermc.paper.ban;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.ban.IpBanList;
|
||||
import org.bukkit.ban.ProfileBanList;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a ban-type that a {@link BanList} may track.
|
||||
* It enforces the correct return value at compile time.
|
||||
*
|
||||
* @param <T> the type of ban list
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BanListType<T> {
|
||||
|
||||
/**
|
||||
* Banned IP addresses
|
||||
* Banned IP addresses.
|
||||
*/
|
||||
BanListType<IpBanList> IP = new BanListTypeImpl<>(IpBanList.class);
|
||||
/**
|
||||
* Banned player profiles
|
||||
* Banned player profiles.
|
||||
*/
|
||||
BanListType<ProfileBanList> PROFILE = new BanListTypeImpl<>(ProfileBanList.class);
|
||||
|
||||
/**
|
||||
* Returns the type class of the ban list used generically
|
||||
* Returns the type class of the ban list used generically.
|
||||
*
|
||||
* @return the type class
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package io.papermc.paper.ban;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
record BanListTypeImpl<T>(Class<T> typeClass) implements BanListType<T> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Ban list API.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.ban;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -4,13 +4,11 @@ import org.bukkit.Fluid;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.Range;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A representation of a fluid in a specific state of data.
|
||||
* This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface FluidData extends Cloneable {
|
||||
|
||||
/**
|
||||
@@ -44,8 +42,7 @@ public interface FluidData extends Cloneable {
|
||||
*
|
||||
* @return the amount as an integer, between 0 and 8
|
||||
*/
|
||||
@Range(from = 0, to = 8)
|
||||
int getLevel();
|
||||
@Range(from = 0, to = 8) int getLevel();
|
||||
|
||||
/**
|
||||
* Computes the height of the fluid in the world.
|
||||
@@ -57,11 +54,10 @@ public interface FluidData extends Cloneable {
|
||||
* @param location the location at which to check the high of this fluid data.
|
||||
* @return the height as a float value
|
||||
*/
|
||||
@Range(from = 0, to = 1)
|
||||
float computeHeight(Location location);
|
||||
@Range(from = 0, to = 1) float computeHeight(Location location);
|
||||
|
||||
/**
|
||||
* Returns whether this fluid is a source block
|
||||
* Returns whether this fluid is a source block.
|
||||
*
|
||||
* @return true if the fluid is a source block, false otherwise
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for fluids and their data.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.block.fluid;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Specific types of {@link io.papermc.paper.block.fluid.FluidData}.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.block.fluid.type;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -5,14 +5,13 @@ import io.papermc.paper.command.brigadier.MessageComponentSerializer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI.
|
||||
*
|
||||
* @deprecated for removal. See {@link MessageComponentSerializer} for a direct replacement of functionality found in
|
||||
* this class.
|
||||
* As a general entrypoint to brigadier on paper, see {@link io.papermc.paper.command.brigadier.Commands}.
|
||||
* this class.
|
||||
* As a general entrypoint to brigadier on paper, see {@link io.papermc.paper.command.brigadier.Commands}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.20.6")
|
||||
public final class PaperBrigadier {
|
||||
@@ -28,7 +27,7 @@ public final class PaperBrigadier {
|
||||
* @param componentLike The {@link ComponentLike} to use for the {@link Message} contents
|
||||
* @return A new Brigadier {@link Message}
|
||||
*/
|
||||
public static @NonNull Message message(final @NonNull ComponentLike componentLike) {
|
||||
public static Message message(final ComponentLike componentLike) {
|
||||
return MessageComponentSerializer.message().serialize(componentLike.asComponent());
|
||||
}
|
||||
|
||||
@@ -42,7 +41,7 @@ public final class PaperBrigadier {
|
||||
* @param message The {@link Message} to create a {@link Component} from
|
||||
* @return The created {@link Component}
|
||||
*/
|
||||
public static @NonNull Component componentFromMessage(final @NonNull Message message) {
|
||||
public static Component componentFromMessage(final Message message) {
|
||||
return MessageComponentSerializer.message().deserialize(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Deprecated helpers for bridging Brigadier and Paper.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.brigadier;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -4,34 +4,32 @@ import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A chat renderer is responsible for rendering chat messages sent by {@link Player}s to the server.
|
||||
*/
|
||||
@NullMarked
|
||||
@FunctionalInterface
|
||||
public interface ChatRenderer {
|
||||
|
||||
/**
|
||||
* Renders a chat message. This will be called once for each receiving {@link Audience}.
|
||||
*
|
||||
* @param source the message source
|
||||
* @param source the message source
|
||||
* @param sourceDisplayName the display name of the source player
|
||||
* @param message the chat message
|
||||
* @param viewer the receiving {@link Audience}
|
||||
* @param message the chat message
|
||||
* @param viewer the receiving {@link Audience}
|
||||
* @return a rendered chat message
|
||||
*/
|
||||
@ApiStatus.OverrideOnly
|
||||
Component render(Player source, Component sourceDisplayName, Component message, Audience viewer);
|
||||
|
||||
/**
|
||||
* Create a new instance of the default {@link ChatRenderer}.
|
||||
* Gets the default {@link ChatRenderer}.
|
||||
*
|
||||
* @return a new {@link ChatRenderer}
|
||||
* @return the default {@link ChatRenderer}
|
||||
*/
|
||||
static ChatRenderer defaultRenderer() {
|
||||
return new ViewerUnawareImpl.Default((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
|
||||
return ViewerUnawareImpl.Default.INSTANCE;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -59,9 +57,9 @@ public interface ChatRenderer {
|
||||
/**
|
||||
* Renders a chat message.
|
||||
*
|
||||
* @param source the message source
|
||||
* @param source the message source
|
||||
* @param sourceDisplayName the display name of the source player
|
||||
* @param message the chat message
|
||||
* @param message the chat message
|
||||
* @return a rendered chat message
|
||||
*/
|
||||
@ApiStatus.OverrideOnly
|
||||
|
||||
@@ -4,14 +4,10 @@ import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
sealed class ViewerUnawareImpl implements ChatRenderer, ChatRenderer.ViewerUnaware permits ViewerUnawareImpl.Default {
|
||||
private final ViewerUnaware unaware;
|
||||
private @Nullable Component message;
|
||||
|
||||
ViewerUnawareImpl(final ViewerUnaware unaware) {
|
||||
this.unaware = unaware;
|
||||
@@ -24,13 +20,12 @@ sealed class ViewerUnawareImpl implements ChatRenderer, ChatRenderer.ViewerUnawa
|
||||
|
||||
@Override
|
||||
public Component render(final Player source, final Component sourceDisplayName, final Component message) {
|
||||
if (this.message == null) {
|
||||
this.message = this.unaware.render(source, sourceDisplayName, message);
|
||||
}
|
||||
return this.message;
|
||||
return this.unaware.render(source, sourceDisplayName, message);
|
||||
}
|
||||
|
||||
static final class Default extends ViewerUnawareImpl implements ChatRenderer.Default {
|
||||
static final ViewerUnawareImpl.Default INSTANCE = new ViewerUnawareImpl.Default((_, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
|
||||
|
||||
Default(final ViewerUnaware unaware) {
|
||||
super(unaware);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for rendering chat messages.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.chat;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -1,10 +1,14 @@
|
||||
package io.papermc.paper.command;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
/**
|
||||
* Represents something that holds and runs a command like a command block.
|
||||
*
|
||||
* @see org.bukkit.block.CommandBlock
|
||||
* @see org.bukkit.entity.minecart.CommandMinecart
|
||||
*/
|
||||
public interface CommandBlockHolder {
|
||||
|
||||
/**
|
||||
@@ -41,17 +45,17 @@ public interface CommandBlockHolder {
|
||||
|
||||
/**
|
||||
* Gets the success count from this command block.
|
||||
* @see <a href="https://minecraft.wiki/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
*
|
||||
* @return the success count
|
||||
* @see <a href="https://minecraft.wiki/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
*/
|
||||
int getSuccessCount();
|
||||
|
||||
/**
|
||||
* Sets the success count from this command block.
|
||||
* @see <a href="https://minecraft.wiki/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
*
|
||||
* @param successCount the success count
|
||||
* @see <a href="https://minecraft.wiki/wiki/Command_Block#Success_count">Command_Block#Success_count</a>
|
||||
*/
|
||||
void setSuccessCount(int successCount);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.papermc.paper.command.brigadier;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -20,7 +21,7 @@ public interface BasicCommand {
|
||||
* @param args the arguments of the command ignoring repeated spaces
|
||||
*/
|
||||
@ApiStatus.OverrideOnly
|
||||
void execute(CommandSourceStack commandSourceStack, String[] args);
|
||||
void execute(CommandSourceStack commandSourceStack, String[] args) throws CommandSyntaxException;
|
||||
|
||||
/**
|
||||
* Suggests possible completions for the given command {@link CommandSourceStack} and arguments.
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package io.papermc.paper.command.brigadier;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.brigadier.RedirectModifier;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import net.kyori.adventure.pointer.Pointered;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.GameRules;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -81,4 +87,123 @@ public interface CommandSourceStack {
|
||||
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
|
||||
*/
|
||||
CommandSourceStack withExecutor(Entity executor);
|
||||
|
||||
/**
|
||||
* Sends a system message to the {@link #getExecutor()} if it is a {@link Player},
|
||||
* otherwise sends a system message to the {@link #getSender()}.
|
||||
*
|
||||
* @param message the message to send
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
void sendReply(ComponentLike message);
|
||||
|
||||
/**
|
||||
* Sends a system message with the MiniMessage format to the {@link #getExecutor()}
|
||||
* if it is a {@link Player}, otherwise sends it to the {@link #getSender()}.
|
||||
*
|
||||
* <p>See <a href="https://docs.papermc.io/adventure/minimessage/">MiniMessage docs</a> and
|
||||
* <a href="https://docs.papermc.io/adventure/minimessage/dynamic-replacements/">MiniMessage Placeholders docs</a>
|
||||
* for more information on the format.</p>
|
||||
*
|
||||
* <p>This method provides the target of the system message as a {@link net.kyori.adventure.pointer.Pointered}
|
||||
* to the MiniMessage {@link MiniMessage#deserialize(String, Pointered, TagResolver...)} method.</p>
|
||||
*
|
||||
* @param message the MiniMessage message to send
|
||||
* @param resolvers resolvers to use
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
default void sendRichReply(final String message, final TagResolver... resolvers) {
|
||||
Preconditions.checkArgument(message != null, "message cannot be null.");
|
||||
this.sendReply(MiniMessage.miniMessage().deserialize(
|
||||
message,
|
||||
this.getExecutor() instanceof final Player player ? player : this.getSender(),
|
||||
resolvers
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a system message to the {@link #getSender()}, admins, and console indicating successful command execution
|
||||
* according to vanilla semantics.
|
||||
*
|
||||
* <p>This currently includes checking for environments with suppressed output,
|
||||
* {@link GameRules#SEND_COMMAND_FEEDBACK}, and {@link GameRules#LOG_ADMIN_COMMANDS}.</p>
|
||||
*
|
||||
* @param message the message to send
|
||||
* @param allowInformingAdmins whether admins and console may be informed of this success
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
void sendSuccess(ComponentLike message, boolean allowInformingAdmins);
|
||||
|
||||
/**
|
||||
* Sends a system message to the {@link #getSender()}, admins, and console indicating successful command execution
|
||||
* according to vanilla semantics. This method informs admins and the console of this success.
|
||||
*
|
||||
* <p>This currently includes checking for environments with suppressed output,
|
||||
* {@link GameRules#SEND_COMMAND_FEEDBACK}, and {@link GameRules#LOG_ADMIN_COMMANDS}.</p>
|
||||
*
|
||||
* @param message the message to send
|
||||
* @see #sendSuccess(ComponentLike, boolean) to disable if admins and console should be informed
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
default void sendSuccess(final ComponentLike message) {
|
||||
this.sendSuccess(message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a system message with the MiniMessage format to the {@link #getSender()}, admins, and console indicating
|
||||
* successful command execution according to vanilla semantics. This method informs admins and the console of
|
||||
* this success.
|
||||
*
|
||||
* <p>This currently includes checking for environments with suppressed output,
|
||||
* {@link GameRules#SEND_COMMAND_FEEDBACK}, and {@link GameRules#LOG_ADMIN_COMMANDS}.</p>
|
||||
*
|
||||
* <p>See <a href="https://docs.papermc.io/adventure/minimessage/">MiniMessage docs</a> and
|
||||
* <a href="https://docs.papermc.io/adventure/minimessage/dynamic-replacements/">MiniMessage Placeholders docs</a>
|
||||
* for more information on the format.</p>
|
||||
*
|
||||
* <p>This method provides the {@link CommandSender} of this command as a {@link net.kyori.adventure.pointer.Pointered}
|
||||
* to the MiniMessage {@link MiniMessage#deserialize(String, Pointered, TagResolver...)} method.</p>
|
||||
*
|
||||
* @param message the MiniMessage message to send
|
||||
* @param resolvers resolvers to use
|
||||
* @see #sendSuccess(ComponentLike, boolean) to disable if admins and console should be informed
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
default void sendRichSuccess(final String message, final TagResolver... resolvers) {
|
||||
Preconditions.checkArgument(message != null, "message cannot be null.");
|
||||
this.sendSuccess(MiniMessage.miniMessage().deserialize(message, this.getSender(), resolvers), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a system message indicating a failed command execution to the {@link #getSender()}.
|
||||
* Does not apply red styling to the message as vanilla does to allow for custom failure message styling.
|
||||
*
|
||||
* <p>Respects vanilla semantics for accepting failure output and suppressed output environments.</p>
|
||||
*
|
||||
* @param message the message to send
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
void sendFailure(ComponentLike message);
|
||||
|
||||
/**
|
||||
* Sends a system message with the MiniMessage format indicating a failed command execution to the{@link #getSender()}.
|
||||
* Does not apply red styling to the message as vanilla does to allow for custom failure message styling.
|
||||
*
|
||||
* <p>Respects vanilla semantics for accepting failure output and suppressed output environments.</p>
|
||||
*
|
||||
* <p>See <a href="https://docs.papermc.io/adventure/minimessage/">MiniMessage docs</a> and
|
||||
* <a href="https://docs.papermc.io/adventure/minimessage/dynamic-replacements/">MiniMessage Placeholders docs</a>
|
||||
* for more information on the format.</p>
|
||||
*
|
||||
* <p>This method provides the {@link CommandSender} of this command as a {@link net.kyori.adventure.pointer.Pointered}
|
||||
* to the MiniMessage {@link MiniMessage#deserialize(String, Pointered, TagResolver...)} method.</p>
|
||||
*
|
||||
* @param message the MiniMessage message to send
|
||||
* @param resolvers resolvers to use
|
||||
* @throws IllegalArgumentException if the message is null
|
||||
*/
|
||||
default void sendRichFailure(final String message, final TagResolver... resolvers) {
|
||||
Preconditions.checkArgument(message != null, "message cannot be null.");
|
||||
this.sendFailure(MiniMessage.miniMessage().deserialize(message, this.getSender(), resolvers));
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,23 @@ public interface Commands extends Registrar {
|
||||
* @return a new predicate with restricted execution behavior
|
||||
*/
|
||||
static Predicate<CommandSourceStack> restricted(final Predicate<CommandSourceStack> predicate) {
|
||||
return InternalAPIBridge.get().restricted(predicate);
|
||||
return InternalAPIBridge.get().restricted(predicate, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an unrestricted {@link Predicate} that wraps the given predicate.
|
||||
* <p>
|
||||
* A restricted predicate prevents execution in unattended contexts, such as from chat click events.
|
||||
* Unrestricting prevents the warning shown on the client before executing the command.
|
||||
* <p>
|
||||
* This is used by vanilla to prevent invocation of sensitive commands (like op) from
|
||||
* players without their knowledge.
|
||||
*
|
||||
* @param predicate the original predicate to wrap
|
||||
* @return a new predicate with unrestricted execution behavior
|
||||
*/
|
||||
static Predicate<CommandSourceStack> unrestricted(final Predicate<CommandSourceStack> predicate) {
|
||||
return InternalAPIBridge.get().restricted(predicate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-2
@@ -3,13 +3,11 @@ package io.papermc.paper.command.brigadier.argument.position;
|
||||
import io.papermc.paper.math.BlockPosition;
|
||||
import io.papermc.paper.math.Position;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A block position, which does not have a y value.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public interface ColumnBlockPosition {
|
||||
|
||||
/**
|
||||
|
||||
-2
@@ -3,13 +3,11 @@ package io.papermc.paper.command.brigadier.argument.position;
|
||||
import io.papermc.paper.math.FinePosition;
|
||||
import io.papermc.paper.math.Position;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A fine position, which does not hold a y value.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public interface ColumnFinePosition {
|
||||
|
||||
/**
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Positions resolved from Brigadier arguments.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.command.brigadier.argument.position;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+1
-2
@@ -54,8 +54,7 @@ public interface BlockInWorldPredicate {
|
||||
/**
|
||||
* The block passed to the predicate was in an unloaded chunk and the {@code loadChunk} flag was false.
|
||||
*/
|
||||
UNLOADED_CHUNK,
|
||||
;
|
||||
UNLOADED_CHUNK;
|
||||
|
||||
/**
|
||||
* Converts the result into an approximated boolean representation.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Command-related APIs.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.command;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API for reading selected server configuration settings.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.configuration;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -41,6 +41,8 @@ public interface PlayerConnection {
|
||||
/**
|
||||
* Gets the real client address of the player. If the connection is behind a proxy,
|
||||
* this will be the actual player’s IP address extracted from the proxy handshake.
|
||||
* If the player is connecting through a Unix domain socket and the proxy has not
|
||||
* forwarded the player's IP address yet, this will be the loopback address.
|
||||
*
|
||||
* @return the client {@link InetSocketAddress}
|
||||
*/
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public interface AttributeModifierDisplay {
|
||||
interface OverrideText extends AttributeModifierDisplay {
|
||||
|
||||
/**
|
||||
* Overridden text
|
||||
* Overridden text.
|
||||
*
|
||||
* @return the overridden text
|
||||
*/
|
||||
|
||||
+6
-3
@@ -3,13 +3,16 @@ package io.papermc.paper.datacomponent.item.attribute;
|
||||
import java.util.Optional;
|
||||
import java.util.ServiceLoader;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.util.Services;
|
||||
|
||||
interface AttributeModifierDisplayBridge {
|
||||
|
||||
Optional<AttributeModifierDisplayBridge> BRIDGE = ServiceLoader.load(AttributeModifierDisplayBridge.class, AttributeModifierDisplayBridge.class.getClassLoader()).findFirst();
|
||||
|
||||
static AttributeModifierDisplayBridge bridge() {
|
||||
return BRIDGE.orElseThrow();
|
||||
final class Holder {
|
||||
static final Optional<AttributeModifierDisplayBridge> BRIDGE = Services.service(ServiceLoader.load(AttributeModifierDisplayBridge.class), AttributeModifierDisplayBridge.class);
|
||||
}
|
||||
|
||||
return Holder.BRIDGE.orElseThrow();
|
||||
}
|
||||
|
||||
AttributeModifierDisplay.Default reset();
|
||||
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Attribute modifier display API for the {@link io.papermc.paper.datacomponent.DataComponentTypes#ATTRIBUTE_MODIFIERS} data component.
|
||||
*/
|
||||
@NullMarked
|
||||
@MinecraftVersionDependent
|
||||
package io.papermc.paper.datacomponent.item.attribute;
|
||||
|
||||
@@ -45,16 +45,22 @@ public interface Dialog extends Keyed, DialogLike {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||
* and {@link io.papermc.paper.registry.RegistryKey#DIALOG}. Dialogs can exist without a key.
|
||||
* Gets the key of this dialog.
|
||||
*
|
||||
* @return the key of this dialog
|
||||
* @deprecated use {@link Registry#getKey(Keyed)}, {@link RegistryAccess#getRegistry(RegistryKey)},
|
||||
* and {@link RegistryKey#DIALOG}. Dialogs can exist without a key.
|
||||
*/
|
||||
@Deprecated(since = "1.21.8", forRemoval = true)
|
||||
@Override
|
||||
NamespacedKey getKey();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||
* and {@link io.papermc.paper.registry.RegistryKey#DIALOG}. Dialogs can exist without a key.
|
||||
* Gets the key of this dialog.
|
||||
*
|
||||
* @return the key of this dialog
|
||||
* @deprecated use {@link Registry#getKey(Keyed)}, {@link RegistryAccess#getRegistry(RegistryKey)},
|
||||
* and {@link RegistryKey#DIALOG}. Dialogs can exist without a key.
|
||||
*/
|
||||
@Deprecated(since = "1.21.8", forRemoval = true)
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package io.papermc.paper.enchantments;
|
||||
|
||||
/**
|
||||
* Represents the rarity of an enchantment.
|
||||
*
|
||||
* @deprecated Enchantments do not have a "rarity" since 1.20.5
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.20.5")
|
||||
@@ -13,7 +15,7 @@ public enum EnchantmentRarity {
|
||||
|
||||
private final int weight;
|
||||
|
||||
EnchantmentRarity(int weight) {
|
||||
EnchantmentRarity(final int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
@@ -23,6 +25,6 @@ public enum EnchantmentRarity {
|
||||
* @return the weight
|
||||
*/
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
return this.weight;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Enchantment API.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.enchantments;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -52,4 +52,13 @@ public interface PlayerPostEffects {
|
||||
*/
|
||||
boolean clear();
|
||||
|
||||
/**
|
||||
* Forces an immediate update of post-effects currently applied to the player.
|
||||
* <p>
|
||||
* Calling this method manually is usually unnecessary, as post-effects are automatically
|
||||
* synchronized at the end of the player entity tick. It should only be called if changes
|
||||
* need to be synchronized immediately.
|
||||
*/
|
||||
void update();
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package io.papermc.paper.entity.poi;
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Holds the result of searching for a point of interest.
|
||||
@@ -11,7 +10,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
* @see World#locateAllPoiInRange(Location, Predicate, int)
|
||||
* @see World#locateAllPoiInRange(Location, Predicate, int, PoiType.Occupancy)
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PoiSearchResult {
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.papermc.paper.entity.poi;
|
||||
import io.papermc.paper.InternalAPIBridge;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a point of interest (POI).
|
||||
@@ -14,7 +13,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
*
|
||||
* @see PoiTypes
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PoiType extends Keyed {
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,12 +3,10 @@ package io.papermc.paper.entity.poi;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import org.bukkit.Registry;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* All the built-in point of interest types.
|
||||
*/
|
||||
@NullMarked
|
||||
public final class PoiTypes {
|
||||
|
||||
// Start generate - PoiTypes
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Point of interest (POI) API.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.entity.poi;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+2
-2
@@ -46,7 +46,7 @@ public class PlayerConnectionValidateLoginEvent extends Event {
|
||||
*
|
||||
* @return connection
|
||||
* @apiNote disconnecting the player through this connection
|
||||
* or using any methods that may send packets is not supported
|
||||
* or using any methods that may send packets is not supported
|
||||
*/
|
||||
public PlayerConnection getConnection() {
|
||||
return this.connection;
|
||||
@@ -61,7 +61,7 @@ public class PlayerConnectionValidateLoginEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Disallows the player from logging in, with the given reason
|
||||
* Disallows the player from logging in, with the given reason.
|
||||
*
|
||||
* @param message Kick message to display to the user
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.checkerframework.checker.index.qual.NonNegative;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when an {@link Entity} lands on the block after falling.
|
||||
* This event is called before {@link org.bukkit.event.entity.EntityDamageEvent}, {@link org.bukkit.event.entity.EntityChangeBlockEvent}, {@link org.bukkit.event.player.PlayerInteractEvent}
|
||||
* and {@link org.bukkit.event.entity.EntityInteractEvent}.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityLandEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final Block block;
|
||||
private boolean cancelled;
|
||||
private double fallDistance;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityLandEvent(final Entity entity, final Block block, final double fallDistance) {
|
||||
super(entity);
|
||||
this.block = block;
|
||||
this.fallDistance = fallDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the block that the entity landed on}
|
||||
*/
|
||||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to cancel the landing, cancelling this event will prevent
|
||||
* the entity from taking fall damage and interact with the block. (ex: break turtle egg)
|
||||
*
|
||||
* @param cancel true if the event should be cancelled, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fall distance of the entity before landing.
|
||||
*
|
||||
* @return the fall distance
|
||||
*/
|
||||
public double getFallDistance() {
|
||||
return this.fallDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fall distance of the entity before landing.
|
||||
* Fall distance in the event is used to calculate fall damage and
|
||||
* the chance of transforming {@link org.bukkit.Material#FARMLAND} to {@link org.bukkit.Material#DIRT} and
|
||||
* the type of falling sound when the entity lands on {@link org.bukkit.Material#POWDER_SNOW}.
|
||||
*
|
||||
* @param fallDistance the fall distance
|
||||
* @throws IllegalArgumentException if the fall distance is negative or not finite
|
||||
*/
|
||||
public void setFallDistance(final @NonNegative double fallDistance) {
|
||||
Preconditions.checkArgument(
|
||||
Double.isFinite(fallDistance) && fallDistance >= 0.0,
|
||||
"Fall distance must be finite and non-negative"
|
||||
);
|
||||
this.fallDistance = fallDistance;
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when an entity is launched upward by a Potent Sulfur geyser.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityPotentSulfurLaunchEvent extends EntityEvent {
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final Block sulfurBlock;
|
||||
private final Location sourceLocation;
|
||||
|
||||
private final Vector launchVelocity;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityPotentSulfurLaunchEvent(
|
||||
final Entity entity,
|
||||
final Block sulfurBlock,
|
||||
final Location sourceLocation,
|
||||
final Vector launchVelocity
|
||||
) {
|
||||
super(entity);
|
||||
this.sulfurBlock = sulfurBlock;
|
||||
this.sourceLocation = sourceLocation;
|
||||
this.launchVelocity = launchVelocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Potent Sulfur block.
|
||||
*/
|
||||
public Block getSulfurBlock() {
|
||||
return this.sulfurBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location where the geyser exits the water column.
|
||||
*/
|
||||
public Location getSourceLocation() {
|
||||
return this.sourceLocation.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity that will be added to the entity.
|
||||
* <br>
|
||||
* This value is read-only, changes made to it <b>will not</b> have any
|
||||
* effect on the final launch velocity.
|
||||
*/
|
||||
public Vector getLaunchVelocity() {
|
||||
return this.launchVelocity.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.entity.CopperGolem;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when an item-transporting entity (ex a {@link CopperGolem})
|
||||
* is inspecting a destination {@link Container} to decide if the item it is holding
|
||||
* belongs in said container.
|
||||
* <br>
|
||||
* This gives plugin developers an opportunity to
|
||||
* override the {@link CopperGolem}'s sorting behavior.
|
||||
* <br>
|
||||
* <b>Note:</b> This event can be called twice during a single
|
||||
* "interaction", once before the container is opened, and again before items are
|
||||
* added and the container is closed.
|
||||
*/
|
||||
@NullMarked
|
||||
public class ItemTransportingEntitySortEvent extends EntityEvent {
|
||||
protected static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final ItemStack itemStack;
|
||||
private final Inventory containerInventory;
|
||||
private Result result;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ItemTransportingEntitySortEvent(
|
||||
final Entity entity,
|
||||
final ItemStack itemStack,
|
||||
final Inventory containerInventory
|
||||
) {
|
||||
super(entity);
|
||||
this.containerInventory = containerInventory;
|
||||
this.itemStack = itemStack;
|
||||
this.result = Result.DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sorting decision for the held item and the inspected container.
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW}: the item belongs in the container.</li>
|
||||
* <li>{@link Result#DENY}: the item does not belong in the container.</li>
|
||||
* <li>{@link Result#DEFAULT}: use the vanilla sorting logic.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param result the sorting decision
|
||||
* @see Result
|
||||
*/
|
||||
public void setResult(final Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current sorting decision. Starts as {@link Result#DEFAULT}
|
||||
* and may have been modified by other plugins.
|
||||
*
|
||||
* @return the current sorting decision
|
||||
* @see #setResult(Result)
|
||||
*/
|
||||
public Result getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the inventory of the container the entity is comparing
|
||||
* against the held item.
|
||||
*
|
||||
* @return the inventory of the potential destination container
|
||||
*/
|
||||
public Inventory getContainerInventory() {
|
||||
return this.containerInventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone of the ItemStack held by the entity that is being compared
|
||||
* against the container.
|
||||
*
|
||||
* @return The held ItemStack
|
||||
*/
|
||||
public ItemStack getItemStack() {
|
||||
return this.itemStack.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package io.papermc.paper.event.executor;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.constant.ConstantDescs;
|
||||
@@ -15,16 +10,19 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public final class EventExecutorFactory {
|
||||
private static final byte[] TEMPLATE_CLASS_BYTES;
|
||||
|
||||
static {
|
||||
try (final InputStream is = EventExecutorFactory.class.getResourceAsStream("MethodHandleEventExecutorTemplate.class")) {
|
||||
try (InputStream is = EventExecutorFactory.class.getResourceAsStream("MethodHandleEventExecutorTemplate.class")) {
|
||||
TEMPLATE_CLASS_BYTES = Objects.requireNonNull(is, "template class is missing").readAllBytes();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
@@ -34,17 +32,19 @@ public final class EventExecutorFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return an {@link EventExecutor} implemented by a hidden class calling a method handle}
|
||||
* Creates an {@link EventExecutor} implemented by a hidden class calling a method handle.
|
||||
*
|
||||
* @param method the method to be invoked by the created event executor
|
||||
* @param eventClass the class of the event to handle
|
||||
* @return the event executor
|
||||
* @throws AssertionError if the hidden class cannot be defined or instantiated
|
||||
*/
|
||||
public static EventExecutor create(final Method method, final Class<? extends Event> eventClass) {
|
||||
final List<?> classData = List.of(method, eventClass);
|
||||
try {
|
||||
final MethodHandles.Lookup newClass = MethodHandles.lookup().defineHiddenClassWithClassData(TEMPLATE_CLASS_BYTES, classData, true);
|
||||
return newClass.lookupClass().asSubclass(EventExecutor.class).getDeclaredConstructor().newInstance();
|
||||
} catch (ReflectiveOperationException e) {
|
||||
} catch (final ReflectiveOperationException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,10 @@ public final class EventExecutorFactory {
|
||||
/**
|
||||
* Extracts the class data and creates an adjusted MethodHandle directly usable by the lookup class.
|
||||
* The logic is kept here to minimize memory usage per created class.
|
||||
*
|
||||
* @param lookup the lookup of the hidden class, which holds the class data
|
||||
* @return the class data with a method handle adjusted to the event executor signature
|
||||
* @throws AssertionError if the class data cannot be read or the method cannot be unreflected
|
||||
*/
|
||||
static ClassData classData(final MethodHandles.Lookup lookup) {
|
||||
try {
|
||||
@@ -67,7 +71,7 @@ public final class EventExecutorFactory {
|
||||
mh = mh.asType(MethodType.methodType(void.class, Listener.class, Event.class));
|
||||
final Class<?> eventClass = MethodHandles.classDataAt(lookup, ConstantDescs.DEFAULT_NAME, Class.class, 1);
|
||||
return new ClassData(method, mh, eventClass.asSubclass(Event.class));
|
||||
} catch (ReflectiveOperationException e) {
|
||||
} catch (final ReflectiveOperationException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -1,15 +1,14 @@
|
||||
package io.papermc.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 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 java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* This class is designed to be used as hidden class template.
|
||||
@@ -25,7 +24,6 @@ import java.lang.reflect.Method;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
class MethodHandleEventExecutorTemplate implements EventExecutor {
|
||||
private static final Method METHOD;
|
||||
private static final MethodHandle HANDLE;
|
||||
@@ -44,7 +42,7 @@ class MethodHandleEventExecutorTemplate implements EventExecutor {
|
||||
if (!EVENT_CLASS.isInstance(event)) return;
|
||||
try {
|
||||
HANDLE.invokeExact(listener, event);
|
||||
} catch (Throwable t) {
|
||||
} catch (final Throwable t) {
|
||||
SneakyThrow.sneaky(t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Internal implementation of event executors.
|
||||
*/
|
||||
@NullMarked
|
||||
@ApiStatus.Internal
|
||||
package io.papermc.paper.event.executor;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -5,12 +5,10 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player picks up a crafted item from the result slot of a crafting grid.
|
||||
*/
|
||||
@NullMarked
|
||||
public class ItemCraftedEvent extends Event {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
package io.papermc.paper.event.inventory;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Called when a {@link Player} selects an item inside a bundle.
|
||||
*
|
||||
* @apiNote This event does not fire for bundle item selections in creative mode player inventories.
|
||||
*/
|
||||
public final class PlayerBundleItemSelectEvent extends InventoryEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final ItemStack bundle;
|
||||
private final int rawSlot;
|
||||
private final int slot;
|
||||
|
||||
private final ItemStack previousItem;
|
||||
private final ItemStack selectedItem;
|
||||
|
||||
private final int previousIndex;
|
||||
private final int selectedIndex;
|
||||
private final Direction direction;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerBundleItemSelectEvent(
|
||||
final InventoryView view,
|
||||
final ItemStack bundle,
|
||||
final int rawSlot,
|
||||
final ItemStack previousItem,
|
||||
final ItemStack selectedItem,
|
||||
final int previousIndex,
|
||||
final int selectedIndex,
|
||||
final Direction direction
|
||||
) {
|
||||
super(view);
|
||||
|
||||
this.bundle = bundle;
|
||||
this.rawSlot = rawSlot;
|
||||
this.slot = view.convertSlot(rawSlot);
|
||||
|
||||
this.previousItem = previousItem;
|
||||
this.selectedItem = selectedItem;
|
||||
|
||||
this.previousIndex = previousIndex;
|
||||
this.selectedIndex = selectedIndex;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player who triggered the event.
|
||||
*
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return (Player) this.getView().getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bundle item.
|
||||
*
|
||||
* @return the bundle item
|
||||
*/
|
||||
public ItemStack getBundle() {
|
||||
return this.bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot number of the bundle, depending on which {@link Inventory} it is located in.
|
||||
*
|
||||
* @return the slot number
|
||||
* @see InventoryClickEvent#getSlot()
|
||||
*/
|
||||
public int getSlot() {
|
||||
return this.slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw slot number of the bundle inside the {@link InventoryView}.
|
||||
*
|
||||
* @return the raw slot number
|
||||
* @see InventoryClickEvent#getRawSlot()
|
||||
*/
|
||||
public int getRawSlot() {
|
||||
return this.rawSlot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the previously selected item inside the bundle. If no item was previously selected, this will return an empty item.
|
||||
*
|
||||
* @return the previously selected item
|
||||
*/
|
||||
public ItemStack getPreviousItem() {
|
||||
return this.previousItem.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected item inside the bundle.
|
||||
*
|
||||
* @return the selected item
|
||||
*/
|
||||
public ItemStack getSelectedItem() {
|
||||
return this.selectedItem.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the previously selected index. If no item was previously selected, this will be -1.
|
||||
*
|
||||
* @return the previously selected index
|
||||
*/
|
||||
public int getPreviousIndex() {
|
||||
return this.previousIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected index.
|
||||
*
|
||||
* @return the selected index
|
||||
*/
|
||||
public int getSelectedIndex() {
|
||||
return this.selectedIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direction from the previous selection to the new one.
|
||||
*
|
||||
* @return the direction
|
||||
* @apiNote The direction cannot be reliably determined if there are less than three item stacks inside the bundle, in which case this returns {@link Direction#UNKNOWN}.
|
||||
*/
|
||||
public Direction getDirection() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a selection direction.
|
||||
*/
|
||||
public enum Direction {
|
||||
/**
|
||||
* Represents forward direction.
|
||||
*/
|
||||
FORWARD(OptionalInt.of(1)),
|
||||
/**
|
||||
* Represents backward direction.
|
||||
*/
|
||||
BACKWARD(OptionalInt.of(-1)),
|
||||
/**
|
||||
* Represents indeterminable direction.
|
||||
* <p>
|
||||
* That is, for bundles with less than three item stacks inside.
|
||||
*/
|
||||
UNKNOWN(OptionalInt.empty());
|
||||
|
||||
private final OptionalInt delta;
|
||||
|
||||
Direction(final OptionalInt delta) {
|
||||
this.delta = delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the delta integer of the direction.
|
||||
* <p>
|
||||
* Directions are mapped the following:
|
||||
* <ul>
|
||||
* <li>{@link #FORWARD} to {@code +1}</li>
|
||||
* <li>{@link #BACKWARD} to {@code -1}</li>
|
||||
* <li>{@link #UNKNOWN} to {@link OptionalInt#empty()}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return the delta
|
||||
*/
|
||||
public OptionalInt getDelta() {
|
||||
return this.delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the direction opposite to this direction.
|
||||
*
|
||||
* @return the flipped direction or {@link #UNKNOWN} if the direction is unknown
|
||||
*/
|
||||
public Direction flip() {
|
||||
return switch (this) {
|
||||
case FORWARD -> BACKWARD;
|
||||
case BACKWARD -> FORWARD;
|
||||
case UNKNOWN -> UNKNOWN;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package io.papermc.paper.event.inventory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Called when a hopper or hopper minecart is about to choose an item to move,
|
||||
* before any {@link InventoryMoveItemEvent}.
|
||||
* <p>
|
||||
* The hopper treats disallowed slots of the source as if they do not exist, so
|
||||
* a source with items only in disallowed slots is treated as empty.
|
||||
*/
|
||||
public class PrepareHopperTransferEvent extends Event {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
protected long disallowedSlots;
|
||||
private final Inventory source;
|
||||
private final Inventory destination;
|
||||
private final boolean didSourceInitiate;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PrepareHopperTransferEvent(final Inventory source, final Inventory destination, final boolean didSourceInitiate) {
|
||||
this.source = source;
|
||||
this.destination = destination;
|
||||
this.didSourceInitiate = didSourceInitiate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Inventory that items are being taken from.
|
||||
*
|
||||
* @return Inventory that items are being taken from
|
||||
*/
|
||||
public Inventory getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Inventory that items are being put into.
|
||||
*
|
||||
* @return Inventory that items are being put into
|
||||
*/
|
||||
public Inventory getDestination() {
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Inventory that initiated the transfer. This will always be
|
||||
* either the destination or source Inventory.
|
||||
*
|
||||
* @return Inventory that initiated the transfer
|
||||
*/
|
||||
public Inventory getInitiator() {
|
||||
return this.didSourceInitiate ? this.source : this.destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the hopper is allowed to take items from a slot of {@link #getSource()}.
|
||||
*
|
||||
* @param slot the slot
|
||||
* @return true if the slot is allowed
|
||||
*/
|
||||
public boolean isSlotAllowed(final int slot) {
|
||||
Preconditions.checkArgument(slot >= 0 && slot < this.source.getSize(), "Slot %s is outside the source inventory", slot);
|
||||
return (this.disallowedSlots & (1L << slot)) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the hopper is allowed to take items from a slot of {@link #getSource()}.
|
||||
*
|
||||
* @param slot the slot
|
||||
* @param allowed whether the slot is allowed
|
||||
*/
|
||||
public void setSlotAllowed(final int slot, final boolean allowed) {
|
||||
Preconditions.checkArgument(slot >= 0 && slot < this.source.getSize(), "Slot %s is outside the source inventory", slot);
|
||||
if (allowed) {
|
||||
this.disallowedSlots &= ~(1L << slot);
|
||||
} else {
|
||||
this.disallowedSlots |= 1L << slot;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* {@link org.bukkit.event.Event Events} relating to inventories and the items in them.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper.event.inventory;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -15,6 +15,8 @@ import org.jspecify.annotations.NullMarked;
|
||||
* <p>
|
||||
* Adding or removing entities from the world at the point in time this event is called is completely
|
||||
* unsupported and should be avoided.
|
||||
* Teleporting entities in the world at the point in time this event is called yields an undefined tracker
|
||||
* behavior and should be avoided.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PlayerTrackEntityEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
Loaded 100 of 634 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user