Skip to content

Commit

Permalink
push (#29)
Browse files Browse the repository at this point in the history
* fix log4j2.xml packages

* add new file to .gitignore

* The server opens an interfaces to make the server visible

* fix shutdown server

* get player skin for ClientChainData

* add dependendy com.google.guava

* ProtocolInfo.getPacket(int protocol) for compare player protocol and server protocol

* Init ChainData

* add new function

* Enable server connection

* feat(readme): small readme update
added the image of the sculk block + renamed the project in Sculk and not in Sculk-MP, giving it the pmmp aspet

* feat(readme): update logo png

* fix(log4j2): error using log4j2 which caused an error in the launch console + style update which will be a bit more compact

* feat(Sculk): update file to remove System.out which returns the same thing as log.info + use Code-Name

* add(Sculk): a runner for Sculk to make it more practical

* Update log4j2.xml

* add event system

* fix text

* import aikar timings

* fix co.aikar.timings

* fix login

* add getScheduler() function

* Adding thread backup

* Create player interface for player.class

* Timings.java fix

* add events

* add AsyncTask system

* fix LoginData & PacketHandler

* Update Server.java

* feat(vscode): delete unnecessary vscode files

* Bump com.nimbusds:nimbus-jose-jwt from 9.10.1 to 9.37.2

Bumps [com.nimbusds:nimbus-jose-jwt](https://bitbucket.org/connect2id/nimbus-jose-jwt) from 9.10.1 to 9.37.2.
- [Changelog](https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt)
- [Commits](https://bitbucket.org/connect2id/nimbus-jose-jwt/branches/compare/9.37.2..9.10.1)

---
updated-dependencies:
- dependency-name: com.nimbusds:nimbus-jose-jwt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Create publish.yml

* Update build.yml (#11)

* fix build and add post artifact on Action

* feat(colors): new minecraft colors added (#14)

* fix(server): modify server folder (#15)

* style(file header): Sculk-MP -> Sculk (#17)

* feat(server-properties): Creation of ServerProperties System (#18)

* feat(server-properties): creation of a ServerProperties system with enums

* feat(server-properties): delete "on" and "off"

* feat(server-properties): add "SPAWN_ANIMALS" and "SPAWN_MONSTERS"

* Readme Update (#20)

* style(Update badges with sculk colors + add contributors below):

* feat: edit badge color

* feat: edit SculkMP -> Sculk

* fix server ip and port

* Update Timings.java

* login send, next step world for login

* Update form milestone in readme

* Implement Forms (#21)

* impl: form sending logic

* impl: Form response handling

* Add Getters for CustomResponse

* Tried to reduce code complexity

* Player: give formId a default value

* Add consumers

* Add license headers

* impl: Code for PacketHandler

* Rename method name

* Update LoginData & Bedrock Interface

* Fix async task collect

* add packet connection

* feat: Base plugin + plugin manager (#22)

* fix string in PluginLoader

* (In dev) LoginPacketHandler JWT

* Update README.md

* Update README.md

* rename all fire function (Event) -> call

* Update handler and fix resources pack loading

Co-Authored-By: AzaleeX <[email protected]>
Co-Authored-By: Sensei Tarzan <[email protected]>

* Create spawn response packet

Co-Authored-By: Sensei Tarzan <[email protected]>

* login Success

* Create attribute

* Create hunger attribute

* generate Human file and extends

* Add new event (PlayerExhaustEvent)

* send player attributes

* Implement plugin api version check (#23)

* feat: Base plugin + plugin manager

* Try to reduce complexity

* feat: plugin api version check

* comment unfinished line of code

---------

Co-authored-by: PleaseInsertNameHere <[email protected]>

* Attribute (#24)

* Add experience attribute

* init hungerManager and experienceManager to function initEntity()

* Define default EntityFlag.BREATHING true (#25)

* Add experience attribute

* init hungerManager and experienceManager to function initEntity()

* Define default EntityFlag.BREATHING true

* 🔀 Add support chat and command integration (#26)

* add onUpdate() and call PlayerChatEvent.java

* Player login console information

* add ChatFormatter/StandardChatFormatter for PlayerChatEvent

* move player class

* Update Player::onChat()

* Change BedrockServerSession -> SculkServerSession

* Base logic command

* Sends message to the console when players are typing in chat

* Creation of the command system and version command

* register command and add Server::dispatchCommand()

* Add support Json message

Co-Authored-By: Sensei Tarzan <[email protected]>

* add CommandRequestPacket

* add Player::sendAnnouncement Player::sendWhisperPlayer::sendMessageTranslationPlayer::sendMessageSystem

Co-Authored-By: Sensei Tarzan <[email protected]>

* Add version command

* Fix display translation message

Co-Authored-By: Sensei Tarzan <[email protected]>

* Fix command data

Co-Authored-By: Sensei Tarzan <[email protected]>

* Add execute command in console

Co-Authored-By: Sensei Tarzan <[email protected]>

---------

Co-authored-by: Sensei Tarzan <[email protected]>

* feat(submotd): Add `getSubMotd` method and fix level name retrieval (#27)

* feat(submotd): added getSubMotd

* fix: Correction of the world name on the startgame package

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: JblusItsMe <[email protected]>
Co-authored-by: JblusItsMe <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sensei Tarzan <[email protected]>
Co-authored-by: PleaseInsertNameHere <[email protected]>
Co-authored-by: KeksDev <[email protected]>
Co-authored-by: Sensei Tarzan <[email protected]>
  • Loading branch information
8 people authored Sep 29, 2024
1 parent 772e6c5 commit 7ffdb77
Show file tree
Hide file tree
Showing 142 changed files with 9,427 additions and 281 deletions.
1 change: 0 additions & 1 deletion .AddCompLib/global.json

This file was deleted.

42 changes: 20 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
name: Maven Build with GraalVM
name: Sculk Server

on:
push:
branches:
- main
pull_request:
branches:
- main
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest

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 @@ -40,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
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Maven Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
23 changes: 18 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,21 @@ plugins/
resource_packs/
logs/
worlds/
server.json
whitelist.json
op.json
banned-ips.json
banned-players.json
whitelist.txt
op.txt
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.

16 changes: 16 additions & 0 deletions .run/Sculk.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Sculk" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.sculk.Sculk" />
<module name="Sculk" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/.run" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.sculk.player.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
![Header](https://capsule-render.vercel.app/api?type=Waving&color=timeGradient&height=200&animation=fadeIn&section=header&text=Sculk-MP&fontSize=70)
<div align="center">
<h3>Open source server software for Minecraft: Bedrock Edition written in Java</h3>
<img src="https://static.wikia.nocookie.net/minecraft_gamepedia/images/e/e2/Sculk_%28pre-release%29.png" width="150" height="150" alt="Logo Sculk">
<h4>Open source server software for Minecraft: Bedrock Edition written in Java</h4>

[![SculkVersion](https://img.shields.io/badge/version-soon-14191E.svg?cacheSeconds=2592000)]()
[![MinecraftVersion](https://img.shields.io/badge/minecraft-v1.21.21%20(Bedrock)-17272F)]()
[![ProtocolVersion](https://img.shields.io/badge/protocol-712-38D3DF)]()
[![Github Download](https://img.shields.io/github/downloads/sculkmp/Sculk/total?label=downloads%40total)]()
[![License](https://img.shields.io/badge/License-LGPL--3-yellow.svg)]()
[![JitPack](https://jitpack.io/v/sculkmp/Sculk.svg)]()
[![MinecraftVersion](https://img.shields.io/badge/minecraft-v1.21.1%20(Bedrock)-56383E)]()
[![SculkVersion](https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000)]()

</div>

Expand All @@ -18,7 +19,7 @@ Sculk is open source server software for Minecraft: Bedrock Edition, It has a fe
* We provided a high-level friendly API akin PocketMine plugin developers. Save yourself the hassle of dealing with the dot-and-cross of the low-level system API and hooks, we've done the difficult part for you!

## ✨ Creating plugins
Add SculkMP to your dependencies *(it is hosted by JitPack, so you need to specify a custom repository)*.
Add Sculk to your dependencies *(it is hosted by JitPack, so you need to specify a custom repository)*.

For maven:
```xml
Expand Down Expand Up @@ -49,15 +50,17 @@ dependencies {

| Milestone | Status |
|------------------------------------------|--------|
| **⚒️ Construction of the server tree** ||
| **🛜 Join server** ||
| **⚒️ Construction of the server tree** ||
| **👓 Visible server** ||
| **🛜 Join server** ||
| **🎍 World loader** | 🚧 |
| **🔌Plugin loader** | 🚧 |
| **🔌Plugin loader** | |
| **⌨️ Command System** | 🚧 |
| **🔐 Permission System** | 🚧 |
| **🎈 Event System** | 🚧 |
| **🖼 Form & Scoreboard API** | 🚧 |
| **👤 Player & Actor API** | 🚧 |
| **🎈 Event System** ||
| **🖼 Scoreboard API** | 🚧 |
| **🖼 Form API** ||
| **👤 Player & Actor API** ||
| **🔩 Item API** | 🚧 |
| **🧱 Block API** | 🚧 |
| **📦 Inventory API** | 🚧 |
Expand Down Expand Up @@ -95,5 +98,5 @@ Please ensure your code follows our coding standards and include tests where pos
This project is licensed under LGPL-3.0. Please see the [LICENSE](/LICENSE) file for details.

`sculkmp/Sculk` are not affiliated with Mojang.
All brands and trademarks belong to their respective owners. Sculk-MP is not a Mojang-approved software,
All brands and trademarks belong to their respective owners. Sculk is not a Mojang-approved software,
nor is it associated with Mojang.
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>
14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@
</repositories>

<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>33.2.1-jre</version>
</dependency>
<dependency>
<groupId>com.bugsnag</groupId>
<version>[3.0,4.0)</version>
Expand All @@ -135,7 +145,7 @@
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.12</version>
<version>8.5.13</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -257,7 +267,7 @@
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>9.10.1</version>
<version>9.37.2</version>
</dependency>
</dependencies>

Expand Down
Empty file added sculk.yml
Empty file.
108 changes: 108 additions & 0 deletions src/main/java/co/aikar/timings/FullServerTickTiming.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* This file is licensed under the MIT License (MIT).
*
* Copyright (c) 2014 Daniel Ennis <http://aikar.co>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package co.aikar.timings;

import static co.aikar.timings.TimingIdentifier.DEFAULT_GROUP;
import static co.aikar.timings.TimingsManager.*;

public class FullServerTickTiming extends Timing {
private static final TimingIdentifier IDENTIFIER = new TimingIdentifier(DEFAULT_GROUP.name, "Full Server Tick", null);
final TimingData minuteData;
double avgFreeMemory = -1D;
double avgUsedMemory = -1D;

FullServerTickTiming() {
super(IDENTIFIER);
this.minuteData = new TimingData(this.id);

TIMING_MAP.put(IDENTIFIER, this);
}

@Override
public Timing startTiming() {
if (TimingsManager.needsFullReset) {
TimingsManager.resetTimings();
} else if (TimingsManager.needsRecheckEnabled) {
TimingsManager.recheckEnabled();
}
super.startTiming();
return this;
}

@Override
public void stopTiming() {
super.stopTiming();
if (!this.enabled) {
return;
}

if (TimingsHistory.timedTicks % 20 == 0) {
final Runtime runtime = Runtime.getRuntime();
double usedMemory = runtime.totalMemory() - runtime.freeMemory();
double freeMemory = runtime.maxMemory() - usedMemory;

if (this.avgFreeMemory == -1) {
this.avgFreeMemory = freeMemory;
} else {
this.avgFreeMemory = (this.avgFreeMemory * (59 / 60D)) + (freeMemory * (1 / 60D));
}

if (this.avgUsedMemory == -1) {
this.avgUsedMemory = usedMemory;
} else {
this.avgUsedMemory = (this.avgUsedMemory * (59 / 60D)) + (usedMemory * (1 / 60D));
}
}

long start = System.nanoTime();
TimingsManager.tick();
long diff = System.nanoTime() - start;

CURRENT = Timings.timingsTickTimer;
Timings.timingsTickTimer.addDiff(diff);
//addDiff for timingsTickTimer incremented this, bring it back down to 1 per tick.
this.record.curTickCount--;
this.minuteData.curTickTotal = this.record.curTickTotal;
this.minuteData.curTickCount = 1;
boolean violated = isViolated();
this.minuteData.tick(violated);
Timings.timingsTickTimer.tick(violated);
tick(violated);

if (TimingsHistory.timedTicks % 1200 == 0) {
MINUTE_REPORTS.add(new TimingsHistory.MinuteReport());
TimingsHistory.resetTicks(false);
this.minuteData.reset();
}

if (TimingsHistory.timedTicks % Timings.getHistoryInterval() == 0) {
TimingsManager.HISTORY.add(new TimingsHistory());
TimingsManager.resetTimings();
}
}

boolean isViolated() {
return this.record.curTickTotal > 50000000;
}
}
Loading

0 comments on commit 7ffdb77

Please sign in to comment.