ElytraFly

ElytraFly

por poggit-archive
No disponible
MecánicasHerramientasVariospocketmine
4visitas
0descargas

General

what it does

Single plugin that handles everything elytra-related. No more juggling 3–4 separate plugins for the item, entity, fireworks boost, and flight physics. ElytraFly auto-detects your server kernel at runtime and loads only what's needed — this is a revolution among vanilla mechanics in PMMP.

Config

configuration

language: en # english or russian, default is en. Set ru for russian. elytra-durability: 432 # elytra durability elytra-breakable: true # can elytra break at all? true - yes / false - no elytra-in-creative: true # show elytra in creative mode? true - yes / false - no cancel-fall-damage: true # disable fall damage while gliding? true - yes / false - no. This is a somewhat broken feature — proper BDS physics are hard to port to PHP. If you manage to do it, pull requests are welcome on GitHub.

API

Took care of plugin developers too, both small ones and those using this in production. Add ElytraFly as a dependency in your plugin.yml:

softdepend:

  • ElytraFly

Guard every call with a null-check first:

if ($this->getServer()->getPluginManager()->getPlugin('ElytraFly') === null) { return; }

Item checks:

use berg\ElytraFly\ElytraFlyAPI; // Get an elytra instance elytra=ElytraFlyAPI::getElytra();//Getafireworksinstance—nullonNetherGameselytra = ElytraFlyAPI::getElytra(); // Get a fireworks instance — null on NetherGames fireworks = ElytraFlyAPI::getFireworks(); // Give elytra to a player ElytraFlyAPI::giveElytra(player);ElytraFlyAPI::giveElytra(player); ElytraFlyAPI::giveElytra(player, count: 3); // Give fireworks — returns false on NetherGames success=ElytraFlyAPI::giveFireworks(success = ElytraFlyAPI::giveFireworks(player);

Armor slot and instance checks:

// Equip elytra ElytraFlyAPI::equipElytra(player);//Removeelytraifequipped—falseifslotwasemptyplayer); // Remove elytra if equipped — false if slot was empty removed = ElytraFlyAPI::unequipElytra(player);//Checkifelytraisinthechestplateslotplayer); // Check if elytra is in the chestplate slot equipped = ElytraFlyAPI::hasElytraEquipped(player);//Checkifelytraexistsanywhereininventoryplayer); // Check if elytra exists anywhere in inventory has = ElytraFlyAPI::hasElytraInInventory($player);

Player flight state checks:

// Is the player currently gliding? gliding=ElytraFlyAPI::isGliding(gliding = ElytraFlyAPI::isGliding(player); // Can the player glide? (elytra equipped + not broken) canGlide=ElytraFlyAPI::canGlide(canGlide = ElytraFlyAPI::canGlide(player); // Remaining durability — null if no elytra equipped durability=ElytraFlyAPI::getElytraDurability(durability = ElytraFlyAPI::getElytraDurability(player);

Debug strings — originally kept these for personal use, then decided to leave them in forever. Might come in handy:

// "PocketMine-MP" or "NetherGames" $kernel = ElytraFlyAPI::getKernel(); ElytraFlyAPI::isPMMP(); // bool ElytraFlyAPI::isNetherGames(); // bool