Compare commits

...

30 Commits

Author SHA1 Message Date
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
_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
28 changed files with 204 additions and 79 deletions

View File

@@ -14,11 +14,11 @@ jobs:
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- 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
@@ -28,7 +28,7 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- run: ./gradlew build
- run: ./gradlew build --full-stacktrace
- uses: actions/upload-artifact@v2
with:

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

@@ -12,6 +12,7 @@ dependencies {
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 {
@@ -25,6 +26,9 @@ allprojects {
mavenLocal()
maven("https://jitpack.io")
// CustomCrafting
maven("https://maven.wolfyscript.com/repository/public/")
// SuperiorSkyblock2
maven("https://repo.bg-software.com/repository/api/")
@@ -65,6 +69,11 @@ allprojects {
// 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> {
@@ -93,8 +102,8 @@ allprojects {
}
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}

View File

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

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

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

@@ -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()) {
if (Bukkit.getServer().getRecipe(this.getKey()) != null) {
return;
}
}
Bukkit.getServer().addRecipe(shapedRecipe);
Bukkit.getServer().addRecipe(displayedRecipe);
}

View File

@@ -82,13 +82,12 @@ 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());
return onlinePlayer.getDisplayName();
updateSavedDisplayName(onlinePlayer);
}
PlayerProfile profile = PlayerProfile.load(player);
String saved = profile.read(PLAYER_NAME_KEY);
if (saved.equals(PLAYER_NAME_KEY.getDefaultValue())) {

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

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

@@ -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,5 +1,5 @@
plugins {
id("io.papermc.paperweight.userdev") version "1.1.14"
id("io.papermc.paperweight.userdev") version "1.2.0"
}
group = "com.willfp"
@@ -7,8 +7,6 @@ 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 {

View File

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

Binary file not shown.

View File

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

View File

@@ -254,7 +254,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
GUIListener(this),
ArrowDataListener(this),
ArmorChangeEventListeners(this),
DataListener(),
DataListener(this),
PlayerBlockListener(this)
)
}

View File

@@ -1,6 +1,7 @@
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) {
plugin.scheduler.runLater({
PlayerUtils.updateSavedDisplayName(event.player)
}, 5)
}
@EventHandler

View File

