Skip to content

Commit

Permalink
Merge branch 'retromcorg-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Moresteck committed Dec 17, 2024
2 parents 6646dff + de395d5 commit 3a5552b
Show file tree
Hide file tree
Showing 31 changed files with 679 additions and 170 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/java21-buld-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Java-Compatibility
on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- master
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Java 8 is tested as a part of the build-and-test workflow
java-version: ['17', '21' ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Java ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
java-package: jdk

- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.1

- name: Build application
shell: bash
run: |
mvn clean install
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release Workflow

on:
push:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout
uses: actions/checkout@v4

# Step 2: Set up JDK 1.8
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 8

# Step 3: Get the version from pom.xml
- name: Get the version from pom.xml
id: get_version
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

# Step 4: Fail if snapshot version
- name: Fail if snapshot version
run: |
if [[ $PROJECT_VERSION == *"-SNAPSHOT"* ]]; then
echo "Snapshot versions are not releasable"
exit 0
fi
# Step 5: Generate custom release version
- name: Generate Release Version
id: release_version
run: |
DATE=$(date +'%y%m%d-%H%M')
SHA=$(echo $GITHUB_SHA | cut -c1-7)
RELEASE_VERSION="${PROJECT_VERSION}-${DATE}-${SHA}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
# Step 6: Create version.properties file
- name: Create version.properties file
run: |
mkdir -p src/main/resources
# Application Information
APP_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)
# Core Metadata
echo "version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties
echo "build_timestamp=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')" >> src/main/resources/version.properties
echo "git_branch=${{ github.ref_name }}" >> src/main/resources/version.properties
echo "git_commit=${GITHUB_SHA}" >> src/main/resources/version.properties
echo "app_name=${APP_NAME}" >> src/main/resources/version.properties
echo "release_version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties
echo "maven_version=${{ env.PROJECT_VERSION }}" >> src/main/resources/version.properties
# Build Type
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ github.ref }}" == "refs/heads/main" ]]; then
BUILD_TYPE="production"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
BUILD_TYPE="pull_request"
else
BUILD_TYPE="development"
fi
echo "build_type=${BUILD_TYPE}" >> src/main/resources/version.properties
# CI/CD Metadata
echo "workflow_name=${{ github.workflow }}" >> src/main/resources/version.properties
echo "workflow_run_id=${{ github.run_id }}" >> src/main/resources/version.properties
echo "workflow_run_number=${{ github.run_number }}" >> src/main/resources/version.properties
# Team or Author Information
echo "build_author=${{ github.actor }}" >> src/main/resources/version.properties
# Step 7: Build with Maven
- name: Build with Maven
run: mvn clean package

