Compare commits

...

36 Commits

Author SHA1 Message Date
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
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
51 changed files with 331 additions and 162 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 {

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

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

@@ -0,0 +1,57 @@
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.
*/
public class CustomModelDataArgParser implements LookupArgParser {
@Override
public @Nullable Predicate<ItemStack> parseArguments(@NotNull final String[] args,
@NotNull final ItemMeta meta) {
Integer modelData = null;
for (String arg : args) {
String[] argSplit = arg.split(":");
if (!argSplit[0].equalsIgnoreCase("custom-model-data")) {
continue;
}
if (argSplit.length < 2) {
continue;
}
String asString = argSplit[1];
try {
modelData = Integer.parseInt(asString);
} catch (NumberFormatException e) {
modelData = null;
}
}
if (modelData == null) {
return null;
}
meta.setCustomModelData(modelData);
int finalModelData = modelData;
return test -> {
if (!test.hasItemMeta()) {
return false;
}
ItemMeta testMeta = test.getItemMeta();
assert testMeta != null;
return testMeta.getCustomModelData() == finalModelData;
};
}
}

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

@@ -86,16 +86,13 @@ public final class PlayerUtils {
if (player instanceof Player onlinePlayer) {
profile.write(PLAYER_NAME_KEY, onlinePlayer.getDisplayName());
return onlinePlayer.getDisplayName();
}
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;
@@ -15,7 +14,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.Color;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -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

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

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

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

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

@@ -4,7 +4,6 @@ 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

@@ -6,7 +6,7 @@ import com.willfp.eco.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

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

@@ -1,11 +1,10 @@
package com.willfp.eco.proxy.v1_17_R1
import com.willfp.eco.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
import com.willfp.eco.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,9 +1,9 @@
package com.willfp.eco.proxy.v1_17_R1
import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.proxy.FastItemStackFactoryProxy
import com.willfp.eco.proxy.v1_17_R1.fast.NMSFastItemStack
import org.bukkit.inventory.ItemStack
import com.willfp.eco.proxy.FastItemStackFactoryProxy
class FastItemStackFactory : FastItemStackFactoryProxy {
override fun create(itemStack: ItemStack): FastItemStack {

View File

@@ -6,7 +6,7 @@ import com.willfp.eco.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

@@ -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'
@@ -41,6 +41,7 @@ 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'
// CombatLogX V10 + NewbieHelper Expansion
compileOnly 'com.SirBlobman.combatlogx:CombatLogX-API:10.0.0.0-SNAPSHOT'

View File

@@ -2,23 +2,8 @@ package com.willfp.eco.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
@@ -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)
}
@@ -136,7 +121,7 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
MetricHandler.createMetrics(plugin, this.ecoPlugin)
}
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

@@ -15,6 +15,7 @@ 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.CustomModelDataArgParser
import com.willfp.eco.core.items.args.EnchantmentArgParser
import com.willfp.eco.core.items.args.TextureArgParser
import com.willfp.eco.internal.display.EcoDisplayHandler
@@ -27,7 +28,12 @@ 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.PacketAutoRecipe
import com.willfp.eco.spigot.display.PacketChat
import com.willfp.eco.spigot.display.PacketOpenWindowMerchant
import com.willfp.eco.spigot.display.PacketSetCreativeSlot
import com.willfp.eco.spigot.display.PacketSetSlot
import com.willfp.eco.spigot.display.PacketWindowItems
import com.willfp.eco.spigot.display.frame.clearFrames
import com.willfp.eco.spigot.drops.CollatedRunnable
import com.willfp.eco.spigot.eventlisteners.EntityDeathByEntityListeners
@@ -38,14 +44,30 @@ 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.anticheat.AnticheatAAC
import com.willfp.eco.spigot.integrations.anticheat.AnticheatAlice
import com.willfp.eco.spigot.integrations.anticheat.AnticheatMatrix
import com.willfp.eco.spigot.integrations.anticheat.AnticheatNCP
import com.willfp.eco.spigot.integrations.anticheat.AnticheatSpartan
import com.willfp.eco.spigot.integrations.anticheat.AnticheatVulcan
import com.willfp.eco.spigot.integrations.antigrief.AntigriefBentoBox
import com.willfp.eco.spigot.integrations.antigrief.AntigriefCombatLogXV10
import com.willfp.eco.spigot.integrations.antigrief.AntigriefCombatLogXV11
import com.willfp.eco.spigot.integrations.antigrief.AntigriefCrashClaim
import com.willfp.eco.spigot.integrations.antigrief.AntigriefDeluxeCombat
import com.willfp.eco.spigot.integrations.antigrief.AntigriefFactionsUUID
import com.willfp.eco.spigot.integrations.antigrief.AntigriefGriefPrevention
import com.willfp.eco.spigot.integrations.antigrief.AntigriefIridiumSkyblock
import com.willfp.eco.spigot.integrations.antigrief.AntigriefKingdoms
import com.willfp.eco.spigot.integrations.antigrief.AntigriefLands
import com.willfp.eco.spigot.integrations.antigrief.AntigriefSuperiorSkyblock2
import com.willfp.eco.spigot.integrations.antigrief.AntigriefTowny
import com.willfp.eco.spigot.integrations.antigrief.AntigriefWorldGuard
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
@@ -70,6 +92,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
init {
Items.registerArgParser(EnchantmentArgParser())
Items.registerArgParser(TextureArgParser())
Items.registerArgParser(CustomModelDataArgParser())
val skullProxy = getProxy(SkullProxy::class.java)
SkullUtils.initialize(
@@ -154,6 +177,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 +209,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
// Hologram
IntegrationLoader("HolographicDisplays") { HologramManager.register(HologramHolographicDisplays(this)) },
IntegrationLoader("CMI") { HologramManager.register(HologramCMI()) },
IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
//IntegrationLoader("GHolo") { HologramManager.register(HologramGHolo()) },
// AFK
IntegrationLoader("Essentials") { AFKManager.register(AFKIntegrationEssentials()) },

View File

@@ -2,7 +2,7 @@ package com.willfp.eco.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

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

@@ -5,7 +5,7 @@ import com.willfp.eco.core.data.PlayerProfile
import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.spigot.EcoSpigotPlugin
import org.bukkit.NamespacedKey
import java.util.*
import java.util.UUID
@Suppress("UNCHECKED_CAST")
class YamlDataHandler(

View File

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

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

@@ -2,7 +2,7 @@ package com.willfp.eco.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

@@ -9,7 +9,7 @@ import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerMoveEvent
import org.bukkit.potion.PotionEffectType
import java.text.DecimalFormat
import java.util.*
import java.util.UUID
@Suppress("DEPRECATION")
class PlayerJumpListeners : Listener {

View File

@@ -10,7 +10,11 @@ import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.event.block.Action
import org.bukkit.event.entity.PlayerDeathEvent
import org.bukkit.event.inventory.*
import org.bukkit.event.inventory.ClickType
import org.bukkit.event.inventory.InventoryAction
import org.bukkit.event.inventory.InventoryClickEvent
import org.bukkit.event.inventory.InventoryDragEvent
import org.bukkit.event.inventory.InventoryType
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.player.PlayerItemBreakEvent
import org.bukkit.event.player.PlayerJoinEvent

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import java.util.*
import java.util.UUID
class AnticheatAlice : AnticheatWrapper, Listener {
private val exempt: MutableSet<UUID> = HashSet()

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import java.util.*
import java.util.UUID
class AnticheatMatrix : AnticheatWrapper, Listener {
private val exempt: MutableSet<UUID> = HashSet()

View File

@@ -4,7 +4,7 @@ import com.willfp.eco.core.integrations.anticheat.AnticheatWrapper
import fr.neatmonster.nocheatplus.checks.CheckType
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager
import org.bukkit.entity.Player
import java.util.*
import java.util.UUID
class AnticheatNCP : AnticheatWrapper {
private val exempt: MutableSet<UUID> = HashSet()

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import java.util.*
import java.util.UUID
class AnticheatSpartan : AnticheatWrapper, Listener {
private val exempt: MutableSet<UUID> = HashSet()

View File

@@ -6,7 +6,7 @@ import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import java.util.*
import java.util.UUID
class AnticheatVulcan : AnticheatWrapper, Listener {
private val exempt: MutableSet<UUID> = HashSet()

View File

@@ -0,0 +1,66 @@
package com.willfp.eco.spigot.integrations.antigrief
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import net.crashcraft.crashclaim.CrashClaim
import net.crashcraft.crashclaim.permissions.PermissionRoute
import org.bukkit.Location
import org.bukkit.block.Block
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
class AntigriefCrashClaim : AntigriefWrapper {
override fun canBreakBlock(
player: Player,
block: Block
): Boolean {
val api = CrashClaim.getPlugin().api ?: return true
val claim = api.getClaim(block.location).get() ?: return true
return claim.hasPermission(player.uniqueId, block.location, PermissionRoute.BUILD)
}
override fun canCreateExplosion(
player: Player,
location: Location
): Boolean {
val api = CrashClaim.getPlugin().api ?: return true
val claim = api.getClaim(location).get() ?: return true
return claim.hasPermission(player.uniqueId, location, PermissionRoute.EXPLOSIONS)
}
override fun canPlaceBlock(
player: Player,
block: Block
): Boolean {
val api = CrashClaim.getPlugin().api ?: return true
val claim = api.getClaim(block.location).get() ?: return true
return claim.hasPermission(player.uniqueId, block.location, PermissionRoute.BUILD)
}
override fun canInjure(
player: Player,
victim: LivingEntity
): Boolean {
val api = CrashClaim.getPlugin().api ?: return true
val claim = api.getClaim(victim.location).get() ?: return true
return when (victim) {
is Player -> false
else -> claim.hasPermission(player.uniqueId, victim.location, PermissionRoute.ENTITIES)
}
}
override fun getPluginName(): String {
return "CrashClaim"
}
override fun equals(other: Any?): Boolean {
if (other !is AntigriefWrapper) {
return false
}
return other.pluginName == this.pluginName
}
override fun hashCode(): Int {
return this.pluginName.hashCode()
}
}

View File

@@ -1,6 +1,10 @@
package com.willfp.eco.spigot.integrations.antigrief
import com.massivecraft.factions.*
import com.massivecraft.factions.Board
import com.massivecraft.factions.FLocation
import com.massivecraft.factions.FPlayer
import com.massivecraft.factions.FPlayers
import com.massivecraft.factions.Faction
import com.massivecraft.factions.perms.PermissibleAction
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import org.bukkit.Location

View File

@@ -6,7 +6,7 @@ import com.willfp.eco.util.NamespacedKeyUtils
import io.th0rgal.oraxen.items.OraxenItems
import org.bukkit.NamespacedKey
import org.bukkit.inventory.ItemStack
import java.util.*
import java.util.Objects
import java.util.function.Predicate
class CustomItemsOraxen : CustomItemsWrapper {

View File

@@ -4,7 +4,7 @@ import com.willfp.eco.core.integrations.hologram.Hologram
import com.willfp.eco.core.integrations.hologram.HologramWrapper
import me.gholo.api.GHoloAPI
import org.bukkit.Location
import java.util.*
import java.util.UUID
@Suppress("DEPRECATION")
class HologramGHolo : HologramWrapper {

View File

@@ -18,6 +18,7 @@ softdepend:
- AAC
- Matrix
- Spartan
- Vulcan
- PlaceholderAPI
- mcMMO
- CombatLogX
@@ -36,6 +37,7 @@ softdepend:
- DeluxeCombat
- IridiumSkyblock
- SuperiorSkyblock2
- CrashClaim
libraries:
- 'org.reflections:reflections:0.9.12'
- 'org.apache.maven:maven-artifact:3.0.3'
@@ -45,8 +47,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

@@ -3,6 +3,5 @@ package com.willfp.eco.proxy
import com.willfp.eco.core.proxy.AbstractProxy
interface AutoCraftProxy : AbstractProxy {
@Throws(NoSuchFieldException::class, IllegalAccessException::class)
fun modifyPacket(packet: Any)
}

View File

@@ -1,2 +1,2 @@
version = 6.13.9
version = 6.13.12
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/" }
}
}