Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folia #433

Merged
merged 53 commits into from
Oct 11, 2024
Merged

Folia #433

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d179a56
start integer primitive type
CJCrafter Feb 28, 2024
df6667c
add basic int map implementation
CJCrafter Mar 1, 2024
a319e88
replace our primitive implementations with fastutil
CJCrafter Apr 11, 2024
79ad2fb
add configuration using fastutil
CJCrafter Apr 15, 2024
e10f13d
convert all weaponmechanics stuff to the new fast config
CJCrafter Apr 15, 2024
7b088e2
Merge branch 'refs/heads/master' into primitive-config
CJCrafter Apr 15, 2024
55af778
spotlessApply
CJCrafter Apr 15, 2024
186a4f0
remove double map test
CJCrafter Apr 15, 2024
c4adb8a
let weapon mechanics be run on folia
CJCrafter Jun 12, 2024
2553b67
use FoliaLib to schedule tasks in MechanicsCore
CJCrafter Jun 12, 2024
18376f0
use FoliaLib in Database methods
CJCrafter Jun 12, 2024
6457fbc
deprecate TaskChain
CJCrafter Jun 12, 2024
1adb579
use FoliaLib in FireworkMechanic
CJCrafter Jun 13, 2024
67a6677
switch firework mechanic to location-based scheduling
CJCrafter Jun 13, 2024
e3bf5ef
Merge branch 'refs/heads/master' into folia
CJCrafter Jun 14, 2024
f10ee4a
use FoliaLib in Debugger
CJCrafter Jun 14, 2024
b92ccb6
add FoliaLib to WeaponMechanics, and convert commands
CJCrafter Jun 14, 2024
315391b
convert message mechanics to folia
CJCrafter Jun 14, 2024
16536c7
convert the weapon info display to be folia compatible
CJCrafter Jun 14, 2024
c3ad834
convert legacy commands
CJCrafter Jun 14, 2024
c7db23f
convert explosion stuff to folia
CJCrafter Jun 14, 2024
6205fa3
remove assertion
CJCrafter Jun 14, 2024
3d94800
remove TaskChain usages
CJCrafter Jun 15, 2024
afb6dc7
fix /wm reload not using CompleteableFuture methods
CJCrafter Jun 15, 2024
1657a4c
add folia support to the MoveTask
CJCrafter Jun 15, 2024
4246435
Merge branch 'refs/heads/master' into folia
CJCrafter Jul 21, 2024
e059c32
use new projectile spawner
CJCrafter Jul 21, 2024
e1f6a56
build with new projectile system
CJCrafter Jul 21, 2024
de7026e
let full auto work on folia
CJCrafter Jul 21, 2024
32f3f32
convert to com.cjcrafter.scheduler
CJCrafter Jul 29, 2024
fdd9df9
Merge branch 'refs/heads/master' into folia
CJCrafter Jul 29, 2024
b579c6d
fix trying to use tick delay of 0
CJCrafter Jul 29, 2024
9f6457c
start reload folia support
CJCrafter Aug 4, 2024
fbb00f9
add foliascheduler 0.3.0 support to MechanicsCore
CJCrafter Aug 6, 2024
07ae7d1
add foliascheduler 0.3.0 support to WeaponMechanics
CJCrafter Aug 6, 2024
a201d35
add folia support to reloading and firearm actions
CJCrafter Aug 6, 2024
88ffe9d
primitive folia support for mechanics
CJCrafter Aug 6, 2024
bb35f9a
remove legacy task handlers
CJCrafter Aug 7, 2024
fdd7deb
remove bukkitrunnable in favor of folia tasks
CJCrafter Aug 7, 2024
24481e7
working build of folia
CJCrafter Aug 7, 2024
098920c
stop trying to cancel tasks onDisable
CJCrafter Aug 7, 2024
ea080ed
relocate to foliascheduler
CJCrafter Aug 17, 2024
6026093
Merge branch 'refs/heads/master' into folia
CJCrafter Aug 19, 2024
a450acb
Merge branch 'refs/heads/master' into folia
CJCrafter Sep 19, 2024
9f38321
Merge branch 'refs/heads/master' into primitive-config
CJCrafter Sep 19, 2024
2ccc724
Merge branch 'refs/heads/folia' into primitive-config
CJCrafter Sep 19, 2024
931713d
fix javadoc error for duplicate key errors
CJCrafter Sep 24, 2024
82b82c1
fix old maven artifacts causing gradle build issues
CJCrafter Sep 30, 2024
d4081a9
fix projectiles not ticking on Spigot servers
CJCrafter Sep 30, 2024
a0400d5
cancel tasks on reload
CJCrafter Sep 30, 2024
bec0de3
fix resource pack downloading happening too early
CJCrafter Sep 30, 2024
0549592
teleport async
CJCrafter Oct 8, 2024
4691e36
fix javadoc error for publishing
CJCrafter Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions BuildMechanicsCore/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bukkit {
name = "MechanicsCore" // Since we don't want to use "BuildMechanicsCore"
version = mechanicsCoreVersion
apiVersion = "1.13"
foliaSupported = true

load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.STARTUP
authors = listOf("DeeCaaD", "CJCrafter")
Expand Down Expand Up @@ -102,5 +103,9 @@ tasks.shadowJar {
relocate("com.cryptomorin.xseries", "me.deecaad.core.lib.xseries") {
include(dependency("com.github.cryptomorin:XSeries:"))
}

relocate("com.cjcrafter.foliascheduler", "me.deecaad.core.lib.scheduler") {
include(dependency("com.cjcrafter:foliascheduler:"))
}
}
}
4 changes: 3 additions & 1 deletion BuildWeaponMechanics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id("me.deecaad.mechanics-project")
//id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.github.goooler.shadow") version "8.1.7"
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
}