# Step 8: Create GitHub Release
- name: Create GitHub Release
if: ${{ !endsWith(env.PROJECT_VERSION, '-SNAPSHOT') }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
files: |
target/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ You can download the latest GitHub release [here](https://github.com/Moresteck/P
You can download the latest build through [GitHub actions](https://github.com/Moresteck/Project-Poseidon-Uberbukkit/actions/workflows/build-and-test.yaml) (You need to be logged in on GitHub) <br>
or get it from [betacraft.uk](https://betacraft.uk/utilities) along with **pre-made configuration files**.

Please note, download the artifact (JAR) without `original` in the name, eg. `uberbukkit-2.0.2.jar`.

## Licensing
CraftBukkit and Bukkit are licensed under GNU General Public License v3.0<br>
Any future commits to this repository will remain under the same GNU General Public License v3.0<br>
Expand Down
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.7</version>
<version>2.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand All @@ -133,7 +133,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>32.0.0-jre</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand All @@ -153,15 +153,15 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
<build>
<defaultGoal>clean install</defaultGoal>
<!-- <sourceDirectory>src</sourceDirectory>-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <directory>src</directory>-->
<!-- <excludes>-->
<!-- <exclude>**/*.java</exclude>-->
<!-- </excludes>-->
<!-- </resource>-->
<!-- </resources>-->
<!-- <sourceDirectory>src</sourceDirectory>-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <directory>src</directory>-->
<!-- <excludes>-->
<!-- <exclude>**/*.java</exclude>-->
<!-- </excludes>-->
<!-- </resource>-->
<!-- </resources>-->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/legacyminecraft/poseidon/Poseidon.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.legacyminecraft.poseidon;

import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftServer;

import java.util.LinkedList;

public class Poseidon {
public final class Poseidon {
private static PoseidonServer server;

/**
* Returns a list of the server's TPS (Ticks Per Second) records for performance monitoring.
Expand All @@ -17,5 +19,17 @@ public static LinkedList<Double> getTpsRecords() {
return ((CraftServer) Bukkit.getServer()).getServer().getTpsRecords();
}

public static PoseidonServer getServer() {
return server;
}

public static void setServer(PoseidonServer server) {
if (Poseidon.server != null) {
throw new UnsupportedOperationException("Cannot redefine singleton Server");
}

Poseidon.server = server;
}


}
12 changes: 12 additions & 0 deletions src/main/java/com/legacyminecraft/poseidon/PoseidonConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ private void write() {
generateConfigOption("world.settings.block-tree-growth.info", "This setting allows for server owners to easily block trees growing from automatically destroying certain blocks. The list must be a string with numerical item ids separated by commas.");
generateConfigOption("world.settings.block-pistons-pushing-furnaces.info", "This workaround prevents pistons from pushing furnaces which prevents a malicious server crash.");
generateConfigOption("world.settings.block-pistons-pushing-furnaces.enabled", true);
generateConfigOption("world.settings.pistons.transmutation-fix.enabled", true);
generateConfigOption("world.settings.pistons.transmutation-fix.info", "This setting fixes block transmutation exploits.");
generateConfigOption("world.settings.pistons.sand-gravel-duping-fix.enabled", true);
generateConfigOption("world.settings.pistons.sand-gravel-duping-fix.info", "This setting fixes sand/gravel duplication exploits.");
generateConfigOption("world.settings.pistons.other-fixes.enabled", true);
generateConfigOption("world.settings.pistons.other-fixes.info", "This setting fixes various other piston exploits like creating illegal pistons, breaking bedrock and duplicating redstone torches.");
generateConfigOption("world.settings.skeleton-shooting-sound-fix.info", "This setting fixes the sound of skeletons and players shooting not playing on clients.");
generateConfigOption("world.settings.skeleton-shooting-sound-fix.enabled", true);
generateConfigOption("world.settings.speed-hack-check.enable", true);
Expand Down Expand Up @@ -172,6 +178,11 @@ private void write() {
generateConfigOption("emergency.debug.regenerate-corrupt-chunks.enable", false);
generateConfigOption("emergency.debug.regenerate-corrupt-chunks.info", "This setting allows you to automatically regenerate corrupt chunks. This is useful after a ungraceful shutdown while a file is being written to or out of memory exception.");

generateConfigOption("settings.update-checker.enabled", true);
generateConfigOption("settings.update-checker.info", "This setting allows you to disable the update checker. This is useful if you have a custom build of Poseidon or don't want to be notified of updates.");
generateConfigOption("settings.update-checker.notify-staff.enabled", true);
generateConfigOption("settings.update-checker.notify-staff.info", "This setting notifies operators and players with the permission poseidon.update when a new version of Poseidon is available on join.");

//Messages
generateConfigOption("message.kick.banned", "You are banned from this server!");
generateConfigOption("message.kick.ip-banned", "Your IP address is banned from this server!");
Expand All @@ -181,6 +192,7 @@ private void write() {
generateConfigOption("message.kick.already-online", "\u00A7cA player with your username or uuid is already online, try reconnecting in a minute.");
generateConfigOption("message.player.join", "\u00A7e%player% joined the game.");
generateConfigOption("message.player.leave", "\u00A7e%player% left the game.");
generateConfigOption("message.update.available", "\u00A7dA newer version of Poseidon is available: %newversion%");

//Optional Poseidon Commands
generateConfigOption("command.info", "This section allows you to enable or disable optional Poseidon commands. This is useful if you have a plugin that conflicts with a Poseidon command.");
Expand Down
Loading

0 comments on commit 3a5552b

Please sign in to comment.