kangarko / Foundation

Foundation™ helps you create highly customized Minecraft plugins (based on Spigot/Paper API) that support multiple MC versions.
https://mineacademy.org
305 stars 63 forks source link

1.16.5: Many plugins no longer work #266

Closed GabryOsas closed 6 months ago

GabryOsas commented 6 months ago

Hello! I tried today and yesterday following the Foundation library course on Youtube. I first tried the plugin alone without other plugins inside the server and everything worked correctly except for the plugin itself taking a little too long to start up. Subsequently I added other plugins within the server and these started to cause problems by not starting or not starting my plugin. Checking your discord I noticed that a guy also encountered the same problem as me with EssentialsX but didn't receive a response.

QualityArmory: link

My plugin with QualityArmory and ProtocolLib: link

My plugin with PlaceHolderAPI: link

My plugin with EssentialsX: link

As mentioned previously, the plugin works on its own, if in doubt I insert the code I used here:

POM

<?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>me.gabryosas</groupId>
    <artifactId>TestAPI</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>TestAPI</name>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.kangarko</groupId>
            <artifactId>Foundation</artifactId>
            <version>6.6.4</version>
        </dependency>
    </dependencies>
</project>

Main class

public final class TestAPI extends SimplePlugin implements Listener {

    @Override
    public void onPluginStart() {
        getServer().getPluginManager().registerEvents(this, this);
    }
    @EventHandler
    public void onJoin(PlayerJoinEvent e){
        new MainMenu().displayTo(e.getPlayer());
    }
    @Override
    public void onPluginStop() {
        // Plugin shutdown logic
    }
}

Menu class

public class MainMenu extends Menu {
    @Position(11)
    private final Button cartaID;
    public MainMenu(){
        setTitle("Seleziona l'azione da eseguire");
        setSize(27);
        this.cartaID = new ButtonMenu(new PaginatedMenu(), CompMaterial.PAPER, "§dCARTAID");
    }
    private class PaginatedMenu extends MenuPagged<Player> {
        PaginatedMenu(){
            super(MainMenu.this, loadItems());
            setTitle("Seleziona il giocatore");
            setSize(36);
        }

        /*@Override
        public Button formNextButton() {
            return new Button() {
                final boolean canGo = getCurrentPage() < getPages().size();

                @Override
                public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) {
                    if (this.canGo)
                        setCurrentPage(MathUtil.range(getCurrentPage() + 1, 1, getPages().size()));
                }

                @Override
                public ItemStack getItem() {
                    final boolean lastPage = getCurrentPage() == getPages().size();

                    return ItemCreator
                            .of(this.canGo ? MenuPagged.getActivePageButton() : MenuPagged.getInactivePageButton())
                            .name(lastPage ? SimpleLocalization.Menu.PAGE_LAST : SimpleLocalization.Menu.PAGE_NEXT.replace("{page}", String.valueOf(getCurrentPage() + 1)))
                            .make();
                }
            };
        }*/

        @Override
        protected ItemStack convertToItemStack(Player item) {
            return ItemCreator.of(CompMaterial.PLAYER_HEAD, item.getName()).skullOwner(item.getName()).make();
        }

        @Override
        protected void onPageClick(Player player, Player item, ClickType click) {
            player.closeInventory();
        }
    }
    private static List<Player> loadItems(){
        List<Player> players = new ArrayList<>();
        players.addAll(Bukkit.getOnlinePlayers());
        return players;
    }
}
kangarko commented 6 months ago

Do you have the latest version of ProtocolLib and these other plugins?

GabryOsas commented 6 months ago

Yes, all the plugins are updated, except qualityarmory but I also tried with new versions and it doesn't work.

kangarko commented 6 months ago

When you are compiling with maven you accidentally shaded all libraries inside the jar:

a

Use the pom.xml from https://github.com/kangarko/plugintemplate and customize it, with regards to the include filters in maven shade plugin section.