Skip to content

Commit

Permalink
Merge branch 'main' into readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AzaleeX authored Aug 21, 2024
2 parents 09a6cc9 + d6b0650 commit fe3e0a7
Show file tree
Hide file tree
Showing 55 changed files with 498 additions and 301 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Set up GraalVM with Java 21
uses: graalvm/setup-graalvm@v1
with:
version: '21.3.0' # Utilisez la version de GraalVM souhaitée
java-version: '21'
components: native-image # Installe également le composant Native Image de GraalVM
java-version: '21' # See 'Options' section below for all supported versions
distribution: 'graalvm' # See 'Options' section below for all available distributions
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Maven
uses: actions/setup-java@v3
uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm' # Spécifie que nous utilisons GraalVM
java-version: '21'
java-version: '21' # See 'Options' section below for all supported versions
distribution: 'graalvm' # See 'Options' section below for all available distributions
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Maven packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand All @@ -34,8 +36,10 @@ jobs:
- name: Build with Maven
run: mvn clean package

# Optionnel : Générer une image native avec GraalVM
- name: Build Native Image
run: |
mvn package -Pnative
if: success() # N'exécute cette étape que si la construction précédente a réussi
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release_artifacts
path: |
${{ github.workspace }}/target/Sculk-1.0-SNAPSHOT.jar
${{ github.workspace }}/target/Sculk-1.0-SNAPSHOT-jar-with-dependencies.jar
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ banned-ip.txt
banned-players.txt
server.properties
.run/sculk.yml
.run/logs/
.run/players
.run/plugin_data
.run/plugins
.run/resource_packs
.run/worlds
.run/banned-ip.txt
.run/banned-players.txt
.run/op.txt
.run/sculk.yml
.run/server.properties
.run/whitelist.txt
10 changes: 5 additions & 5 deletions .idea/fileTemplates/includes/File Header.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .run/Sculk.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Sculk" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.sculk.Sculk" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/.run" />
<module name="Sculk" />
<extension name="coverage">
<pattern>
Expand Down
19 changes: 19 additions & 0 deletions Sculk.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/.run/logs" />
<excludeFolder url="file://$MODULE_DIR$/.run/players" />
<excludeFolder url="file://$MODULE_DIR$/.run/plugin_data" />
<excludeFolder url="file://$MODULE_DIR$/.run/plugins" />
<excludeFolder url="file://$MODULE_DIR$/.run/resource_packs" />
<excludeFolder url="file://$MODULE_DIR$/.run/worlds" />
<excludeFolder url="file://$MODULE_DIR$/.run/banned-ip.txt" />
<excludeFolder url="file://$MODULE_DIR$/.run/banned-players.txt" />
<excludeFolder url="file://$MODULE_DIR$/.run/op.txt" />
<excludeFolder url="file://$MODULE_DIR$/.run/sculk.yml" />
<excludeFolder url="file://$MODULE_DIR$/.run/server.properties" />
<excludeFolder url="file://$MODULE_DIR$/.run/whitelist.txt" />
</content>
</component>
</module>
10 changes: 5 additions & 5 deletions src/main/java/org/sculk/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import java.util.UUID;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/sculk/Sculk.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import org.sculk.utils.TextFormat;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/sculk/SculkModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import org.sculk.event.EventManagerInterface;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
47 changes: 17 additions & 30 deletions src/main/java/org/sculk/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.apache.logging.log4j.Logger;
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
import org.sculk.config.Config;
import org.sculk.config.ServerProperties;
import org.sculk.config.ServerPropertiesKeys;
import org.sculk.console.TerminalConsole;
import org.sculk.event.EventManager;
import org.sculk.network.BedrockInterface;
Expand All @@ -28,11 +30,11 @@
import java.util.UUID;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -58,7 +60,7 @@ public class Server {
private final Path dataPath;
private final Path pluginDataPath;

private final Config properties;
private final ServerProperties properties;
private final Config config;
private final Config operators;
private final Config whitelist;
Expand All @@ -69,6 +71,7 @@ public class Server {
private final Map<SocketAddress, Player> players = new HashMap<>();

private String motd;
private String submotd;
private int maxPlayers;
private String defaultGamemode;
private UUID serverId;
Expand Down Expand Up @@ -96,25 +99,9 @@ public Server(Logger logger, String dataPath) {
this.config = new Config(this.dataPath + "/sculk.yml");

logger.info("Loading {}...", TextFormat.AQUA + "server.properties" + TextFormat.WHITE);
this.properties = new Config(this.dataPath.resolve("server.properties").toString(), Config.PROPERTIES);
if(!this.properties.exists("server-port")) {
this.properties.set("language", "English");
this.properties.set("motd", "A Sculk Server Software");
this.properties.set("server-port", 19132);
this.properties.set("server-ip", "0.0.0.0");
this.properties.set("white-list", false);
this.properties.set("max-players", 20);
this.properties.set("gamemode", "Survival");
this.properties.set("pvp", true);
this.properties.set("difficulty", 1);
this.properties.set("level-name", "world");
this.properties.set("level-seed", "");
this.properties.set("level-type", "DEFAULT");
this.properties.set("auto-save", true);
this.properties.set("xbox-auth", true);
this.properties.save();
}
this.motd = this.properties.getString("motd");
this.properties = new ServerProperties(this.dataPath);
this.motd = this.properties.get(ServerPropertiesKeys.MOTD, "A Sculk Server Software");
this.submotd = this.properties.get(ServerPropertiesKeys.SUB_MOTD, "Powered by Sculk");

this.injector = Guice.createInjector(Stage.PRODUCTION, new SculkModule(this));
this.eventManager = injector.getInstance(EventManager.class);
Expand All @@ -125,7 +112,7 @@ public Server(Logger logger, String dataPath) {
this.banByName = new Config(this.dataPath.resolve("banned-players.txt").toString(), Config.ENUM);
this.banByIp = new Config(this.dataPath.resolve("banned-ip.txt").toString(), Config.ENUM);

logger.info("Selected {} as the base language", this.properties.getString("language"));
logger.info("Selected {} as the base language", this.properties.get(ServerPropertiesKeys.LANGUAGE, "English"));
logger.info("Starting Minecraft: Bedrock Edition server version {}", TextFormat.AQUA + Sculk.MINECRAFT_VERSION + TextFormat.WHITE);

this.console = new TerminalConsole(this);
Expand All @@ -148,15 +135,15 @@ public void start() {
shutdown();
}

if(this.properties.getBoolean("xbox-auth")) {
if(this.properties.get(ServerPropertiesKeys.XBOX_AUTH, true)) {
logger.info("Online mode is enable. The server will verify that players are authenticated to XboxLive.");
} else {
logger.info("{}Online mode is not enabled. The server no longer checks if players are authenticated to XboxLive.", TextFormat.RED);
}
logger.info("This server is running on version {}",TextFormat.AQUA + Sculk.CODE_VERSION);
logger.info("Sculk-MP is distributed undex the {}",TextFormat.AQUA + "GNU GENERAL PUBLIC LICENSE");
logger.info("Sculk is distributed undex the {}",TextFormat.AQUA + "GNU GENERAL PUBLIC LICENSE");

getLogger().info("Done ("+ (double) (System.currentTimeMillis() - Sculk.START_TIME) / 1000 +"s)! For help, type \"help\" or \"?");
getLogger().info("Done ({}s)! For help, type \"help\" or \"?", (double) (System.currentTimeMillis() - Sculk.START_TIME) / 1000);
}

public void shutdown() {
Expand Down Expand Up @@ -213,7 +200,7 @@ public Map<UUID, Player> getOnlinePlayers() {
return Collections.unmodifiableMap(playerList);
}

public Config getProperties() {
public ServerProperties getProperties() {
return properties;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/sculk/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import java.util.regex.Pattern;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/sculk/config/ConfigSection.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import java.util.*;

/*
* ____ _ _ __ __ ____
* / ___| ___ _ _| | | __ | \/ | _ \
* \___ \ / __| | | | | |/ / _____ | |\/| | |_) |
* ___) | (__| |_| | | < |_____| | | | | __/
* |____/ \___|\__,_|_|_|\_\ |_| |_|_|
* ____ _ _
* / ___| ___ _ _| | | __
* \___ \ / __| | | | | |/ /
* ___) | (__| |_| | | <
* |____/ \___|\__,_|_|_|\_\
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
Loading

0 comments on commit fe3e0a7

Please sign in to comment.