Compare commits

...

35 Commits

Author SHA1 Message Date
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
Auxilor
3ec1183ec3 Javadoc changes 2021-11-13 11:57:46 +00:00
Auxilor
b3e37ea717 Fixed lang.yml 2021-11-13 11:54:51 +00:00
Auxilor
9d0707a4db Merge remote-tracking branch 'origin/master' 2021-11-13 11:51:01 +00:00
Auxilor
41eee84966 Updated to 6.13.8 2021-11-13 11:50:31 +00:00
Auxilor
0f215b48bf Fixed custom items being used in shapeless vanilla recipes 2021-11-13 11:49:51 +00:00
Auxilor
abad973051 PR Codestyle 2021-11-13 11:06:03 +00:00
Auxilor
b385ebff75 Fixed IridiumSkyblock integration 2021-11-13 11:02:42 +00:00
Auxilor
f924d23feb Merge remote-tracking branch 'origin/master' into develop 2021-11-13 11:00:34 +00:00
Will FP
d603476201 Merge pull request #53
Fixed DeluxeCombat integration
2021-11-13 11:00:28 +00:00
Auxilor
b911bbce87 Updated Config string getters for more explicit formatting options 2021-11-13 11:00:08 +00:00
_OfTeN_
d2676c2af1 Fixed DeluxeCombat integration 2021-11-13 10:41:59 +03:00
25 changed files with 282 additions and 104 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 16
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 16
- 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
- uses: actions/upload-artifact@v2
with:
name: eco-dev-${{ steps.vars.outputs.sha_short }}
path: build/libs

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

