mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-28 08:44:07 +00:00
Compare commits
37
Commits
node-server
...
v3.6.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97ee43e434 | ||
|
|
6992e3a41a | ||
|
|
b69d4aa787 | ||
|
|
c7a1a4e069 | ||
|
|
1d4389188f | ||
|
|
ab9911605c | ||
|
|
6eca1c5c73 | ||
|
|
621f3a6876 | ||
|
|
bd45e4cb87 | ||
|
|
b878c992f9 | ||
|
|
aeeffc9e1b | ||
|
|
09ce7e79d2 | ||
|
|
e017aa83c6 | ||
|
|
ff79654444 | ||
|
|
c2a45e8b7b | ||
|
|
9f0801fda4 | ||
|
|
66fe5b9001 | ||
|
|
4697f06163 | ||
|
|
15fc3eba67 | ||
|
|
86b2e3508b | ||
|
|
1f16f943e8 | ||
|
|
3cf85f2ce6 | ||
|
|
a5400d18e5 | ||
|
|
f494297607 | ||
|
|
6e1bb098c9 | ||
|
|
ebd0bedb2d | ||
|
|
4c2dbae45a | ||
|
|
12125d258f | ||
|
|
35d5fac459 | ||
|
|
9f181605f1 | ||
|
|
9c21792669 | ||
|
|
c721cd7837 | ||
|
|
d18bd94b3a | ||
|
|
077c55723d | ||
|
|
2971c1a407 | ||
|
|
e6ccb3be55 | ||
|
|
9ab1648bfb |
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
|
run: cp settings.xml $HOME/.m2/settings.xml
|
||||||
|
|
||||||
- name: Build and test with Maven
|
- name: Build and test with Maven
|
||||||
run: mvn test
|
run: mvn -B -pl :BetterRTP test
|
||||||
@@ -9,3 +9,6 @@ target
|
|||||||
BetterRTP.wiki/
|
BetterRTP.wiki/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode/
|
.vscode/
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
/dist/
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
<?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.13</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>
|
||||||
|
<!-- 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>
|
||||||
+11
@@ -1,5 +1,8 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP;
|
package me.SuperRonanCraft.BetterRTP;
|
||||||
|
|
||||||
|
import com.ronanplugins.bettersync.editor.EditorClient;
|
||||||
|
import com.ronanplugins.bettersync.editor.EditorSchema;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
||||||
@@ -47,12 +50,19 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
@Getter private boolean PlaceholderAPI;
|
@Getter private boolean PlaceholderAPI;
|
||||||
@Getter private final RTPLogger rtpLogger = new RTPLogger();
|
@Getter private final RTPLogger rtpLogger = new RTPLogger();
|
||||||
@Getter private final FoliaHandler foliaHandler = new FoliaHandler();
|
@Getter private final FoliaHandler foliaHandler = new FoliaHandler();
|
||||||
|
@Getter private EditorClient editorBridge;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
registerDependencies();
|
registerDependencies();
|
||||||
loadAll();
|
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 Updater(this);
|
||||||
new Metrics(this);
|
new Metrics(this);
|
||||||
listener.registerEvents(this);
|
listener.registerEvents(this);
|
||||||
@@ -66,6 +76,7 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
if (editorBridge != null) editorBridge.close();
|
||||||
invs.closeAll();
|
invs.closeAll();
|
||||||
queue.unload();
|
queue.unload();
|
||||||
rtpLogger.unload();
|
rtpLogger.unload();
|
||||||
File renamed without changes.
+4
-1
@@ -43,7 +43,10 @@ public class Commands {
|
|||||||
//Command Event
|
//Command Event
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (!event.isCancelled()) {
|
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);
|
cmd.execute(sendi, label, args);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new RTP_CommandEvent_After(sendi, cmd));
|
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 {
|
public enum RTPCommandType {
|
||||||
BIOME(new CmdBiome()),
|
BIOME(new CmdBiome()),
|
||||||
EDIT(new CmdEdit()),
|
EDIT(new CmdEdit()),
|
||||||
|
EDITOR(new CmdEditor()),
|
||||||
|
EDITOR_SYNC(new CmdEditorSync()),
|
||||||
HELP(new CmdHelp()),
|
HELP(new CmdHelp()),
|
||||||
INFO(new CmdInfo()),
|
INFO(new CmdInfo()),
|
||||||
LOCATION(new CmdLocation()),
|
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.
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.
File renamed without changes.
File renamed without changes.
+14
-8
@@ -5,6 +5,7 @@ import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
|||||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileOther;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileOther;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.messages.Message_RTP;
|
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.web.Updater;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP;
|
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP;
|
||||||
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
||||||
@@ -12,29 +13,34 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class Join {
|
public class Join {
|
||||||
|
|
||||||
static void event(PlayerJoinEvent e) {
|
static void event(PlayerJoinEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
updater(p);
|
updater(p);
|
||||||
AsyncHandler.async(() -> {
|
AsyncHandler.async(() -> getPl().getCooldowns().loadPlayer(p));
|
||||||
getPl().getCooldowns().loadPlayer(p);
|
|
||||||
});
|
|
||||||
rtpOnFirstJoin(p);
|
rtpOnFirstJoin(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updater
|
//Updater
|
||||||
private static void updater(Player p) {
|
private static void updater(Player p) {
|
||||||
if (!getPl().getFiles().getType(FileOther.FILETYPE.CONFIG).getBoolean("Settings.DisableUpdater") && PermissionNode.UPDATER.check(p))
|
if (!getPl().getFiles().getType(FileOther.FILETYPE.CONFIG).getBoolean("Settings.DisableUpdater") && PermissionNode.UPDATER.check(p)) {
|
||||||
if (!getPl().getDescription().getVersion().equals(Updater.updatedVersion))
|
if (!getPl().getDescription().getVersion().equals(Updater.updatedVersion)) {
|
||||||
Message_RTP.sms(p, "&7There is currently an update for &6BetterRTP &7version &e#" +
|
String currentVersion = getPl().getDescription().getVersion();
|
||||||
Updater.updatedVersion + " &7you have version &e#" + getPl().getDescription().getVersion());
|
String newVersion = Updater.updatedVersion;
|
||||||
|
|
||||||
|
MessagesCore.UPDATE.send(p, Arrays.asList(currentVersion, newVersion));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//RTP on first join
|
//RTP on first join
|
||||||
private static void rtpOnFirstJoin(Player p) {
|
private static void rtpOnFirstJoin(Player p) {
|
||||||
if (getPl().getSettings().isRtpOnFirstJoin_Enabled() && !p.hasPlayedBefore())
|
if (getPl().getSettings().isRtpOnFirstJoin_Enabled() && !p.hasPlayedBefore())
|
||||||
HelperRTP.tp(p, Bukkit.getConsoleSender(), Bukkit.getWorld(getPl().getSettings().getRtpOnFirstJoin_World()), null, RTP_TYPE.JOIN); //Console is sender to override delays
|
HelperRTP.tp(p, Bukkit.getConsoleSender(), Bukkit.getWorld(getPl().getSettings().getRtpOnFirstJoin_World()), null, RTP_TYPE.JOIN, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BetterRTP getPl() {
|
private static BetterRTP getPl() {
|
||||||
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-11
@@ -6,8 +6,6 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
public abstract class AbstractPacket {
|
public abstract class AbstractPacket {
|
||||||
// The packet we will be modifying
|
// The packet we will be modifying
|
||||||
protected PacketContainer handle;
|
protected PacketContainer handle;
|
||||||
@@ -42,15 +40,9 @@ public abstract class AbstractPacket {
|
|||||||
* Send the current packet to the given receiver.
|
* Send the current packet to the given receiver.
|
||||||
*
|
*
|
||||||
* @param receiver - the receiver.
|
* @param receiver - the receiver.
|
||||||
* @throws RuntimeException If the packet cannot be sent.
|
|
||||||
*/
|
*/
|
||||||
public void sendPacket(Player receiver) {
|
public void sendPacket(Player receiver) {
|
||||||
try {
|
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, getHandle());
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver,
|
|
||||||
getHandle());
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
throw new RuntimeException("Cannot send packet.", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +63,7 @@ public abstract class AbstractPacket {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public void recievePacket(Player sender) {
|
public void recievePacket(Player sender) {
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
|
ProtocolLibrary.getProtocolManager().receiveClientPacket(sender,
|
||||||
getHandle());
|
getHandle());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Cannot recieve packet.", e);
|
throw new RuntimeException("Cannot recieve packet.", e);
|
||||||
@@ -86,7 +78,7 @@ public abstract class AbstractPacket {
|
|||||||
*/
|
*/
|
||||||
public void receivePacket(Player sender) {
|
public void receivePacket(Player sender) {
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
|
ProtocolLibrary.getProtocolManager().receiveClientPacket(sender,
|
||||||
getHandle());
|
getHandle());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Cannot receive packet.", e);
|
throw new RuntimeException("Cannot receive packet.", e);
|
||||||
File renamed without changes.
+3
-2
@@ -49,9 +49,10 @@ public interface PermissionCheck {
|
|||||||
|
|
||||||
String getNode();
|
String getNode();
|
||||||
|
|
||||||
|
@Getter
|
||||||
class PermissionResult {
|
class PermissionResult {
|
||||||
@Getter private final boolean passed;
|
private final boolean passed;
|
||||||
@Getter private final String string;
|
private final String string;
|
||||||
PermissionResult(String string, boolean passed) {
|
PermissionResult(String string, boolean passed) {
|
||||||
this.passed = passed;
|
this.passed = passed;
|
||||||
this.string = string;
|
this.string = string;
|
||||||
+3
-1
@@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTP.references;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum PermissionNode implements PermissionCheck {
|
public enum PermissionNode implements PermissionCheck {
|
||||||
|
|
||||||
ADMIN("admin"),
|
ADMIN("admin"),
|
||||||
@@ -21,11 +22,12 @@ public enum PermissionNode implements PermissionCheck {
|
|||||||
SIGN_CREATE("sign"),
|
SIGN_CREATE("sign"),
|
||||||
VERSION("version"),
|
VERSION("version"),
|
||||||
EDIT("edit"),
|
EDIT("edit"),
|
||||||
|
EDITOR("editor"),
|
||||||
LOCATION("location"),
|
LOCATION("location"),
|
||||||
DEVELOPER("DEVELOPER_PERM"),
|
DEVELOPER("DEVELOPER_PERM"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@Getter private final String node;
|
private final String node;
|
||||||
|
|
||||||
PermissionNode(String node) {
|
PermissionNode(String node) {
|
||||||
this.node = PermissionCheck.getPrefix() + node;
|
this.node = PermissionCheck.getPrefix() + node;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.depends.DepPerms;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
public class Permissions {
|
||||||
|
|
||||||
|
private final DepPerms depPerms = new DepPerms();
|
||||||
|
|
||||||
|
public void register() {
|
||||||
|
depPerms.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkPerm(String str, CommandSender sendi) {
|
||||||
|
return depPerms.hasPerm(str, sendi);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
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.
+96
@@ -0,0 +1,96 @@
|
|||||||
|
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.concurrent.Future;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupData(PlayerData data) {
|
||||||
|
if (data == null || data.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Future<?> task = SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
conn = getSQLConnection();
|
||||||
|
ps = conn.prepareStatement("SELECT * FROM " + tables.get(0) + " WHERE " + COLUMNS.UUID.name + " = ?");
|
||||||
|
ps.setString(1, data.player.getUniqueId().toString());
|
||||||
|
|
||||||
|
rs = ps.executeQuery();
|
||||||
|
if (rs.next()) {
|
||||||
|
long count = rs.getLong(COLUMNS.COUNT.name);
|
||||||
|
long time = rs.getLong(COLUMNS.LAST_COOLDOWN_DATE.name);
|
||||||
|
data.setRtpCount(Math.toIntExact(count));
|
||||||
|
data.setGlobalCooldown(time);
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
BetterRTP.getInstance().getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||||
|
} finally {
|
||||||
|
close(ps, rs, conn);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
task.get();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set a player Cooldown
|
||||||
|
public void setData(PlayerData data) {
|
||||||
|
try {
|
||||||
|
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 = new ArrayList<Object>() {{
|
||||||
|
add(data.player.getUniqueId().toString());
|
||||||
|
add(data.getRtpCount());
|
||||||
|
add(data.getGlobalCooldown());
|
||||||
|
}};
|
||||||
|
sqlUpdate(sql, params);
|
||||||
|
});
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.database;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueData;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueGenerator;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueHandler;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.RTPWorld;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
public class DatabaseQueue extends SQLite {
|
||||||
|
|
||||||
|
public DatabaseQueue() {
|
||||||
|
super(DATABASE_TYPE.QUEUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTables() {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
list.add("Queue");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum COLUMNS {
|
||||||
|
ID("id", "integer PRIMARY KEY AUTOINCREMENT"),
|
||||||
|
//Location Data
|
||||||
|
X("x", "long"),
|
||||||
|
Z("z", "long"),
|
||||||
|
WORLD("world", "varchar(32)"),
|
||||||
|
GENERATED("generated", "long")
|
||||||
|
;
|
||||||
|
|
||||||
|
public final String name;
|
||||||
|
public final String type;
|
||||||
|
|
||||||
|
COLUMNS(String name, String type) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void load() {
|
||||||
|
if (QueueHandler.isEnabled())
|
||||||
|
super.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<QueueData> getInRange(QueueRangeData range) {
|
||||||
|
final List<QueueData> queueDataList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
conn = getSQLConnection();
|
||||||
|
ps = conn.prepareStatement("SELECT * FROM " + tables.get(0) + " WHERE "
|
||||||
|
+ COLUMNS.WORLD.name + " = '" + range.getWorld().getName() + "' AND "
|
||||||
|
+ COLUMNS.X.name + " BETWEEN " + range.getXLow() + " AND " + range.getXHigh()
|
||||||
|
+ " AND " + COLUMNS.Z.name + " BETWEEN " + range.getZLow() + " AND " + range.getZHigh()
|
||||||
|
+ " ORDER BY RANDOM() LIMIT " + (QueueGenerator.queueMax + 1)
|
||||||
|
);
|
||||||
|
rs = ps.executeQuery();
|
||||||
|
while (rs.next()) {
|
||||||
|
long x = rs.getLong(COLUMNS.X.name);
|
||||||
|
long z = rs.getLong(COLUMNS.Z.name);
|
||||||
|
String worldName = rs.getString(COLUMNS.WORLD.name);
|
||||||
|
int id = rs.getInt(COLUMNS.ID.name);
|
||||||
|
long generated = rs.getLong(COLUMNS.GENERATED.name);
|
||||||
|
World world = Bukkit.getWorld(worldName);
|
||||||
|
if (world != null) {
|
||||||
|
queueDataList.add(new QueueData(new Location(world, x, 69, z), generated, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
BetterRTP.getInstance().getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||||
|
} finally {
|
||||||
|
close(ps, rs, conn);
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return queueDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set a queue to save
|
||||||
|
public QueueData addQueue(Location loc) {
|
||||||
|
try {
|
||||||
|
return SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||||
|
String sql = "INSERT INTO " + tables.get(0) + " ("
|
||||||
|
+ COLUMNS.X.name + ", "
|
||||||
|
+ COLUMNS.Z.name + ", "
|
||||||
|
+ COLUMNS.WORLD.name + ", "
|
||||||
|
+ COLUMNS.GENERATED.name + ") VALUES(?, ?, ?, ?)";
|
||||||
|
List<Object> params = new ArrayList<Object>() {{
|
||||||
|
add(loc.getBlockX());
|
||||||
|
add(loc.getBlockZ());
|
||||||
|
add(loc.getWorld().getName());
|
||||||
|
add(System.currentTimeMillis());
|
||||||
|
}};
|
||||||
|
int database_id = createQueue(sql, params);
|
||||||
|
return database_id >= 0 ? new QueueData(loc, System.currentTimeMillis(), database_id) : null;
|
||||||
|
}).get();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int createQueue(String statement, @NonNull List<Object> params) {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
int id = -1;
|
||||||
|
try {
|
||||||
|
conn = getSQLConnection();
|
||||||
|
ps = conn.prepareStatement(statement, Statement.RETURN_GENERATED_KEYS);
|
||||||
|
Iterator<Object> it = params.iterator();
|
||||||
|
int paramIndex = 1;
|
||||||
|
while (it.hasNext()) {
|
||||||
|
ps.setObject(paramIndex, it.next());
|
||||||
|
paramIndex++;
|
||||||
|
}
|
||||||
|
ps.executeUpdate();
|
||||||
|
ResultSet rs = ps.getGeneratedKeys();
|
||||||
|
if (rs.next()) {
|
||||||
|
id = rs.getInt(1);
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
BetterRTP.getInstance().getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||||
|
} finally {
|
||||||
|
close(ps, null, conn);
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeLocation(Location loc) {
|
||||||
|
try {
|
||||||
|
return SQLiteExecutor.EXECUTOR.submit(() -> {
|
||||||
|
String sql = "DELETE FROM " + tables.get(0) + " WHERE "
|
||||||
|
+ COLUMNS.X.name + " = ? AND "
|
||||||
|
+ COLUMNS.Z.name + " = ? AND "
|
||||||
|
+ COLUMNS.WORLD.name + " = ?";
|
||||||
|
List<Object> params = new ArrayList<Object>() {{
|
||||||
|
add(loc.getBlockX());
|
||||||
|
add(loc.getBlockZ());
|
||||||
|
add(loc.getWorld().getName());
|
||||||
|
}};
|
||||||
|
return sqlUpdate(sql, params);
|
||||||
|
}).get();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public static class QueueRangeData {
|
||||||
|
|
||||||
|
int xLow, xHigh;
|
||||||
|
int zLow, zHigh;
|
||||||
|
World world;
|
||||||
|
|
||||||
|
public QueueRangeData(RTPWorld rtpWorld) {
|
||||||
|
this.xLow = rtpWorld.getCenterX() - rtpWorld.getMaxRadius();
|
||||||
|
this.xHigh = rtpWorld.getCenterX() + rtpWorld.getMaxRadius();
|
||||||
|
this.zLow = rtpWorld.getCenterZ() - rtpWorld.getMaxRadius();
|
||||||
|
this.zHigh = rtpWorld.getCenterZ() + rtpWorld.getMaxRadius();
|
||||||
|
this.world = rtpWorld.getWorld();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.database;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class SQLiteExecutor {
|
||||||
|
public static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor();
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-3
@@ -3,11 +3,13 @@ package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum REGIONPLUGINS {
|
public enum REGIONPLUGINS {
|
||||||
FACTIONSUUID("FactionsUUID", "Factions", new RTP_FactionsUUID()),
|
FACTIONSUUID("FactionsUUID", "Factions", new RTP_FactionsUUID()),
|
||||||
GRIEFDEFENDER("GriefDefender", new RTP_GriefDefender()),
|
GRIEFDEFENDER("GriefDefender", new RTP_GriefDefender()),
|
||||||
GRIEFPREVENTION("GriefPrevention", new RTP_GriefPrevention()),
|
GRIEFPREVENTION("GriefPrevention", new RTP_GriefPrevention()),
|
||||||
HCLAIMS("hClaims", "hClaim", new RTP_hClaims()),
|
HCLAIMS("hClaims", "hClaim", new RTP_hClaims()),
|
||||||
|
HUSKCLAIMS("HuskClaims", new RTP_HuskClaims()),
|
||||||
HUSKTOWNS("HuskTowns", new RTP_HuskTowns()),
|
HUSKTOWNS("HuskTowns", new RTP_HuskTowns()),
|
||||||
KINGDOMSX("KingdomsX", "Kingdoms", new RTP_KingdomsX()),
|
KINGDOMSX("KingdomsX", "Kingdoms", new RTP_KingdomsX()),
|
||||||
LANDS("Lands", new RTP_Lands()),
|
LANDS("Lands", new RTP_Lands()),
|
||||||
@@ -22,9 +24,9 @@ public enum REGIONPLUGINS {
|
|||||||
FACTIONSBRIDGE("FactionsBridge", new RTP_FactionsBridge()),
|
FACTIONSBRIDGE("FactionsBridge", new RTP_FactionsBridge()),
|
||||||
CRASH_CLAIM("CrashClaim", new RTP_CrashClaim());
|
CRASH_CLAIM("CrashClaim", new RTP_CrashClaim());
|
||||||
|
|
||||||
@Getter private final SoftDepends.RegionPlugin plugin = new SoftDepends.RegionPlugin();
|
private final SoftDepends.RegionPlugin plugin = new SoftDepends.RegionPlugin();
|
||||||
@Getter private final String setting_name, pluginyml_name;
|
private final String setting_name, pluginyml_name;
|
||||||
@Getter private final RegionPluginCheck validator;
|
private final RegionPluginCheck validator;
|
||||||
|
|
||||||
REGIONPLUGINS(String all_name, RegionPluginCheck validator) {
|
REGIONPLUGINS(String all_name, RegionPluginCheck validator) {
|
||||||
this(all_name, all_name, validator);
|
this(all_name, all_name, validator);
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import net.william278.huskclaims.BukkitHuskClaims;
|
||||||
|
import net.william278.huskclaims.api.BukkitHuskClaimsAPI;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_HuskClaims implements RegionPluginCheck {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (REGIONPLUGINS.HUSKCLAIMS.isEnabled()) {
|
||||||
|
try {
|
||||||
|
result = !BukkitHuskClaimsAPI.getInstance().getClaimAt(BukkitHuskClaims.Adapter.adapt(loc)).isPresent();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-6
@@ -1,21 +1,20 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
import net.william278.husktowns.api.HuskTownsAPI;
|
import net.william278.husktowns.api.BukkitHuskTownsAPI;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class RTP_HuskTowns implements RegionPluginCheck {
|
public class RTP_HuskTowns implements RegionPluginCheck {
|
||||||
|
|
||||||
// NOT TESTED (3.4.5)
|
@Override
|
||||||
// HuskTowns (v1.8.1)
|
|
||||||
// https://www.spigotmc.org/resources/husktowns.92672/
|
|
||||||
public boolean check(Location loc) {
|
public boolean check(Location loc) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (REGIONPLUGINS.HUSKTOWNS.isEnabled())
|
if (REGIONPLUGINS.HUSKTOWNS.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
result = !HuskTownsAPI.getInstance().getClaimAt(loc).isPresent();
|
result = !BukkitHuskTownsAPI.getInstance().getClaimAt(loc).isPresent();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user