Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e12403a5a | |||
| fdf51d95c1 | |||
| 3266f46d17 | |||
| 43856aefbc | |||
| a4733d073e | |||
| d74fb27d30 | |||
| 2d3f8c151b | |||
| 267bd3644c | |||
| d6515d9cbb | |||
| 204198f143 | |||
| 9fdc4f4991 | |||
| b88d7f3e08 | |||
| ebbb92f66d |
@@ -8,7 +8,7 @@ on:
|
||||
push:
|
||||
branches: [ master, dev ]
|
||||
pull_request:
|
||||
branches: [ master, dev ]
|
||||
branches: [ dev ]
|
||||
|
||||
env:
|
||||
REPO_USERNAME: Altarik
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '17' ]
|
||||
java: [ '21' ]
|
||||
os: [ ubuntu-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
@@ -32,7 +32,15 @@ jobs:
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'oracle'
|
||||
distribution: 'temurin'
|
||||
# - uses: actions/cache@v3
|
||||
# with:
|
||||
# path: |
|
||||
# ~/.gradle/caches
|
||||
# ~/.gradle/wrapper
|
||||
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-gradle-
|
||||
- name: make gradle wrapper executable
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
run: |
|
||||
@@ -43,7 +51,7 @@ jobs:
|
||||
deploy:
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '17' ]
|
||||
java: [ '21' ]
|
||||
os: [ ubuntu-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: ${{ gitea.ref == 'refs/heads/master' && gitea.event_name == 'push' }}
|
||||
@@ -57,7 +65,7 @@ jobs:
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'oracle'
|
||||
distribution: 'temurin'
|
||||
- name: make gradle wrapper executable
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
run: |
|
||||
|
||||
4
Core/build.gradle
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/core.accesswidener")
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package fr.altarik.toolbox.core.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.widget.Positioner;
|
||||
import net.minecraft.client.gui.widget.SimplePositioningWidget;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public abstract class ExtendedSimplePositionWidget extends SimplePositioningWidget {
|
||||
|
||||
private final List<Element> elements = new ArrayList<>();
|
||||
|
||||
public ExtendedSimplePositionWidget(int x, int y, int width, int height) {
|
||||
super(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Widget> T add(T widget, Positioner positioner) {
|
||||
this.elements.add(new Element(widget, positioner));
|
||||
return widget;
|
||||
}
|
||||
|
||||
public <T extends Widget> void remove(T widget) {
|
||||
this.elements.remove(new Element(widget, this.copyPositioner()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachElement(Consumer<Widget> consumer) {
|
||||
this.elements.forEach((element) -> consumer.accept(element.widget));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package fr.altarik.toolbox.core.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.widget.WrapperWidget;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public abstract class MultiTabWrapperWidget<A extends Enum<A>, B extends Widget> extends WrapperWidget {
|
||||
|
||||
protected final Screen parent;
|
||||
protected A currentTab;
|
||||
|
||||
public MultiTabWrapperWidget(Screen parent) {
|
||||
this(parent, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public MultiTabWrapperWidget(Screen parent, int x, int y, int width, int height) {
|
||||
super(x, y, width, height);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
protected void setCurrentTab(A currentTab) {
|
||||
this.currentTab = currentTab;
|
||||
update();
|
||||
}
|
||||
|
||||
protected abstract B getCurrentTab();
|
||||
|
||||
public abstract void update();
|
||||
|
||||
public abstract void remove();
|
||||
|
||||
@Override
|
||||
public void forEachElement(Consumer<Widget> consumer) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,10 +24,10 @@ public class ConfigI {
|
||||
return configPath.resolve(name);
|
||||
}
|
||||
|
||||
public static ConfigI load(Path configPath, String name, Class<? extends ConfigI> clazz) throws IOException, JsonSyntaxException, JsonIOException {
|
||||
public static <T extends ConfigI> T load(Path configPath, String name, Class<T> clazz) throws IOException, JsonSyntaxException, JsonIOException {
|
||||
Path path = getConfigPath(configPath, name);
|
||||
|
||||
ConfigI file;
|
||||
T file;
|
||||
|
||||
if(Files.exists(path)) {
|
||||
FileReader reader = new FileReader(path.toFile());
|
||||
@@ -58,6 +58,7 @@ public class ConfigI {
|
||||
Files.writeString(this.configPath, GSON.toJson(this));
|
||||
// Files.copy(tempPath, this.configPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
// Files.delete(tempPath);
|
||||
// commented because throws an error on windows each time if the file already exist
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package fr.altarik.toolbox.core.event;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
||||
public interface PlayerLifecycleCallback {
|
||||
|
||||
Event<PlayerJoin> PLAYER_JOIN = EventFactory.createArrayBacked(PlayerJoin.class, listeners -> player -> {
|
||||
for(PlayerJoin listener : listeners) {
|
||||
ActionResult result = listener.onPlayerJoin(player);
|
||||
if (result != ActionResult.PASS)
|
||||
return result;
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
});
|
||||
|
||||
Event<PlayerLeave> PLAYER_LEAVE = EventFactory.createArrayBacked(PlayerLeave.class, listeners -> player -> {
|
||||
for(PlayerLeave listener : listeners) {
|
||||
ActionResult result = listener.onPlayerLeave(player);
|
||||
if (result != ActionResult.PASS)
|
||||
return result;
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
});
|
||||
|
||||
@FunctionalInterface
|
||||
interface PlayerJoin {
|
||||
ActionResult onPlayerJoin(ServerPlayerEntity player);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface PlayerLeave {
|
||||
ActionResult onPlayerLeave(ServerPlayerEntity player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package fr.altarik.toolbox.core.mixin;
|
||||
|
||||
import fr.altarik.toolbox.core.event.PlayerLifecycleCallback;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.network.ConnectedClientData;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(PlayerManager.class)
|
||||
public class PlayerJoinEvent {
|
||||
|
||||
@Inject(method = "onPlayerConnect", at = @At(value = "RETURN"))
|
||||
private void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
|
||||
PlayerLifecycleCallback.PLAYER_JOIN.invoker().onPlayerJoin(player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package fr.altarik.toolbox.core.mixin;
|
||||
|
||||
import fr.altarik.toolbox.core.event.PlayerLifecycleCallback;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ServerPlayNetworkHandler.class)
|
||||
public class PlayerLeaveEvent {
|
||||
|
||||
@Shadow
|
||||
public ServerPlayerEntity player;
|
||||
|
||||
@Inject(at = @At(value = "HEAD"), method = "onDisconnected")
|
||||
private void onPlayerQuit(Text reason, CallbackInfo ci) {
|
||||
PlayerLifecycleCallback.PLAYER_LEAVE.invoker().onPlayerLeave(player);
|
||||
}
|
||||
}
|
||||
14
Core/src/main/resources/Core.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "fr.altarik.toolbox.core.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"PlayerJoinEvent",
|
||||
"PlayerLeaveEvent"
|
||||
],
|
||||
"verbose": false,
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 323 KiB |
4
Core/src/main/resources/core.accesswidener
Normal file
@@ -0,0 +1,4 @@
|
||||
accessWidener v2 named
|
||||
|
||||
accessible class net/minecraft/client/gui/widget/SimplePositioningWidget$Element
|
||||
accessible method net/minecraft/client/gui/widget/SimplePositioningWidget$Element <init> (Lnet/minecraft/client/gui/widget/Widget;Lnet/minecraft/client/gui/widget/Positioner;)V
|
||||
@@ -8,7 +8,7 @@
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://altarik.fr"
|
||||
@@ -19,11 +19,21 @@
|
||||
"entrypoints": {
|
||||
"main": []
|
||||
},
|
||||
"mixins": [],
|
||||
"mixins": [
|
||||
"Core.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": "^${loaderVersion}",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "${minecraftVersion}",
|
||||
"java": ">=17"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ],
|
||||
"parent": {
|
||||
"parent": "toolbox"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BuilderImpl implements IBuilder<BuilderResult> {
|
||||
|
||||
|
||||
@Override
|
||||
public BuilderResult build() throws Exception {
|
||||
public BuilderResult build() {
|
||||
return new BuilderResult(collection.get(), numberOfSentences.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ConfigITest {
|
||||
public double para3 = 3.14;
|
||||
|
||||
public static ConfigClazz load() throws IOException {
|
||||
return (ConfigClazz) load(Path.of("."), "test.json", ConfigClazz.class);
|
||||
return load(Path.of("."), "test.json", ConfigClazz.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
dependencies {
|
||||
implementation 'org.postgresql:postgresql:42.6.0'
|
||||
implementation 'org.postgresql:postgresql:42.7.5'
|
||||
testImplementation 'com.google.code.gson:gson:2.10'
|
||||
implementation project(':Core')
|
||||
// implementation "org.hibernate.orm:hibernate-core:${project.hibernate_version}"
|
||||
include "org.hibernate.orm:hibernate-core:${project.hibernate_version}"
|
||||
include "jakarta.activation:jakarta.activation-api:2.1.1"
|
||||
include "jakarta.inject:jakarta.inject-api:2.0.1"
|
||||
include "jakarta.persistence:jakarta.persistence-api:3.1.0"
|
||||
include "jakarta.transaction:jakarta.transaction-api:2.0.1"
|
||||
include "jakarta.xml.bind:jakarta.xml.bind-api:4.0.0"
|
||||
include "org.hibernate.common:hibernate-commons-annotations:7.0.3.Final"
|
||||
include "org.jboss.logging:jboss-logging:3.5.0.Final"
|
||||
include "com.fasterxml:classmate:1.5.1"
|
||||
include "net.bytebuddy:byte-buddy:1.14.18"
|
||||
include "org.antlr:antlr4-runtime:4.13.0"
|
||||
include "io.smallrye:jandex:3.2.0"
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -25,13 +25,6 @@ public abstract class AbstractSqlConnection implements SqlConnection {
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeConnection() {
|
||||
try {
|
||||
close();
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
if(!connection.isClosed()) {
|
||||
|
||||
@@ -23,10 +23,4 @@ public interface SqlConnection extends AutoCloseable {
|
||||
*/
|
||||
void checkConnection() throws SQLException;
|
||||
|
||||
/**
|
||||
* @deprecated replaced with {@link AutoCloseable#close()}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
void closeConnection();
|
||||
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 323 KiB |
@@ -8,7 +8,7 @@
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://altarik.fr"
|
||||
@@ -26,5 +26,13 @@
|
||||
"minecraft": "${minecraftVersion}",
|
||||
"java": ">=17",
|
||||
"toolbox-core": "${version}"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ],
|
||||
"parent": {
|
||||
"parent": "toolbox"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 323 KiB |
@@ -8,7 +8,7 @@
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://altarik.fr"
|
||||
@@ -29,5 +29,13 @@
|
||||
"fabric-api": "*",
|
||||
"minecraft": "${minecraftVersion}",
|
||||
"java": ">=17"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ],
|
||||
"parent": {
|
||||
"parent": "toolbox"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 323 KiB |
@@ -8,7 +8,7 @@
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://altarik.fr"
|
||||
|
||||
@@ -2,7 +2,7 @@ import fr.altarik.CreateTag
|
||||
import fr.altarik.ReportDiscord
|
||||
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.5-SNAPSHOT' apply false
|
||||
id 'fabric-loom' version "${loom_version}" apply false
|
||||
}
|
||||
|
||||
Properties local = new Properties()
|
||||
@@ -81,8 +81,8 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter:${project.junit_version}"
|
||||
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
@@ -1 +1 @@
|
||||
okhttp_version=4.10.0
|
||||
okhttp_version=4.12.0
|
||||
@@ -1,14 +1,16 @@
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
fabric.loom.multiProjectOptimisation=true
|
||||
|
||||
junit_version=5.9.0
|
||||
junit_version=5.14.0
|
||||
minecraft_version=1.20.4
|
||||
yarn_mappings=1.20.4+build.3
|
||||
loader_version=0.15.6
|
||||
fabric_version=0.95.4+1.20.4
|
||||
loader_version=0.17.2
|
||||
fabric_version=0.97.3+1.20.4
|
||||
hibernate_version=6.6.3.Final
|
||||
loom_version=1.11-SNAPSHOT
|
||||
|
||||
maven_group=fr.altarik.toolbox
|
||||
maven_version=4.5.1
|
||||
maven_version=5.2.0
|
||||
|
||||
git_owner=quentinlegot
|
||||
git_repo=Toolbox
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 323 KiB |
@@ -8,7 +8,7 @@
|
||||
"Altarik"
|
||||
],
|
||||
"contributors": [
|
||||
"Legot Quentin<legotquentin@gmail.com>"
|
||||
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://altarik.fr"
|
||||
@@ -25,6 +25,11 @@
|
||||
"toolbox-database": "${version}",
|
||||
"toolbox-pagination": "${version}",
|
||||
"toolbox-task": "${version}"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||