Compare commits

...

120 Commits

Author SHA1 Message Date
Auxilor
00ea3506ca config.yml changes 2021-12-08 20:32:55 +00:00
Auxilor
521659cfec bStats changes 2021-12-08 20:32:31 +00:00
Auxilor
bbe5f1eba4 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	eco-core/core-plugin/build.gradle
2021-12-08 20:24:07 +00:00
Auxilor
eae5d29f8d Downgraded bStats 2021-12-08 20:16:59 +00:00
Auxilor
c878d6fd12 Implemented stipped-down bStats directly (recoded in kotlin) 2021-12-08 16:08:03 +00:00
Auxilor
2b97c0072f Downgraded bStats 2021-12-08 14:18:24 +00:00
Auxilor
63079df745 Removed explicit buffer size 2021-12-08 12:41:24 +00:00
Auxilor
079b41e877 Switched to old config behavior 2021-12-08 12:40:13 +00:00
Auxilor
1aaab459d8 Updated bStats to 2.2.1 2021-12-08 12:34:38 +00:00
Auxilor
db78c2eb4c Fixed javadoc + codestyle 2021-12-08 12:22:51 +00:00
Auxilor
02fd07b3c8 Fixed shadowed name 2021-12-08 12:17:22 +00:00
Auxilor
3de2e53031 Fixed default captive items bug 2021-12-08 11:27:33 +00:00
Auxilor
cb088bb70b Allowed specifiying default captive items 2021-12-08 11:23:23 +00:00
Auxilor
36fca7016f Fixed ArgParserEnchantment never returning null 2021-12-08 11:11:59 +00:00
Auxilor
7e1137da06 Cleaned up SS2 integration 2021-12-08 10:53:16 +00:00
Auxilor
0da104d614 Added color:#fffff support x 2021-12-08 10:51:25 +00:00
Auxilor
9095de7d19 Updated to 6.16.0 2021-12-08 10:50:36 +00:00
Auxilor
7a8abac1a2 Pull Request Fixes / Changes, config changes 2021-12-08 10:50:12 +00:00
0ft3n
1ddcb6e964 Merge branch 'master' into master 2021-12-07 14:11:40 +03:00
_OfTeN_
4d0858ad84 Added AntigriefManager#canPickupItem and created and implemented DropQueuePushEvent event 2021-12-07 14:08:04 +03:00
_OfTeN_
3d05695a36 Added Items#getItem 2021-12-07 13:30:36 +03:00
Auxilor
d676be15ce Grammar 2021-12-06 13:46:27 +00:00
Auxilor
16848caec1 Fixed grammar errors 2021-12-06 13:08:45 +00:00
Auxilor
ef26fe4629 Removed legacy arg parser method bodies 2021-12-06 13:06:22 +00:00
Auxilor
29fbd785d7 Added ArgParserName 2021-12-06 12:54:28 +00:00
Auxilor
8c73676ee0 Added ArgParserUnbreakable 2021-12-06 12:50:26 +00:00
Auxilor
ebf27d28d9 Updated to 6.15.2 2021-12-06 12:49:10 +00:00
Auxilor
317bc13f65 Moved arg parsers to internals and added ArgParserFlag 2021-12-06 12:49:00 +00:00
Auxilor
b8ec0ee6fc Updated to 6.15.1 2021-12-06 10:14:14 +00:00
Auxilor
307e57c902 Display frame changes with PacketHeldWindowItems 2021-12-06 10:13:29 +00:00
Auxilor
db0d55659f Empty transient config 2021-12-06 10:10:35 +00:00
Auxilor
548529feb3 Javadoc formatting 2021-12-06 10:09:52 +00:00
Auxilor
fb56baf452 Fixed class-cast error 2021-12-06 10:02:24 +00:00
Auxilor
5d18b424d7 Added ColorArgParser 2021-12-04 15:37:29 +00:00
Auxilor
7be9a1bd10 Fixed EcoYamlConfigWrapper cast issues 2021-12-03 20:59:07 +00:00
Auxilor
97c39b56dd Updated to 6.15.0 2021-12-03 20:23:25 +00:00
_OfTeN_
3a9f5bc139 Added support for DecentHolograms 2021-12-03 21:10:40 +03:00
Auxilor
1e5955f249 Codestyle fixes 2021-12-03 16:21:47 +00:00
Auxilor
bad076bbe9 Added kotlin.code.style = official 2021-12-03 16:18:53 +00:00
Auxilor
e219b2f33c Config additions 2021-12-03 16:13:37 +00:00
Auxilor
2f7603409e Generic variance 2021-12-03 15:58:41 +00:00
Auxilor
28cdb65176 Added Config#getSubsections 2021-12-03 15:49:00 +00:00
_OfTeN_
03ae9e89b3 Added color:#FFFFFF, color:FFFFFF or color:red,green,blue parser for leather armor color 2021-12-02 23:26:38 +03:00
Auxilor
2d074bc186 Updated to 6.14.1 2021-12-02 14:50:31 +00:00
Auxilor
7e4422f6e2 Fixed ShapedCraftingRecipe on 1.18 2021-12-02 14:50:04 +00:00
Auxilor
5b29c90457 Added PacketHeldWindowItems to hopefully fix display 2021-12-02 14:49:29 +00:00
Auxilor
4ebc1a18a1 Merge branch 'develop' 2021-11-30 19:40:39 +00:00
Auxilor
db20bed6e0 Added impl.jar 2021-11-30 19:40:32 +00:00
Auxilor
0826da6cfc 1.18 API changes 2021-11-30 19:29:01 +00:00
Auxilor
6d8fce3462 Switched 1.18 impl jar 2021-11-30 19:23:23 +00:00
Auxilor
eedb1404b6 Added async read option 2021-11-30 19:02:53 +00:00
Auxilor
299abe4568 PR Codestyle 2021-11-30 18:54:52 +00:00
Auxilor
98e1f19145 Removed broken CustomCrafting integration 2021-11-30 18:53:43 +00:00
Will FP
424e2ff43d Merge pull request #61
Added support for items from CustomCrafting
2021-11-30 18:45:53 +00:00
Auxilor
3a899226a3 v1_18_R1 impl jar 2021-11-30 18:38:50 +00:00
_OfTeN_
8336eee892 Fast fix 2021-11-29 15:09:01 +03:00
_OfTeN_
a48f756582 Added support for items from CustomCrafting 2021-11-29 15:00:44 +03:00
Auxilor
2aa463d083 Updated paperweight userdev 2021-11-28 14:37:46 +00:00
Auxilor
ea833de9f7 Janky fix for libraries.minecraft.net not working 2021-11-28 14:30:22 +00:00
Auxilor
3c0822310d Updated kotlin to 1.6.0 2021-11-28 14:00:10 +00:00
Auxilor
d5cbc1d497 Added dummy / mock nms for 1.18 2021-11-28 13:40:40 +00:00
Auxilor
c912ad1c9c Updated adventure 2021-11-28 12:05:26 +00:00
Auxilor
752f38ef25 Switched from adoptium to temurin 2021-11-28 11:53:07 +00:00
Auxilor
a5525ab332 Added --full-stacktrace to java-ci 2021-11-28 11:25:01 +00:00
Auxilor
1b442f400d 1_18_R1 Changes 2021-11-28 11:23:52 +00:00
Auxilor
3c9c0bcef4 Added v1_18_R1 to EcoProxyFactory supported versions 2021-11-28 11:05:49 +00:00
Auxilor
3a7a938e7f Updated to Java 17 2021-11-28 11:01:12 +00:00
Auxilor
32c17aa3ae 1.18 work 2021-11-28 10:59:35 +00:00
Auxilor
e451732876 Fixed listener registration 2021-11-28 10:05:03 +00:00
Auxilor
53f81c0a03 Updated to 6.14.0 2021-11-28 10:02:43 +00:00
Auxilor
f60d91c5f3 Merge remote-tracking branch '0ft3n/master' into develop 2021-11-28 10:01:42 +00:00
Auxilor
a9bdca56a5 PlayerUtils#getSavedDisplayName fixes 2021-11-28 09:59:19 +00:00
_OfTeN_
3516d5881e Merge remote-tracking branch 'origin/master' 2021-11-27 22:20:57 +03:00
_OfTeN_
95cecc2b2a Remade SuperiorSkyblock2 antigrief integration 2021-11-27 22:20:32 +03:00
Auxilor
66d0625d2e Updated to 6.13.13 2021-11-26 19:04:23 +00:00
Auxilor
99a60f2b8b Fixed CrashClaim support 2021-11-26 19:04:14 +00:00
Auxilor
0bdfbe76fe Refactored internal package names 2021-11-25 10:07:51 +00:00
Auxilor
e0240069fc Moved root gralde to kts 2021-11-25 09:55:08 +00:00
Auxilor
11d2f7d711 Updated PlayerUtils#getSavedDisplayName 2021-11-24 12:15:35 +00:00
Auxilor
5cf632e58b Updated to 6.13.12 2021-11-24 12:14:16 +00:00
Auxilor
a90fe5d100 Temporarily removed GHolo support as it's broken 2021-11-24 12:14:04 +00:00
Auxilor
8dd145ed7d Added CustomModelDataArgParser 2021-11-24 12:13:13 +00:00
Auxilor
e4c65f1db5 Cleaned up AutoCraft.kt 2021-11-24 11:48:51 +00:00
Auxilor
2208f161c0 Fixed readme 2021-11-24 11:47:20 +00:00
Auxilor
95833ea8f6 Added support for CrashClaim 2021-11-24 11:46:25 +00:00
Auxilor
ba2da5c238 Merge remote-tracking branch 'origin/master' into develop 2021-11-23 16:28:14 +00:00
_OfTeN_
f276026972 Added more flexible constructors to ConfigYml.java 2021-11-22 12:40:03 +03:00
_OfTeN_
d2c6cc0d2e Added more flexible constructors to ConfigYml.java 2021-11-19 23:22:15 +03:00
Auxilor
60829a3e1d Removed markdown flavor 2021-11-17 11:31:42 +00:00
Auxilor
38c5bf97a0 EcoHandler now specifies impl as return type 2021-11-16 16:49:10 +00:00
Auxilor
d61f1bd23b Optimized kotlin imports 2021-11-16 16:32:31 +00:00
Auxilor
275f08fcb6 Merge branch 'develop' 2021-11-16 09:34:18 +00:00
Auxilor
68ae25b7db Re-added URL Encoding to Paste 2021-11-16 09:30:20 +00:00
Auxilor
89c529fdb3 Updated to 6.13.11 2021-11-16 09:25:48 +00:00
Auxilor
43157b154a Removed URL Encoding/Decoding from Paste 2021-11-16 09:25:37 +00:00
Auxilor
8721f96a2f packet.deepClone() replaced with packet.shallowClone() and moved to always be synchronous 2021-11-16 09:15:10 +00:00
Auxilor
ad3f7e529d Merge branch 'develop' 2021-11-15 21:03:06 +00:00
Auxilor
ec6ac88fea Remap changes, moved Paste to paste.willfp.com 2021-11-15 20:31:21 +00:00
Auxilor
13b10c13b3 Exposed changes 2021-11-15 20:27:02 +00:00
Auxilor
1e24cbf67b Fixed FastItemStack#hashCode bug 2021-11-15 20:19:55 +00:00
Auxilor
d9cfc8b91a Removed second ./gradlew build in java-ci 2021-11-15 20:14:55 +00:00
Auxilor
b40001d79b Updated to 6.13.10 2021-11-15 20:13:49 +00:00
Auxilor
b8128ef87e Fixed item picker bug with FastItemStack 2021-11-15 20:13:19 +00:00
Auxilor
be885e9092 Updated exposed 2021-11-15 20:11:51 +00:00
Auxilor
5658c92d3d Switched from special gradle to paperweight 2021-11-15 20:10:02 +00:00
Auxilor
e4b0a602f0 Gradle changes 2021-11-15 18:04:00 +00:00
Will FP
bf5c36d2c9 Update README.md 2021-11-15 12:24:32 +00:00
Will FP
cc57d10a36 Update README.md 2021-11-15 12:23:10 +00:00
Auxilor
dcbdbb5230 More Java CI changes 2021-11-15 12:14:06 +00:00
Auxilor
de19d67275 More Java CI changes 2021-11-15 12:05:49 +00:00
Will FP
43abfcb3fc Update README.md 2021-11-15 11:32:54 +00:00
Will FP
34f201d62d Update README.md 2021-11-15 11:32:42 +00:00
Auxilor
d3c811614f Improved java CI 2021-11-15 11:26:47 +00:00
Auxilor
44da61daaa Merge remote-tracking branch 'origin/master' into develop 2021-11-15 11:17:28 +00:00
Auxilor
3ea6d11026 Updated java ci 2021-11-15 11:12:20 +00:00
Auxilor
9a03a2e47a Added Java CI workflow 2021-11-15 11:11:21 +00:00
Auxilor
af91c9d659 Updated to 6.13.9 2021-11-14 13:43:29 +00:00
Auxilor
89eaaf3a5e Updated annotations and jupiter 2021-11-14 13:43:00 +00:00
Auxilor
ab174e2d41 Added configurability to MySQL threads 2021-11-14 13:42:24 +00:00
Auxilor
cfa9badc1e Limited SQL threads to 2 for socket connection limit 2021-11-14 13:41:11 +00:00
160 changed files with 1943 additions and 771 deletions

