0

I'm making a spigot plugin just for my minecraft server. Until now everything was OK and worked perfectly. Then I added some code and it just won't build... Here is the maven output:

https://pastebin.com/fftMVJth

And here is the code I added:

@EventHandler
public void onPlayerAdvancement(@NotNull PlayerAdvancementDoneEvent _event) {
    AdvancementDisplay $display = Objects.requireNonNull(_event.getAdvancement().getDisplay());
    String $message = "";
    
    switch ($display.getType()) {
        case TASK -> $message =
                """
                ["","<Name> has made the advancement ",{"text":"[<AName>]","color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"<AName>\\n","color":"green"},{"text":"<ADescription>","color":"green"}]}}]
                """;
        case GOAL -> $message =
                """
                ["","<Name> has reached the goal ",{"text":"[<AName>]","color":"green","hoverEvent":{"action":"show_text","contents":[{"text":"<AName>\\n","color":"green"},{"text":"<ADescription>","color":"green"}]}}]
                """;
        case CHALLENGE -> $message =
                """
                ["","<Name> has completed the challenge ",{"text":"[<AName>]","color":"dark_purple","hoverEvent":{"action":"show_text","contents":[{"text":"<AName>\\n","color":"dark_purple"},{"text":"<ADescription>","color":"dark_purple"}]}}]
                """;
    }
    
    String final$message = $message;
    getServer().getOnlinePlayers().forEach(_player -> _player.sendRawMessage(final$message
            .replaceAll("<Name>", _event.getPlayer().getName())
            .replaceAll("<AName>", $display.getTitle())
            .replaceAll("<ADescription>", $display.getDescription())));
}

I don't think the error is in my code, it is probably in something else... So here is my pom.xml:

<?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>

    <groupId>codes.rorak</groupId>
    <artifactId>Plugin</artifactId>
    <version>0.0.16-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19.3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

</project>

I tried to bring the version in pom.xml down to 8, but then my code doesn't work, because I use string blocks, switch expressions and parametrized instanceof operators... But I don't think that would work then, because in the error message, some of the errors are from code that was there from start and worked perfectly before...

EDIT: I event tried to edit my code so it works on Java 8 (and bringing it down to that level too ofc), but the error is still there...

Thanks for help!

0 Answers0