Giter VIP home page Giter VIP logo

clearlag's Introduction

ClearLag

A plugin for Pocketmine-MP


About

ClearLag is a plugin for Pocketmine-MP that removes entities after a certain period of time to prevent lags.

Installation

  • Download ClearLag
  • Move the plugin (ClearLag.phar) to the plugins/ folder of your server
  • Start the server, that's it!

For Developers

You can use ClearLag in your plugins to remove entities.

You can either use the ClearLag->doClear() method, which follows the configuration of the ClearLag plugin:

$result = \tobias14\clearlag\ClearLag::getInstance()->doClear();

/** @var int $clearedEntityCount Number of cleared entities */
$clearedEntityCount = $result['entity_count'];

/** @var int $clearedItemCount Number of cleared items */
$clearedItemCount = $result['item_count'];

Or you can use the EntityRemover, which offers a few more options and does not use the configuration of the ClearLag plugin:

final class EntityRemover
{

    /**
     * @param array<class-string<Entity>>|null $entityTypes Entity types to be removed. If null, all will be removed.
     * @param string[] $exclusions Entity-/item-names which are spared.
     * @param World[]|null $worlds Affected worlds. If null all loaded worlds.
     * @return int Number of removed entities.
     */
    public static function removeEntities(?array $entityTypes = null, array $exclusions = [], ?array $worlds = null): int;

}

E.g. removal of all entities that inherit from Zombie, except CustomZombie(s).

/** @var int $clearedEntityCount Number of cleared entities */
$clearedEntityCount = \tobias14\clearlag\utils\EntityRemover::removeEntities([\pocketmine\entity\Zombie::class], ['CustomZombie']);

Contributing

You think you can do better or have discovered a bug? Then do it yourself and help the project.

Simply fork the repository and create a pull request.

License

  • GPL-3.0

Icon by Icons8

clearlag's People

Contributors

poggit-bot avatar tobiaskirchmaier avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

clearlag's Issues

Idea

Can you add in config.yml that WE can disable Messages from clearlag in console ITS spamm my Server log

Change alert Messages? (Ideal)

Can you please add in config.yml that we can set the times manually? @tobias-2006
Like this

Here you can Set the alert Messages example 1s= 1 Second 1m= 1 Minute

Times: 1s, 2s, 5s, 10s, 1m

Or can you say ne how i can Change it in your Plugin?
LG zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.