36
.github/workflows/java-ci.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v2
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
- name: Setup build cache
uses: actions/cache@v2.1.6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: ./gradlew build --full-stacktrace
- uses: actions/upload-artifact@v2
with:
name: eco-dev-${{ steps.vars.outputs.sha_short }}
path: build/libs

View File

@@ -12,11 +12,11 @@ jobs:
- name: Checkout latest code
uses: actions/checkout@v2
- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 16
distribution: 'temurin'
java-version: 17
- name: Setup build cache
uses: actions/cache@v2.1.6

View File

@@ -21,4 +21,4 @@
## Other
- All drops **must** be sent through a DropQueue - calls to World#dropItem will get your PR rejected.
- eco is built with java 16.
- eco is built with java 17.

View File

@@ -22,12 +22,20 @@ and many more.
<a href="https://discord.gg/ZcwpSsE/" alt="Discord">
<img src="https://img.shields.io/discord/452518336627081236?label=discord&color=informational"/>
</a>
<a href="https://github.com/Auxilor/eco/actions/workflows/java-ci.yml" alt="Latest Dev Build">
<img src="https://img.shields.io/github/workflow/status/Auxilor/eco/Java%20CI/develop?color=informational"/>
</a>
</p>
# For server owners
- Requires ProtocolLib to be installed: get the latest version [here](https://www.spigotmc.org/resources/protocollib.1997/)
- Supports 1.16.5+
## Downloads
- Stable (Recommended): [GitHub](https://github.com/Auxilor/eco/releases), [Polymart](https://polymart.org/resource/eco.773)
- Dev (Not Recommended): [GitHub](https://github.com/Auxilor/eco/actions/workflows/java-ci.yml) (Open latest run and download)
# For developers
## Javadoc
@@ -43,12 +51,6 @@ depend:
- eco
```
eco is available from any of these places:
- [GitHub](https://github.com/Auxilor/eco/releases)
- [Polymart](https://polymart.org/resource/eco.773)
- [Build it locally](https://github.com/Auxilor/eco#build-locally).
## Get from JitPack:
Gradle:

View File

@@ -1,124 +0,0 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'maven-publish'
id 'java'
}
dependencies {
implementation project(":eco-api")
implementation project(":eco-core:core-plugin")
implementation project(":eco-core:core-proxy")
implementation project(":eco-core:core-backend")
implementation project(":eco-core:core-nms:v1_16_R3")
implementation project(path: ":eco-core:core-nms:v1_17_R1", configuration: 'mapped')
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
// SuperiorSkyblock2
maven { url 'https://repo.bg-software.com/repository/api/' }
// NMS (for jitpack compilation)
maven { url 'https://repo.codemc.org/repository/nms/' }
// bStats, mcMMO, BentoBox
maven { url 'https://repo.codemc.org/repository/maven-public/' }
// Spigot API, Bungee API
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
// PlaceholderAPI
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
// ProtocolLib
maven { url 'https://repo.dmulloy2.net/nexus/repository/public/' }
// WorldGuard
maven { url 'https://maven.enginehub.org/repo/' }
// FactionsUUID
maven { url 'https://ci.ender.zone/plugin/repository/everything/' }
// NoCheatPlus
maven { url 'https://repo.md-5.net/content/repositories/snapshots/' }
// CombatLogX
maven { url 'https://nexus.sirblobman.xyz/repository/public/' }
// IridiumSkyblock
maven { url 'https://nexus.iridiumdevelopment.net/repository/maven-releases/' }
}
dependencies {
compileOnly 'org.jetbrains:annotations:19.0.0'
// Test
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
tasks.withType(JavaCompile) {
options.deprecation = true
options.encoding = 'UTF-8'
}
configurations.all {
exclude group: "org.codehaus.plexus", module: "plexus-utils"
exclude group: "com.mojang", module: "brigadier"
exclude group: "org.kitteh", module: "paste-gg-api"
exclude group: "org.kitteh", module: "pastegg"
exclude group: "org.spongepowered", module: "configurate-hocon"
exclude group: "com.darkblade12", module: "particleeffect"
exclude group: "com.github.cryptomorin", module: "XSeries"
}
shadowJar {
relocate('org.bstats', 'com.willfp.eco.shaded.bstats')
relocate('net.kyori.adventure.text.minimessage', 'com.willfp.eco.shaded.minimessage')
}
jar {
onlyIf { !sourceSets.main.allSource.files.isEmpty() }
}
compileJava {
onlyIf { !sourceSets.main.allSource.files.isEmpty() }
}
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
withSourcesJar()
}
test {
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn cleanTest
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}
compileJava.options.encoding = 'UTF-8'
compileJava.dependsOn clean
build.dependsOn shadowJar
}
group = 'com.willfp'
archivesBaseName = project.name
version = findProperty("version")

126
build.gradle.kts Normal file
View File

@@ -0,0 +1,126 @@
plugins {
id("java-library")
id("com.github.johnrengelman.shadow") version "7.0.0"
id("maven-publish")
id("java")
}
dependencies {
implementation(project(":eco-api"))
implementation(project(":eco-core:core-plugin"))
implementation(project(":eco-core:core-proxy"))
implementation(project(":eco-core:core-backend"))
implementation(project(":eco-core:core-nms:v1_16_R3"))
implementation(project(path = ":eco-core:core-nms:v1_17_R1", configuration = "reobf"))
implementation(project(":eco-core:core-nms:v1_18_R1"))
}
allprojects {
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "com.github.johnrengelman.shadow")
repositories {
mavenCentral()
mavenLocal()
maven("https://jitpack.io")
// CustomCrafting
maven("https://maven.wolfyscript.com/repository/public/")
// SuperiorSkyblock2
maven("https://repo.bg-software.com/repository/api/")
// NMS (for jitpack compilation)
maven("https://repo.codemc.org/repository/nms/")
// mcMMO, BentoBox
maven("https://repo.codemc.org/repository/maven-public/")
// Spigot API, Bungee API
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
// PlaceholderAPI
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
// ProtocolLib
maven("https://repo.dmulloy2.net/nexus/repository/public/")
// WorldGuard
maven("https://maven.enginehub.org/repo/")
// FactionsUUID
maven("https://ci.ender.zone/plugin/repository/everything/")
// NoCheatPlus
maven("https://repo.md-5.net/content/repositories/snapshots/")
// CombatLogX
maven("https://nexus.sirblobman.xyz/repository/public/")
// IridiumSkyblock
maven("https://nexus.iridiumdevelopment.net/repository/maven-releases/")
}
dependencies {
compileOnly("org.jetbrains:annotations:23.0.0")
// Test
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
// Adventure
compileOnly("net.kyori:adventure-api:4.9.3")
compileOnly("net.kyori:adventure-text-serializer-gson:4.9.3")
compileOnly("net.kyori:adventure-text-serializer-legacy:4.9.3")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
configurations.all {
exclude(group = "org.codehaus.plexus", module = "plexus-utils")
exclude(group = "com.mojang", module = "brigadier")
exclude(group = "org.kitteh", module = "paste-gg-api")
exclude(group = "org.kitteh", module = "pastegg")
exclude(group = "org.spongepowered", module = "configurate-hocon")
exclude(group = "com.darkblade12", module = "particleeffect")
exclude(group = "com.github.cryptomorin", module = "XSeries")
}
tasks {
shadowJar {
relocate("org.bstats", "com.willfp.eco.shaded.bstats")
relocate("net.kyori.adventure.text.minimessage", "com.willfp.eco.shaded.minimessage")
}
compileJava {
dependsOn(clean)
options.encoding = "UTF-8"
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
test {
useJUnitPlatform()
// Show test results.
testLogging {
events("passed", "skipped", "failed")
}
}
build {
dependsOn(shadowJar)
}
}
}
group = "com.willfp"
version = findProperty("version")!!

View File

@@ -9,14 +9,11 @@ dependencies {
// Adventure
compileOnly 'net.kyori:adventure-platform-bukkit:4.0.0'
compileOnly 'net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT'
compileOnly 'net.kyori:adventure-api:4.9.2'
compileOnly 'net.kyori:adventure-text-serializer-gson:4.9.2'
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.9.2'
// Other
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'org.apache.maven:maven-artifact:3.8.1'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.1-SNAPSHOT'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
compileOnly 'com.google.code.gson:gson:2.8.8'
}

View File

@@ -2,8 +2,8 @@ package com.willfp.eco.core;
import com.willfp.eco.core.config.updating.ConfigHandler;
import com.willfp.eco.core.config.wrapper.ConfigFactory;
import com.willfp.eco.core.data.keys.KeyRegistry;
import com.willfp.eco.core.data.PlayerProfileHandler;
import com.willfp.eco.core.data.keys.KeyRegistry;
import com.willfp.eco.core.drops.DropQueueFactory;
import com.willfp.eco.core.events.EventManager;
import com.willfp.eco.core.extensions.ExtensionLoader;

View File

@@ -41,11 +41,19 @@ public class Prerequisite {
"Requires server to have vault"
);
/**
* Requires the server to be running 1.18.
*/
public static final Prerequisite HAS_1_18 = new Prerequisite(
() -> ProxyConstants.NMS_VERSION.contains("18"),
"Requires server to be running 1.18+"
);
/**
* Requires the server to be running 1.17.
*/
public static final Prerequisite HAS_1_17 = new Prerequisite(
() -> ProxyConstants.NMS_VERSION.contains("17"),
() -> ProxyConstants.NMS_VERSION.contains("17") || HAS_1_18.isMet(),
"Requires server to be running 1.17+"
);

View File

@@ -16,4 +16,40 @@ public class ConfigYml extends YamlBaseConfig {
public ConfigYml(@NotNull final EcoPlugin plugin) {
super("config", true, plugin);
}
/**
* Config.yml.
*
* @param plugin The plugin.
* @param removeUnused Remove unused.
*/
public ConfigYml(@NotNull final EcoPlugin plugin,
final boolean removeUnused) {
super("config", removeUnused, plugin);
}
/**
* Config.yml.
*
* @param plugin The plugin.
* @param name The config name.
*/
public ConfigYml(@NotNull final EcoPlugin plugin,
@NotNull final String name) {
super(name, true, plugin);
}
/**
* Config.yml.
*
* @param plugin The plugin.
* @param name The config name.
* @param removeUnused Remove unused.
*/
public ConfigYml(@NotNull final EcoPlugin plugin,
@NotNull final String name,
final boolean removeUnused) {
super(name, removeUnused, plugin);
}
}

View File

@@ -524,6 +524,25 @@ public interface Config extends Cloneable {
@Nullable
List<Double> getDoublesOrNull(@NotNull String path);
/**
* Get a list of subsections from config.
*
* @param path The key to fetch the value from.
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
*/
@NotNull
List<? extends Config> getSubsections(@NotNull String path);
/**
* Get a list of subsections from config.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
*/
@Nullable
List<? extends Config> getSubsectionsOrNull(@NotNull String path);
/**
* Clone the config.
*

View File

@@ -173,6 +173,16 @@ public abstract class ConfigWrapper<T extends Config> implements Config {
return handle.getDoublesOrNull(path);
}
@Override
public @NotNull List<? extends Config> getSubsections(@NotNull final String path) {
return handle.getSubsections(path);
}
@Override
public @Nullable List<? extends Config> getSubsectionsOrNull(@NotNull final String path) {
return handle.getSubsectionsOrNull(path);
}
@Override
public Config clone() {
return handle.clone();

View File

@@ -14,16 +14,23 @@ import java.io.StringReader;
*/
public class YamlTransientConfig extends YamlConfigWrapper {
/**
* @param config The YamlConfiguration handle.
* @param config The YamlConfiguration handle.
*/
public YamlTransientConfig(@NotNull final YamlConfiguration config) {
super(Eco.getHandler().getConfigFactory().createYamlConfig(config));
}
/**
* @param contents The contents of the config.
* @param contents The contents of the config.
*/
public YamlTransientConfig(@NotNull final String contents) {
super(Eco.getHandler().getConfigFactory().createYamlConfig(YamlConfiguration.loadConfiguration(new StringReader(contents))));
}
/**
* Create a new empty transient config.
*/
public YamlTransientConfig() {
super(Eco.getHandler().getConfigFactory().createYamlConfig(YamlConfiguration.loadConfiguration(new StringReader(""))));
}
}

View File

@@ -0,0 +1,143 @@
package com.willfp.eco.core.events;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* Called on DropQueue push.
*/
public class DropQueuePushEvent extends PlayerEvent implements Cancellable {
/**
* Cancel state.
*/
private boolean cancelled;
/**
* If telekinetic.
*/
private final boolean isTelekinetic;
/**
* The items.
*/
private final Collection<? extends ItemStack> items;
/**
* The xp.
*/
private final int xp;
/**
* The location.
*/
private final Location location;
/**
* Bukkit parity.
*/
private static final HandlerList HANDLERS = new HandlerList();
/**
* Create a new DropQueuePushEvent.
*
* @param player The player.
* @param items The items.
* @param location The location.
* @param xp The xp.
* @param isTelekinetic If the event is telekinetic.
*/
public DropQueuePushEvent(@NotNull final Player player,
@NotNull final Collection<? extends ItemStack> items,
@NotNull final Location location,
final int xp,
final boolean isTelekinetic) {
super(player);
this.items = items;
this.location = location;
this.xp = xp;
this.isTelekinetic = isTelekinetic;
}
/**
* Gets a list of handlers handling this event.
*
* @return A list of handlers handling this event.
*/
@Override
@NotNull
public HandlerList getHandlers() {
return HANDLERS;
}
/**
* Bukkit parity.
*
* @return The handler list.
*/
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Get cancel state.
*
* @return The cancel state.
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Set cancel state.
*
* @param cancelled If cancelled.
*/
@Override
public void setCancelled(final boolean cancelled) {
this.cancelled = cancelled;
}
/**
* Get the items to be dropped.
*
* @return The items.
*/
public Collection<? extends ItemStack> getItems() {
return items;
}
/**
* Get the xp to be dropped.
*
* @return The xp.
*/
public int getXp() {
return xp;
}
/**
* Get the location.
*
* @return The location.
*/
public Location getLocation() {
return location;
}
/**
* Get force telekinesis state.
*
* @return The force telekinesis state.
*/
public boolean isTelekinetic() {
return this.isTelekinetic;
}
}

View File

@@ -70,14 +70,14 @@ public interface FastItemStack {
*
* @param hideFlags The flags.
*/
void addItemFlags(ItemFlag... hideFlags);
void addItemFlags(@NotNull ItemFlag... hideFlags);
/**
* Remove ItemFlags.
*
* @param hideFlags The flags.
*/
void removeItemFlags(ItemFlag... hideFlags);
void removeItemFlags(@NotNull ItemFlag... hideFlags);
/**
* Get the ItemFlags.
@@ -92,7 +92,7 @@ public interface FastItemStack {
* @param flag The flag.
* @return If the flag is present.
*/
boolean hasItemFlag(ItemFlag flag);
boolean hasItemFlag(@NotNull ItemFlag flag);
/**
* Get the Bukkit ItemStack again.

View File

@@ -37,6 +37,17 @@ public final class AntigriefManager {
REGISTERED.remove(antigrief);
}
/**
* Can player pickup item.
*
* @param player The player.
* @param location The location.
* @return If player can pick up item.
*/
public static boolean canPickupItem(@NotNull final Player player, @NotNull final Location location) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPickupItem(player, location));
}
/**
* Can player break block.
*
@@ -45,7 +56,7 @@ public final class AntigriefManager {
* @return If player can break block.
*/
public static boolean canBreakBlock(@NotNull final Player player,
@NotNull final Block block) {
@NotNull final Block block) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canBreakBlock(player, block));
}
@@ -57,7 +68,7 @@ public final class AntigriefManager {
* @return If player can create explosion.
*/
public static boolean canCreateExplosion(@NotNull final Player player,
@NotNull final Location location) {
@NotNull final Location location) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canCreateExplosion(player, location));
}
@@ -69,7 +80,7 @@ public final class AntigriefManager {
* @return If player can place block.
*/
public static boolean canPlaceBlock(@NotNull final Player player,
@NotNull final Block block) {
@NotNull final Block block) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPlaceBlock(player, block));
}
@@ -81,7 +92,7 @@ public final class AntigriefManager {
* @return If player can injure.
*/
public static boolean canInjure(@NotNull final Player player,
@NotNull final LivingEntity victim) {
@NotNull final LivingEntity victim) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canInjure(player, victim));
}

View File

@@ -5,6 +5,7 @@ import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for antigrief integrations.
@@ -17,7 +18,7 @@ public interface AntigriefWrapper extends Integration {
* @param block The block.
* @return If player can break block.
*/
boolean canBreakBlock(Player player, Block block);
boolean canBreakBlock(@NotNull Player player, @NotNull Block block);
/**
* Can player create explosion at location.
@@ -26,7 +27,7 @@ public interface AntigriefWrapper extends Integration {
* @param location The location.
* @return If player can create explosion.
*/
boolean canCreateExplosion(Player player, Location location);
boolean canCreateExplosion(@NotNull Player player, @NotNull Location location);
/**
* Can player place block.
@@ -35,7 +36,7 @@ public interface AntigriefWrapper extends Integration {
* @param block The block.
* @return If player can place block.
*/
boolean canPlaceBlock(Player player, Block block);
boolean canPlaceBlock(@NotNull Player player, @NotNull Block block);
/**
* Can player injure living entity.
@@ -44,5 +45,15 @@ public interface AntigriefWrapper extends Integration {
* @param victim The victim.
* @return If player can injure.
*/
boolean canInjure(Player player, LivingEntity victim);
boolean canInjure(@NotNull Player player, @NotNull LivingEntity victim);
/**
* Can player pick up item.
*
* @param player The player.
* @param location The location.
* @return If player can pick up item.
*/
boolean canPickupItem(@NotNull Player player, @NotNull Location location);
}

View File

@@ -50,7 +50,7 @@ public final class Items {
* @param item The item.
*/
public static void registerCustomItem(@NotNull final NamespacedKey key,
@NotNull final TestableItem item) {
@NotNull final TestableItem item) {
REGISTRY.put(key, item);
}
@@ -84,7 +84,7 @@ public final class Items {
/**
* This is the backbone of the entire eco item system.
* <p>
* You can lookup a TestableItem for any material, custom item,
* You can look up a TestableItem for any material, custom item,
* or item in general, and it will return it with any modifiers
* passed as parameters. This includes stack size (item amount)
* and enchantments that should be present on the item.
@@ -94,8 +94,8 @@ public final class Items {
* <p>
* The advantages of the testable item system are that there is the inbuilt
* {@link TestableItem#matches(ItemStack)} - this allows to check if any item
* is that testable item; which may sound negligible but actually it allows for
* much more power an flexibility. For example, you can have an item with an
* is that testable item; which may sound negligible, but actually it allows for
* much more power and flexibility. For example, you can have an item with an
* extra metadata tag, extra lore lines, different display name - and it
* will still work as long as the test passes. This is very important
* for custom crafting recipes where other plugins may add metadata
@@ -104,6 +104,7 @@ public final class Items {
* @param key The lookup string.
* @return The testable item, or an {@link EmptyTestableItem}.
*/
@NotNull
public static TestableItem lookup(@NotNull final String key) {
if (key.contains("?")) {
String[] options = key.split("\\?");
@@ -235,6 +236,37 @@ public final class Items {
}
}
/**
* Get a Testable Item from an ItemStack.
* <p>
* Will search for registered items first. If there are no matches in the registry,
* then it will return a {@link MaterialTestableItem} matching the item type.
* <p>
* Does not account for modifiers (arg parser data).
*
* @param item The ItemStack.
* @return The found Testable Item.
*/
@NotNull
public static TestableItem getItem(@Nullable final ItemStack item) {
if (item == null || item.getType().isAir()) {
return new EmptyTestableItem();
}
CustomItem customItem = getCustomItem(item);
if (customItem != null) {
return customItem;
}
for (TestableItem known : REGISTRY.values()) {
if (known.matches(item)) {
return known;
}
}
return new MaterialTestableItem(item.getType());
}
/**
* Get if itemStack is a custom item.
*
@@ -284,6 +316,7 @@ public final class Items {
* @param item The item.
* @return The CustomItem.
*/
@NotNull
public static CustomItem getOrWrap(@NotNull final TestableItem item) {
if (item instanceof CustomItem) {
return (CustomItem) item;

View File

@@ -0,0 +1,22 @@
package com.willfp.eco.core.items.args;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Predicate;
/**
* Parse leather armor colors.
*
* @deprecated Moved to internals.
*/
@Deprecated(forRemoval = true)
public class ColorArgParser implements LookupArgParser {
@Override
public @Nullable Predicate<ItemStack> parseArguments(@NotNull final String[] args,
@NotNull final ItemMeta meta) {
return null;
}
}

View File

@@ -0,0 +1,22 @@
package com.willfp.eco.core.items.args;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Predicate;
/**
* Parse custom model data.
*
* @deprecated Moved to internals.
*/
@Deprecated(forRemoval = true)
public class CustomModelDataArgParser implements LookupArgParser {
@Override
public @Nullable Predicate<ItemStack> parseArguments(@NotNull final String[] args,
@NotNull final ItemMeta meta) {
return null;
}
}

View File

@@ -1,83 +1,22 @@
package com.willfp.eco.core.items.args;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Predicate;
/**
* Parses enchantment arguments.
*
* @deprecated Moved to internals.
*/
@Deprecated(forRemoval = true)
public class EnchantmentArgParser implements LookupArgParser {
@Override
public @Nullable Predicate<ItemStack> parseArguments(@NotNull final String[] args,
@NotNull final ItemMeta meta) {
Map<Enchantment, Integer> requiredEnchantments = new HashMap<>();
for (String enchantArg : args) {
String[] enchantArgSplit = enchantArg.split(":");
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantArgSplit[0].toLowerCase()));
if (enchantment == null) {
continue;
}
if (enchantArgSplit.length < 2) {
continue;
}
int level = Integer.parseInt(enchantArgSplit[1]);
requiredEnchantments.put(enchantment, level);
}
if (requiredEnchantments.isEmpty()) {
return null;
}
if (meta instanceof EnchantmentStorageMeta storageMeta) {
requiredEnchantments.forEach((enchantment, integer) -> storageMeta.addStoredEnchant(enchantment, integer, true));
} else {
requiredEnchantments.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true));
}
return test -> {
if (!test.hasItemMeta()) {
return false;
}
ItemMeta testMeta = test.getItemMeta();
assert testMeta != null;
if (testMeta instanceof EnchantmentStorageMeta storageMeta) {
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
if (!storageMeta.hasStoredEnchant(entry.getKey())) {
return false;
}
if (storageMeta.getStoredEnchantLevel(entry.getKey()) < entry.getValue()) {
return false;
}
}
} else {
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
if (!testMeta.hasEnchant(entry.getKey())) {
return false;
}
if (testMeta.getEnchantLevel(entry.getKey()) < entry.getValue()) {
return false;
}
}
}
return true;
};
return null;
}
}

View File

@@ -1,9 +1,7 @@
package com.willfp.eco.core.items.args;
import com.willfp.eco.util.SkullUtils;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -11,49 +9,14 @@ import java.util.function.Predicate;
/**
* Parse skull textures.
*
* @deprecated Moved to internals.
*/
@Deprecated(forRemoval = true)
public class TextureArgParser implements LookupArgParser {
@Override
public @Nullable Predicate<ItemStack> parseArguments(@NotNull final String[] args,
@NotNull final ItemMeta meta) {
String skullTexture = null;
for (String arg : args) {
String[] argSplit = arg.split(":");
if (!argSplit[0].equalsIgnoreCase("texture")) {
continue;
}
if (argSplit.length < 2) {
continue;
}
skullTexture = argSplit[1];
}
if (meta instanceof SkullMeta skullMeta && skullTexture != null) {
SkullUtils.setSkullTexture(skullMeta, skullTexture);
}
if (skullTexture == null) {
return null;
}
String finalSkullTexture = skullTexture;
return test -> {
if (!test.hasItemMeta()) {
return false;
}
ItemMeta testMeta = test.getItemMeta();
assert testMeta != null;
if (testMeta instanceof SkullMeta skullMeta) {
return finalSkullTexture.equalsIgnoreCase(SkullUtils.getSkullTexture(skullMeta));
}
return true;
};
return null;
}
}

View File

@@ -3,6 +3,7 @@ package com.willfp.eco.core.recipe.recipes;
import com.willfp.eco.core.Eco;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.Prerequisite;
import com.willfp.eco.core.items.TestableItem;
import com.willfp.eco.core.recipe.Recipes;
import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
@@ -112,6 +113,12 @@ public final class ShapedCraftingRecipe extends PluginDependent<EcoPlugin> imple
displayedRecipe.setIngredient(character, new RecipeChoice.ExactChoice(item));
}
if (Prerequisite.HAS_1_18.isMet() && !Prerequisite.HAS_PAPER.isMet()) {
if (Bukkit.getServer().getRecipe(this.getKey()) != null) {
return;
}
}
Bukkit.getServer().addRecipe(shapedRecipe);
Bukkit.getServer().addRecipe(displayedRecipe);
}

View File

@@ -11,6 +11,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.function.Consumer;
@@ -43,10 +44,10 @@ public class Paste {
public void getHastebinToken(@NotNull final Consumer<String> callback) {
Eco.getHandler().getEcoPlugin().getScheduler().runAsync(() -> {
try {
byte[] postData = contents.getBytes(StandardCharsets.UTF_8);
byte[] postData = URLEncoder.encode(contents, StandardCharsets.UTF_8).getBytes(StandardCharsets.UTF_8);
int postDataLength = postData.length;
String requestURL = "https://hastebin.com/documents";
String requestURL = "https://paste.willfp.com/documents";
URL url = new URL(requestURL);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);
@@ -86,7 +87,7 @@ public class Paste {
public static Paste getFromHastebin(@NotNull final String token) {
try {
StringBuilder result = new StringBuilder();
URL url = new URL("https://hastebin.com/raw/" + token);
URL url = new URL("https://paste.willfp.com/raw/" + token);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
try (var reader = new BufferedReader(

View File

@@ -1,7 +1,6 @@
package com.willfp.eco.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -21,8 +20,8 @@ public final class ListUtils {
* @return The list, filled will null objects.
*/
@NotNull
public static <@Nullable T> List<List<T>> create2DList(final int rows,
final int columns) {
public static <T> List<List<T>> create2DList(final int rows,
final int columns) {
List<List<T>> list = new ArrayList<>(rows);
while (list.size() < rows) {
List<T> row = new ArrayList<>(columns);

View File

@@ -82,20 +82,16 @@ public final class PlayerUtils {
* @return The player name.
*/
public static String getSavedDisplayName(@NotNull final OfflinePlayer player) {
PlayerProfile profile = PlayerProfile.load(player);
if (player instanceof Player onlinePlayer) {
profile.write(PLAYER_NAME_KEY, onlinePlayer.getDisplayName());
updateSavedDisplayName(onlinePlayer);
}
PlayerProfile profile = PlayerProfile.load(player);
String saved = profile.read(PLAYER_NAME_KEY);
if (saved.equals(PLAYER_NAME_KEY.getDefaultValue())) {
String name = player.getName();
if (name != null) {
profile.write(PLAYER_NAME_KEY, player.getName());
return player.getName();
}
return player.getName();
}
return saved;

View File

@@ -7,7 +7,6 @@ import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.markdown.DiscordFlavor;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.md_5.bungee.api.ChatColor;
@@ -275,7 +274,7 @@ public final class StringUtils {
}
private static String translateMiniMessage(@NotNull final String message) {
return LEGACY_COMPONENT_SERIALIZER.serialize(MiniMessage.withMarkdownFlavor(DiscordFlavor.get()).parse(message));
return LEGACY_COMPONENT_SERIALIZER.serialize(MiniMessage.get().parse(message));
}
private static String translateHexColorCodes(@NotNull final String message) {

View File

@@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
}
}
@@ -16,14 +16,14 @@ subprojects {
dependencies {
compileOnly project(":eco-api")
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.5.31'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
}
compileKotlin {
kotlinOptions {
jvmTarget = "16"
jvmTarget = "17"
}
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
}

View File

@@ -30,7 +30,7 @@ open class EcoLoadableJSONConfig(
}
}
override fun createFile() {
final override fun createFile() {
val inputStream = source.getResourceAsStream(resourcePath)!!
val outFile = File(this.plugin.dataFolder, resourcePath)
val lastIndex = resourcePath.lastIndexOf('/')
@@ -40,7 +40,7 @@ open class EcoLoadableJSONConfig(
}
if (!outFile.exists()) {
val out: OutputStream = FileOutputStream(outFile)
inputStream.copyTo(out, 1024)
inputStream.copyTo(out)
out.close()
inputStream.close()
}

View File

@@ -40,11 +40,10 @@ open class EcoLoadableYamlConfig(
}
if (!outFile.exists()) {
val out: OutputStream = FileOutputStream(outFile)
inputStream.copyTo(out, 1024)
inputStream.copyTo(out)
out.close()
inputStream.close()
}
plugin.configHandler.addConfig(this)
}
override fun getResourcePath(): String {

View File

@@ -5,12 +5,11 @@ import com.willfp.eco.util.StringUtils
import org.bukkit.configuration.ConfigurationSection
import org.bukkit.configuration.file.YamlConfiguration
import java.io.StringReader
import java.util.concurrent.ConcurrentHashMap
@Suppress("UNCHECKED_CAST")
open class EcoYamlConfigWrapper<T : ConfigurationSection> : Config {
lateinit var handle: T
private val cache = ConcurrentHashMap<String, Any?>()
private val cache = mutableMapOf<String, Any?>()
protected fun init(config: T): Config {
handle = config
@@ -70,9 +69,9 @@ open class EcoYamlConfigWrapper<T : ConfigurationSection> : Config {
override fun getInt(path: String): Int {
return if (cache.containsKey(path)) {
cache[path] as Int
(cache[path] as Number).toInt()
} else {
cache[path] = handle.getInt(path, 0)
cache[path] = handle.getDouble(path, 0.0).toInt()
getInt(path)
}
}
@@ -90,9 +89,9 @@ open class EcoYamlConfigWrapper<T : ConfigurationSection> : Config {
def: Int
): Int {
return if (cache.containsKey(path)) {
cache[path] as Int
(cache[path] as Number).toInt()
} else {
cache[path] = handle.getInt(path, def)
cache[path] = handle.getDouble(path, def.toDouble()).toInt()
getInt(path)
}
}
@@ -262,6 +261,31 @@ open class EcoYamlConfigWrapper<T : ConfigurationSection> : Config {
}
}
override fun getSubsections(path: String): MutableList<out Config> {
return if (cache.containsKey(path)) {
(cache[path] as Collection<Config>).toMutableList()
} else {
val mapList = ArrayList(handle.getMapList(path)) as List<Map<String, Any?>>
val configList = mutableListOf<Config>()
for (map in mapList) {
val temp = YamlConfiguration.loadConfiguration(StringReader(""))
temp.createSection("a", map)
configList.add(EcoYamlConfigSection(temp.getConfigurationSection("a")!!))
}
cache[path] = if (has(path)) configList else emptyList()
getSubsections(path)
}
}
override fun getSubsectionsOrNull(path: String): MutableList<out Config>? {
return if (has(path)) {
getSubsections(path)
} else {
null
}
}
override fun clone(): Config {
return EcoYamlConfigSection(
YamlConfiguration.loadConfiguration(

View File

@@ -2,7 +2,7 @@ package com.willfp.eco.internal.data
import com.willfp.eco.core.data.PlayerProfile
import com.willfp.eco.core.data.keys.PersistentDataKey
import java.util.*
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
class EcoPlayerProfile(

View File

@@ -1,6 +1,8 @@
package com.willfp.eco.internal.drops.impl
import com.willfp.eco.core.drops.InternalDropQueue
import com.willfp.eco.core.events.DropQueuePushEvent
import com.willfp.eco.core.integrations.antigrief.AntigriefManager
import com.willfp.eco.util.TelekinesisUtils
import org.bukkit.Bukkit
import org.bukkit.Location
@@ -15,7 +17,7 @@ import org.bukkit.util.Vector
open class EcoDropQueue(val player: Player) : InternalDropQueue {
val items = mutableListOf<ItemStack>()
var xp: Int = 0
var loc: Location
var location: Location
var hasTelekinesis = false
override fun addItem(item: ItemStack): InternalDropQueue {
@@ -34,7 +36,7 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
}
override fun setLocation(location: Location): InternalDropQueue {
loc = location
this.location = location
return this
}
@@ -47,8 +49,20 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
if (!hasTelekinesis) {
hasTelekinesis = TelekinesisUtils.testPlayer(player)
}
val world = loc.world!!
loc = loc.add(0.5, 0.5, 0.5)
if (hasTelekinesis && !AntigriefManager.canPickupItem(player, location)) {
hasTelekinesis = false
}
val pushEvent = DropQueuePushEvent(player, items, location, xp, hasTelekinesis)
Bukkit.getServer().pluginManager.callEvent(pushEvent)
if (pushEvent.isCancelled) {
return
}
val world = location.world!!
location = location.add(0.5, 0.5, 0.5)
items.removeIf { itemStack: ItemStack -> itemStack.type == Material.AIR }
if (items.isEmpty()) {
return
@@ -56,7 +70,7 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
if (hasTelekinesis) {
val leftover = player.inventory.addItem(*items.toTypedArray())
for (drop in leftover.values) {
world.dropItem(loc, drop!!).velocity = Vector()
world.dropItem(location, drop!!).velocity = Vector()
}
if (xp > 0) {
val event = PlayerExpChangeEvent(player, xp)
@@ -68,16 +82,16 @@ open class EcoDropQueue(val player: Player) : InternalDropQueue {
}
} else {
for (drop in items) {
world.dropItem(loc, drop).velocity = Vector()
world.dropItem(location, drop).velocity = Vector()
}
if (xp > 0) {
val orb = world.spawnEntity(loc, EntityType.EXPERIENCE_ORB) as ExperienceOrb
val orb = world.spawnEntity(location, EntityType.EXPERIENCE_ORB) as ExperienceOrb
orb.experience = xp
}
}
}
init {
loc = player.location
location = player.location
}
}

View File

@@ -10,10 +10,10 @@ class EcoFastCollatedDropQueue(player: Player) : EcoDropQueue(player) {
val fetched = COLLATED_MAP[player]
if (fetched == null) {
COLLATED_MAP[player] = CollatedDrops(items, loc, xp, hasTelekinesis)
COLLATED_MAP[player] = CollatedDrops(items, location, xp, hasTelekinesis)
} else {
fetched.addDrops(items)
fetched.location = loc
fetched.location = location
fetched.addXp(xp)
if (this.hasTelekinesis) {
fetched.forceTelekinesis()

View File

@@ -1,8 +1,8 @@
package com.willfp.eco.internal.gui.menu
import com.willfp.eco.internal.gui.slot.EcoCaptivatorSlot
import com.willfp.eco.util.MenuUtils
import com.willfp.eco.util.StringUtils
import org.bukkit.Material
import org.bukkit.NamespacedKey
import org.bukkit.entity.Player
import org.bukkit.inventory.Inventory
@@ -20,12 +20,14 @@ class ExtendedInventory(
for (i in 0 until inventory.size) {
val (row, column) = MenuUtils.convertSlotToRowColumn(i)
val slot = menu.getSlot(row, column)
if (slot is EcoCaptivatorSlot) {
if (slot.isCaptive) {
val defaultItem = slot.getItemStack(player)
val item = inventory.getItem(i) ?: continue
if (item != defaultItem) {
captiveItems.add(item)
if (item == defaultItem && item.type == Material.AIR) {
continue
}
captiveItems.add(item)
}
}

View File

@@ -2,7 +2,7 @@ package com.willfp.eco.internal.gui.menu
import com.willfp.eco.core.gui.menu.Menu
import org.bukkit.inventory.Inventory
import java.util.*
import java.util.WeakHashMap
object MenuHandler {
private val menus = WeakHashMap<ExtendedInventory, EcoMenu>()

View File

@@ -1,28 +0,0 @@
package com.willfp.eco.internal.gui.slot
import com.willfp.eco.core.Eco
import com.willfp.eco.core.gui.slot.functional.SlotHandler
import org.bukkit.Material
import org.bukkit.inventory.ItemStack
class EcoCaptivatorSlot : EcoSlot(
{ _, _ -> ItemStack(Material.AIR) },
allowMovingItem,
allowMovingItem,
allowMovingItem,
allowMovingItem,
allowMovingItem,
{ _, _, _ -> }
) {
companion object {
val plugin = Eco.getHandler().ecoPlugin
val allowMovingItem = SlotHandler { event, _, _ ->
event.isCancelled = false
}
}
override fun isCaptive(): Boolean {
return true
}
}

View File

@@ -0,0 +1,24 @@
package com.willfp.eco.internal.gui.slot
import com.willfp.eco.core.gui.slot.functional.SlotHandler
import com.willfp.eco.core.gui.slot.functional.SlotProvider
class EcoCaptiveSlot(
provider: SlotProvider
) : EcoSlot(
provider,
allowMovingItem,
allowMovingItem,
allowMovingItem,
allowMovingItem,
allowMovingItem,
{ _, _, _ -> }
) {
override fun isCaptive(): Boolean {
return true
}
}
private val allowMovingItem = SlotHandler { event, _, _ ->
event.isCancelled = false
}

View File

@@ -31,8 +31,7 @@ open class EcoSlot(
ClickType.SHIFT_LEFT -> this.onShiftLeftClick.handle(event, this, menu)
ClickType.SHIFT_RIGHT -> this.onShiftRightClick.handle(event, this, menu)
ClickType.MIDDLE -> this.onMiddleClick.handle(event, this, menu)
else -> {
}
else -> {}
}
}

View File

@@ -58,7 +58,7 @@ class EcoSlotBuilder(private val provider: SlotProvider) : SlotBuilder {
override fun build(): Slot {
return if (captive) {
EcoCaptivatorSlot()
EcoCaptiveSlot(provider)
} else {
EcoSlot(provider, onLeftClick, onRightClick, onShiftLeftClick, onShiftRightClick, onMiddleClick, modifier)
}

View File

@@ -0,0 +1,44 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import org.bukkit.Color
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import org.bukkit.inventory.meta.LeatherArmorMeta
import java.util.function.Predicate
class ArgParserColor : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
if (meta !is LeatherArmorMeta) {
return null
}
var color: String? = null
for (arg in args) {
val argSplit = arg.split(":")
if (!argSplit[0].equals("color", ignoreCase = true)) {
continue
}
if (argSplit.size < 2) {
continue
}
color = argSplit[1].replace("#","")
}
color ?: return null
meta.setColor(Color.fromRGB(Integer.parseInt(color, 16)))
return Predicate {
val testMeta = it.itemMeta as? LeatherArmorMeta ?: return@Predicate false
color.equals(
Integer.toHexString(testMeta.color.red)
+ Integer.toHexString(testMeta.color.green)
+ Integer.toHexString(testMeta.color.blue),
ignoreCase = true
)
}
}
}

View File

@@ -0,0 +1,33 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import java.util.function.Predicate
class ArgParserCustomModelData : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
var modelData: Int? = null
for (arg in args) {
val argSplit = arg.split(":")
if (!argSplit[0].equals("custom-model-data", ignoreCase = true)) {
continue
}
if (argSplit.size < 2) {
continue
}
modelData = argSplit[1].toIntOrNull()
}
modelData ?: return null
meta.setCustomModelData(modelData)
return Predicate {
val testMeta = it.itemMeta ?: return@Predicate false
testMeta.customModelData == modelData
}
}
}

View File

@@ -0,0 +1,55 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.core.items.args.LookupArgParser
import org.bukkit.NamespacedKey
import org.bukkit.enchantments.Enchantment
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.EnchantmentStorageMeta
import org.bukkit.inventory.meta.ItemMeta
import java.util.function.Predicate
class ArgParserEnchantment : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
val enchants = mutableMapOf<Enchantment, Int>()
for (arg in args) {
val argSplit = arg.split(":")
if (argSplit.size < 2) {
continue
}
val enchant = Enchantment.getByKey(NamespacedKey.minecraft(argSplit[0].lowercase()))
val level = argSplit[1].toIntOrNull()
if (enchant != null && level != null) {
enchants[enchant] = level
}
}
if (enchants.isEmpty()) {
return null
}
for ((enchant, level) in enchants) {
if (meta is EnchantmentStorageMeta) {
meta.addStoredEnchant(enchant, level, true)
} else {
meta.addEnchant(enchant, level, true)
}
}
return Predicate {
val onItem = FastItemStack.wrap(it).getEnchantmentsOnItem(true)
for ((enchant, level) in enchants) {
if ((onItem[enchant] ?: 0) < level) {
return@Predicate false
}
}
true
}
}
}

View File

@@ -0,0 +1,35 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import org.bukkit.inventory.ItemFlag
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import java.util.function.Predicate
class ArgParserFlag : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
val flags = mutableSetOf<ItemFlag>()
for (arg in args) {
val flag = try {
ItemFlag.valueOf(arg.uppercase())
} catch (e: Exception) {
null
} ?: continue
flags.add(flag)
}
if (flags.isEmpty()) {
return null
}
meta.addItemFlags(*flags.toTypedArray())
return Predicate {
val testMeta = it.itemMeta ?: return@Predicate false
testMeta.itemFlags.containsAll(flags)
}
}
}

View File

@@ -0,0 +1,36 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import com.willfp.eco.util.StringUtils
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import java.util.function.Predicate
class ArgParserName : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
var name: String? = null
for (arg in args) {
val argSplit = arg.split(":")
if (!argSplit[0].equals("name", ignoreCase = true)) {
continue
}
if (argSplit.size < 2) {
continue
}
name = argSplit[1].replace("_", "")
}
name ?: return null
val formatted = StringUtils.format(name)
meta.setDisplayName(formatted)
return Predicate {
val testMeta = it.itemMeta ?: return@Predicate false
testMeta.displayName == formatted
}
}
}

View File

@@ -0,0 +1,39 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import com.willfp.eco.util.SkullUtils
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import org.bukkit.inventory.meta.SkullMeta
import java.util.function.Predicate
class ArgParserTexture : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
if (meta !is SkullMeta) {
return null
}
var texture: String? = null
for (arg in args) {
val argSplit = arg.split(":")
if (!argSplit[0].equals("texture", ignoreCase = true)) {
continue
}
if (argSplit.size < 2) {
continue
}
texture = argSplit[1]
}
texture ?: return null
SkullUtils.setSkullTexture(meta, texture)
return Predicate {
val testMeta = it.itemMeta as? SkullMeta ?: return@Predicate false
texture == SkullUtils.getSkullTexture(testMeta)
}
}
}

View File

@@ -0,0 +1,30 @@
package com.willfp.eco.internal.items
import com.willfp.eco.core.items.args.LookupArgParser
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import java.util.function.Predicate
class ArgParserUnbreakable : LookupArgParser {
override fun parseArguments(args: Array<out String>, meta: ItemMeta): Predicate<ItemStack>? {
var unbreakable = false
for (arg in args) {
if (arg.equals("unbreakable", true)) {
unbreakable = true
}
}
if (!unbreakable) {
return null
}
meta.isUnbreakable = true
return Predicate {
val testMeta = it.itemMeta ?: return@Predicate false
testMeta.isUnbreakable
}
}
}

View File

@@ -7,7 +7,7 @@ import com.willfp.eco.core.proxy.ProxyFactory
import com.willfp.eco.core.proxy.exceptions.ProxyError
import com.willfp.eco.core.proxy.exceptions.UnsupportedVersionException
import java.net.URLClassLoader
import java.util.*
import java.util.IdentityHashMap
class EcoProxyFactory(
private val plugin: EcoPlugin
@@ -74,7 +74,8 @@ class EcoProxyFactory(
companion object {
val SUPPORTED_VERSIONS = listOf(
"v1_16_R3",
"v1_17_R1"
"v1_17_R1",
"v1_18_R1"
)
}
}

View File

@@ -2,7 +2,11 @@ package com.willfp.eco.internal.requirement
import com.willfp.eco.core.requirement.Requirement
import com.willfp.eco.core.requirement.RequirementFactory
import com.willfp.eco.internal.requirement.requirements.*
import com.willfp.eco.internal.requirement.requirements.RequirementHasPermission
import com.willfp.eco.internal.requirement.requirements.RequirementPlaceholderEquals
import com.willfp.eco.internal.requirement.requirements.RequirementPlaceholderGreaterThan
import com.willfp.eco.internal.requirement.requirements.RequirementPlaceholderLessThan
import com.willfp.eco.internal.requirement.requirements.RequirementTrue
class EcoRequirementFactory: RequirementFactory {
override fun create(name: String): Requirement {

View File

@@ -15,6 +15,6 @@ class RequirementPlaceholderGreaterThan : Requirement() {
val placeholder = args[0]
val equals = args[1].toDoubleOrNull() ?: return false
return PlaceholderManager.translatePlaceholders(placeholder, player).toDoubleOrNull() ?: 0.0 >= equals
return (PlaceholderManager.translatePlaceholders(placeholder, player).toDoubleOrNull() ?: 0.0) >= equals
}
}

View File

@@ -15,6 +15,6 @@ class RequirementPlaceholderLessThan : Requirement() {
val placeholder = args[0]
val equals = args[1].toDoubleOrNull() ?: return false
return PlaceholderManager.translatePlaceholders(placeholder, player).toDoubleOrNull() ?: 0.0 < equals
return (PlaceholderManager.translatePlaceholders(placeholder, player).toDoubleOrNull() ?: 0.0) < equals
}
}

View File

@@ -1,10 +0,0 @@
group 'com.willfp'
version rootProject.version
subprojects {
dependencies {
compileOnly project(':eco-core:core-proxy')
compileOnly project(':eco-core:core-plugin')
compileOnly project(':eco-core:core-backend')
}
}

View File

@@ -0,0 +1,12 @@
group = "com.willfp"
version = rootProject.version
subprojects {
dependencies {
compileOnly(project(":eco-core:core-proxy"))
compileOnly(project(":eco-core:core-plugin"))
compileOnly(project(":eco-core:core-backend"))
// libraries.minecraft.net machine broke
compileOnly("com.github.Mojang:brigadier:1.0.18")
}
}

View File

@@ -3,6 +3,4 @@ version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT'
compileOnly 'net.kyori:adventure-api:4.9.1'
compileOnly 'net.kyori:adventure-text-serializer-gson:4.8.1'
}

View File

@@ -1,10 +1,9 @@
package com.willfp.eco.proxy.v1_16_R3
import com.willfp.eco.proxy.AutoCraftProxy
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.internal.spigot.proxy.AutoCraftProxy
import net.minecraft.server.v1_16_R3.MinecraftKey
import net.minecraft.server.v1_16_R3.PacketPlayOutAutoRecipe
class AutoCraft : AutoCraftProxy {
@Throws(NoSuchFieldException::class, IllegalAccessException::class)
override fun modifyPacket(packet: Any) {
val recipePacket = packet as PacketPlayOutAutoRecipe
val fKey = recipePacket.javaClass.getDeclaredField("b")

View File

@@ -1,5 +1,5 @@
package com.willfp.eco.proxy.v1_16_R3
import com.willfp.eco.proxy.BlockBreakProxy
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.internal.spigot.proxy.BlockBreakProxy
import net.minecraft.server.v1_16_R3.BlockPosition
import org.bukkit.block.Block
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer

View File

@@ -1,7 +1,7 @@
package com.willfp.eco.proxy.v1_16_R3
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.core.display.Display
import com.willfp.eco.proxy.ChatComponentProxy
import com.willfp.eco.internal.spigot.proxy.ChatComponentProxy
import net.kyori.adventure.nbt.api.BinaryTagHolder
import net.kyori.adventure.text.BuildableComponent
import net.kyori.adventure.text.Component

View File

@@ -1,7 +1,7 @@
package com.willfp.eco.proxy.v1_16_R3
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.proxy.FastItemStackFactoryProxy
import com.willfp.eco.proxy.v1_16_R3.fast.NMSFastItemStack
import com.willfp.eco.internal.spigot.proxy.FastItemStackFactoryProxy
import com.willfp.eco.internal.spigot.proxy.v1_16_R3.fast.NMSFastItemStack
import org.bukkit.inventory.ItemStack
class FastItemStackFactory : FastItemStackFactoryProxy {

View File

@@ -1,12 +1,12 @@
package com.willfp.eco.proxy.v1_16_R3
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.mojang.authlib.GameProfile
import com.mojang.authlib.properties.Property
import com.willfp.eco.proxy.SkullProxy
import com.willfp.eco.internal.spigot.proxy.SkullProxy
import org.bukkit.inventory.meta.SkullMeta
import java.lang.reflect.Field
import java.lang.reflect.Method
import java.util.*
import java.util.UUID
class Skull : SkullProxy {
private lateinit var setProfile: Method

View File

@@ -1,6 +1,6 @@
package com.willfp.eco.proxy.v1_16_R3
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.proxy.TPSProxy
import com.willfp.eco.internal.spigot.proxy.TPSProxy
import org.bukkit.Bukkit
import org.bukkit.craftbukkit.v1_16_R3.CraftServer

View File

@@ -1,6 +1,6 @@
package com.willfp.eco.proxy.v1_16_R3
package com.willfp.eco.internal.spigot.proxy.v1_16_R3
import com.willfp.eco.core.display.Display
import com.willfp.eco.proxy.VillagerTradeProxy
import com.willfp.eco.internal.spigot.proxy.VillagerTradeProxy
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMerchantRecipe
import org.bukkit.entity.Player
import org.bukkit.inventory.MerchantRecipe

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.proxy.v1_16_R3.fast
package com.willfp.eco.internal.spigot.proxy.v1_16_R3.fast
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack
import org.bukkit.inventory.ItemStack

View File

@@ -1,8 +1,14 @@
package com.willfp.eco.proxy.v1_16_R3.fast
package com.willfp.eco.internal.spigot.proxy.v1_16_R3.fast
import com.willfp.eco.internal.fast.EcoFastItemStack
import com.willfp.eco.util.StringUtils
import net.minecraft.server.v1_16_R3.*
import net.minecraft.server.v1_16_R3.Item
import net.minecraft.server.v1_16_R3.ItemEnchantedBook
import net.minecraft.server.v1_16_R3.ItemStack
import net.minecraft.server.v1_16_R3.Items
import net.minecraft.server.v1_16_R3.NBTTagCompound
import net.minecraft.server.v1_16_R3.NBTTagList
import net.minecraft.server.v1_16_R3.NBTTagString
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack
import org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey
@@ -82,7 +88,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
}
private fun getLoreJSON(): List<String> {
val displayTag = handle.a("display")
val displayTag = handle.b("display") ?: return emptyList()
return if (displayTag.hasKey("Lore")) {
val loreTag = displayTag.getList("Lore", CraftMagicNumbers.NBT.TAG_STRING)
val lore: MutableList<String> = ArrayList(loreTag.size)
@@ -91,7 +97,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
}
lore
} else {
ArrayList()
emptyList()
}
}
@@ -159,7 +165,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
}
override fun hashCode(): Int {
return handle.tag.hashCode() * 31 + Item.getId(handle.item)
return handle.tag?.hashCode() ?: (0b00010101 * 31 + Item.getId(handle.item))
}
private fun apply() {

View File

@@ -1,31 +0,0 @@
plugins {
id 'xyz.jpenilla.special-gradle' version '1.0.0-SNAPSHOT'
}
group 'com.willfp'
version rootProject.version
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang'
compileOnly 'net.kyori:adventure-api:4.9.1'
compileOnly 'net.kyori:adventure-text-serializer-gson:4.8.1'
}
specialGradle {
minecraftVersion.set("1.17")
specialSourceVersion.set("1.10.0")
}
buildTools {
quiet.set(true);
}
configurations.create('mapped')
artifacts {
mapped jar.outputs.files.files.toArray()[0]
}
productionMappedJar.mustRunAfter(clean)
productionMappedJar.mustRunAfter(compileKotlin)
build.dependsOn productionMappedJar

View File

@@ -0,0 +1,16 @@
plugins {
id("io.papermc.paperweight.userdev") version "1.2.0"
}
group = "com.willfp"
version = rootProject.version
dependencies {
paperDevBundle("1.17.1-R0.1-SNAPSHOT")
}
tasks {
build {
dependsOn(reobfJar)
}
}

View File

@@ -1,11 +1,10 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.internal.spigot.proxy.AutoCraftProxy
import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket
import net.minecraft.resources.ResourceLocation
import com.willfp.eco.proxy.AutoCraftProxy
class AutoCraft : AutoCraftProxy {
@Throws(NoSuchFieldException::class, IllegalAccessException::class)
override fun modifyPacket(packet: Any) {
val recipePacket = packet as ClientboundPlaceGhostRecipePacket
val fKey = recipePacket.javaClass.getDeclaredField("b")

View File

@@ -1,8 +1,8 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.internal.spigot.proxy.BlockBreakProxy
import org.bukkit.block.Block
import org.bukkit.entity.Player
import com.willfp.eco.proxy.BlockBreakProxy
class BlockBreak : BlockBreakProxy {
override fun breakBlock(

View File

@@ -1,7 +1,7 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.core.display.Display
import com.willfp.eco.proxy.ChatComponentProxy
import com.willfp.eco.internal.spigot.proxy.ChatComponentProxy
import net.kyori.adventure.nbt.api.BinaryTagHolder
import net.kyori.adventure.text.BuildableComponent
import net.kyori.adventure.text.Component

View File

@@ -1,9 +1,9 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.proxy.v1_17_R1.fast.NMSFastItemStack
import com.willfp.eco.internal.spigot.proxy.v1_17_R1.fast.NMSFastItemStack
import com.willfp.eco.internal.spigot.proxy.FastItemStackFactoryProxy
import org.bukkit.inventory.ItemStack
import com.willfp.eco.proxy.FastItemStackFactoryProxy
class FastItemStackFactory : FastItemStackFactoryProxy {
override fun create(itemStack: ItemStack): FastItemStack {

View File

@@ -1,12 +1,12 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.mojang.authlib.GameProfile
import com.mojang.authlib.properties.Property
import com.willfp.eco.proxy.SkullProxy
import com.willfp.eco.internal.spigot.proxy.SkullProxy
import org.bukkit.inventory.meta.SkullMeta
import java.lang.reflect.Field
import java.lang.reflect.Method
import java.util.*
import java.util.UUID
class Skull : SkullProxy {
private lateinit var setProfile: Method

View File

@@ -1,6 +1,6 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.proxy.TPSProxy
import com.willfp.eco.internal.spigot.proxy.TPSProxy
import org.bukkit.Bukkit
import org.bukkit.craftbukkit.v1_17_R1.CraftServer

View File

@@ -1,7 +1,7 @@
package com.willfp.eco.proxy.v1_17_R1
package com.willfp.eco.internal.spigot.proxy.v1_17_R1
import com.willfp.eco.core.display.Display
import com.willfp.eco.proxy.VillagerTradeProxy
import com.willfp.eco.internal.spigot.proxy.VillagerTradeProxy
import net.minecraft.world.item.trading.MerchantOffer
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMerchantRecipe
import org.bukkit.entity.Player

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.proxy.v1_17_R1.fast
package com.willfp.eco.internal.spigot.proxy.v1_17_R1.fast
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack
import org.bukkit.inventory.ItemStack

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.proxy.v1_17_R1.fast
package com.willfp.eco.internal.spigot.proxy.v1_17_R1.fast
import com.willfp.eco.internal.fast.EcoFastItemStack
import com.willfp.eco.util.StringUtils
@@ -101,7 +101,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
}
private fun getLoreJSON(): List<String> {
val displayTag = handle.getOrCreateTagElement("display")
val displayTag = handle.getTagElement("display") ?: return emptyList()
return if (displayTag.contains("Lore")) {
val loreTag = displayTag.getList("Lore", CraftMagicNumbers.NBT.TAG_STRING)
val lore: MutableList<String> = ArrayList(loreTag.size)
@@ -112,7 +112,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
lore
} else {
ArrayList()
emptyList()
}
}
@@ -180,7 +180,7 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS
}
override fun hashCode(): Int {
return handle.tag.hashCode() * 31 + Item.getId(handle.item)
return handle.tag?.hashCode() ?: (0b00010101 * 31 + Item.getId(handle.item))
}
private fun apply() {

View File

@@ -0,0 +1,6 @@
group = "com.willfp"
version = rootProject.version
dependencies {
implementation(files("./impl.jar"))
}

Binary file not shown.

View File

@@ -2,20 +2,16 @@ group 'com.willfp'
version rootProject.version
dependencies {
implementation 'org.bstats:bstats-bukkit:1.7'
implementation('net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT') {
exclude group: 'net.kyori', module: 'adventure-api'
}
compileOnly 'net.kyori:adventure-platform-bukkit:4.0.0'
compileOnly 'net.kyori:adventure-api:4.9.2'
compileOnly 'net.kyori:adventure-text-serializer-gson:4.9.2'
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.9.2'
compileOnly 'org.apache.maven:maven-artifact:3.8.1'
compileOnly 'com.google.code.gson:gson:2.8.8'
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly project(":eco-core:core-proxy")
compileOnly project(":eco-core:core-backend")
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.1-SNAPSHOT'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT'
compileOnly 'com.github.TechFortress:GriefPrevention:16.17.1'
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.5.10'
@@ -30,9 +26,9 @@ dependencies {
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
compileOnly 'com.arcaniax:HeadDatabase-API:1.3.0'
compileOnly 'org.jetbrains.exposed:exposed-core:0.35.1'
compileOnly 'org.jetbrains.exposed:exposed-dao:0.35.1'
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.35.1'
compileOnly 'org.jetbrains.exposed:exposed-core:0.36.2'
compileOnly 'org.jetbrains.exposed:exposed-dao:0.36.2'
compileOnly 'org.jetbrains.exposed:exposed-jdbc:0.36.2'
compileOnly 'mysql:mysql-connector-java:8.0.25'
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
@@ -41,6 +37,9 @@ dependencies {
compileOnly 'world.bentobox:bentobox:1.17.3-SNAPSHOT'
compileOnly 'com.google.guava:guava:31.0.1-jre'
compileOnly 'com.iridium:IridiumSkyblock:3.1.2'
compileOnly 'com.github.WillFP:CrashClaim:1.0.19'
compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:1.7.8.1'
compileOnly 'com.github.decentsoftware-eu:decentholograms:2.1.2'
// CombatLogX V10 + NewbieHelper Expansion
compileOnly 'com.SirBlobman.combatlogx:CombatLogX-API:10.0.0.0-SNAPSHOT'

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.recipes;
package com.willfp.eco.internal.spigot.recipes;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;

View File

@@ -1,24 +1,9 @@
package com.willfp.eco.spigot
package com.willfp.eco.internal.spigot
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.Handler
import com.willfp.eco.core.config.updating.ConfigHandler
import com.willfp.eco.core.config.wrapper.ConfigFactory
import com.willfp.eco.core.data.PlayerProfileHandler
import com.willfp.eco.core.data.keys.KeyRegistry
import com.willfp.eco.core.drops.DropQueueFactory
import com.willfp.eco.core.events.EventManager
import com.willfp.eco.core.extensions.ExtensionLoader
import com.willfp.eco.core.factory.MetadataValueFactory
import com.willfp.eco.core.factory.NamespacedKeyFactory
import com.willfp.eco.core.factory.RunnableFactory
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.core.gui.GUIFactory
import com.willfp.eco.core.integrations.placeholder.PlaceholderIntegration
import com.willfp.eco.core.proxy.Cleaner
import com.willfp.eco.core.proxy.ProxyFactory
import com.willfp.eco.core.requirement.RequirementFactory
import com.willfp.eco.core.scheduling.Scheduler
import com.willfp.eco.internal.EcoCleaner
import com.willfp.eco.internal.Plugins
import com.willfp.eco.internal.config.EcoConfigFactory
@@ -35,18 +20,18 @@ import com.willfp.eco.internal.logging.EcoLogger
import com.willfp.eco.internal.proxy.EcoProxyFactory
import com.willfp.eco.internal.requirement.EcoRequirementFactory
import com.willfp.eco.internal.scheduling.EcoScheduler
import com.willfp.eco.proxy.FastItemStackFactoryProxy
import com.willfp.eco.spigot.data.EcoKeyRegistry
import com.willfp.eco.spigot.data.EcoPlayerProfileHandler
import com.willfp.eco.spigot.data.storage.MySQLDataHandler
import com.willfp.eco.spigot.data.storage.YamlDataHandler
import com.willfp.eco.spigot.integrations.bstats.MetricHandler
import com.willfp.eco.internal.spigot.data.EcoKeyRegistry
import com.willfp.eco.internal.spigot.data.EcoPlayerProfileHandler
import com.willfp.eco.internal.spigot.data.storage.MySQLDataHandler
import com.willfp.eco.internal.spigot.data.storage.YamlDataHandler
import com.willfp.eco.internal.spigot.integrations.bstats.MetricHandler
import com.willfp.eco.internal.spigot.proxy.FastItemStackFactoryProxy
import net.kyori.adventure.platform.bukkit.BukkitAudiences
import org.bukkit.inventory.ItemStack
import java.util.logging.Logger
@Suppress("UNUSED")
class EcoHandler : EcoSpigotPlugin(), Handler {
class EcoHandler : com.willfp.eco.internal.spigot.EcoSpigotPlugin(), Handler {
private val cleaner = EcoCleaner()
private val requirementFactory = EcoRequirementFactory()
private var adventure: BukkitAudiences? = null
@@ -56,31 +41,31 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
MySQLDataHandler(this) else YamlDataHandler(this)
)
override fun createScheduler(plugin: EcoPlugin): Scheduler {
override fun createScheduler(plugin: EcoPlugin): EcoScheduler {
return EcoScheduler(plugin)
}
override fun createEventManager(plugin: EcoPlugin): EventManager {
override fun createEventManager(plugin: EcoPlugin): EcoEventManager {
return EcoEventManager(plugin)
}
override fun createNamespacedKeyFactory(plugin: EcoPlugin): NamespacedKeyFactory {
override fun createNamespacedKeyFactory(plugin: EcoPlugin): EcoNamespacedKeyFactory {
return EcoNamespacedKeyFactory(plugin)
}
override fun createMetadataValueFactory(plugin: EcoPlugin): MetadataValueFactory {
override fun createMetadataValueFactory(plugin: EcoPlugin): EcoMetadataValueFactory {
return EcoMetadataValueFactory(plugin)
}
override fun createRunnableFactory(plugin: EcoPlugin): RunnableFactory {
override fun createRunnableFactory(plugin: EcoPlugin): EcoRunnableFactory {
return EcoRunnableFactory(plugin)
}
override fun createExtensionLoader(plugin: EcoPlugin): ExtensionLoader {
override fun createExtensionLoader(plugin: EcoPlugin): EcoExtensionLoader {
return EcoExtensionLoader(plugin)
}
override fun createConfigHandler(plugin: EcoPlugin): ConfigHandler {
override fun createConfigHandler(plugin: EcoPlugin): EcoConfigHandler {
return EcoConfigHandler(plugin)
}
@@ -96,23 +81,23 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
return this
}
override fun getConfigFactory(): ConfigFactory {
override fun getConfigFactory(): EcoConfigFactory {
return EcoConfigFactory()
}
override fun getDropQueueFactory(): DropQueueFactory {
override fun getDropQueueFactory(): EcoDropQueueFactory {
return EcoDropQueueFactory()
}
override fun getGUIFactory(): GUIFactory {
override fun getGUIFactory(): EcoGUIFactory {
return EcoGUIFactory()
}
override fun getCleaner(): Cleaner {
override fun getCleaner(): EcoCleaner {
return cleaner
}
override fun createProxyFactory(plugin: EcoPlugin): ProxyFactory {
override fun createProxyFactory(plugin: EcoPlugin): EcoProxyFactory {
return EcoProxyFactory(plugin)
}
@@ -133,10 +118,10 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
}
override fun registerBStats(plugin: EcoPlugin) {
MetricHandler.createMetrics(plugin, this.ecoPlugin)
MetricHandler.createMetrics(plugin)
}
override fun getRequirementFactory(): RequirementFactory {
override fun getRequirementFactory(): EcoRequirementFactory {
return requirementFactory
}
@@ -144,11 +129,11 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
return adventure
}
override fun getKeyRegistry(): KeyRegistry {
override fun getKeyRegistry(): EcoKeyRegistry {
return keyRegistry
}
override fun getPlayerProfileHandler(): PlayerProfileHandler {
override fun getPlayerProfileHandler(): EcoPlayerProfileHandler {
return playerProfileHandler
}

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot
package com.willfp.eco.internal.spigot
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.Eco
@@ -15,42 +15,70 @@ import com.willfp.eco.core.integrations.hologram.HologramManager
import com.willfp.eco.core.integrations.mcmmo.McmmoManager
import com.willfp.eco.core.integrations.shop.ShopManager
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.args.EnchantmentArgParser
import com.willfp.eco.core.items.args.TextureArgParser
import com.willfp.eco.internal.display.EcoDisplayHandler
import com.willfp.eco.internal.drops.DropManager
import com.willfp.eco.proxy.BlockBreakProxy
import com.willfp.eco.proxy.FastItemStackFactoryProxy
import com.willfp.eco.proxy.SkullProxy
import com.willfp.eco.proxy.TPSProxy
import com.willfp.eco.spigot.arrows.ArrowDataListener
import com.willfp.eco.spigot.data.DataListener
import com.willfp.eco.spigot.data.PlayerBlockListener
import com.willfp.eco.spigot.data.storage.ProfileSaver
import com.willfp.eco.spigot.display.*
import com.willfp.eco.spigot.display.frame.clearFrames
import com.willfp.eco.spigot.drops.CollatedRunnable
import com.willfp.eco.spigot.eventlisteners.EntityDeathByEntityListeners
import com.willfp.eco.spigot.eventlisteners.NaturalExpGainListeners
import com.willfp.eco.spigot.eventlisteners.PlayerJumpListeners
import com.willfp.eco.spigot.eventlisteners.armor.ArmorChangeEventListeners
import com.willfp.eco.spigot.eventlisteners.armor.ArmorListener
import com.willfp.eco.spigot.gui.GUIListener
import com.willfp.eco.spigot.integrations.afk.AFKIntegrationCMI
import com.willfp.eco.spigot.integrations.afk.AFKIntegrationEssentials
import com.willfp.eco.spigot.integrations.anticheat.*
import com.willfp.eco.spigot.integrations.antigrief.*
import com.willfp.eco.spigot.integrations.customitems.CustomItemsHeadDatabase
import com.willfp.eco.spigot.integrations.customitems.CustomItemsItemsAdder
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
import com.willfp.eco.spigot.integrations.economy.EconomyVault
import com.willfp.eco.spigot.integrations.hologram.HologramCMI
import com.willfp.eco.spigot.integrations.hologram.HologramGHolo
import com.willfp.eco.spigot.integrations.hologram.HologramHolographicDisplays
import com.willfp.eco.spigot.integrations.mcmmo.McmmoIntegrationImpl
import com.willfp.eco.spigot.integrations.multiverseinventories.MultiverseInventoriesIntegration
import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus
import com.willfp.eco.spigot.recipes.ShapedRecipeListener
import com.willfp.eco.internal.items.ArgParserColor
import com.willfp.eco.internal.items.ArgParserCustomModelData
import com.willfp.eco.internal.items.ArgParserEnchantment
import com.willfp.eco.internal.items.ArgParserFlag
import com.willfp.eco.internal.items.ArgParserName
import com.willfp.eco.internal.items.ArgParserTexture
import com.willfp.eco.internal.items.ArgParserUnbreakable
import com.willfp.eco.internal.spigot.arrows.ArrowDataListener
import com.willfp.eco.internal.spigot.data.DataListener
import com.willfp.eco.internal.spigot.data.PlayerBlockListener
import com.willfp.eco.internal.spigot.data.storage.ProfileSaver
import com.willfp.eco.internal.spigot.display.PacketAutoRecipe
import com.willfp.eco.internal.spigot.display.PacketChat
import com.willfp.eco.internal.spigot.display.PacketHeldWindowItems
import com.willfp.eco.internal.spigot.display.PacketOpenWindowMerchant
import com.willfp.eco.internal.spigot.display.PacketSetCreativeSlot
import com.willfp.eco.internal.spigot.display.PacketSetSlot
import com.willfp.eco.internal.spigot.display.PacketWindowItems
import com.willfp.eco.internal.spigot.display.frame.clearFrames
import com.willfp.eco.internal.spigot.drops.CollatedRunnable
import com.willfp.eco.internal.spigot.eventlisteners.EntityDeathByEntityListeners
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListeners
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListeners
import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorChangeEventListeners
import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorListener
import com.willfp.eco.internal.spigot.gui.GUIListener
import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationCMI
import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationEssentials
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAAC
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAlice
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatMatrix
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatNCP
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatSpartan
import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatVulcan
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefBentoBox
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV10
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV11
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCrashClaim
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefDeluxeCombat
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefFactionsUUID
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefGriefPrevention
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefIridiumSkyblock
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefKingdoms
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefLands
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefSuperiorSkyblock2
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefTowny
import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefWorldGuard
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsHeadDatabase
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsOraxen
import com.willfp.eco.internal.spigot.integrations.economy.EconomyVault
import com.willfp.eco.internal.spigot.integrations.hologram.HologramCMI
import com.willfp.eco.internal.spigot.integrations.hologram.HologramDecentHolograms
import com.willfp.eco.internal.spigot.integrations.hologram.HologramHolographicDisplays
import com.willfp.eco.internal.spigot.integrations.mcmmo.McmmoIntegrationImpl
import com.willfp.eco.internal.spigot.integrations.multiverseinventories.MultiverseInventoriesIntegration
import com.willfp.eco.internal.spigot.integrations.shop.ShopShopGuiPlus
import com.willfp.eco.internal.spigot.proxy.BlockBreakProxy
import com.willfp.eco.internal.spigot.proxy.FastItemStackFactoryProxy
import com.willfp.eco.internal.spigot.proxy.SkullProxy
import com.willfp.eco.internal.spigot.proxy.TPSProxy
import com.willfp.eco.internal.spigot.recipes.ShapedRecipeListener
import com.willfp.eco.util.BlockUtils
import com.willfp.eco.util.ServerUtils
import com.willfp.eco.util.SkullUtils
@@ -64,12 +92,17 @@ import org.bukkit.inventory.ItemStack
abstract class EcoSpigotPlugin : EcoPlugin(
773,
10043,
"com.willfp.eco.proxy",
"com.willfp.eco.internal.spigot.proxy",
"&a"
) {
init {
Items.registerArgParser(EnchantmentArgParser())
Items.registerArgParser(TextureArgParser())
Items.registerArgParser(ArgParserEnchantment())
Items.registerArgParser(ArgParserColor())
Items.registerArgParser(ArgParserTexture())
Items.registerArgParser(ArgParserCustomModelData())
Items.registerArgParser(ArgParserFlag())
Items.registerArgParser(ArgParserUnbreakable())
Items.registerArgParser(ArgParserName())
val skullProxy = getProxy(SkullProxy::class.java)
SkullUtils.initialize(
@@ -154,6 +187,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
IntegrationLoader("Towny") { AntigriefManager.register(AntigriefTowny()) },
IntegrationLoader("Lands") { AntigriefManager.register(AntigriefLands(this)) },
IntegrationLoader("Kingdoms") { AntigriefManager.register(AntigriefKingdoms()) },
IntegrationLoader("CrashClaim") { AntigriefManager.register(AntigriefCrashClaim()) },
IntegrationLoader("CombatLogX") {
val pluginManager = Bukkit.getPluginManager()
val combatLogXPlugin = pluginManager.getPlugin("CombatLogX") ?: return@IntegrationLoader
@@ -185,7 +219,8 @@ abstract class EcoSpigotPlugin : EcoPlugin(
// Hologram
IntegrationLoader("HolographicDisplays") { HologramManager.register(HologramHolographicDisplays(this)) },
IntegrationLoader("CMI") { HologramManager.register(HologramCMI()) },
IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
IntegrationLoader("DecentHolograms") { HologramManager.register(HologramDecentHolograms()) },
//IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
// AFK
IntegrationLoader("Essentials") { AFKManager.register(AFKIntegrationEssentials()) },
@@ -216,6 +251,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
PacketSetCreativeSlot(this),
PacketSetSlot(this),
PacketWindowItems(this),
PacketHeldWindowItems(this),
PacketOpenWindowMerchant(this)
)
}
@@ -230,7 +266,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
GUIListener(this),
ArrowDataListener(this),
ArmorChangeEventListeners(this),
DataListener(),
DataListener(this),
PlayerBlockListener(this)
)
}

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.arrows
package com.willfp.eco.internal.spigot.arrows
import com.willfp.eco.core.EcoPlugin
import org.bukkit.Material

View File

@@ -1,6 +1,7 @@
package com.willfp.eco.spigot.data
package com.willfp.eco.internal.spigot.data
import com.willfp.eco.core.Eco
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.util.PlayerUtils
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
@@ -8,16 +9,19 @@ import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.event.player.PlayerLoginEvent
import org.bukkit.event.player.PlayerQuitEvent
class DataListener : Listener {
class DataListener(
private val plugin: EcoPlugin
) : Listener {
@EventHandler
fun onLeave(event: PlayerQuitEvent) {
PlayerUtils.updateSavedDisplayName(event.player)
Eco.getHandler().playerProfileHandler.unloadPlayer(event.player.uniqueId)
}
@EventHandler
fun onJoin(event: PlayerJoinEvent) {
PlayerUtils.updateSavedDisplayName(event.player)
plugin.scheduler.runLater({
PlayerUtils.updateSavedDisplayName(event.player)
}, 5)
}
@EventHandler

View File

@@ -1,10 +1,10 @@
package com.willfp.eco.spigot.data
package com.willfp.eco.internal.spigot.data
import com.willfp.eco.core.Eco
import com.willfp.eco.core.data.keys.KeyRegistry
import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.core.data.keys.PersistentDataKeyType
import com.willfp.eco.spigot.EcoSpigotPlugin
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
import org.bukkit.NamespacedKey
class EcoKeyRegistry(

View File

@@ -1,10 +1,10 @@
package com.willfp.eco.spigot.data
package com.willfp.eco.internal.spigot.data
import com.willfp.eco.core.data.PlayerProfile
import com.willfp.eco.core.data.PlayerProfileHandler
import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.internal.data.EcoPlayerProfile
import com.willfp.eco.spigot.data.storage.DataHandler
import com.willfp.eco.internal.spigot.data.storage.DataHandler
import java.util.UUID
class EcoPlayerProfileHandler(

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.data
package com.willfp.eco.internal.spigot.data
import com.willfp.eco.core.EcoPlugin
import org.bukkit.block.Block

View File

@@ -1,8 +1,8 @@
package com.willfp.eco.spigot.data.storage
package com.willfp.eco.internal.spigot.data.storage
import com.willfp.eco.core.data.keys.PersistentDataKey
import org.bukkit.NamespacedKey
import java.util.*
import java.util.UUID
interface DataHandler {
fun save() {

View File

@@ -1,17 +1,29 @@
package com.willfp.eco.spigot.data.storage
package com.willfp.eco.internal.spigot.data.storage
import com.google.common.util.concurrent.ThreadFactoryBuilder
import com.willfp.eco.core.Eco
import com.willfp.eco.core.data.PlayerProfile
import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.core.data.keys.PersistentDataKeyType
import com.willfp.eco.spigot.EcoSpigotPlugin
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
import org.apache.logging.log4j.Level
import org.bukkit.NamespacedKey
import org.jetbrains.exposed.dao.id.UUIDTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.BooleanColumnType
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.DoubleColumnType
import org.jetbrains.exposed.sql.IntegerColumnType
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.VarCharColumnType
import org.jetbrains.exposed.sql.exposedLogger
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
import java.util.*
import org.jetbrains.exposed.sql.update
import java.util.UUID
import java.util.concurrent.Callable
import java.util.concurrent.Executors
@Suppress("UNCHECKED_CAST")
@@ -20,7 +32,7 @@ class MySQLDataHandler(
) : DataHandler {
private val columns = mutableMapOf<String, Column<*>>()
private val threadFactory = ThreadFactoryBuilder().setNameFormat("eco-mysql-thread-%d").build()
private val executor = Executors.newCachedThreadPool(threadFactory)
private val executor = Executors.newFixedThreadPool(plugin.configYml.getInt("mysql.threads"), threadFactory)
init {
Database.connect(
@@ -38,13 +50,17 @@ class MySQLDataHandler(
}
// Get Exposed to shut the hell up
exposedLogger::class.java.getDeclaredField("logger").apply { isAccessible = true }
.apply {
get(exposedLogger).apply {
this.javaClass.getDeclaredMethod("setLevel", Level::class.java)
.invoke(this, Level.OFF)
try {
exposedLogger::class.java.getDeclaredField("logger").apply { isAccessible = true }
.apply {
get(exposedLogger).apply {
this.javaClass.getDeclaredMethod("setLevel", Level::class.java)
.invoke(this, Level.OFF)
}
}
}
} catch (e: Exception) {
Eco.getHandler().ecoPlugin.logger.warning("Failed to silence Exposed logger! You might get some console spam")
}
}
override fun updateKeys() {
@@ -53,7 +69,7 @@ class MySQLDataHandler(
registerColumn(key, Players)
}
SchemaUtils.createMissingTablesAndColumns(Players)
SchemaUtils.createMissingTablesAndColumns(Players, withLogs = false)
}
}
@@ -99,13 +115,21 @@ class MySQLDataHandler(
}
override fun <T> read(uuid: UUID, key: NamespacedKey): T? {
var value: T? = null
transaction {
val player = getPlayer(uuid)
value = player[getColumn(key.toString())] as T?
val doRead = Callable<T?> {
var value: T? = null
transaction {
val player = getPlayer(uuid)
value = player[getColumn(key.toString())] as T?
}
return@Callable value
}
return value
return if (Eco.getHandler().ecoPlugin.configYml.getBool("mysql.async-reads")) {
executor.submit(doRead).get()
} else {
doRead.call()
}
}
object Players : UUIDTable("eco_players")

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.data.storage
package com.willfp.eco.internal.spigot.data.storage
import com.willfp.eco.core.Eco
import com.willfp.eco.core.EcoPlugin

View File

@@ -1,11 +1,11 @@
package com.willfp.eco.spigot.data.storage
package com.willfp.eco.internal.spigot.data.storage
import com.willfp.eco.core.config.yaml.YamlBaseConfig
import com.willfp.eco.core.data.PlayerProfile
import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.spigot.EcoSpigotPlugin
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
import org.bukkit.NamespacedKey
import java.util.*
import java.util.UUID
@Suppress("UNCHECKED_CAST")
class YamlDataHandler(

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.ProtocolLibrary
@@ -6,7 +6,7 @@ import com.comphenix.protocol.events.PacketContainer
import com.comphenix.protocol.events.PacketEvent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.proxy.AutoCraftProxy
import com.willfp.eco.internal.spigot.proxy.AutoCraftProxy
import org.bukkit.entity.Player
import java.lang.reflect.InvocationTargetException
@@ -24,11 +24,7 @@ class PacketAutoRecipe(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packet
if (packet.minecraftKeys.values[0].fullKey.split(":".toRegex()).toTypedArray()[1].contains("displayed")) {
return
}
try {
getPlugin().getProxy(AutoCraftProxy::class.java).modifyPacket(packet.handle)
} catch (e: Exception) {
e.printStackTrace()
}
getPlugin().getProxy(AutoCraftProxy::class.java).modifyPacket(packet.handle)
val newAutoRecipe = PacketContainer(PacketType.Play.Server.AUTO_RECIPE)
newAutoRecipe.minecraftKeys.write(0, packet.minecraftKeys.read(0))
try {

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.ListenerPriority
@@ -7,7 +7,7 @@ import com.comphenix.protocol.events.PacketEvent
import com.comphenix.protocol.wrappers.WrappedChatComponent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.proxy.ChatComponentProxy
import com.willfp.eco.internal.spigot.proxy.ChatComponentProxy
import org.bukkit.entity.Player
class PacketChat(plugin: EcoPlugin) :

View File

@@ -0,0 +1,29 @@
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.PacketContainer
import com.comphenix.protocol.events.PacketEvent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.Prerequisite
import com.willfp.eco.core.display.Display
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
class PacketHeldWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, PacketType.Play.Server.WINDOW_ITEMS, false) {
override fun onSend(
packet: PacketContainer,
player: Player,
event: PacketEvent
) {
if (!Prerequisite.HAS_1_17.isMet) {
return
}
packet.itemModifier.modify(0) { item: ItemStack? ->
Display.display(
item!!, player
)
}
}
}

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.ListenerPriority
@@ -6,7 +6,7 @@ import com.comphenix.protocol.events.PacketContainer
import com.comphenix.protocol.events.PacketEvent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.proxy.VillagerTradeProxy
import com.willfp.eco.internal.spigot.proxy.VillagerTradeProxy
import com.willfp.eco.util.NamespacedKeyUtils
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemFlag

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.PacketContainer
@@ -6,8 +6,8 @@ import com.comphenix.protocol.events.PacketEvent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.display.Display
import com.willfp.eco.spigot.display.frame.DisplayFrame
import com.willfp.eco.spigot.display.frame.lastDisplayFrame
import com.willfp.eco.internal.spigot.display.frame.DisplayFrame
import com.willfp.eco.internal.spigot.display.frame.lastDisplayFrame
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.PacketContainer
@@ -6,8 +6,8 @@ import com.comphenix.protocol.events.PacketEvent
import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.display.Display
import com.willfp.eco.spigot.display.frame.DisplayFrame
import com.willfp.eco.spigot.display.frame.lastDisplayFrame
import com.willfp.eco.internal.spigot.display.frame.DisplayFrame
import com.willfp.eco.internal.spigot.display.frame.lastDisplayFrame
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.display
package com.willfp.eco.internal.spigot.display
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.ProtocolLibrary
@@ -9,9 +9,9 @@ import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.display.Display
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.spigot.display.frame.DisplayFrame
import com.willfp.eco.spigot.display.frame.HashedItem
import com.willfp.eco.spigot.display.frame.lastDisplayFrame
import com.willfp.eco.internal.spigot.display.frame.DisplayFrame
import com.willfp.eco.internal.spigot.display.frame.HashedItem
import com.willfp.eco.internal.spigot.display.frame.lastDisplayFrame
import com.willfp.eco.util.ServerUtils
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
@@ -47,10 +47,11 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
handleRateLimit(player)
if (usingAsync(player)) {
val newPacket = packet.shallowClone()
fun modifyAndSend(itemStacks: MutableList<ItemStack>, windowId: Int, player: Player) {
modifyWindowItems(itemStacks, windowId, player)
val newPacket = packet.deepClone()
newPacket.itemListModifier.write(0, itemStacks)
ignorePacketList.add(player.name)

View File

@@ -1,8 +1,8 @@
package com.willfp.eco.spigot.display.frame
package com.willfp.eco.internal.spigot.display.frame
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import java.util.*
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
data class HashedItem(val hash: Int, val item: ItemStack)

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.drops
package com.willfp.eco.internal.spigot.drops
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.internal.drops.impl.EcoDropQueue

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.eventlisteners
package com.willfp.eco.internal.spigot.eventlisteners
import com.willfp.eco.core.events.EntityDeathByEntityEvent
import org.apache.commons.lang.Validate

View File

@@ -1,4 +1,4 @@
package com.willfp.eco.spigot.eventlisteners
package com.willfp.eco.internal.spigot.eventlisteners
import com.willfp.eco.core.EcoPlugin
import org.bukkit.entity.LivingEntity

Some files were not shown because too many files have changed in this diff Show More