@@ -23,6 +23,7 @@ import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import java.util.UUID
import java.util.concurrent.Callable
import java.util.concurrent.Executors
@Suppress("UNCHECKED_CAST")
@@ -114,13 +115,21 @@ class MySQLDataHandler(
}
override fun <T> read(uuid: UUID, key: NamespacedKey): T? {
val doRead = Callable<T?> {
var value: T? = null
transaction {
val player = getPlayer(uuid)
value = player[getColumn(key.toString())] as T?
}
return value
return@Callable 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

@@ -2,14 +2,15 @@ package com.willfp.eco.internal.spigot.integrations.antigrief
import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI
import com.bgsoftware.superiorskyblock.api.enums.HitActionResult
import com.bgsoftware.superiorskyblock.api.island.Island
import com.bgsoftware.superiorskyblock.api.island.IslandPrivilege
import com.bgsoftware.superiorskyblock.api.key.Key
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.block.Block
import org.bukkit.entity.Animals
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Monster
import org.bukkit.entity.Player
import org.bukkit.entity.*
class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
override fun getPluginName(): String {
@@ -17,11 +18,42 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
}
override fun canBreakBlock(player: Player, block: Block): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
val island: Island? =
SuperiorSkyblockAPI.getIslandAt(block.location)
val superiorPlayer: SuperiorPlayer =
SuperiorSkyblockAPI.getPlayer(player)
if (island == null) {
if (!superiorPlayer.hasBypassModeEnabled() && SuperiorSkyblockAPI.getSuperiorSkyblock().grid
.isIslandsWorld(player.world)
) {
return false
}
return true
}
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Break"))
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("BREAK"))
val blockType = block.type
val islandPermission: IslandPrivilege =
if (blockType == Material.SPAWNER) IslandPrivilege.getByName("SPAWNER_BREAK") else IslandPrivilege.getByName("BREAK")
if (!island.hasPermission(superiorPlayer, islandPermission)) {
return false
}
if (SuperiorSkyblockAPI.getSuperiorSkyblock().settings.valuableBlocks
.contains(Key.of(block)) &&
!island.hasPermission(superiorPlayer, IslandPrivilege.getByName("VALUABLE_BREAK"))
) {
return false
}
if (!island.isInsideRange(block.location)) {
return false
}
return true
}
override fun canCreateExplosion(player: Player, location: Location): Boolean {
@@ -32,11 +64,29 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
}
override fun canPlaceBlock(player: Player, block: Block): Boolean {
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
val island: Island? =
SuperiorSkyblockAPI.getIslandAt(block.location)
val superiorPlayer: SuperiorPlayer =
SuperiorSkyblockAPI.getPlayer(player)
if (island == null) {
if (!superiorPlayer.hasBypassModeEnabled() && SuperiorSkyblockAPI.getSuperiorSkyblock().grid.isIslandsWorld(superiorPlayer.world)
) {
return false
}
return true
}
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Place"))
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("PLACE"))
if (!island.hasPermission(superiorPlayer, IslandPrivilege.getByName("BUILD"))) {
return false
}
if (!island.isInsideRange(block.location)) {
return false
}
return true
}
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
@@ -45,13 +95,14 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
}
return when (victim) {
is Player -> SuperiorSkyblockAPI.getPlayer(player).canHit(SuperiorSkyblockAPI.getPlayer(victim)).equals(HitActionResult.SUCCESS)
is Animals -> {
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("ANIMAL_DAMAGE"))
else -> {
val island: Island? = SuperiorSkyblockAPI.getSuperiorSkyblock().grid.getIslandAt(victim.location)
val islandPermission = if (victim is Monster) IslandPrivilege.getByName("MONSTER_DAMAGE") else IslandPrivilege.getByName("ANIMAL_DAMAGE")
if (island != null ) {
return island.hasPermission(player, islandPermission)
}
return true
}
is Monster -> {
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("MONSTER_DAMAGE"))
}
else -> true
}
}
}

View File

@@ -9,6 +9,8 @@ mysql:
# very high numbers can cause issues with OS configuration. If writes are taking
# too long, increase this value.
threads: 2
# If read operations should be ran in the thread pool. Runs on main thread by default.
async-reads: false
host: localhost
port: 3306
database: database

View File

@@ -41,12 +41,11 @@ softdepend:
libraries:
- 'org.reflections:reflections:0.9.12'
- 'org.apache.maven:maven-artifact:3.0.3'
- 'org.jetbrains.kotlin:kotlin-stdlib:1.5.31'
- 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
- 'net.kyori:adventure-platform-bukkit:4.0.0'
- 'net.kyori:adventure-api:4.9.2'
- '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'
- 'net.kyori:adventure-api:4.9.3'
- 'net.kyori:adventure-text-serializer-gson:4.9.3'
- 'net.kyori:adventure-text-serializer-legacy:4.9.3'
- 'org.jetbrains.exposed:exposed-core:0.36.2'
- 'org.jetbrains.exposed:exposed-dao:0.36.2'
- 'org.jetbrains.exposed:exposed-jdbc:0.36.2'

View File

@@ -1,2 +1,2 @@
version = 6.13.13
version = 6.14.0
plugin-name = eco

View File

@@ -1,6 +1,6 @@
jdk: openjdk16
jdk: openjdk17
before_install:
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk update
- sdk install java 16.0.1-open
- sdk use java 16.0.1-open
- sdk install java 17.0.1-tem
- sdk use java 17.0.1-tem

View File

@@ -13,6 +13,7 @@ include(":eco-core")
include(":eco-core:core-nms")
include(":eco-core:core-nms:v1_16_R3")
include(":eco-core:core-nms:v1_17_R1")
include(":eco-core:core-nms:v1_18_R1")
include(":eco-core:core-proxy")
include(":eco-core:core-plugin")
include(":eco-core:core-backend")