dependencies {
Expand Down Expand Up @@ -39,6 +39,7 @@ bukkit {
name = "WeaponMechanics" // Since we don't want to use "BuildWeaponMechanics"
version = weaponMechanicsVersion
apiVersion = "1.13"
foliaSupported = true

authors = listOf("DeeCaaD", "CJCrafter")
depend = listOf("ProtocolLib")
Expand Down Expand Up @@ -93,4 +94,5 @@ tasks.shadowJar {
// to the mechanics core lib.
relocate("net.kyori", "me.deecaad.core.lib")
relocate("kotlin.", "me.deecaad.weaponmechanics.lib.kotlin.")
relocate("com.cjcrafter.foliascheduler", "me.deecaad.core.lib.scheduler")
}
4 changes: 3 additions & 1 deletion MechanicsCore/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

repositories {
mavenCentral()
maven(url = "https://mvn.lumine.io/repository/maven-public/")
maven(url = "https://mvn.lumine.io/repository/maven-public/") // Mythic
}

dependencies {
Expand All @@ -31,8 +31,10 @@ dependencies {
implementation("org.slf4j:slf4j-nop:1.7.30")
implementation(Dependencies.MYTHIC_MOBS)
implementation(Dependencies.X_SERIES)
implementation(Dependencies.FOLIA_SCHEDULER)
implementation("xyz.jpenilla:reflection-remapper:0.1.1")
implementation("net.fabricmc:mapping-io:0.5.0")
implementation(Dependencies.FAST_UTIL)

testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testImplementation(Dependencies.LATEST_SPIGOT_API)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.deecaad.core;

import com.cjcrafter.foliascheduler.FoliaCompatibility;
import com.cjcrafter.foliascheduler.ServerImplementation;
import me.deecaad.core.events.QueueSerializerEvent;
import me.deecaad.core.events.triggers.EquipListener;
import me.deecaad.core.file.JarSearcher;
Expand Down Expand Up @@ -30,6 +32,7 @@
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.IOException;
Expand All @@ -43,10 +46,12 @@ public class MechanicsCore extends JavaPlugin {

public BukkitAudiences adventure;
public MiniMessage message;
public ServerImplementation foliaScheduler;
private boolean registeredMechanics;

public void onLoad() {
instance = this;
foliaScheduler = new FoliaCompatibility(this).getServerImplementation();

int level = getConfig().getInt("Debug_Level");
boolean printTraces = getConfig().getBoolean("Print_Traces");
Expand Down Expand Up @@ -138,12 +143,15 @@ public void onQueue(QueueSerializerEvent event) throws IOException {

public void onDisable() {
HandlerList.unregisterAll(this);
Bukkit.getServer().getScheduler().cancelTasks(this);
debug = null;
adventure.close();
adventure = null;
}

public @NotNull ServerImplementation getFoliaScheduler() {
return foliaScheduler;
}

/**
* @return the MechanicsCore plugin instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import me.deecaad.core.MechanicsCore;
import me.deecaad.core.utils.LogLevel;
import org.bukkit.scheduler.BukkitRunnable;

import org.jetbrains.annotations.Nullable;
import java.sql.*;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.function.Consumer;

public abstract class Database {
Expand Down Expand Up @@ -66,11 +70,7 @@ public void executeUpdate(boolean forceSync, String... sql) {
return;
}

new BukkitRunnable() {
public void run() {
executeUpdate(sql);
}
}.runTaskAsynchronously(MechanicsCore.getPlugin());
MechanicsCore.getPlugin().getFoliaScheduler().async().runNow(() -> executeUpdate(sql));
}

private void executeUpdate(String... sql) {
Expand Down Expand Up @@ -130,23 +130,22 @@ private void executeUpdate(String... sql) {
public void executeQuery(String sql, Consumer<ResultSet> consumer) {
if (sql == null || sql.isEmpty() || consumer == null)
throw new IllegalArgumentException("Empty statement or null consumer");
new BukkitRunnable() {
public void run() {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
connection = getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
consumer.accept(resultSet);
} catch (SQLException e) {
MechanicsCore.debug.log(LogLevel.ERROR, e);
} finally {
close(connection, preparedStatement, resultSet);
}

MechanicsCore.getPlugin().getFoliaScheduler().async().runNow(() -> {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
connection = getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
consumer.accept(resultSet);
} catch (SQLException e) {
MechanicsCore.debug.log(LogLevel.ERROR, e);
} finally {
close(connection, preparedStatement, resultSet);
}
}.runTaskAsynchronously(MechanicsCore.getPlugin());
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import java.lang.reflect.Field;
import java.util.HashSet;
Expand Down Expand Up @@ -122,12 +121,7 @@ public void onDrop(PlayerDropItemEvent event) {

// Register, then unregister in 1 tick
Bukkit.getPluginManager().registerEvents(listener, MechanicsCore.getPlugin());
new BukkitRunnable() {
@Override
public void run() {
HandlerList.unregisterAll(listener);
}
}.runTask(MechanicsCore.getPlugin());
MechanicsCore.getPlugin().getFoliaScheduler().global().run(() -> HandlerList.unregisterAll(listener));
}
}

Expand Down
Loading
Loading