Code Monkey home page Code Monkey logo

chameleon's Introduction

Chameleon Logo

Cross-platform Minecraft plugin framework

License Code quality Test coverage
Latest release Latest version

Table of Contents

What is Chameleon?

Chameleon is a framework created to allow developers to easily create Minecraft plugins that work across multiple platforms.

Stability

While still in its development phrase, Chameleon is being actively used by the authors in production. However, until a stable release is made, the codebase is subject to major and potentially breaking changes without warning.

When we make a breaking change, we will try our best to change the version so that existing projects will not be affected until they update to a newer version.

Use of the Chameleon Framework in production environments, or for any other purpose, is entirely at your own risk.

Supported Platforms

Chameleon supports a variety of platforms. Do you know of another platform that we could support? Let us know by creating a feature request issue or sending a message in our official Discord server!

Please note that platforms marked as Unstable often experience breaking API changes that may impact the functionality of Chameleon. If you experience any issues with any of the platforms, please create a bug report, so we can address the issue.

In the event that maintaining compatibility with a platform's API becomes unfeasible or for any other reason a platform is deemed no longer worth supporting, we reserve the right to discontinue support for the platform without prior notice.

Platform Name Dependency Status
Bukkit (Paper, Folia) dev.hypera:chameleon-platform-bukkit
BungeeCord dev.hypera:chameleon-platform-bungeecord
Fabric dev.hypera:chameleon-platform-fabric Coming soon
Forge dev.hypera:chameleon-platform-forge Coming soon
Nukkit dev.hypera:chameleon-platform-nukkit
Sponge dev.hypera:chameleon-platform-sponge Unstable
Velocity dev.hypera:chameleon-platform-velocity

Discontinued Platform Support

Chameleon attempts to maintain support for a wide range of platforms. However, there are times when we must discontinue support for certain platforms. The decision to drop support for a platform is typically made when maintaining support the platform becomes too challenging, or when the platform becomes obsolete (or has been surpassed).

Below is a list of platforms that Chameleon no longer supports:

Platform Name Dependency Last version Related Issues
Minestom dev.hypera:chameleon-platform-minestom 0.16.0-SNAPSHOT #268

Getting started

We're currently working on Chameleon's documentation, and it will be available soon. In the meantime, you can check out our example project here. If you have any questions, don't hesitate to ask us in our official Discord server!

Project structure

Chameleon is a modular system that allows you to choose which parts you want to use. Here are the key modules:

  • chameleon-api contains Chameleon's core API, most things happen here.
  • chameleon-annotations contains our annotation-based platform class generator, designed to make using Chameleon as easy as possible.
  • chameleon-platform-(name) contains the implementation of Chameleon's API on the named platform. You can see a full list of supported platforms here.

If you have any questions or concerns, please do not hesitate to reach out to us in our official Discord server.

Annotation-based platform class generator

chameleon-annotations simplifies the process of generating the required classes for each platform to load and start Chameleon automatically.

To use this feature, add dev.hypera:chameleon-annotations as a compileOnly dependency and an annotationProcessor (Gradle) or as a provided dependency (Maven). Then, annotate your ChameleonPlugin class with @Plugin and provide some information about your plugin, that's it!

Dependencies

Latest Release Latest Snapshot

Java 11

Chameleon requires Java 11 as a minimum version. This is because Java 8 reached its end-of-life (EOL) in March 2022, which means that it will no longer receive public updates, leaving it vulnerable to security risks. Java 11 is the next long-term support (LTS) version, which means it will continue receiving public updates until at least September 2026 (Azul).

In addition to security reasons, Java 11 brings significant improvements over Java 8, such as better performance, improved memory management, and new API features. Using Java 11 will help ensure that Chameleon runs smoothly and efficiently, providing a better use experience.

Gradle

Kotlin DSL
repositories {
    // If using a release:
    mavenCentral()

    // If using a snapshot:
    maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
    // Import Chameleon's Bill of Materials to set the version for every other
    // Chameleon dependency.
    implementation(platform("dev.hypera:chameleon-bom:(VERSION)"))

    // Include Chameleon's API
    implementation("dev.hypera:chameleon-api")

    // Include the Chameleon implementation for each platform you wish to support.
    // Replace (name) with the platform name, and repeat the next line for as many
    // platforms as you wish.
    implementation("dev.hypera:chameleon-platform-(name)")

    // If you wish to use the automatic platform main class generation:
    compileOnly("dev.hypera:chameleon-annotations")
    annotationProcessor("dev.hypera:chameleon-annotations")
}
Groovy DSL
repositories {
    // If using a release:
    mavenCentral()

    // If using a snapshot:
    maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}

dependencies {
    // Import Chameleon's Bill of Materials to set the version for every other
    // Chameleon dependency.
    implementation platform('dev.hypera:chameleon-bom:(VERSION)')

    // Include Chameleon's API
    implementation 'dev.hypera:chameleon-api'

    // Include the Chameleon implementation for each platform you wish to support.
    // Replace (name) with the platform name, and repeat the next line for as many
    // platforms as you wish.
    implementation 'dev.hypera:chameleon-platform-(name)'

    // If you wish to use the automatic platform main class generation:
    compileOnly 'dev.hypera:chameleon-annotations'
    annotationProcessor 'dev.hypera:chameleon-annotations'
}

Maven

Maven
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- ... -->

    <repositories>
      <!-- If using a snapshot: -->
      <repository>
        <id>sonatype-oss-s01</id>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
      </repository>
    </repositories>
    
    <dependencyManagement>
      <dependencies>
        <!-- Import Chameleon's Bill of Materials to set the version for every other -->
        <!-- Chameleon dependency. -->
        <dependency>
          <groupId>dev.hypera</groupId>
          <artifactId>chameleon-bom</artifactId>
          <version>(VERSION)</version>
          <type>pom</type>
          <scope>import</scope>
        </dependency>
      </dependencies>
    </dependencyManagement>
    
    <dependencies>
      <!-- Include Chameleon's API -->
      <dependency>
        <groupId>dev.hypera</groupId>
        <artifactId>chameleon-api</artifactId>
      </dependency>
    
      <!-- Include the Chameleon implementation for each platform you wish to support. -->
      <!-- Replace (name) with the platform name, and repeat the next line for as many -->
      <!-- platforms as you wish. -->
      <dependency>
        <groupId>dev.hypera</groupId>
        <artifactId>chameleon-platform-(name)</artifactId>
      </dependency>
    
      <!-- If you wish to use the automatic platform main class generation: -->
      <dependency>
        <groupId>dev.hypera</groupId>
        <artifactId>chameleon-annotations</artifactId>
        <scope>provided</scope>
      </dependency>
    </dependencies>
</project>

Contributing

We welcome all contributions! If you have found something that you think you can improve, please feel free to contribute!
Please read our Contributing guide before creating a Pull Request or Issue :D

Building

To build this project, execute ./gradlew build in the project root directory. If you have Gradle 8.0+ installed, you can alternatively execute gradle build in the project root directory.

To publish the built artifacts to your local maven repository, add publishToMavenLocal to the end of the build command, e.g. ./gradlew build publishToMavenLocal

It is important to note that while the projects created with Chameleon can run on Java 11 or above, you will need Java 17 or newer to build Chameleon. This is due to several supported platforms requiring modern versions of Java.

Contact

You can contact us in our official Discord server (faster) or by emailing us at [email protected].

You can report a security vulnerability in Chameleon by:

License

Chameleon Framework is distributed under the terms of the MIT License.
For further details, please refer to the LICENSE file.

Acknowledgements

We are extremely grateful to the amazing individuals who have contributed to this project, as well as those who have supported us by providing valuable feedback and donations.

We would also like to thank all the individuals and companies who have supported us in sustaining this project. We are grateful for their valuable contributions that have enabled us to continue to improve Chameleon.

Please note that the individuals and companies listed under the "Supporters" section are independent of this project, and their inclusion should not be interpreted as an endorsement or affiliation.

Supporters

JetBrains

Plugins using Chameleon

We are thrilled to showcase some of the amazing plugins and resources that have been created using Chameleon! If you have created something using Chameleon that you think deserves to be on this list, don't hesitate to create a pull request to add it here! We would love to see what you have created.

chameleon's People

Contributors

dependabot[bot] avatar gayatriagarwal19 avatar joshuasing avatar loofifteen avatar renovate-bot avatar renovate[bot] avatar theserumdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chameleon's Issues

Improve GitHub issue templates

Confirmation

  • I have checked for similar issues.

Problem

The current GitHub issue templates require fields that should not be required, and format most fields as markdown inside code blocks.

Suggested solution

We should improve the GitHub issue templates, making it easier to report bugs and suggest ideas.

Additional information

No response

Blossom causes build failures on Gradle 8.2+

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

An exception occurred applying plugin request [id: 'net.kyori.blossom']
> Failed to apply plugin 'net.kyori.blossom'.
   > The plugin in class class net.kyori.blossom.Blossom has not been updatedto override the non-Convention apply method in ProjectPlugin!

Expected behaviour

Blossom should work as expected.

Reproduction steps

N/A

Exception

N/A

Environment

N/A

Additional information

A pull request was merged to resolve this issue: KyoriPowered/blossom#22
However a release has not been made since this pull request was merged

ServerUser

ServerUser should be filled with common methods from the Minestom Player and Spigot Player.

  • Block
  • Advancement
  • AdvancementProgress
  • Location
  • WeatherType
  • Scoreboard
  • ItemStack
  • Effect
  • Instrument
  • Note
  • Sound
  • SoundCategory
  • BlockData
  • Materal

The list goes on...

Improved platform plugin class generation

Confirmation

  • I have checked for similar issues.

Problem

The current chameleon-annotations module has a lot of problems, however the major ones are:

  • Hard to maintain due to complexity
  • Easy for the user to misuse
  • Lacks features

Suggested solution

It would be helpful if we could completely revamp the chameleon-annotations module to:

  • Use templates (makes everything less complex)
  • Allow customisation (packages, etc.)
  • Validate everything
  • Extension support (perhaps just add extension support to plugin bootstraps?)
  • Tests. Lots of tests. (100% test coverage if possible)

Additional information

No response

Remove `ChameleonPluginData`

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

Currently, Chameleon requires that plugins provide a ChameleonPluginData object during bootstrap creation.
This data is stored in Chameleon, however as Chameleon doesn't do anything with it, I don't see the reason for it being required, or existing in the first place.

I do not remember why this was originally introduced.

Expected behaviour

N/A

Reproduction steps

N/A

Exception

N/A

Environment

N/A

Additional information

No response

`PlatformPlugin#getDataFolder()` should be renamed to `#getDataDirectory()` to align with Chameleon

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

Chameleon#getDataFolder() was renamed to #getDataDirectory() to align with the majority of platforms.
PlatformPlugin was missed in this change, and still contains the method #getDataFolder().

Expected behaviour

PlatformPlugin#getDataDirectory()

Reproduction steps

N/A

Exception

N/A

Environment

N/A

Additional information

No response

Forge support

A Forge implementation of Chameleon would be nice to have.

Decouple managers from platform's Chameleon

Confirmation

  • I have checked for similar issues.

Problem

Currently, when creating support for a Bukkit-based platform, BukkitChameleon must be extended to grant access to Bukkit's manager classes. If these managers begin to use the abstracted classes rather than the internals where possible, it'll be less hacky when adding a platform like this to Chameleon.

Suggested solution

Prefer abstract classes over internal implementation in managers.

Additional information

No response

Folia PlatformTarget method missing

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

PlatformTarget is missing a static method for creating a Folia platform target.

Expected behaviour

PlatformTarget#folia() should exist.

Reproduction steps

N/A

Exception

N/A

Environment

N/A

Additional information

No response

null parameter passed into NotNull method

The proxy switch event in the Velocity support passes null into the #wrap method, which requires it to be not null.

Possible fix is to allow nullable servers to be passed into the event.

wrap(event.getPreviousServer().orElse(null)),
wrap(event.getPlayer().getCurrentServer().map(ServerConnection::getServer).orElse(null))

Extensions v2

Confirmation

  • I have checked for similar issues.

Problem

The current design of Chameleon extensions is rather over complicated, hard to work with, and has many features overlooked.

Suggested solution

It would be helpful to replace the current Extension system with a new one, that is thoroughly tested and easier to implement.

Additional information

No response

Documentation site

To make Chameleon easier to use, I think a documentation site made with Vitepress would probably be best.
This could be done in either a docs/ directory in this repository or in a separate repository.

Brigadier command support

It would be helpful to have Brigadier command support with Chameleon.
This should be fairly easy to do as platforms like Velocity and Minestom have native support for Brigadier.

Add `ChameleonPluginBootstrap` to allow users to provide custom plugin creation logic

Confirmation

  • I have checked for similar issues.

Problem

Chameleon currently creates a new instance of the ChameleonPlugin class via reflection.
This does not allow for any custom creation logic, and could cause instantiation issues to go undetected until runtime.

Suggested solution

We could add a ChameleonPluginBootstrap interface that could be used instead of providing a ChameleonPlugin class.
Paper provides a similar functionality: https://docs.papermc.io/paper/dev/getting-started/paper-plugins#bootstrapper

Additional information

No response

Add server list ping event

Confirmation

  • I have checked for similar issues.

Problem

Chameleon does not currently have a server list ping event.

Suggested solution

It would be helpful if Chameleon added a server list ping event.
This event could be used to create cross-platform MOTD plugins, or any other plugin that modifies the server list ping response.

I suggest a ServerPingEvent (feedback on name would be appreciated!) be added to the dev.hypera.chameleon.event.common package.

Platform events:

This event would also need a representation of a server list ping response.

Additional information

No response

Support for multiple versions of Sponge

Confirmation

  • I have checked for similar issues.

Problem

Sponge seems to consistently and completely break their API between each version.
We currently only support Sponge v8, and even support for that is problematic and somewhat broken.

E.g. #118

Suggested solution

It might work to create several separate modules for sponge; e.g. platform-sponge7, platform-sponge8, platform-sponge9, however this is rather impractical and would take a lot of time and effort to maintain.
We could support only the latest version of Sponge, however that could cause problems for some developers.

If possible, we need to figure out a better solution or drop Sponge support entirely.

Additional information

No response

UserConnectEvent cannot be cancelled

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

When canceling the UserConnectEvent, with orn without a reason, the user is not being kicked.

