mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-28 08:44:07 +00:00
Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8210536dad | ||
|
|
04309fba14 | ||
|
|
97ee43e434 | ||
|
|
6992e3a41a | ||
|
|
b69d4aa787 | ||
|
|
c7a1a4e069 | ||
|
|
1d4389188f | ||
|
|
ab9911605c | ||
|
|
6eca1c5c73 | ||
|
|
621f3a6876 | ||
|
|
bd45e4cb87 | ||
|
|
b878c992f9 | ||
|
|
aeeffc9e1b | ||
|
|
09ce7e79d2 | ||
|
|
e017aa83c6 | ||
|
|
ff79654444 | ||
|
|
c2a45e8b7b | ||
|
|
9f0801fda4 | ||
|
|
66fe5b9001 |
No files matched your search
@@ -0,0 +1,37 @@
|
||||
name: Publish editor schema
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
publish:
|
||||
if: '!github.event.release.prerelease'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Prepare plugin-owned schemas
|
||||
env:
|
||||
SCHEMA_PATHS: BetterRTP-Core/src/main/resources/META-INF/editor-schema.json BetterRTPAddons/src/main/resources/META-INF/editor-schema.json
|
||||
run: |
|
||||
node --input-type=module <<'JS'
|
||||
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
mkdirSync('editor-schemas');
|
||||
for (const path of process.env.SCHEMA_PATHS.split(' ')) {
|
||||
const bytes = readFileSync(path), meta = JSON.parse(bytes)['x-bettersync'];
|
||||
if (meta?.format !== 1 || !/^[a-z0-9-]+$/.test(meta.plugin) || !/^[A-Za-z0-9._-]+$/.test(meta.schemaVersion)) throw new Error('Invalid schema identity');
|
||||
writeFileSync(`editor-schemas/${meta.plugin}-${meta.schemaVersion}.schema.json`, bytes);
|
||||
}
|
||||
JS
|
||||
- name: Attach schemas to this plugin release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: gh release upload "$RELEASE_TAG" editor-schemas/*.schema.json
|
||||
@@ -0,0 +1,79 @@
|
||||
name: Release BetterRTP Maven version
|
||||
on:
|
||||
push:
|
||||
branches: [online-editor]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: write
|
||||
concurrency:
|
||||
group: release-maven-version
|
||||
cancel-in-progress: false
|
||||
jobs:
|
||||
release:
|
||||
if: github.ref == 'refs/heads/online-editor'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
cache: maven
|
||||
- name: Read BetterRTP Maven version
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
mvn -B -q -f BetterRTP-Core/pom.xml help:evaluate -Dexpression=project.version -Doutput="$RUNNER_TEMP/version-0"
|
||||
version0=$(cat "$RUNNER_TEMP/version-0")
|
||||
[[ "$version0" =~ ^[0-9][A-Za-z0-9._-]*$ ]] || { echo "Invalid Maven version"; exit 1; }
|
||||
[[ "$version0" != *SNAPSHOT* ]] || { echo "Snapshot versions are not released"; exit 1; }
|
||||
echo "version0=$version0" >> "$GITHUB_OUTPUT"
|
||||
echo "tag=v$version0" >> "$GITHUB_OUTPUT"
|
||||
echo "title=BetterRTP $version0" >> "$GITHUB_OUTPUT"
|
||||
- name: Check for an existing release
|
||||
id: existing
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
RELEASE_TAG: ${{ steps.version.outputs.tag }}
|
||||
run: |
|
||||
# Listing errors fail the workflow; they are not mistaken for an absent release.
|
||||
releases=$(gh api --paginate "repos/$GH_REPO/releases?per_page=100" --jq '.[].tag_name')
|
||||
if printf '%s\n' "$releases" | grep -Fxq "$RELEASE_TAG"; then
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
echo "Release $RELEASE_TAG already exists; bump the Maven version for another release."
|
||||
fi
|
||||
- name: Build and test
|
||||
if: steps.existing.outputs.exists != 'true'
|
||||
run: |
|
||||
mvn -B -pl :BetterRTP clean verify
|
||||
mvn -B -f tests/editor/pom.xml verify
|
||||
- name: Prepare BetterRTP JAR and editor schemas
|
||||
if: steps.existing.outputs.exists != 'true'
|
||||
env:
|
||||
# The website still needs Addons field metadata; this does not build its JAR.
|
||||
SCHEMA_PATHS: BetterRTP-Core/src/main/resources/META-INF/editor-schema.json BetterRTPAddons/src/main/resources/META-INF/editor-schema.json
|
||||
run: |
|
||||
mkdir release-assets
|
||||
cp "dist/BetterRTP-${{ steps.version.outputs.version0 }}.jar" release-assets/
|
||||
python3 - <<'PYTHON'
|
||||
import json, os, pathlib, re
|
||||
for path in os.environ['SCHEMA_PATHS'].split():
|
||||
data = pathlib.Path(path).read_bytes()
|
||||
meta = json.loads(data)['x-bettersync']
|
||||
if meta['format'] != 1 or not re.fullmatch(r'[a-z0-9-]+', meta['plugin']) or not re.fullmatch(r'[A-Za-z0-9._-]+', meta['schemaVersion']):
|
||||
raise ValueError('Invalid schema identity')
|
||||
pathlib.Path('release-assets', f"{meta['plugin']}-{meta['schemaVersion']}.schema.json").write_bytes(data)
|
||||
PYTHON
|
||||
- name: Publish versioned release
|
||||
if: steps.existing.outputs.exists != 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
RELEASE_TAG: ${{ steps.version.outputs.tag }}
|
||||
RELEASE_TITLE: ${{ steps.version.outputs.title }}
|
||||
run: |
|
||||
gh release create "$RELEASE_TAG" release-assets/* \
|
||||
--target "$GITHUB_SHA" --title "$RELEASE_TITLE" --generate-notes --latest
|
||||
@@ -18,4 +18,4 @@ jobs:
|
||||
run: cp settings.xml $HOME/.m2/settings.xml
|
||||
|
||||
- name: Build and test with Maven
|
||||
run: mvn test
|
||||
run: mvn -B -pl :BetterRTP test
|
||||
@@ -10,3 +10,5 @@ BetterRTP.wiki/
|
||||
.DS_Store
|
||||
.vscode/
|
||||
node_modules/
|
||||
|
||||
/dist/
|
||||
@@ -0,0 +1,434 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.6.14</version>
|
||||
|
||||
<!-- Upload patches to https://repo.ronanplugins.com/#/ -->
|
||||
|
||||
<properties>
|
||||
<bettersync.version>2.0.0</bettersync.version>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<editor.website>https://www.minecentral.net</editor.website>
|
||||
<editor.buildSuffix></editor.buildSuffix>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- Local Server Building -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/../../../Java/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.artifactId}-${project.version}${editor.buildSuffix}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/../dist</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- Shade PaperLib into project -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
|
||||
</dependencyReducedPomLocation>
|
||||
<relocations>
|
||||
<relocation><pattern>com.ronanplugins.bettersync</pattern><shadedPattern>me.SuperRonanCraft.BetterRTP.lib.bettersync</shadedPattern></relocation>
|
||||
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.lib.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.tcoded.folialib</pattern>
|
||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.lib.folialib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- Remove only Shade's unbundled backup, after the final JAR is ready. -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>${project.basedir}/../dist</directory>
|
||||
<includes>
|
||||
<include>${project.artifactId}-*.jar</include>
|
||||
<include>original-${project.artifactId}-*.jar</include>
|
||||
</includes>
|
||||
<followSymlinks>false</followSymlinks>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>remove-unshaded-backup</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>clean</goal></goals>
|
||||
<configuration>
|
||||
<excludeDefaultDirectories>true</excludeDefaultDirectories>
|
||||
<filesets combine.self="override">
|
||||
<fileset>
|
||||
<directory>${project.basedir}/../dist</directory>
|
||||
<includes><include>original-${project.build.finalName}.jar</include></includes>
|
||||
<followSymlinks>false</followSymlinks>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<!-- CAN BE UNCOMMENTED IF YOU HAVE ACCESS TO THE REPO -->
|
||||
<!--<repository>
|
||||
<id>ronanplugins-private</id>
|
||||
<name>RonanPlugins Repository</name>
|
||||
<url>https://repo.ronanplugins.com/private</url>
|
||||
</repository>-->
|
||||
<!-- GitHub based Repos -->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<!-- FoliaLib Repo -->
|
||||
<repository>
|
||||
<id>tcoded-releases</id>
|
||||
<url>https://repo.tcoded.com/releases</url>
|
||||
</repository>
|
||||
<!-- Spigot Repo -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- PaperMC Repo -->
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<!-- Vault Repo -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>https://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<!-- WorldGuard Repo -->
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<!-- ProjectRed Repo -->
|
||||
<repository>
|
||||
<id>redprotect-repo</id>
|
||||
<url>https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/</url>
|
||||
</repository>
|
||||
<!-- FactionsUUID Repo -->
|
||||
<repository>
|
||||
<id>factions-uuid</id>
|
||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<!-- ProtocolLib Repo -->
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
<!-- EssentialsX Repo -->
|
||||
<repository>
|
||||
<id>essentials-releases</id>
|
||||
<url>https://repo.essentialsx.net/releases/</url>
|
||||
</repository>
|
||||
<!-- PlaceholderAPI Repo -->
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<!-- MinePlots Repo -->
|
||||
<repository>
|
||||
<id>minecodes-repository-releases</id>
|
||||
<name>mineCodes Organization Repository</name>
|
||||
<url>https://repository.minecodes.pl/releases</url>
|
||||
</repository>
|
||||
<!-- Used by Husk plugins -->
|
||||
<repository>
|
||||
<id>william278-releases</id>
|
||||
<url>https://repo.william278.net/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.2</version><scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Download the tagged GitHub library through JitPack; bundled by Shade. -->
|
||||
<dependency>
|
||||
<groupId>com.github.RonanPlugins</groupId>
|
||||
<artifactId>BetterSync</artifactId>
|
||||
<version>${bettersync.version}</version>
|
||||
</dependency>
|
||||
<!--Spigot API-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Spigot Stuff -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Vault -->
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Paper Library for Async Chunk/Teleport -->
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.8</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- WorldGuard (https://dev.bukkit.org/projects/worldguard) -->
|
||||
<dependency> <!-- Saber Factions screws up if updated -->
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- RedProtect (https://www.spigotmc.org/resources/redprotect.15841/) -->
|
||||
<dependency>
|
||||
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
|
||||
<artifactId>RedProtect-Core</artifactId>
|
||||
<version>7.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
|
||||
<artifactId>RedProtect-Spigot-1.13</artifactId>
|
||||
<version>7.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- FactionsUUID (https://www.spigotmc.org/resources/factionsuuid.1035/) -->
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-U0.6.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Lands (https://www.spigotmc.org/resources/lands.53313/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.angeschossen</groupId>
|
||||
<artifactId>LandsAPI</artifactId>
|
||||
<version>6.28.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ProtocolLib -->
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>5.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Towny (https://www.spigotmc.org/resources/towny.72694/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.TownyAdvanced</groupId>
|
||||
<artifactId>Towny</artifactId>
|
||||
<version>0.98.6.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- GriefPrevention (https://www.spigotmc.org/resources/griefprevention.1884/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>17.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- KingdomsX (https://www.spigotmc.org/resources/kingdomsx.77670/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>kingdoms</artifactId>
|
||||
<version>1.16.8.1.1</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- GriefDefender (https://www.spigotmc.org/resources/griefdefender.68900/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.bloodmc</groupId>
|
||||
<artifactId>GriefDefenderApi</artifactId>
|
||||
<version>920a610</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Peublos (https://www.spigotmc.org/resources/pueblos.91255/) -->
|
||||
<dependency>
|
||||
<groupId>com.github.SuperRonanCraft</groupId>
|
||||
<artifactId>Pueblos</artifactId>
|
||||
<version>97b96c9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Particles Library
|
||||
https://github.com/ByteZ1337/ParticleLib
|
||||
(https://github.com/ByteZ1337/ParticleLib/blob/master/src/main/java/xyz/xenondevs/particle/ParticleEffect.java) -->
|
||||
<dependency>
|
||||
<groupId>xyz.xenondevs</groupId>
|
||||
<artifactId>particle</artifactId>
|
||||
<version>1.8.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Lombok Support (@Getter & @Setter)-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.38</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- EssentialsX -->
|
||||
<dependency>
|
||||
<groupId>net.essentialsx</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.21.0</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Saber Factions (https://www.spigotmc.org/resources/saberfactions.69771/) (Added in 3.4.5)-->
|
||||
<dependency> <!-- WorldGuard screws up if updated -->
|
||||
<groupId>com.github.SaberLLC</groupId>
|
||||
<artifactId>Saber-Factions</artifactId>
|
||||
<version>2.4.0-RC</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- PlaceholderAPI Support (Added in 3.4.5)-->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- HuskClaims (https://www.spigotmc.org/resources/huskclaims.114467/) (Added in 3.6.13)-->
|
||||
<dependency>
|
||||
<groupId>net.william278.huskclaims</groupId>
|
||||
<artifactId>huskclaims-bukkit</artifactId>
|
||||
<version>1.5.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Husktown (https://www.spigotmc.org/resources/husktowns.92672/) (Added in 3.4.5)-->
|
||||
<dependency>
|
||||
<groupId>net.william278.husktowns</groupId>
|
||||
<artifactId>husktowns-bukkit</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- MinePlots (https://builtbybit.com/resources/mineplots.21646/) (Added in 3.6.6 ) -->
|
||||
<dependency>
|
||||
<groupId>pl.minecodes.plots</groupId>
|
||||
<artifactId>plugin-api</artifactId>
|
||||
<version>3.4.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- FoliaLib -->
|
||||
<dependency>
|
||||
<groupId>com.tcoded</groupId>
|
||||
<artifactId>FoliaLib</artifactId>
|
||||
<version>0.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- FactionsBridge -->
|
||||
<dependency>
|
||||
<groupId>com.dansplugins.factionsystem</groupId>
|
||||
<artifactId>FactionsBridge</artifactId>
|
||||
<version>1.3.8</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../lib/FactionsBridge-1.3.8.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.WhipDevelopment</groupId>
|
||||
<artifactId>CrashClaim</artifactId>
|
||||
<version>c697d3e9ef</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit.residence</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>5.1.4.1</version>
|
||||
<scope>system</scope>
|
||||
<optional>true</optional>
|
||||
<systemPath>${project.basedir}/../lib/Residence5.1.4.1.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+14
@@ -1,5 +1,8 @@
|
||||
package me.SuperRonanCraft.BetterRTP;
|
||||
|
||||
import com.ronanplugins.bettersync.editor.EditorClient;
|
||||
import com.ronanplugins.bettersync.editor.EditorSchema;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
||||
@@ -47,12 +50,19 @@ public class BetterRTP extends JavaPlugin {
|
||||
@Getter private boolean PlaceholderAPI;
|
||||
@Getter private final RTPLogger rtpLogger = new RTPLogger();
|
||||
@Getter private final FoliaHandler foliaHandler = new FoliaHandler();
|
||||
@Getter private EditorClient editorBridge;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
registerDependencies();
|
||||
loadAll();
|
||||
editorBridge = new EditorClient(
|
||||
this, EditorSchema.load(this, "META-INF/editor-schema.json"),
|
||||
EditorClient.website(this, "META-INF/betterrtp-editor.properties"),
|
||||
me.SuperRonanCraft.BetterRTP.versions.AsyncHandler::sync, this::reload,
|
||||
me.SuperRonanCraft.BetterRTP.references.PermissionNode.EDITOR::check,
|
||||
() -> me.SuperRonanCraft.BetterRTP.references.file.FileOther.FILETYPE.CONFIG.getConfig().saveToString());
|
||||
new Updater(this);
|
||||
new Metrics(this);
|
||||
listener.registerEvents(this);
|
||||
@@ -66,6 +76,8 @@ public class BetterRTP extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
playerDataManager.clear();
|
||||
if (editorBridge != null) editorBridge.close();
|
||||
invs.closeAll();
|
||||
queue.unload();
|
||||
rtpLogger.unload();
|
||||
@@ -101,6 +113,8 @@ public class BetterRTP extends JavaPlugin {
|
||||
private void loadAll() {
|
||||
foliaHandler.load();
|
||||
playerDataManager.clear();
|
||||
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers())
|
||||
playerDataManager.startSession(player);
|
||||
files.loadAll();
|
||||
settings.load();
|
||||
cooldowns.load();
|
||||
File renamed without changes.
+4
-1
@@ -43,7 +43,10 @@ public class Commands {
|
||||
//Command Event
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
BetterRTP.debug(sendi.getName() + " executed: /" + label + " " + String.join(" ", args));
|
||||
boolean editorSync = args[0].equalsIgnoreCase("editorsync") ||
|
||||
(args[0].equalsIgnoreCase("addons") && args.length > 1 && args[1].equalsIgnoreCase("editorsync"));
|
||||
BetterRTP.debug(sendi.getName() + " executed: /" + label + " " +
|
||||
(editorSync ? (args[0].equalsIgnoreCase("addons") ? "addons editorsync [redacted]" : "editorsync [redacted]") : String.join(" ", args)));
|
||||
cmd.execute(sendi, label, args);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new RTP_CommandEvent_After(sendi, cmd));
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+2
@@ -5,6 +5,8 @@ import me.SuperRonanCraft.BetterRTP.player.commands.types.*;
|
||||
public enum RTPCommandType {
|
||||
BIOME(new CmdBiome()),
|
||||
EDIT(new CmdEdit()),
|
||||
EDITOR(new CmdEditor()),
|
||||
EDITOR_SYNC(new CmdEditorSync()),
|
||||
HELP(new CmdHelp()),
|
||||
INFO(new CmdInfo()),
|
||||
LOCATION(new CmdLocation()),
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+28
@@ -0,0 +1,28 @@
|
||||
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
|
||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||
import me.SuperRonanCraft.BetterRTP.references.messages.MessagesHelp;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CmdEditor implements RTPCommand, RTPCommandHelpable {
|
||||
public String getName() { return "editor"; }
|
||||
public PermissionNode permission() { return PermissionNode.EDITOR; }
|
||||
public List<String> tabComplete(CommandSender sender, String[] args) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public void execute(CommandSender sender, String label, String[] args) {
|
||||
if (args.length == 1) BetterRTP.getInstance().getEditorBridge().upload(sender);
|
||||
else sender.sendMessage("Usage: /" + label + " editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return MessagesHelp.EDITOR.get();
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
|
||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||
import me.SuperRonanCraft.BetterRTP.references.messages.MessagesHelp;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CmdEditorSync implements RTPCommand, RTPCommandHelpable {
|
||||
public String getName() { return "editorsync"; }
|
||||
public PermissionNode permission() { return PermissionNode.EDITOR; }
|
||||
public List<String> tabComplete(CommandSender sender, String[] args) { return Collections.emptyList(); }
|
||||
public void execute(CommandSender sender, String label, String[] args) {
|
||||
if (args.length == 2) BetterRTP.getInstance().getEditorBridge().redeem(sender, args[1]);
|
||||
else sender.sendMessage("Usage: /" + label + " editorsync <token>");
|
||||
}
|
||||
public String getHelp() { return MessagesHelp.EDITOR_SYNC.get(); }
|
||||
}
|
||||
File renamed without changes.
+6
-14
@@ -13,9 +13,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||
@@ -147,27 +144,22 @@ public class CmdInfo implements RTPCommand, RTPCommandHelpable {
|
||||
if (!upload) {
|
||||
sendi.sendMessage(list.toArray(new String[0]));
|
||||
if (sendi instanceof Player) {
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload command log to &flogs.ronanplugins.com"));
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload command log to &fmclo.gs"));
|
||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd + " _UPLOAD_"));
|
||||
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.color("&6Suggested command&f: &7" + "/betterrtp " + String.join(" ", args) + " _UPLOAD_")).create()));
|
||||
((Player) sendi).spigot().sendMessage(component);
|
||||
} else {
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload command log to https://logs.ronanplugins.com");
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload command log to https://mclo.gs");
|
||||
}
|
||||
} else {
|
||||
list.add(0, "Command: " + cmd);
|
||||
list.forEach(str -> list.set(list.indexOf(str), ChatColor.stripColor(str)));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
String key = LogUploader.post(list);
|
||||
if (key == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cAn error occured attempting to upload log!")), null);
|
||||
String url = LogUploader.post(list);
|
||||
if (url == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cCould not upload the log. Check your connection and ensure the log is under 5 MiB, then try again.")), null);
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(key);
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6https://logs.ronanplugins.com/" + json.get("key")), null);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6" + url), null);
|
||||
}
|
||||
});
|
||||
}
|
||||
File renamed without changes.
+6
-14
@@ -13,9 +13,6 @@ import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -36,25 +33,20 @@ public class CmdLogger implements RTPCommand {
|
||||
String cmd = "/" + label + " " + String.join(" ", args);
|
||||
if (!upload) {
|
||||
if (sendi instanceof Player) {
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload log to &flogs.ronanplugins.com"));
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload log to &fmclo.gs"));
|
||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd + " _UPLOAD_"));
|
||||
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.color("&6Suggested command&f: &7" + "/betterrtp " + String.join(" ", args) + " _UPLOAD_")).create()));
|
||||
((Player) sendi).spigot().sendMessage(component);
|
||||
} else {
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload log to https://logs.ronanplugins.com");
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload log to https://mclo.gs");
|
||||
}
|
||||
} else {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
String key = LogUploader.post(BetterRTP.getInstance().getRtpLogger().getFile());
|
||||
if (key == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cAn error occured attempting to upload log!")), null);
|
||||
String url = LogUploader.post(BetterRTP.getInstance().getRtpLogger().getFile());
|
||||
if (url == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cCould not upload the log. Check your connection and ensure the log is under 5 MiB, then try again.")), null);
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(key);
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6https://logs.ronanplugins.com/" + json.get("key")), null);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6" + url), null);
|
||||
}
|
||||
});
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+6
-14
@@ -22,9 +22,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -59,27 +56,22 @@ public class CmdQueue implements RTPCommand {
|
||||
if (!upload) {
|
||||
sendi.sendMessage(list.toArray(new String[0]));
|
||||
if (sendi instanceof Player) {
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload command log to &flogs.ronanplugins.com"));
|
||||
TextComponent component = new TextComponent(Message.color("&7- &7Click to upload command log to &fmclo.gs"));
|
||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd + " _UPLOAD_"));
|
||||
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.color("&6Suggested command&f: &7" + "/betterrtp " + String.join(" ", args) + " _UPLOAD_")).create()));
|
||||
((Player) sendi).spigot().sendMessage(component);
|
||||
} else {
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload command log to https://logs.ronanplugins.com");
|
||||
sendi.sendMessage("Execute `" + cmd + " _UPLOAD_`" + " to upload command log to https://mclo.gs");
|
||||
}
|
||||
} else {
|
||||
list.add(0, "Command: " + cmd);
|
||||
list.forEach(str -> list.set(list.indexOf(str), ChatColor.stripColor(str)));
|
||||
CompletableFuture.runAsync(() -> {
|
||||
String key = LogUploader.post(list);
|
||||
if (key == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cAn error occured attempting to upload log!")), null);
|
||||
String url = LogUploader.post(list);
|
||||
if (url == null) {
|
||||
Message.sms(sendi, new ArrayList<>(Collections.singletonList("&cCould not upload the log. Check your connection and ensure the log is under 5 MiB, then try again.")), null);
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(key);
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6https://logs.ronanplugins.com/" + json.get("key")), null);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Message.sms(sendi, Arrays.asList(" ", Message.getPrefix(Message_RTP.msg) + "&aLog uploaded! &fView&7: &6" + url), null);
|
||||
}
|
||||
});
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
@@ -21,6 +21,7 @@ public class Click {
|
||||
try {
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
PlayerData data = HelperPlayer.getData(p);
|
||||
if (data == null) return;
|
||||
RTPInventories menu = BetterRTP.getInstance().getInvs();
|
||||
menu.getInv(data.getMenu().getInvType()).clickEvent(e);
|
||||
} catch (NullPointerException ex) {
|
||||
@@ -38,6 +39,7 @@ public class Click {
|
||||
else if (e.getWhoClicked() instanceof Player) {
|
||||
// Clicks the inventory
|
||||
PlayerData data = HelperPlayer.getData((Player) e.getWhoClicked());
|
||||
if (data == null) return false;
|
||||
if (!e.getInventory().equals(data.getMenu().getInv()))
|
||||
return false;
|
||||
// Clicks their own inventory
|
||||
File renamed without changes.
+3
-1
@@ -1,6 +1,7 @@
|
||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.references.player.HelperPlayer;
|
||||
import me.SuperRonanCraft.BetterRTP.references.player.playerdata.PlayerData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
@@ -11,7 +12,8 @@ public class Damage {
|
||||
}
|
||||
|
||||
static boolean isInInvincibleMode(Player player) {
|
||||
return HelperPlayer.getData(player).getInvincibleEndTime() > System.currentTimeMillis();
|
||||
PlayerData data = HelperPlayer.getData(player);
|
||||
return data != null && data.getInvincibleEndTime() > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
static void onEntityDamage(EntityDamageEvent event) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -8,7 +8,6 @@ import me.SuperRonanCraft.BetterRTP.references.messages.Message_RTP;
|
||||
import me.SuperRonanCraft.BetterRTP.references.messages.MessagesCore;
|
||||
import me.SuperRonanCraft.BetterRTP.references.web.Updater;
|
||||
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@@ -19,8 +18,9 @@ public class Join {
|
||||
|
||||
static void event(PlayerJoinEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
getPl().getPlayerDataManager().startSession(p);
|
||||
updater(p);
|
||||
AsyncHandler.async(() -> getPl().getCooldowns().loadPlayer(p));
|
||||
getPl().getCooldowns().loadPlayer(p);
|
||||
rtpOnFirstJoin(p);
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4
-1
@@ -3,6 +3,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp.effects;
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.references.file.FileOther;
|
||||
import me.SuperRonanCraft.BetterRTP.references.player.HelperPlayer;
|
||||
import me.SuperRonanCraft.BetterRTP.references.player.playerdata.PlayerData;
|
||||
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@@ -52,8 +53,10 @@ public class RTPEffect_Potions { //Potions AND Invincibility
|
||||
|
||||
public void giveEffects(Player p) {
|
||||
AsyncHandler.syncAtEntity(p, () -> {
|
||||
PlayerData data = HelperPlayer.getData(p);
|
||||
if (data == null) return;
|
||||
if (invincibleEnabled)
|
||||
HelperPlayer.getData(p).setInvincibleEndTime(System.currentTimeMillis() + (invincibleTime * 1000L));
|
||||
data.setInvincibleEndTime(System.currentTimeMillis() + (invincibleTime * 1000L));
|
||||
if (potionEnabled) {
|
||||
List<PotionEffect> effects = new ArrayList<>();
|
||||
for (PotionEffectType e : potionEffects.keySet()) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
@@ -22,6 +22,7 @@ public enum PermissionNode implements PermissionCheck {
|
||||
SIGN_CREATE("sign"),
|
||||
VERSION("version"),
|
||||
EDIT("edit"),
|
||||
EDITOR("editor"),
|
||||
LOCATION("location"),
|
||||
DEVELOPER("DEVELOPER_PERM"),
|
||||
;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+108
@@ -0,0 +1,108 @@
|
||||
package me.SuperRonanCraft.BetterRTP.references.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.references.player.playerdata.PlayerData;
|
||||
|
||||
public class DatabasePlayers extends SQLite {
|
||||
|
||||
public DatabasePlayers() {
|
||||
super(DATABASE_TYPE.PLAYERS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTables() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("Players");
|
||||
return list;
|
||||
}
|
||||
|
||||
public enum COLUMNS {
|
||||
UUID("uuid", "varchar(32) PRIMARY KEY"),
|
||||
//COOLDOWN DATA
|
||||
COUNT("count", "long"),
|
||||
LAST_COOLDOWN_DATE("last_rtp_date", "long"),
|
||||
;
|
||||
|
||||
public final String name;
|
||||
public final String type;
|
||||
|
||||
COLUMNS(String name, String type) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
/** Immutable persistence values; never retains a Bukkit player/session. */
|
||||
public static final class Snapshot {
|
||||
public final UUID uuid;
|
||||
public final int count;
|
||||
public final long cooldown;
|
||||
|
||||
public Snapshot(UUID uuid, int count, long cooldown) {
|
||||
this.uuid = uuid;
|
||||
this.count = count;
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
public static Snapshot capture(PlayerData data) {
|
||||
return new Snapshot(data.player.getUniqueId(), data.getRtpCount(), data.getGlobalCooldown());
|
||||
}
|
||||
}
|
||||
|
||||
/** Existing API: load into this session only while it is still current. */
|
||||
public void setupData(PlayerData data) {
|
||||
if (data == null) return;
|
||||
Snapshot stored = loadData(data.player.getUniqueId());
|
||||
if (stored != null)
|
||||
BetterRTP.getInstance().getPlayerDataManager().applyIfCurrent(data, current -> {
|
||||
current.setRtpCount(stored.count);
|
||||
current.setGlobalCooldown(stored.cooldown);
|
||||
});
|
||||
}
|
||||
|
||||
public Snapshot loadData(UUID uuid) {
|
||||
try {
|
||||
return SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||
try (Connection conn = getSQLConnection();
|
||||
PreparedStatement ps = conn.prepareStatement("SELECT * FROM " + tables.get(0) + " WHERE " + COLUMNS.UUID.name + " = ?")) {
|
||||
ps.setString(1, uuid.toString());
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
if (rs.next())
|
||||
return new Snapshot(uuid, Math.toIntExact(rs.getLong(COLUMNS.COUNT.name)),
|
||||
rs.getLong(COLUMNS.LAST_COOLDOWN_DATE.name));
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
BetterRTP.getInstance().getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||
}
|
||||
return null;
|
||||
}).get();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Compatibility entry point: capture before deferring database work. */
|
||||
public void setData(PlayerData data) {
|
||||
if (data != null) setData(Snapshot.capture(data));
|
||||
}
|
||||
|
||||
public void setData(Snapshot data) {
|
||||
SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||
String sql = "INSERT OR REPLACE INTO " + tables.get(0) + " ("
|
||||
+ COLUMNS.UUID.name + ", " + COLUMNS.COUNT.name + ", "
|
||||
+ COLUMNS.LAST_COOLDOWN_DATE.name + ") VALUES(?, ?, ?)";
|
||||
List<Object> params = java.util.Arrays.asList(data.uuid.toString(), data.count, data.cooldown);
|
||||
sqlUpdate(sql, params);
|
||||
});
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
@@ -39,6 +39,7 @@ public class DepPlaceholderAPI extends PlaceholderExpansion {
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player player, String request) {
|
||||
PlayerData data = HelperPlayer.getData(player);
|
||||
if (data == null) return null;
|
||||
if (request.equalsIgnoreCase("count")) {
|
||||
return String.valueOf(data.getRtpCount());
|
||||
} else if (request.startsWith("cooldown")) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user