All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.plugin.PowerNukkitPlugin Maven / Gradle / Ivy

Go to download

A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.

There is a newer version: 1.6.0.1-PN
Show newest version
package cn.nukkit.plugin;

import cn.nukkit.api.PowerNukkitOnly;
import cn.nukkit.api.Since;
import cn.nukkit.event.Listener;

@PowerNukkitOnly
@Since("1.3.0.0-PN")
public class PowerNukkitPlugin extends PluginBase {
    private static final PowerNukkitPlugin INSTANCE = new PowerNukkitPlugin();
    
    @PowerNukkitOnly
    @Since("1.3.0.0-PN")
    public static PowerNukkitPlugin getInstance() {
        return INSTANCE;
    }

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new HotFixes(), this);
    }

    /**
     * These are temporary workaround to issues with great impact that wasn't fixed the right way yet.
     */
    private class HotFixes implements Listener {
        /*
         * Hotfix from MR.CLEAN: https://discordapp.com/channels/728280425255927879/728284727748067455/734488813774307329
         */
        /*@EventHandler
        public void onOpenEC(InventoryOpenEvent e) {
            if (!e.isCancelled() && e.getInventory() instanceof PlayerEnderChestInventory) {
                final Player p = e.getPlayer();

                Server.getInstance().getScheduler().scheduleDelayedTask(PowerNukkitPlugin.this, () -> {
                    if (p != null && p.isOnline() && p.getTopWindow().isPresent() && p.getTopWindow().get() instanceof PlayerEnderChestInventory) {
                        PlayerEnderChestInventory ec = (PlayerEnderChestInventory) p.getTopWindow().get();
                        ec.sendContents(p);
                    }
                }, 3);
            }
        }*/
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy