Skip to content
Matthias Ngeo edited this page Nov 7, 2021 · 22 revisions

Why do arguments throw an error when given an input with special characters?

StringArgument.word() relies on StringReader.readUnquotedString() which does not parse non-ASCII characters properly. See this issue for more information.

It is recommended to use WordType.word() instead of StringArgument.word(), and Readers.unquoted(StringReader) instead of StringReader.readUnquoted().

What is Chimera's deprecation & Minecraft version support policy?

The project is stable and breaking API changes are extremely unlikely. That being said, breaking changes may be introduced in major or minor releases.

Chimera will only support the latest Minecraft version at the time of release. We have no plans to support older versions of the game.

How do I use SNAPSHOT releases?

Use the snapshot repository.

<repository>
  <id>chimera-snapshots</id>
  <url>https://repo.karuslabs.com/repository/chimera-snapshots/</url>
</repository>

Why does Chimera Commands require NMS?

Interactions between Brigadier and NMS are complex and intertwined. It is extremely difficult and inefficient to rely on reflection to dance between Spigot and NMS types. In addition, Cartesian types rely on the NMS ArgumentVec types which again makes it impractical to use reflection.

In summary, NMS provides better correctness guarantees and performance over reflection.

Why doesn't Chimera Commands have a caching mechanism?

Early development builds of Chimera supported caching of suggestions and parsed arguments. However, we ran into issues that blocked progress.

Chiefly was the frequency at which the server was asked to provide suggestions which led to the cache being both bloated and stale, rendering it ineffective. It also caused memory leaks as it prevented the cleaning-up of Player objects.

In the end, we felt it to be more hassle than worth and that it can be better implemented in 3rd-party custom types if the need arises.

Why must fields annotated with @Bind be public and final?

Requiring fields annotated with @Bind to be public both facilitates code generation and simplifies the resultant code. To support non-public fields will pose additional and needless complexity when accessing the fields in the generated code. Furthermore, encapsulation will be broken if non-public fields are accessed in another (generated) class.

Mutable fields annotated @Bind opens up the possibility for a slew of subtle mistakes and unexpected behaviour to happen. Take into consideration:

class TellCommand {

    @Bind("<foo>") public Type type = new AType();

    public void doSomething() {
        type = new BType();
    }

}

This raises the question of whether the type bound to foo will be changed after the registration of TellCommand. Some may expect the type for foo to be updated and it may seem unexpected that the type bound to foo will not change once registered. Immutability avoids the problem and provides better semantics.

Why does the project require Java 11 and above?

Chimera uses several new APIs and language features introduced in Java 9 & above.

  • Collection factory methods, i.e. List.of(...), Set.of(...), Map.of(...)
  • Local type inference
  • VarHandle API introduced to modify inaccessible fields in Brigadier classes

We could use Java 10, or Java 9 if we refrain from using local type inference. However, neither has LTS and are no longer supported. Hence Java 11 which has LTS as the minimum required version.

We understand that most servers and plugins are using Java 8; that most developers cannot/will not use the library. Nevertheless, we stand by our decision to use Java 11. We encourage developers and server owners to upgrade to Java 11+ to leverage on the improvements to the language and JVM over the 6 years since Java 8 was released.

Spigot now requires Java 16, it's been a good 4 years since we started, I'm happy now.

Clone this wiki locally