(Also i saw that the implementation of minestom, the events, are using EventBuilder#ignoredIfCancelled(false);, which devers the purpose of the EventSubscriber#acceptCancelled(true) )

Expected behaviour

Kicked/Denied the connection/player with a reason.

Reproduction steps

public class PlayerLoginEvent implements EventSubscriber<UserConnectEvent> {

   public PlayerLoginEvent(ChameleonPlugin pl) {
      pl.getChameleon().getEventbus().subscribe(this);
   }

   public void on(UserConnectEvent event) throws Exception {
       event.cancel(true);
   }

   @Override
   public boolean acceptCancelled() {
    //Gets ingored in the Minestom Impl
    return true;
   }
}

Exception

There is no exception.

Environment

Operating System: Windows 11 & Windows 10
Platform(s): Minestom (Latest Release)

Additional information

None

User manager instantiated before Adventure

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

When instantiating BungeeCord support, an exception is thrown.

Expected behaviour

Not throw an error.

Reproduction steps

`BungeeCordChameleon chameleon = BungeeCordChameleon.create(...);`

Exception

java.lang.NullPointerException: Cannot invoke "dev.hypera.chameleon.adventure.ChameleonAudienceProvider.console()" because the return value of "dev.hypera.chameleon.Chameleon.getAdventure()" is null
        at dev.hypera.chameleon.platform.bungeecord.user.BungeeCordConsoleUser.<init>(BungeeCordConsoleUser.java:49) ~[?:?]
        at dev.hypera.chameleon.platform.bungeecord.user.BungeeCordUserManager.<init>(BungeeCordUserManager.java:59) ~[?:?]
        at dev.hypera.chameleon.platform.bungeecord.BungeeCordChameleon.<init>(BungeeCordChameleon.java:61) ~[?:?]
        at dev.hypera.chameleon.platform.bungeecord.BungeeCordChameleonBootstrap.loadInternal(BungeeCordChameleonBootstrap.java:58) ~[?:?]
        at dev.hypera.chameleon.platform.bungeecord.BungeeCordChameleonBootstrap.loadInternal(BungeeCordChameleonBootstrap.java:42) ~[?:?]
        at dev.hypera.chameleon.ChameleonBootstrap.load(ChameleonBootstrap.java:118) ~[?:?]

Environment

Operating System: Windows 10
Platform(s): BungeeCord 1.19

Additional information

No response

Migrate Adventure mappers to MethodHandles

Confirmation

  • I have checked for similar issues.

Problem

The Adventure mappers currently use Reflection to invoke "platform Adventure" methods.
Reflection is known to be slow, and this can have an impact on performance on platforms where this is required.

Suggested solution

MethodHandles provide an alternative way to invoke methods, whilst being faster than Reflection. However, they are a little bit more complicated and harder to use than Reflection. Additionally, MethodHandles are typed.

If done correctly, I believe moving to MethodHandles would greatly improve the performance of the Adventure mappers, and may allow us to improve the mappers at the same time. Additionally, given MethodHandles are typed, we may be able to catch more issues at compile-time.

Additional information

No response

Add "Plugins using Chameleon" section to README.md

It would be nice to have a section towards the bottom of the README.md file that allows people to show off plugins that they've made that use Chameleon. We would probably have to have some rules for what is allowed so it isn't just used for promotion, however.

`isFolia` check does not use recommended class

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

https://github.com/ChameleonFramework/Chameleon/blob/main/platform-folia/src/main/java/dev/hypera/chameleon/platform/folia/FoliaChameleon.java#L122-L135

Expected behaviour

The PaperMC "Folia Support" documentation recommends checking for the io.papermc.paper.threadedregions.RegionizedServer class to detect Folia.

Reproduction steps

N/A

Exception

N/A

Environment

Operating System: N/A
Platform(s): Folia

Additional information

No response

Benchmarking for Adventure mappers

Confirmation

  • I have checked for similar issues.

Problem

There is currently no way to tell how performant our Adventure mappers are.

Suggested solution

I think it would be helpful if we added benchmarks for the Adventure mappers using JMH.

Additional information

No response

Build and test with Java 21

Confirmation

  • I have checked for similar issues.

Problem

We currently build and test Chameleon with Java 11 and 17.

Suggested solution

Java 21 is the latest released LTS, so we should be testing with it.
However, currently Kotlin does not support Java 21 (therefore nor does Gradle).

As soon as Kotlin and Gradle fully support Java 21:

  • Update gradle.yml, release.yml and snapshot.yml to use Java 21
  • Update chameleon.base.gradle.kts to test with Java 21 (This can be done before Gradle supports running with Java 21)

Additional information

No response

Advanced Command System

A more advanced command system should be put in place that allows for less checks to be done inside the command. Some of these ideas include:

  • Proxy only commands
  • Server only commands
  • Brigadier support

Remove support for Minestom (chameleon-platform-minestom)

Confirmation

  • I have checked for similar issues.

Problem

Due to its artifact management, Minestom has been a pain to upkeep. In addition to this, it is very unlikely that someone is to use Chameleon for a Minestom extension - especially with the recent move to minestom-ce, which doesn't have extensions.

Suggested solution

We should remove Minestom support altogether as it is unlikely to be used and no longer matches the purpose of Chameleon.

Additional information

No response

Drop support for Java 8

Confirmation

  • I have checked for similar issues.

Problem

Mockito v5 has dropped support for Java 8. This means updating would require us to do the same.

Suggested solution

We should completely remove support for Java 8 as it is no longer a good version of Java to use. At the time of writing, only 15 servers are running UltraStaffChatPro v2 on Java 8. The other 251 are using Java 11 or above.
Disclaimer: This is out of all servers with bStats enabled, which is most.

Out of the 15 servers:

  • 1 is a Paper 1.8.8 server, which can be ran on Java versions 8-16
  • 14 are BungeeCord proxies, which can be ran on Java versions 8-17

These statistics technically mean that all servers that currently run on Java 8 can also be updated to Java 16.

Additional information

No response

Update README

Confirmation

  • I have checked for similar issues.

Problem

The current README file does not mention that Chameleon now requires Java 11, or Folia support.

Suggested solution

I think it would be a good idea to update the README.md file to mention the Java 11 requirement and the new Folia platform added by @LooFifteen in #217

Additional information

No response

Releases are not published to Hypera's maven repository

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

Gradle is only publishing releases to Maven Central, and is not publishing them to https://repo.hypera.dev/releases/.

Expected behaviour

Gradle should have published to both repositories.

Reproduction steps

`./gradlew publish closeAndReleaseSonatypeStagingRepository`
Release action logs: https://github.com/ChameleonFramework/Chameleon/actions/runs/6161985517/job/16722475885

Exception

N/A

Environment

N/A

Additional information

No response

Bukkit schedulers do not work on Folia

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

When using the Bukkit scheduler on Folia, an UnsupportedOperationException is thrown.

Expected behaviour

Scheduled a task without throwing.

Reproduction steps

Use the Bukkit Scheduler

Exception

java.lang.UnsupportedOperationException: null
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.handle(CraftScheduler.java:536) ~[folia-1.19.4.jar:git-Folia-"5b74945"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:260) ~[folia-1.19.4.jar:git-Folia-"5b74945"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:247) ~[folia-1.19.4.jar:git-Folia-"5b74945"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskLaterAsynchronously(CraftScheduler.java:192) ~[folia-1.19.4.jar:git-Folia-"5b74945"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskAsynchronously(CraftScheduler.java:161) ~[folia-1.19.4.jar:git-Folia-"5b74945"]

Environment

Operating System: Windows 10
Platform(s): git-Folia-"5b74945" (MC: 1.19.4)

Additional information

No response

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/gradle.yml
  • HyperaDev/actions main
.github/workflows/release.yml
  • HyperaDev/actions main
.github/workflows/snapshot.yml
  • HyperaDev/actions main
gradle
gradle.properties
settings.gradle.kts
  • org.gradle.toolchains.foojay-resolver-convention 0.8.0
build.gradle.kts
annotations/build.gradle.kts
api/build.gradle.kts
bom/build.gradle.kts
build-logic/settings.gradle.kts
build-logic/build.gradle.kts
build-logic/src/main/kotlin/chameleon.base.gradle.kts
build-logic/src/main/kotlin/chameleon.common.gradle.kts
build-logic/src/main/kotlin/chameleon.publishing.gradle.kts
example/build.gradle.kts
  • com.github.johnrengelman.shadow 8.1.1
gradle/libs.versions.toml
  • net.kyori:adventure-api 4.17.0
  • net.kyori:adventure-text-serializer-legacy 4.17.0
  • net.kyori:adventure-text-serializer-gson 4.17.0
  • net.kyori:adventure-platform-api 4.3.2
  • net.kyori:adventure-platform-bukkit 4.3.2
  • net.kyori:adventure-platform-bungeecord 4.3.2
  • io.papermc.paper:paper-api 1.20.2-R0.1-SNAPSHOT
  • net.md-5:bungeecord-api 1.20-R0.3-SNAPSHOT
  • cn.nukkit:nukkit 1.0-SNAPSHOT
  • org.spongepowered:spongeapi 10.0.0
  • com.velocitypowered:velocity-api 3.2.0-SNAPSHOT
  • com.google.code.gson:gson 2.11.0
  • org.yaml:snakeyaml 2.2
  • com.squareup:javapoet 1.13.0
  • org.slf4j:slf4j-api 2.0.13
  • org.apache.logging.log4j:log4j-api 2.23.1
  • org.jetbrains:annotations 24.1.0
  • net.kyori:indra-common 3.1.3
  • net.kyori:indra-publishing-gradle-plugin 3.1.3
  • net.kyori:indra-licenser-spotless 3.1.3
  • com.adarshr:gradle-test-logger-plugin 4.0.0
  • net.ltgt.gradle:gradle-errorprone-plugin 3.1.0
  • com.google.errorprone:error_prone_core 2.27.1
  • com.google.errorprone:error_prone_annotations 2.27.1
  • net.ltgt.gradle:gradle-nullaway-plugin 2.0.0
  • com.uber.nullaway:nullaway 0.10.26
  • com.puppycrawl.tools:checkstyle 10.16.0
  • org.junit:junit-bom 5.10.2
  • com.google.truth:truth 1.4.2
  • com.google.guava:guava-testlib 33.2.0-jre
  • org.mockito:mockito-bom 5.12.0
  • net.kyori.indra.publishing.sonatype 3.1.3
  • io.github.gradle-nexus.publish-plugin 2.0.0
platform-api/build.gradle.kts
platform-bukkit/build.gradle.kts
platform-bungeecord/build.gradle.kts
platform-nukkit/build.gradle.kts
platform-sponge/build.gradle.kts
platform-velocity/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

Sponge support

A Sponge implementation of Chameleon would be nice to have.

Chameleon example doesn't work on Minestom

Confirmation

  • I have checked for similar issues.
  • I using the latest version of Chameleon.

Describe the bug

Running the Chameleon example on the Minestom demo server fails with an error.

Expected behaviour

No error message and the successful loading of the example extension.

Reproduction steps

1. Build the Chameleon example
2. Copy the `example/build/libs/chameleon-example-0.15.0-SNAPSHOT.jar` into the Minestom servers `extension` folder
3. Run the Minestom server

Exception

[main] [11:39:44] (ExtensionManager.loadExtension) - ERROR - While instantiating the main class 'dev.hypera.chameleon.example.platform.minestom.ChameleonExampleMinestom' in 'ChameleonExample' an exception was thrown.: java.lang.NoSuchMethodError: 'dev.hypera.chameleon.example.lib.kyori.adventure.text.logger.slf4j.ComponentLogger net.minestom.server.extensions.Extension.getLogger()'
        at Ext_ChameleonExample//dev.hypera.chameleon.platform.minestom.MinestomChameleonBootstrap.<init>(MinestomChameleonBootstrap.java:47)
        at Ext_ChameleonExample//dev.hypera.chameleon.platform.minestom.MinestomChameleon.create(MinestomChameleon.java:92)
        at Ext_ChameleonExample//dev.hypera.chameleon.example.platform.minestom.ChameleonExampleMinestom.<init>(ChameleonExampleMinestom.java:18)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at net.minestom.server.extensions.ExtensionManager.loadExtension(ExtensionManager.java:305)
        at net.minestom.server.extensions.ExtensionManager.loadExtensions(ExtensionManager.java:237)
        at net.minestom.server.extensions.ExtensionManager.start(ExtensionManager.java:111)
        at net.minestom.server.ServerProcessImpl.start(ServerProcessImpl.java:211)
        at net.minestom.server.MinecraftServer.start(MinecraftServer.java:322)
        at net.minestom.server.MinecraftServer.start(MinecraftServer.java:327)
        at net.minestom.demo.Main.main(Main.java:111)

Environment

Operating System: Ubuntu 22.04.2
Platform(s): Minestom (built from latest master but also on release 8ad2c7701f)

Additional information

The chameleon example has some classes of the Kyori Adventure API in its jar.
Minestom provides them too.
This can potentially cause problems.

Mocked Chameleon and more unit testing

It would be helpful to have a mock Chameleon implementation for use in tests.
This would also allow us to write unit tests for Chameleon which would be extremely helpful in the long term.

Move to NIO

I think it would be a good idea to move to using Java NIO, as it is newer and faster.

  • Move anything using IO to NIO
  • Deprecate old methods using IO

Events

Map and forward events from the platform to the Chameleon plugin.

To do

  • Core event system
  • Listeners

Events

  • Event types
    • UserEvent
    • ProxyUserEvent
    • ServerUserEvent
  • Connection events
    • UserConnectEvent
    • UserLeaveEvent
  • User action events
    • UserChatEvent
    • UserCommandExecuteEvent
  • Tab completion events
    • TabCompleteEvent
    • TabCompleteResponseEvent
  • Proxy only events
    • ProxyUserHandshakeEvent
    • ProxyUserSwitchEvent
  • Server only events
    • ServerUserAnimationEvent
    • ServerUserExperienceEvent
      • ServerUserExperienceChangeEvent
      • ServerUserLevelChangeEvent
    • ServerUserGameModeChangeEvent
    • ServerUserInteractionEvent
      • ServerUserArmorStandManipulateEvent
      • ServerUserInteractAtEntityEvent
      • ServerUserInteractEntityEvent
      • ServerUserInventoryInteractionEvent
        • ServerUserChangedMainHandEvent
        • ServerUserDropItemEvent
        • ServerUserEditBookEvent
        • ServerUserItemBreakEvent
        • ServerUserItemConsumeEvent
        • ServerUserItemDamageEvent
        • ServerUserItemHeldEvent
        • ServerUserItemMendEvent
        • ServerUserPickupArrowEvent
        • ServerUserPickupItemEvent
      • ServerUserLocaleChangeEvent
      • ServerUserMovementEvent
      • ServerUserPortalEvent
      • ServerUserRecipeDiscoverEvent
      • ServerUserRespawnEvent
      • ServerUserRiptideEvent
      • ServerUserStatisticIncrementEvent
      • ServerUserTeleportEvent
      • ServerUserToggleFlightEvent
      • ServerUserToggleSneakEvent
      • ServerUserToggleSprintEvent
      • ServerUserVelocityEvent
      • ServerUserWorldInteractionEvent
        • ServerUserBedEnterEvent
        • ServerUserBedLeaveEvent
        • ServerUserBlockInteractionEvent
          • ServerUserBlockPlaceEvent
          • ServerUserBlockBreakEvent
        • ServerUserBucketEvent
          • ServerUserBucketEmptyEvent
          • ServerUserBucketEntityEvent
          • ServerUserBucketFillEvent
          • ServerUserBucketFishEvent
        • ServerUserEggThrowEvent
        • ServerUserFishEvent
        • ServerUserHarvestBlockEvent
        • ServerUserShearEntityEvent
        • ServerUserUnleashEntityEvent

Better tab completion

Our current implementation of tab completion works, however there are better ways of handling it that should be considered.

Move Platform API into a separate module (`platform-api`)

Confirmation

  • I have checked for similar issues.

Problem

The dev.hypera.chameleon.platform package in the api module currently contains a few classes for platform implementations (e.g. PlatformChameleon). In the future, other features will require more abstract classes and interfaces for Platforms to use (e.g. #216), making this package quite large.

Suggested solution

I think it would be helpful if we added a separate platform-api module to Chameleon.
This module would contain APIs specifically used by platform implementations, and not needed by end-users (although potentially accessible).

This module could also allow us to make implementing Chameleon platforms easier as we could share more code between platforms without making the main module too large.

Additional information

I would highly appreciate any feedback on this idea

Debugging utils

Easy to use and reliable debugging utils would be helpful for creating and maintaining chameleon plugins, these debug utils should include:

  • Debug logging
  • Debug dumps

Fabric support

A Fabric implementation of Chameleon would be nice to have.

Metadata System

Confirmation

  • I have checked for similar issues.

Problem

void myMethod(User user) {
    MyUser myUser = userService.getUser(user.getId()); 
    Group group = groupService.getGroup(myUser.getId());
    // todo something with group
}

The current implementation of the framework requires multiple service calls to retrieve a user's group information, which can be inefficient and result in unnecessary database queries..

Suggested solution

I suggest implementing a metadata system that allows developers to attach custom metadata to a user object, which can be retrieved in a single service call. This would allow for more efficient and streamlined access to user group information.

Code after the sugestion:

public static final MetadataKey<Integer> USER_ID = MetadataKey.of("user_id", Integer.class);

void myMethod(User user) {
    Group group = groupService.getGroup(user.getMetadata(USER_ID));
    // todo something with group
}

Additional information

The suggested metadata system could be implemented using a key-value store, similar to the example provided in the code snippet.

Error management

A easy to use error management system should be implemented, the features of this error management system should include:

  • Error logging
  • Fatal errors

Plugin and Platform information

I think it is necessary to have a way to get data about the plugin and platform that the plugin is running on.
This data should include:

  • Plugin information
    • Plugin name
    • Plugin version
    • Plugin author
  • Platform information
    • Platform name
    • Platform version
    • Platform type

Rename `core` module to `api`

I think it would be a good idea to rename the core module to api and the package dev.hypera.chameleon.core to dev.hypera.chameleon. The name api makes more sense as the core module is mostly just abstract classes and interfaces that are implemented by each platform and the package dev.hypera.chameleon generally looks cleaner.

Update to Gradle 8

Confirmation

  • I have checked for similar issues.

Problem

Gradle has started releasing release candidates for v8.

Suggested solution

When a stable Gradle 8 release is made, we should update the project to build with it.

Gradle 8 removes a lot of deprecated features, however when testing Chameleon with Gradle 8, only one change needs to be made to have the project build successfully.

Additional information

No response

Update Adventure mappers

Confirmation

  • I have checked for similar issues.

Problem

The current Adventure mappers do not support the latest version and should be generally improved.

Suggested solution

The existing mappers should be completely replaced with a new, more efficient, and non-static system.

Additional information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.