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

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

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

AzaleeX
Copy link
Member

@AzaleeX AzaleeX commented Aug 20, 2024

Description

This pull request introduces a new ServerProperties system to manage the server's configuration properties in a more structured and maintainable way. The changes replace the previous use of Config with the newly created ServerProperties class and the associated ServerPropertiesKeys enum.

Key Changes

  • Server.java:

    • Replaced the Config instance managing server.properties with ServerProperties.
    • Removed hardcoded property keys and replaced them with keys from ServerPropertiesKeys.
    • Updated methods to use the new ServerProperties system for retrieving and setting configuration properties.
  • ServerProperties.java:

    • A new class to handle server properties with predefined default values.
    • Provides methods for retrieving properties with type safety (e.g., String, Integer, Boolean, etc.).
    • Simplifies setting and getting property values with appropriate type casting.
  • ServerPropertiesKeys.java:

    • An enum containing all the keys used in the server.properties file.
    • Ensures that all keys are centralized and consistent across the codebase.

Changes Overview

  • Files Modified: 2 files modified (Server.java and ServerProperties.java)
  • Files Added: 2 files added (ServerProperties.java, ServerPropertiesKeys.java)
  • Lines Added: 164 lines
  • Lines Removed: 25 lines

Code Review

Additions:

  • Server.java:

    • Added import org.sculk.config.ServerProperties;
    • Added import org.sculk.config.ServerPropertiesKeys;
    • Initialized ServerProperties instead of Config for server properties.
    • Updated logging and configuration retrieval methods.
  • ServerProperties.java:

    • Added logic for initializing and managing server properties with default values.
    • Created methods for safe retrieval of different data types (e.g., String, Integer, Boolean).
  • ServerPropertiesKeys.java:

    • Enum to define keys used in ServerProperties.

Deletions:

  • Server.java:
    • Removed hardcoded string literals for property keys.
    • Removed old Config initialization for server.properties.

Testing

  • Tested the new ServerProperties system with existing server configurations.
  • Ensured all properties load correctly with their respective types.
  • Verified that default values are applied when properties are missing.

@AzaleeX

@AzaleeX AzaleeX added Priority: Low Low-priority issues that can be addressed later. Status: Awaiting Review Issues waiting to be reviewed by the team. Category: Core Issues related to the core functionality or main components of the software. labels Aug 20, 2024
@AzaleeX AzaleeX self-assigned this Aug 20, 2024
@AzaleeX AzaleeX added Status: Incomplete Issues missing necessary information. and removed Status: Awaiting Review Issues waiting to be reviewed by the team. labels Aug 21, 2024
@JblusItsMe JblusItsMe merged commit d6b0650 into main Aug 21, 2024
3 checks passed
@AzaleeX AzaleeX deleted the server-properties branch August 22, 2024 23:02
AzaleeX added a commit that referenced this pull request Sep 29, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core Issues related to the core functionality or main components of the software. Priority: Low Low-priority issues that can be addressed later. Status: Incomplete Issues missing necessary information.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants