Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f327bb130
|
||
|
|
0f4a7f10e2
|
||
|
|
e3ced84855 | ||
|
|
10cb872506 | ||
|
|
b0d5bb72fe | ||
|
|
7e38775ded | ||
|
|
2ed23b24e5 | ||
|
|
b6d61d4cc9 | ||
|
|
c3f7eaebf4 | ||
|
|
52c90e1cea | ||
|
|
d887ff8eae | ||
|
|
0d5fb6a0ef | ||
|
|
6f8a6e868a | ||
|
|
70c1ecfc09 | ||
|
|
176272a4b9 | ||
|
|
c102e6650e | ||
|
|
c8fee82291 | ||
|
|
0ae9982ce5 | ||
|
|
59d358d907 | ||
|
|
2621181c5d | ||
|
|
48d044af8c |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
.gitea/CODEOWNERS linguist-detectable=false
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Pull requests request review from the eligible staff team(s).
|
||||||
|
# One approval from either an Admin or Developer satisfies branch protection.
|
||||||
|
* @trueog/Admins @trueog/Developers
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
||||||
- package-ecosystem: "maven"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
name: Auto-merge Dependabot PRs
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: [ "Pull Request" ]
|
|
||||||
types: [ completed ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
merge-dependabot:
|
|
||||||
if: "github.actor == 'dependabot[bot]'
|
|
||||||
&& github.event.workflow_run.event == 'pull_request'
|
|
||||||
&& github.event.workflow_run.conclusion == 'success'"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Note: this is directly from GitHub's example for using data from a triggering workflow:
|
|
||||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
|
|
||||||
- name: 'Download artifact'
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
run_id: context.payload.workflow_run.id,
|
|
||||||
});
|
|
||||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
|
||||||
return artifact.name == "pr_number"
|
|
||||||
})[0];
|
|
||||||
let download = await github.rest.actions.downloadArtifact({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
artifact_id: matchArtifact.id,
|
|
||||||
archive_format: 'zip',
|
|
||||||
});
|
|
||||||
let fs = require('fs');
|
|
||||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
|
|
||||||
|
|
||||||
# This might be a useless use of cat, but I'm not sure what shell Actions is going to be running.
|
|
||||||
- name: Add Pull Number Variable
|
|
||||||
run: |-
|
|
||||||
unzip pr_number.zip
|
|
||||||
echo "PR_NUMBER=$(cat pr_number)" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Approve
|
|
||||||
uses: hmarr/auto-approve-action@v3.2.1
|
|
||||||
with:
|
|
||||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
pull-request-number: "${{ env.PR_NUMBER }}"
|
|
||||||
- name: Merge
|
|
||||||
uses: pascalgn/automerge-action@v0.15.6
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
MERGE_LABELS: "dependencies,java"
|
|
||||||
MERGE_METHOD: "squash"
|
|
||||||
PULL_REQUEST: "${{ env.PR_NUMBER }}"
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
name: OpenInv CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
tags-ignore:
|
|
||||||
- '**'
|
|
||||||
# Enable running CI via other Actions, i.e. for drafting releases and handling PRs.
|
|
||||||
workflow_call:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
cache: 'maven'
|
|
||||||
|
|
||||||
# Install Spigot dependencies if necessary.
|
|
||||||
- name: Install Spigot Dependencies
|
|
||||||
run: . scripts/install_spigot_dependencies.sh
|
|
||||||
|
|
||||||
- name: Build With Maven
|
|
||||||
run: mvn -e clean package -am -P all
|
|
||||||
|
|
||||||
# Upload artifacts
|
|
||||||
- name: Upload Distributable Jar
|
|
||||||
id: upload-final
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: ./target/OpenInv.jar
|
|
||||||
- name: Upload API Jar
|
|
||||||
id: upload-api
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: api
|
|
||||||
path: ./api/target/openinvapi*.jar
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
name: Draft Github Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run-ci:
|
|
||||||
uses: Jikoo/OpenInv/.github/workflows/ci.yml@master
|
|
||||||
draft-release:
|
|
||||||
needs: [ run-ci ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Fetch all history - used to assemble changelog.
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set Release Variables
|
|
||||||
run: bash ./scripts/set_release_env.sh
|
|
||||||
|
|
||||||
- name: Download Artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
id: create-release
|
|
||||||
uses: softprops/action-gh-release@v0.1.15
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
name: ${{ env.VERSIONED_NAME }}
|
|
||||||
body: ${{ env.GENERATED_CHANGELOG }}
|
|
||||||
draft: true
|
|
||||||
prerelease: false
|
|
||||||
files: ./dist/OpenInv.jar
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
name: Release to CurseForge
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [ released ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
curseforge_release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Fetch Github Release Asset
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@1.1.1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: ${{ github.event.release.id }}
|
|
||||||
file: OpenInv.jar
|
|
||||||
|
|
||||||
- name: Set CurseForge Variables
|
|
||||||
run: . scripts/set_curseforge_env.sh "${{ github.event.release.body }}"
|
|
||||||
|
|
||||||
- name: Create CurseForge Release
|
|
||||||
uses: itsmeow/curseforge-upload@v3
|
|
||||||
with:
|
|
||||||
token: "${{ secrets.CURSEFORGE_TOKEN }}"
|
|
||||||
project_id: 31432
|
|
||||||
game_endpoint: minecraft
|
|
||||||
file_path: ./OpenInv.jar
|
|
||||||
display_name: "${{ github.event.release.name }}"
|
|
||||||
game_versions: "${{ env.CURSEFORGE_MINECRAFT_VERSIONS }}"
|
|
||||||
release_type: release
|
|
||||||
changelog_type: markdown
|
|
||||||
changelog: "${{ env.CURSEFORGE_CHANGELOG }}"
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
name: Pull Request
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run-ci:
|
|
||||||
uses: Jikoo/OpenInv/.github/workflows/ci.yml@master
|
|
||||||
store-dependabot-pr-data:
|
|
||||||
if: "github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Note: this is directly from GitHub's example for using data from a triggering workflow:
|
|
||||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
|
|
||||||
- name: Store Pull Number
|
|
||||||
run: |
|
|
||||||
mkdir -p ./pr
|
|
||||||
echo ${{ github.event.number }} > ./pr/pr_number
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: pr_number
|
|
||||||
path: pr/
|
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
**/.idea/
|
**/.idea/
|
||||||
**.iml
|
**.iml
|
||||||
**/target/
|
**/target/
|
||||||
|
**/build/
|
||||||
**/bin/
|
**/bin/
|
||||||
**/out/
|
**/out/
|
||||||
|
**/.gradle/
|
||||||
**/dependency-reduced-pom.xml
|
**/dependency-reduced-pom.xml
|
||||||
**/pom.xml.versionsBackup
|
**/pom.xml.versionsBackup
|
||||||
@@ -124,16 +124,10 @@ The OpenInv API is available via [JitPack](https://jitpack.io/).
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Compilation
|
### Compilation
|
||||||
To compile, the relevant Spigot jars must be installed in the local repository.
|
OpenInv now builds with Gradle 8.14.3 using Paperweight userdev for Purpur `1.19.4` on Java 17 / GraalVM 17.
|
||||||
As OpenInv is compiled against Mojang's mappings, you must run BuildTools with the `--remapped` argument:
|
|
||||||
`java -jar BuildTools.jar --remapped --rev $serverVersion`
|
|
||||||
`$serverVersion` is the version of the server, i.e. `1.18.1`
|
|
||||||
|
|
||||||
To compile for a single version, specify the module you are targeting:
|
Build the plugin with:
|
||||||
`mvn -pl $moduleName -am clean install`
|
`./gradlew build`
|
||||||
`$moduleName` is the name of the module, i.e. `internal/v1_18_R1`.
|
|
||||||
|
|
||||||
To compile for a set of versions, use a profile. Select a profile using the `-P` argument:
|
The server-ready shaded jar is written to:
|
||||||
`mvn clean package -am -P all`
|
`build/libs/OpenInv-${version}.jar`
|
||||||
The only provided profile is `all`. The final file is `target/OpenInv.jar`
|
|
||||||
For more information, check out the [official Maven guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html).
|
|
||||||
-49
@@ -1,49 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2022 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<name>OpenInvAPI</name>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2022 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvassembly</artifactId>
|
|
||||||
<name>OpenInvAssembly</name>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<directory>../target</directory>
|
|
||||||
<finalName>OpenInv</finalName>
|
|
||||||
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>reactor-uberjar</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
|
||||||
<descriptors>
|
|
||||||
<descriptor>src/assembly/reactor-uberjar.xml</descriptor>
|
|
||||||
</descriptors>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2021 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
|
||||||
|
|
||||||
<id>reactor-uberjar</id>
|
|
||||||
|
|
||||||
<formats>
|
|
||||||
<format>jar</format>
|
|
||||||
</formats>
|
|
||||||
|
|
||||||
<includeBaseDirectory>false</includeBaseDirectory>
|
|
||||||
|
|
||||||
<moduleSets>
|
|
||||||
<moduleSet>
|
|
||||||
|
|
||||||
<useAllReactorProjects>true</useAllReactorProjects>
|
|
||||||
|
|
||||||
<binaries>
|
|
||||||
<outputDirectory>/</outputDirectory>
|
|
||||||
<unpack>true</unpack>
|
|
||||||
<unpackOptions>
|
|
||||||
<excludes>
|
|
||||||
<!--
|
|
||||||
- Exclude existing meta - assembly will write its own manifest, and the rest is maven
|
|
||||||
- details that end users don't need. Ignoring it saves around 7KB after compression
|
|
||||||
- with a single internal module present.
|
|
||||||
-->
|
|
||||||
<exclude>META-INF/**</exclude>
|
|
||||||
</excludes>
|
|
||||||
</unpackOptions>
|
|
||||||
<!-- Exclude dependencies - shade plugin will handle their inclusion as necessary in individual jars. -->
|
|
||||||
<includeDependencies>false</includeDependencies>
|
|
||||||
</binaries>
|
|
||||||
|
|
||||||
</moduleSet>
|
|
||||||
</moduleSets>
|
|
||||||
|
|
||||||
</assembly>
|
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
|
||||||
|
import io.papermc.paperweight.tasks.RemapJar
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
java
|
||||||
|
`java-library`
|
||||||
|
id("com.gradleup.shadow") version "8.3.9"
|
||||||
|
id("io.papermc.paperweight.userdev") version "2.0.0-beta.18"
|
||||||
|
eclipse
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.lishid"
|
||||||
|
version = "4.4.4-SNAPSHOT"
|
||||||
|
|
||||||
|
val apiVersion = "1.19"
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
vendor.set(JvmVendorSpec.GRAAL_VM)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
paperweight.reobfArtifactConfiguration = ReobfArtifactConfiguration.REOBF_PRODUCTION
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
maven("https://repo.purpurmc.org/snapshots")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
paperweight.paperDevBundle("1.19.4-R0.1-SNAPSHOT")
|
||||||
|
compileOnly("org.jetbrains:annotations:24.1.0")
|
||||||
|
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.setSrcDirs(
|
||||||
|
listOf(
|
||||||
|
"api/src/main/java",
|
||||||
|
"plugin/src/main/java",
|
||||||
|
"internal/v1_19_R3/src/main/java",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
resources.setSrcDirs(listOf("plugin/src/main/resources"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.release.set(17)
|
||||||
|
options.compilerArgs.add("-parameters")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<AbstractArchiveTask>().configureEach {
|
||||||
|
isPreserveFileTimestamps = false
|
||||||
|
isReproducibleFileOrder = true
|
||||||
|
archiveBaseName.set("OpenInv")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
val props = mapOf("version" to project.version, "apiVersion" to apiVersion)
|
||||||
|
inputs.properties(props)
|
||||||
|
filesMatching("plugin.yml") {
|
||||||
|
expand(props)
|
||||||
|
}
|
||||||
|
from("LICENSE.txt") {
|
||||||
|
into("/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.jar {
|
||||||
|
archiveClassifier.set("dev")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<ShadowJar>().configureEach {
|
||||||
|
archiveClassifier.set("dev-all")
|
||||||
|
minimize()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble") {
|
||||||
|
dependsOn(tasks.named("reobfJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("build") {
|
||||||
|
dependsOn(tasks.named("shadowJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<RemapJar>("reobfJar") {
|
||||||
|
outputJar.set(layout.buildDirectory.file("libs/OpenInv-${project.version}.jar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
project {
|
||||||
|
name = rootProject.name
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+94
@@ -0,0 +1,94 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<relativePath>../../pom.xml</relativePath>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvadapter1_19_R3</artifactId>
|
|
||||||
<name>OpenInvAdapter1_19_R3</name>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
<classifier>remapped-mojang</classifier>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
+155
-27
@@ -19,7 +19,6 @@ package com.lishid.openinv.internal.v1_19_R3;
|
|||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
|
||||||
import net.minecraft.nbt.NumericTag;
|
import net.minecraft.nbt.NumericTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
@@ -27,13 +26,50 @@ import net.minecraft.world.level.storage.PlayerDataStorage;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class OpenPlayer extends CraftPlayer {
|
public class OpenPlayer extends CraftPlayer {
|
||||||
|
|
||||||
|
private static final Set<String> RESET_TAGS = Set.of(
|
||||||
|
// net.minecraft.world.Entity#saveWithoutId(CompoundTag)
|
||||||
|
"CustomName",
|
||||||
|
"CustomNameVisible",
|
||||||
|
"Silent",
|
||||||
|
"NoGravity",
|
||||||
|
"Glowing",
|
||||||
|
"TicksFrozen",
|
||||||
|
"HasVisualFire",
|
||||||
|
"Tags",
|
||||||
|
"Passengers",
|
||||||
|
// net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
||||||
|
// Intentional omissions to prevent mount loss: Attach, Entity, and RootVehicle
|
||||||
|
"warden_spawn_tracker",
|
||||||
|
"enteredNetherPosition",
|
||||||
|
"SpawnX",
|
||||||
|
"SpawnY",
|
||||||
|
"SpawnZ",
|
||||||
|
"SpawnForced",
|
||||||
|
"SpawnAngle",
|
||||||
|
"SpawnDimension",
|
||||||
|
// net.minecraft.world.entity.player.Player#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ShoulderEntityLeft",
|
||||||
|
"ShoulderEntityRight",
|
||||||
|
"LastDeathLocation",
|
||||||
|
// net.minecraft.world.entity.LivingEntity#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ActiveEffects",
|
||||||
|
"SleepingX",
|
||||||
|
"SleepingY",
|
||||||
|
"SleepingZ",
|
||||||
|
"Brain"
|
||||||
|
);
|
||||||
|
|
||||||
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
@@ -41,28 +77,42 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
@Override
|
@Override
|
||||||
public void loadData() {
|
public void loadData() {
|
||||||
// See CraftPlayer#loadData
|
// See CraftPlayer#loadData
|
||||||
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
ServerPlayer serverPlayer = getHandle();
|
||||||
|
// The server's own storage, never the hookable PlayerList.playerIo, so an offline edit always targets the main profile
|
||||||
|
CompoundTag loaded = this.server.getServer().playerDataStorage.load(serverPlayer);
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
getHandle().readAdditionalSaveData(loaded);
|
serverPlayer.readAdditionalSaveData(loaded);
|
||||||
|
serverPlayer.loadGameTypes(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
ServerPlayer player = this.getHandle();
|
ServerPlayer player = this.getHandle();
|
||||||
|
// An offline save is a read-modify-write of the stored profile: hold the Utilities-OG player lock that MyWorlds and
|
||||||
|
// DiamondBank hold for theirs, so the two never interleave (no lock without that plugin, nothing else writes then)
|
||||||
|
boolean offline = !isOnline();
|
||||||
|
if (offline) {
|
||||||
|
UtilitiesLock.lock(player.getUUID());
|
||||||
|
}
|
||||||
// See net.minecraft.world.level.storage.PlayerDataStorage#save(EntityHuman)
|
// See net.minecraft.world.level.storage.PlayerDataStorage#save(EntityHuman)
|
||||||
try {
|
try {
|
||||||
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
PlayerDataStorage worldNBTStorage = player.server.playerDataStorage;
|
||||||
|
|
||||||
CompoundTag playerData = player.saveWithoutId(new CompoundTag());
|
// Read without applying: load(Player) would push the stored inventory back over the edit being saved
|
||||||
|
CompoundTag oldData = offline ? readStoredTag(worldNBTStorage, player) : null;
|
||||||
|
CompoundTag playerData = getWritableTag(oldData);
|
||||||
|
playerData = player.saveWithoutId(playerData);
|
||||||
setExtraData(playerData);
|
setExtraData(playerData);
|
||||||
|
|
||||||
if (!isOnline()) {
|
if (oldData != null) {
|
||||||
// Preserve certain data when offline.
|
// Revert certain special data values when offline.
|
||||||
CompoundTag oldData = worldNBTStorage.load(player);
|
|
||||||
revertSpecialValues(playerData, oldData);
|
revertSpecialValues(playerData, oldData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveThroughStorageApi(worldNBTStorage, player.getUUID(), playerData)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
File file = File.createTempFile(player.getStringUUID() + "-", ".dat", worldNBTStorage.getPlayerDir());
|
File file = File.createTempFile(player.getStringUUID() + "-", ".dat", worldNBTStorage.getPlayerDir());
|
||||||
NbtIo.writeCompressed(playerData, file);
|
NbtIo.writeCompressed(playerData, file);
|
||||||
File file1 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat");
|
File file1 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat");
|
||||||
@@ -70,34 +120,109 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
Util.safeReplaceFile(file1, file, file2);
|
Util.safeReplaceFile(file1, file, file2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getScoreboardName(), e);
|
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getScoreboardName(), e);
|
||||||
|
} finally {
|
||||||
|
if (offline) {
|
||||||
|
UtilitiesLock.unlock(player.getUUID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void revertSpecialValues(@NotNull CompoundTag newData, @Nullable CompoundTag oldData) {
|
// Utilities-OG's per player lock, reached by reflection so OpenInv needs no compile dependency on it
|
||||||
if (oldData == null) {
|
private static final class UtilitiesLock {
|
||||||
return;
|
private static final Method LOCK;
|
||||||
}
|
private static final Method UNLOCK;
|
||||||
|
|
||||||
// Prevent vehicle deletion.
|
static {
|
||||||
if (oldData.contains("RootVehicle", Tag.TAG_COMPOUND)) {
|
Method lock = null;
|
||||||
// See net.minecraft.server.players.PlayerList#save(ServerPlayer)
|
Method unlock = null;
|
||||||
// See net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
|
||||||
try {
|
try {
|
||||||
Tag attach = oldData.get("Attach");
|
Class<?> utilities = Class.forName("net.trueog.utilitiesog.UtilitiesOG", true, OpenPlayer.class.getClassLoader());
|
||||||
if (attach != null) {
|
lock = utilities.getMethod("lockPlayerData", UUID.class);
|
||||||
newData.putUUID("Attach", NbtUtils.loadUUID(attach));
|
unlock = utilities.getMethod("unlockPlayerData", UUID.class);
|
||||||
}
|
} catch (ReflectiveOperationException e) {
|
||||||
} catch (IllegalArgumentException ignored) {
|
// Utilities-OG is not installed, offline edits are unsynchronized like on vanilla
|
||||||
// Likely will not re-mount successfully, but at least the mount will not be deleted.
|
|
||||||
}
|
}
|
||||||
newData.put("Entity", oldData.getCompound("Entity"));
|
LOCK = lock;
|
||||||
newData.put("RootVehicle", oldData.getCompound("RootVehicle"));
|
UNLOCK = unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lock(UUID uuid) {
|
||||||
|
invoke(LOCK, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unlock(UUID uuid) {
|
||||||
|
invoke(UNLOCK, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void invoke(@Nullable Method method, UUID uuid) {
|
||||||
|
if (method == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
method.invoke(null, uuid);
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
LogManager.getLogger().warn("Utilities-OG player data lock failed for {}", uuid, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A storage with saveCompoundTag(UUID, CompoundTag) keeps profiles in a database (TrueOG Purpur); its getPlayerData(UUID) never touches the entity
|
||||||
|
private static @Nullable Method storageSave(@NotNull PlayerDataStorage storage) {
|
||||||
|
try {
|
||||||
|
return storage.getClass().getMethod("saveCompoundTag", UUID.class, CompoundTag.class);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @Nullable CompoundTag readStoredTag(@NotNull PlayerDataStorage storage, @NotNull ServerPlayer player) throws ReflectiveOperationException {
|
||||||
|
if (storageSave(storage) != null) {
|
||||||
|
Method get = storage.getClass().getMethod("getPlayerData", UUID.class);
|
||||||
|
return (CompoundTag) get.invoke(storage, player.getUUID());
|
||||||
|
}
|
||||||
|
// CraftBukkit's file read, which does not apply the data to the entity
|
||||||
|
Method getPlayerData = storage.getClass().getMethod("getPlayerData", String.class);
|
||||||
|
return (CompoundTag) getPlayerData.invoke(storage, player.getStringUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
// True when the storage took the profile itself (it logs a failed write); false means the caller keeps the file layout
|
||||||
|
private static boolean saveThroughStorageApi(@NotNull PlayerDataStorage storage, @NotNull UUID uuid, @NotNull CompoundTag playerData) throws ReflectiveOperationException {
|
||||||
|
Method save = storageSave(storage);
|
||||||
|
if (save == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
save.invoke(storage, uuid, playerData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Contract("null -> new")
|
||||||
|
private @NotNull CompoundTag getWritableTag(@Nullable CompoundTag oldData) {
|
||||||
|
if (oldData == null) {
|
||||||
|
return new CompoundTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy old data. This is a deep clone, so operating on it should be safe.
|
||||||
|
oldData = oldData.copy();
|
||||||
|
|
||||||
|
// Remove vanilla/server data that is not written every time.
|
||||||
|
oldData.getAllKeys().removeIf(key -> RESET_TAGS.contains(key) || key.startsWith("Bukkit"));
|
||||||
|
|
||||||
|
return oldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void revertSpecialValues(@NotNull CompoundTag newData, @NotNull CompoundTag oldData) {
|
||||||
// Revert automatic updates to play timestamps.
|
// Revert automatic updates to play timestamps.
|
||||||
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
||||||
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
||||||
copyValue(oldData, newData, "Paper", "LastLogin", NumericTag.class);
|
copyValue(oldData, newData, "Paper", "LastLogin", NumericTag.class);
|
||||||
|
// The persistent data container was captured when the inventory was opened; other plugins (MyWorlds nests its
|
||||||
|
// per-world profiles there) may have changed the stored one since, and this edit never touches it
|
||||||
|
Tag storedValues = oldData.get("BukkitValues");
|
||||||
|
if (storedValues != null) {
|
||||||
|
newData.put("BukkitValues", storedValues.copy());
|
||||||
|
} else {
|
||||||
|
newData.remove("BukkitValues");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends Tag> void copyValue(
|
private <T extends Tag> void copyValue(
|
||||||
@@ -109,8 +234,8 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
||||||
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
||||||
|
|
||||||
// Container being null means the server implementation doesn't store this data.
|
// New container being null means the server implementation doesn't store this data.
|
||||||
if (oldContainer == null || newContainer == null) {
|
if (newContainer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +244,12 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T extends Tag> @Nullable T getTag(
|
private <T extends Tag> @Nullable T getTag(
|
||||||
@NotNull CompoundTag container,
|
@Nullable CompoundTag container,
|
||||||
@NotNull String key,
|
@NotNull String key,
|
||||||
@NotNull Class<T> dataType) {
|
@NotNull Class<T> dataType) {
|
||||||
|
if (container == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Tag value = container.get(key);
|
Tag value = container.get(key);
|
||||||
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+12
-3
@@ -21,9 +21,8 @@ import com.lishid.openinv.internal.IPlayerDataManager;
|
|||||||
import com.lishid.openinv.internal.ISpecialInventory;
|
import com.lishid.openinv.internal.ISpecialInventory;
|
||||||
import com.lishid.openinv.internal.OpenInventoryView;
|
import com.lishid.openinv.internal.OpenInventoryView;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -47,6 +46,9 @@ import org.bukkit.inventory.InventoryView;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class PlayerDataManager implements IPlayerDataManager {
|
public class PlayerDataManager implements IPlayerDataManager {
|
||||||
|
|
||||||
private @Nullable Field bukkitEntity;
|
private @Nullable Field bukkitEntity;
|
||||||
@@ -114,15 +116,22 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
|
|
||||||
// Load data. This also reads basic data into the player.
|
// Load data. This also reads basic data into the player.
|
||||||
// See CraftPlayer#loadData
|
// See CraftPlayer#loadData
|
||||||
CompoundTag loadedData = server.getPlayerList().playerIo.load(entity);
|
// The server's own storage, not PlayerList.playerIo: a world manager may hook that field and answer with a per-world profile, and an offline edit always means the main profile.
|
||||||
|
CompoundTag loadedData = server.playerDataStorage.load(entity);
|
||||||
|
|
||||||
if (loadedData == null) {
|
if (loadedData == null) {
|
||||||
// Exceptions with loading are logged by Mojang.
|
// Exceptions with loading are logged by Mojang.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// A stored tag without a position is no profile, only data other plugins keep for a player who never joined
|
||||||
|
// (a MyWorlds inventory group, for example); editing it would turn it into a profile placed at 0,0,0.
|
||||||
|
if (!loadedData.contains("Pos", Tag.TAG_LIST)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Also read "extra" data.
|
// Also read "extra" data.
|
||||||
entity.readAdditionalSaveData(loadedData);
|
entity.readAdditionalSaveData(loadedData);
|
||||||
|
entity.loadGameTypes(loadedData);
|
||||||
|
|
||||||
if (entity.level == null) {
|
if (entity.level == null) {
|
||||||
// Paper: Move player to spawn
|
// Paper: Move player to spawn
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<relativePath>../../pom.xml</relativePath>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvadapter1_20_R2</artifactId>
|
|
||||||
<name>OpenInvAdapter1_20_R2</name>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
<classifier>remapped-mojang</classifier>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
+59
-25
@@ -20,20 +20,55 @@ import com.mojang.logging.LogUtils;
|
|||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
|
||||||
import net.minecraft.nbt.NumericTag;
|
import net.minecraft.nbt.NumericTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.storage.PlayerDataStorage;
|
import net.minecraft.world.level.storage.PlayerDataStorage;
|
||||||
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class OpenPlayer extends CraftPlayer {
|
public class OpenPlayer extends CraftPlayer {
|
||||||
|
|
||||||
|
private static final Set<String> RESET_TAGS = Set.of(
|
||||||
|
// net.minecraft.world.Entity#saveWithoutId(CompoundTag)
|
||||||
|
"CustomName",
|
||||||
|
"CustomNameVisible",
|
||||||
|
"Silent",
|
||||||
|
"NoGravity",
|
||||||
|
"Glowing",
|
||||||
|
"TicksFrozen",
|
||||||
|
"HasVisualFire",
|
||||||
|
"Tags",
|
||||||
|
"Passengers",
|
||||||
|
// net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
||||||
|
// Intentional omissions to prevent mount loss: Attach, Entity, and RootVehicle
|
||||||
|
"warden_spawn_tracker",
|
||||||
|
"enteredNetherPosition",
|
||||||
|
"SpawnX",
|
||||||
|
"SpawnY",
|
||||||
|
"SpawnZ",
|
||||||
|
"SpawnForced",
|
||||||
|
"SpawnAngle",
|
||||||
|
"SpawnDimension",
|
||||||
|
// net.minecraft.world.entity.player.Player#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ShoulderEntityLeft",
|
||||||
|
"ShoulderEntityRight",
|
||||||
|
"LastDeathLocation",
|
||||||
|
// net.minecraft.world.entity.LivingEntity#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ActiveEffects", // Backwards compat: Renamed from 1.19
|
||||||
|
"active_effects",
|
||||||
|
"SleepingX",
|
||||||
|
"SleepingY",
|
||||||
|
"SleepingZ",
|
||||||
|
"Brain"
|
||||||
|
);
|
||||||
|
|
||||||
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
@@ -50,12 +85,13 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
try {
|
try {
|
||||||
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
||||||
|
|
||||||
CompoundTag playerData = player.saveWithoutId(new CompoundTag());
|
CompoundTag oldData = isOnline() ? null : worldNBTStorage.load(player);
|
||||||
|
CompoundTag playerData = getWritableTag(oldData);
|
||||||
|
playerData = player.saveWithoutId(playerData);
|
||||||
setExtraData(playerData);
|
setExtraData(playerData);
|
||||||
|
|
||||||
if (!isOnline()) {
|
if (oldData != null) {
|
||||||
// Preserve certain data when offline.
|
// Revert certain special data values when offline.
|
||||||
CompoundTag oldData = worldNBTStorage.load(player);
|
|
||||||
revertSpecialValues(playerData, oldData);
|
revertSpecialValues(playerData, oldData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,27 +105,22 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void revertSpecialValues(@NotNull CompoundTag newData, @Nullable CompoundTag oldData) {
|
@Contract("null -> new")
|
||||||
|
private @NotNull CompoundTag getWritableTag(@Nullable CompoundTag oldData) {
|
||||||
if (oldData == null) {
|
if (oldData == null) {
|
||||||
return;
|
return new CompoundTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent vehicle deletion.
|
// Copy old data. This is a deep clone, so operating on it should be safe.
|
||||||
if (oldData.contains("RootVehicle", Tag.TAG_COMPOUND)) {
|
oldData = oldData.copy();
|
||||||
// See net.minecraft.server.players.PlayerList#save(ServerPlayer)
|
|
||||||
// See net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
|
||||||
try {
|
|
||||||
Tag attach = oldData.get("Attach");
|
|
||||||
if (attach != null) {
|
|
||||||
newData.putUUID("Attach", NbtUtils.loadUUID(attach));
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException ignored) {
|
|
||||||
// Likely will not re-mount successfully, but at least the mount will not be deleted.
|
|
||||||
}
|
|
||||||
newData.put("Entity", oldData.getCompound("Entity"));
|
|
||||||
newData.put("RootVehicle", oldData.getCompound("RootVehicle"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Remove vanilla/server data that is not written every time.
|
||||||
|
oldData.getAllKeys().removeIf(key -> RESET_TAGS.contains(key) || key.startsWith("Bukkit"));
|
||||||
|
|
||||||
|
return oldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void revertSpecialValues(@NotNull CompoundTag newData, @NotNull CompoundTag oldData) {
|
||||||
// Revert automatic updates to play timestamps.
|
// Revert automatic updates to play timestamps.
|
||||||
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
||||||
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
||||||
@@ -105,8 +136,8 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
||||||
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
||||||
|
|
||||||
// Container being null means the server implementation doesn't store this data.
|
// New container being null means the server implementation doesn't store this data.
|
||||||
if (oldContainer == null || newContainer == null) {
|
if (newContainer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +146,12 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T extends Tag> @Nullable T getTag(
|
private <T extends Tag> @Nullable T getTag(
|
||||||
@NotNull CompoundTag container,
|
@Nullable CompoundTag container,
|
||||||
@NotNull String key,
|
@NotNull String key,
|
||||||
@NotNull Class<T> dataType) {
|
@NotNull Class<T> dataType) {
|
||||||
|
if (container == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Tag value = container.get(key);
|
Tag value = container.get(key);
|
||||||
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+2
@@ -177,6 +177,8 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
player.load(loadedData);
|
player.load(loadedData);
|
||||||
// Also read "extra" data.
|
// Also read "extra" data.
|
||||||
player.readAdditionalSaveData(loadedData);
|
player.readAdditionalSaveData(loadedData);
|
||||||
|
// Game type settings are also loaded separately.
|
||||||
|
player.loadGameTypes(loadedData);
|
||||||
|
|
||||||
if (paper) {
|
if (paper) {
|
||||||
// Paper: world is not loaded by ServerPlayer#load(CompoundTag).
|
// Paper: world is not loaded by ServerPlayer#load(CompoundTag).
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<relativePath>../../pom.xml</relativePath>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvadapter1_20_R3</artifactId>
|
|
||||||
<name>OpenInvAdapter1_20_R3</name>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>${spigot.version}</version>
|
|
||||||
<classifier>remapped-mojang</classifier>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
+60
-25
@@ -20,21 +20,56 @@ import com.mojang.logging.LogUtils;
|
|||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
|
||||||
import net.minecraft.nbt.NumericTag;
|
import net.minecraft.nbt.NumericTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.storage.PlayerDataStorage;
|
import net.minecraft.world.level.storage.PlayerDataStorage;
|
||||||
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class OpenPlayer extends CraftPlayer {
|
public class OpenPlayer extends CraftPlayer {
|
||||||
|
|
||||||
|
private static final Set<String> RESET_TAGS = Set.of(
|
||||||
|
// net.minecraft.world.Entity#saveWithoutId(CompoundTag)
|
||||||
|
"CustomName",
|
||||||
|
"CustomNameVisible",
|
||||||
|
"Silent",
|
||||||
|
"NoGravity",
|
||||||
|
"Glowing",
|
||||||
|
"TicksFrozen",
|
||||||
|
"HasVisualFire",
|
||||||
|
"Tags",
|
||||||
|
"Passengers",
|
||||||
|
// net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
||||||
|
// Intentional omissions to prevent mount loss: Attach, Entity, and RootVehicle
|
||||||
|
"warden_spawn_tracker",
|
||||||
|
"enteredNetherPosition",
|
||||||
|
"SpawnX",
|
||||||
|
"SpawnY",
|
||||||
|
"SpawnZ",
|
||||||
|
"SpawnForced",
|
||||||
|
"SpawnAngle",
|
||||||
|
"SpawnDimension",
|
||||||
|
// net.minecraft.world.entity.player.Player#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ShoulderEntityLeft",
|
||||||
|
"ShoulderEntityRight",
|
||||||
|
"LastDeathLocation",
|
||||||
|
// net.minecraft.world.entity.LivingEntity#addAdditionalSaveData(CompoundTag)
|
||||||
|
"ActiveEffects", // Backwards compat: Renamed from 1.19
|
||||||
|
"active_effects",
|
||||||
|
"SleepingX",
|
||||||
|
"SleepingY",
|
||||||
|
"SleepingZ",
|
||||||
|
"Brain"
|
||||||
|
);
|
||||||
|
|
||||||
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
public OpenPlayer(CraftServer server, ServerPlayer entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
@@ -51,12 +86,13 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
try {
|
try {
|
||||||
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
||||||
|
|
||||||
CompoundTag playerData = player.saveWithoutId(new CompoundTag());
|
CompoundTag oldData = isOnline() ? null : worldNBTStorage.load(player);
|
||||||
|
CompoundTag playerData = getWritableTag(oldData);
|
||||||
|
playerData = player.saveWithoutId(playerData);
|
||||||
setExtraData(playerData);
|
setExtraData(playerData);
|
||||||
|
|
||||||
if (!isOnline()) {
|
if (oldData != null) {
|
||||||
// Preserve certain data when offline.
|
// Revert certain special data values when offline.
|
||||||
CompoundTag oldData = worldNBTStorage.load(player);
|
|
||||||
revertSpecialValues(playerData, oldData);
|
revertSpecialValues(playerData, oldData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,27 +107,23 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void revertSpecialValues(@NotNull CompoundTag newData, @Nullable CompoundTag oldData) {
|
@Contract("null -> new")
|
||||||
|
private @NotNull CompoundTag getWritableTag(@Nullable CompoundTag oldData) {
|
||||||
if (oldData == null) {
|
if (oldData == null) {
|
||||||
return;
|
return new CompoundTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent vehicle deletion.
|
// Copy old data. This is a deep clone, so operating on it should be safe.
|
||||||
if (oldData.contains("RootVehicle", Tag.TAG_COMPOUND)) {
|
oldData = oldData.copy();
|
||||||
// See net.minecraft.server.players.PlayerList#save(ServerPlayer)
|
|
||||||
// See net.minecraft.server.level.ServerPlayer#addAdditionalSaveData(CompoundTag)
|
|
||||||
try {
|
|
||||||
Tag attach = oldData.get("Attach");
|
|
||||||
if (attach != null) {
|
|
||||||
newData.putUUID("Attach", NbtUtils.loadUUID(attach));
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException ignored) {
|
|
||||||
// Likely will not re-mount successfully, but at least the mount will not be deleted.
|
|
||||||
}
|
|
||||||
newData.put("Entity", oldData.getCompound("Entity"));
|
|
||||||
newData.put("RootVehicle", oldData.getCompound("RootVehicle"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Remove vanilla/server data that is not written every time.
|
||||||
|
oldData.getAllKeys()
|
||||||
|
.removeIf(key -> RESET_TAGS.contains(key) || key.startsWith("Bukkit"));
|
||||||
|
|
||||||
|
return oldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void revertSpecialValues(@NotNull CompoundTag newData, @NotNull CompoundTag oldData) {
|
||||||
// Revert automatic updates to play timestamps.
|
// Revert automatic updates to play timestamps.
|
||||||
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
copyValue(oldData, newData, "bukkit", "lastPlayed", NumericTag.class);
|
||||||
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
copyValue(oldData, newData, "Paper", "LastSeen", NumericTag.class);
|
||||||
@@ -107,8 +139,8 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
CompoundTag oldContainer = getTag(source, container, CompoundTag.class);
|
||||||
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
CompoundTag newContainer = getTag(target, container, CompoundTag.class);
|
||||||
|
|
||||||
// Container being null means the server implementation doesn't store this data.
|
// New container being null means the server implementation doesn't store this data.
|
||||||
if (oldContainer == null || newContainer == null) {
|
if (newContainer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,9 +149,12 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T extends Tag> @Nullable T getTag(
|
private <T extends Tag> @Nullable T getTag(
|
||||||
@NotNull CompoundTag container,
|
@Nullable CompoundTag container,
|
||||||
@NotNull String key,
|
@NotNull String key,
|
||||||
@NotNull Class<T> dataType) {
|
@NotNull Class<T> dataType) {
|
||||||
|
if (container == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Tag value = container.get(key);
|
Tag value = container.get(key);
|
||||||
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
if (value == null || !dataType.isAssignableFrom(value.getClass())) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+2
@@ -177,6 +177,8 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
player.load(loadedData);
|
player.load(loadedData);
|
||||||
// Also read "extra" data.
|
// Also read "extra" data.
|
||||||
player.readAdditionalSaveData(loadedData);
|
player.readAdditionalSaveData(loadedData);
|
||||||
|
// Game type settings are also loaded separately.
|
||||||
|
player.loadGameTypes(loadedData);
|
||||||
|
|
||||||
if (paper) {
|
if (paper) {
|
||||||
// Paper: world is not loaded by ServerPlayer#load(CompoundTag).
|
// Paper: world is not loaded by ServerPlayer#load(CompoundTag).
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2022 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
|
||||||
<name>OpenInvPlugin</name>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -81,4 +81,14 @@ public class OpenInventoryView extends InventoryView {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getOriginalTitle() {
|
||||||
|
return getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTitle(@NotNull String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ settings:
|
|||||||
open:
|
open:
|
||||||
no-args-opens-self: false
|
no-args-opens-self: false
|
||||||
searchcontainer:
|
searchcontainer:
|
||||||
max-radius: 10
|
max-radius: 30
|
||||||
disable-offline-access: false
|
disable-offline-access: false
|
||||||
disable-saving: false
|
disable-saving: false
|
||||||
locale: 'en_us'
|
locale: 'en_us'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
messages:
|
messages:
|
||||||
error:
|
error:
|
||||||
consoleUnsupported: 'You cannot use this command from console.'
|
consoleUnsupported: You cannot use this command from console.
|
||||||
lootNotGenerated: '&cLoot not generated! Please disable &b/silentcontainer&c.'
|
lootNotGenerated: '&cLoot not generated! Please disable &b/silentcontainer&c.'
|
||||||
invalidMaterial: '&cInvalid material: "%target%"'
|
invalidMaterial: '&cInvalid material: "%target%"'
|
||||||
invalidNumber: '&cInvalid number: "%target%"'
|
invalidNumber: '&cInvalid number: "%target%"'
|
||||||
@@ -9,22 +9,24 @@ messages:
|
|||||||
permissionEnderAll: '&cYou''re not allowed to access other players'' ender chests.'
|
permissionEnderAll: '&cYou''re not allowed to access other players'' ender chests.'
|
||||||
permissionExempt: '&c%target%''s inventory is protected.'
|
permissionExempt: '&c%target%''s inventory is protected.'
|
||||||
permissionCrossWorld: '&c%target% is not in your world.'
|
permissionCrossWorld: '&c%target% is not in your world.'
|
||||||
permissionPlayerOnline: '&cYou''re not allowed to open the inventory of online players.'
|
permissionPlayerOnline: '&cYou''re not allowed to open the inventory of online
|
||||||
permissionPlayerOffline: '&cYou''re not allowed to open the inventory of offline players.'
|
players.'
|
||||||
|
permissionPlayerOffline: '&cYou''re not allowed to open the inventory of offline
|
||||||
|
players.'
|
||||||
commandException: '&cAn error occurred. Please check console for details.'
|
commandException: '&cAn error occurred. Please check console for details.'
|
||||||
info:
|
info:
|
||||||
containerBlocked: 'You are opening a blocked container.'
|
containerBlocked: You are opening a blocked container.
|
||||||
containerBlockedSilent: 'You are opening a blocked container silently.'
|
containerBlockedSilent: You are opening a blocked container silently.
|
||||||
containerSilent: 'You are opening a container silently.'
|
containerSilent: You are opening a container silently.
|
||||||
settingState: '%setting%: %state%'
|
settingState: '%setting%: %state%'
|
||||||
player:
|
player:
|
||||||
noMatches: 'No players found with %target%.'
|
noMatches: No players found with %target%.
|
||||||
matches: 'Players holding %target%: %detail%'
|
matches: 'Players holding %target%: %detail%'
|
||||||
container:
|
container:
|
||||||
noMatches: 'No containers found with %target%.'
|
noMatches: No containers found with %target%.
|
||||||
matches: 'Containers holding %target%: %detail%'
|
matches: 'Containers holding %target%: %detail%'
|
||||||
on: 'on'
|
'true': 'on'
|
||||||
off: 'off'
|
'false': 'off'
|
||||||
container:
|
container:
|
||||||
player: '%player%''s Inventory'
|
player: '%player%''s Inventory'
|
||||||
enderchest: '%player%''s Ender Chest'
|
enderchest: '%player%''s Ender Chest'
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
name: OpenInv
|
name: OpenInv
|
||||||
main: com.lishid.openinv.OpenInv
|
main: com.lishid.openinv.OpenInv
|
||||||
version: ${project.version}
|
version: ${version}
|
||||||
author: lishid
|
author: lishid
|
||||||
authors: [Jikoo, ShadowRanger]
|
authors: [Jikoo, ShadowRanger]
|
||||||
description: >
|
description: >
|
||||||
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
||||||
api-version: "1.16"
|
api-version: "${apiVersion}"
|
||||||
|
softdepend: [Utilities-OG]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
OpenInv.any.default:
|
OpenInv.any.default:
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, version 3.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<artifactId>openinvparent</artifactId>
|
|
||||||
<name>OpenInv</name>
|
|
||||||
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<maven.compiler.release>17</maven.compiler.release>
|
|
||||||
<!-- Silence IDE warning - property is declared in individual internal modules. -->
|
|
||||||
<spigot.version>unknown</spigot.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>all</id>
|
|
||||||
<modules>
|
|
||||||
<module>api</module>
|
|
||||||
<module>plugin</module>
|
|
||||||
<module>internal/v1_19_R3</module>
|
|
||||||
<module>internal/v1_20_R2</module>
|
|
||||||
<module>internal/v1_20_R3</module>
|
|
||||||
<module>assembly</module>
|
|
||||||
</modules>
|
|
||||||
</profile>
|
|
||||||
|
|
||||||
<profile>
|
|
||||||
<id>default</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<modules>
|
|
||||||
<module>api</module>
|
|
||||||
<module>plugin</module>
|
|
||||||
<module>assembly</module>
|
|
||||||
</modules>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>24.1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
<version>4.4.2</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.lishid</groupId>
|
|
||||||
<artifactId>openinvapi</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<!--
|
|
||||||
~ This plugin is used in scripts to determine if NMS dependencies need to be installed. This must be
|
|
||||||
~ declared so that we don't run into MDEP-204; the default SuperPOM declares version 2.8.0.
|
|
||||||
-->
|
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<version>3.6.1</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<filters>
|
|
||||||
<filter>
|
|
||||||
<!-- Always shade entirety of required modules. -->
|
|
||||||
<artifact>com.lishid:openinv*</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
<filter>
|
|
||||||
<artifact>*:*</artifact>
|
|
||||||
<!-- Don't warn about file conflicts that'll be clobbered anyway. -->
|
|
||||||
<excludes>
|
|
||||||
<exclude>META-INF/MANIFEST.MF</exclude>
|
|
||||||
</excludes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
|
||||||
<minimizeJar>true</minimizeJar>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<version>3.5.1</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<version>3.11.0</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<version>3.6.0</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
|
||||||
<version>1.2.4</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>remap</goal>
|
|
||||||
</goals>
|
|
||||||
<id>remap-obf</id>
|
|
||||||
<configuration>
|
|
||||||
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
|
|
||||||
<reverse>true</reverse>
|
|
||||||
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
|
|
||||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
|
||||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>remap</goal>
|
|
||||||
</goals>
|
|
||||||
<id>remap-spigot</id>
|
|
||||||
<configuration>
|
|
||||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
|
||||||
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
|
|
||||||
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "OpenInv"
|
||||||
Reference in new issue
Block a user