@@ -11,7 +11,7 @@ dependencies {
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')
implementation project(path: ":eco-core:core-nms:v1_17_R1", configuration: "reobf")
}
allprojects {
@@ -60,10 +60,10 @@ allprojects {
}
dependencies {
compileOnly 'org.jetbrains:annotations:19.0.0'
compileOnly 'org.jetbrains:annotations:23.0.0'
// Test
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

View File

@@ -16,7 +16,7 @@ dependencies {
// 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

@@ -24,7 +24,7 @@ public class LangYml extends YamlBaseConfig {
* @return The prefix.
*/
public String getPrefix() {
return this.getString("messages.prefix");
return this.getFormattedString("messages.prefix");
}
/**
@@ -33,7 +33,7 @@ public class LangYml extends YamlBaseConfig {
* @return The message.
*/
public String getNoPermission() {
return getPrefix() + this.getString("messages.no-permission");
return getPrefix() + this.getFormattedString("messages.no-permission");
}
/**
@@ -55,6 +55,6 @@ public class LangYml extends YamlBaseConfig {
*/
public String getMessage(@NotNull final String message,
@NotNull final StringUtils.FormatOption option) {
return getPrefix() + this.getString("messages." + message, option);
return getPrefix() + this.getFormattedString("messages." + message, option);
}
}

View File

@@ -11,6 +11,7 @@ import java.util.List;
* <p>
* Contains all methods that must exist in yaml and json configurations.
*/
@SuppressWarnings("unused")
public interface Config extends Cloneable {
/**
* Clears cache.
@@ -159,8 +160,34 @@ public interface Config extends Cloneable {
@Nullable
List<Boolean> getBoolsOrNull(@NotNull String path);
/**
* Get a formatted string from config.
*
* @param path The key to fetch the value from.
* @return The found value, or an empty string if not found.
*/
@NotNull
default String getFormattedString(@NotNull String path) {
return getString(path, true);
}
/**
* Get a formatted string from config.
*
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or an empty string if not found.
*/
@NotNull
default String getFormattedString(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getString(path, true, option);
}
/**
* Get a string from config.
* <p>
* Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or an empty string if not found.
@@ -172,12 +199,13 @@ public interface Config extends Cloneable {
/**
* Get a string from config.
* <p>
* This will be deprecated when {@link Config#getString(String)} no longer formats by default.
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @return The found value, or an empty string if not found.
*/
@NotNull
default String getString(@NotNull String path,
boolean format) {
return this.getString(path, format, StringUtils.FormatOption.WITH_PLACEHOLDERS);
@@ -189,8 +217,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or an empty string if not found.
* @deprecated Use {@link Config#getFormattedString(String, StringUtils.FormatOption)} instead.
*/
@NotNull
@Deprecated
default String getString(@NotNull String path,
@NotNull final StringUtils.FormatOption option) {
return this.getString(path, true, option);
@@ -209,8 +239,34 @@ public interface Config extends Cloneable {
boolean format,
@NotNull StringUtils.FormatOption option);
/**
* Get a formatted string from config.
*
* @param path The key to fetch the value from.
* @return The found value, or an empty string if not found.
*/
@Nullable
default String getFormattedStringOrNull(@NotNull String path) {
return getStringOrNull(path, true);
}
/**
* Get a formatted string from config.
*
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or an empty string if not found.
*/
@Nullable
default String getFormattedStringOrNull(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getStringOrNull(path, true, option);
}
/**
* Get a string from config.
* <p>
* Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
@@ -222,6 +278,8 @@ public interface Config extends Cloneable {
/**
* Get a string from config.
* <p>
* This will be deprecated when {@link Config#getStringOrNull(String)} no longer formats by default.
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
@@ -239,8 +297,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or null if not found.
* @deprecated Use {@link Config#getFormattedString(String, StringUtils.FormatOption)} instead.
*/
@Nullable
@Deprecated
default String getStringOrNull(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return this.getStringOrNull(path, true, option);
@@ -251,7 +311,7 @@ public interface Config extends Cloneable {
*
* @param path The key to fetch the value from.
* @param format If the string should be formatted.
* @param option The format option.
* @param option The format option. If format is false, this will be ignored.
* @return The found value, or null if not found.
*/
@Nullable
@@ -268,12 +328,44 @@ public interface Config extends Cloneable {
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
*/
@NotNull
default List<String> getFormattedStrings(@NotNull String path) {
return getStrings(path, true, StringUtils.FormatOption.WITH_PLACEHOLDERS);
}
/**
* Get a list of strings from config.
* <p>
* Formatted by default.
*
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
*/
@NotNull
default List<String> getFormattedStrings(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getStrings(path, true, option);
}
/**
* Get a list of strings from config.
* <p>
* Formatted by default.
* <p>
* This will be changed in newer versions to <b>not</b> format by default.
*
* @param path The key to fetch the value from.
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
*/
@NotNull
default List<String> getStrings(@NotNull String path) {
return getStrings(path, true);
}
/**
* Get a list of strings from config.
* <p>
* This will be deprecated when {@link Config#getStrings(String)} no longer formats by default.
*
* @param path The key to fetch the value from.
* @param format If the strings should be formatted.
@@ -291,8 +383,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or a blank {@link java.util.ArrayList} if not found.
* @deprecated Use {@link Config#getFormattedStrings(String, StringUtils.FormatOption)} instead.
*/
@Nullable
@NotNull
@Deprecated
default List<String> getStrings(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getStrings(path, true, option);
@@ -313,6 +407,38 @@ public interface Config extends Cloneable {
/**
* Get a list of strings from config.
* <p>
* Formatted by default.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
*/
@Nullable
default List<String> getFormattedStringsOrNull(@NotNull String path) {
return getStringsOrNull(path, true, StringUtils.FormatOption.WITH_PLACEHOLDERS);
}
/**
* Get a list of strings from config.
* <p>
* Formatted by default.
*
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or null if not found.
*/
@Nullable
default List<String> getFormattedStringsOrNull(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getStringsOrNull(path, true, option);
}
/**
* Get a list of strings from config.
* <p>
* Formatted by default.
* <p>
* This will be changed in newer versions to <b>not</b> format by default.
*
* @param path The key to fetch the value from.
* @return The found value, or null if not found.
@@ -341,8 +467,10 @@ public interface Config extends Cloneable {
* @param path The key to fetch the value from.
* @param option The format option.
* @return The found value, or null if not found.
* @deprecated Use {@link Config#getFormattedStringsOrNull(String, StringUtils.FormatOption)} instead.
*/
@Nullable
@Deprecated
default List<String> getStringsOrNull(@NotNull String path,
@NotNull StringUtils.FormatOption option) {
return getStringsOrNull(path, true, option);

View File

@@ -46,7 +46,7 @@ public class Paste {
byte[] postData = contents.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 +86,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

@@ -2,7 +2,13 @@ package com.willfp.eco.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,18 @@
plugins {
id("io.papermc.paperweight.userdev") version "1.1.14"
}
group = "com.willfp"
version = rootProject.version
dependencies {
paperDevBundle("1.17.1-R0.1-SNAPSHOT")
compileOnly("net.kyori:adventure-api:4.9.1")
compileOnly("net.kyori:adventure-text-serializer-gson:4.8.1")
}
tasks {
build {
dependsOn(reobfJar)
}
}

View File

@@ -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

@@ -15,7 +15,7 @@ dependencies {
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 +30,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'

View File

@@ -10,6 +10,7 @@ import com.willfp.eco.core.recipe.parts.ModifiedTestableItem;
import com.willfp.eco.core.recipe.parts.TestableStack;
import com.willfp.eco.core.recipe.recipes.CraftingRecipe;
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
@@ -245,7 +246,7 @@ public class ShapedRecipeListener extends PluginDependent<EcoPlugin> implements
@EventHandler
public void preventUsingComplexPartInVanillaRecipe(@NotNull final PrepareItemCraftEvent event) {
if (!(event.getRecipe() instanceof ShapedRecipe recipe)) {
if (!(event.getRecipe() instanceof Keyed recipe)) {
return;
}
@@ -263,7 +264,7 @@ public class ShapedRecipeListener extends PluginDependent<EcoPlugin> implements
@EventHandler
public void preventUsingComplexPartInVanillaRecipe(@NotNull final CraftItemEvent event) {
if (!(event.getRecipe() instanceof ShapedRecipe recipe)) {
if (!(event.getRecipe() instanceof Keyed recipe)) {
return;
}

View File

@@ -9,9 +9,20 @@ import com.willfp.eco.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.Executors
@Suppress("UNCHECKED_CAST")
@@ -20,7 +31,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 +49,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 +68,7 @@ class MySQLDataHandler(
registerColumn(key, Players)
}
SchemaUtils.createMissingTablesAndColumns(Players)
SchemaUtils.createMissingTablesAndColumns(Players, withLogs = false)
}
}

View File

@@ -27,7 +27,7 @@ class AntigriefDeluxeCombat: AntigriefWrapper {
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
val api = DeluxeCombatAPI()
return when(victim) {
is Player -> (api.hasProtection(victim) || !api.hasPvPEnabled(victim)) && !api.isInCombat(victim)
is Player -> ((!api.hasProtection(victim) && api.hasPvPEnabled(victim)) || api.isInCombat(victim))
else -> true
}
}

View File

@@ -9,12 +9,12 @@ import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
class AntigriefIridiumSkyblock : AntigriefWrapper {
private val api = IridiumSkyblockAPI.getInstance()
override fun canBreakBlock(
player: Player,
block: Block
): Boolean {
val api = IridiumSkyblockAPI.getInstance() ?: return true
return api.getIslandPermission(api.getIslandViaLocation(block.location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_BREAK)
}
@@ -22,6 +22,8 @@ class AntigriefIridiumSkyblock : AntigriefWrapper {
player: Player,
location: Location
): Boolean {
val api = IridiumSkyblockAPI.getInstance() ?: return true
return api.getIslandPermission(api.getIslandViaLocation(location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_BREAK)
}
@@ -29,6 +31,8 @@ class AntigriefIridiumSkyblock : AntigriefWrapper {
player: Player,
block: Block
): Boolean {
val api = IridiumSkyblockAPI.getInstance() ?: return true
return api.getIslandPermission(api.getIslandViaLocation(block.location).orElse(null) ?: return true, api.getUser(player), PermissionType.BLOCK_PLACE)
}
@@ -36,6 +40,8 @@ class AntigriefIridiumSkyblock : AntigriefWrapper {
player: Player,
victim: LivingEntity
): Boolean {
val api = IridiumSkyblockAPI.getInstance() ?: return true
return when (victim) {
is Player -> api.getIslandViaLocation(victim.location).orElse(null) != null
else -> api.getIslandPermission(api.getIslandViaLocation(victim.location).orElse(null) ?: return true, api.getUser(player), PermissionType.KILL_MOBS)

View File

@@ -17,24 +17,32 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
}
override fun canBreakBlock(player: Player, block: Block): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) return true
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
return true
}
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Break"))
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("BREAK"))
}
override fun canCreateExplosion(player: Player, location: Location): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) return true
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
return true
}
return SuperiorSkyblockAPI.getIslandAt(location)?.isMember(SuperiorSkyblockAPI.getPlayer(player)) ?: true
}
override fun canPlaceBlock(player: Player, block: Block): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) return true
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
return true
}
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Place"))
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("PLACE"))
}
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) return true
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
return true
}
return when (victim) {
is Player -> SuperiorSkyblockAPI.getPlayer(player).canHit(SuperiorSkyblockAPI.getPlayer(victim)).equals(HitActionResult.SUCCESS)
is Animals -> {

View File

@@ -5,6 +5,10 @@
mysql:
enabled: false # Set to false, data.yml will be used instead.
# How many threads to execute statements on. Higher numbers can be faster however
# very high numbers can cause issues with OS configuration. If writes are taking
# too long, increase this value.
threads: 2
host: localhost
port: 3306
database: database

View File

@@ -45,8 +45,8 @@ libraries:
- 'net.kyori:adventure-text-serializer-gson:4.9.2'
- 'net.kyori:adventure-text-serializer-legacy:4.9.2'
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21'
- 'org.jetbrains.exposed:exposed-core:0.35.1'
- 'org.jetbrains.exposed:exposed-dao:0.35.1'
- 'org.jetbrains.exposed:exposed-jdbc:0.35.1'
- 'org.jetbrains.exposed:exposed-core:0.36.2'
- 'org.jetbrains.exposed:exposed-dao:0.36.2'
- 'org.jetbrains.exposed:exposed-jdbc:0.36.2'
- 'mysql:mysql-connector-java:8.0.25'
- 'com.google.guava:guava:31.0.1-jre'

View File

@@ -1,2 +1,2 @@
version = 6.13.7
version = 6.13.10
plugin-name = eco

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
gradlew vendored
View File

@@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath

21
gradlew.bat vendored
View File

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,21 +64,6 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
@@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View File

@@ -1,7 +1,7 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url "https://repo.jpenilla.xyz/snapshots/" }
maven { url "https://papermc.io/repo/repository/maven-public/" }
}
}