Git Product home page Git Product logo

emotes's Introduction

Emotes

Emote support for pocketmine

This plugin adds emotes into pocketmine so that everyone can see the emotes that you are doing!

Why is this useful?

By default pocketmine does not have support for emotes. This means that you can see yourself perform an emote, but other players can not see you performing them. This plugin fixes this problem and also adds a few extra features.

Permission

Players require a permission emotes.perform to perform an emote. If they do not have this permission, others will not see the emote and the player will get a message telling them they do not have the permission. You can change the permission message in the plugin configuration.

Cooldowns

You can set an emote cooldown for players in the plugin configuration. By default this is set to 2 seconds, but you can change this to anything you want or even just disabe it. When the cooldown is active, it prevents other players from being able to see the emotes that you do and you will get a message telling you that you currently have an active emote cooldown. This message is also configurable in config.yml.

API

The plugin also has an API to make it easy for developers to use emotes in plugins.

Emote event

Whenever a player performs an emote, an event will be called for this emote. This event is AndreasHGK\Emotes\event\EmoteEvent. You are able to cancel the event and also change the flags and emote ID. In the event you can also control who sees the emote, using $event->setViewers([]). This function accept an array of players as first argument.

Sending emotes

With this plugin, you can also easily make a player (or any entity that extends the Human class, so even human slappers) perform an emote! Here is how you can do it.

First of all, you need to import the correct classes. If you just want to be able to send an emote, you will only need these 2 classes. The Emote class is the class that allows you to send emotes and the EmoteIds class contains some emote IDs.

use AndreasHGK\Emotes\emote\Emote;
use AndreasHGK\Emotes\emote\EmoteIds;

To actually send the emote, all you need to do is this. This example shows you how to send the "over there" emote, but you can of course change it to any of the emotes in the EmoteIds class or use the id of another emote you have. It is very simple, you first create an Emote object and you then call the broadcast() function on it, which will display the emote to everyone who can see the performer. The performer can be any entity that extends the Human class.

Emote::create($performer, EmoteIds::OVER_THERE, Emote::FLAG_SERVER)->broadcast();

The broadcast() function has 2 optional arguments. The first is an array of the players that you want to broadcast the emote to. Leave it empty to broadcast to everyone who can see the entity. The second argument is by default false and it controls whether or not an event will be called for the emote. If you don't want an event to be called be sure to change this to false.

Changing the cooldown time per player

You can also change the cooldown time per player, allowing you to do things such as giving certain people a lower cooldown time. First of all, you'll need to import this class.

use AndreasHGK\Emotes\session\SessionManager;

Then all you need to do is get the session for a player and change its cooldown time. In the following example the cooldown time for the player is changed to 5 seconds. Be sure to make this variable a float.

SessionManager::getInstance()->getSession($player)->setCooldownTime(5.0);

emotes's People

Contributors

aiptu avatar andreashgk avatar poggit-bot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

invalidnoah

emotes's Issues

Emote Id

Where do you have the Emote Ids?

Error: "Call to undefined method pocketmine\Player::getNetworkSession()" (EXCEPTION) in "plugins/Emotes_dev-4.phar/src/AndreasHGK/Emotes/emote/Emote" at line 136

https://poggit.pmmp.io/r/96920/Emotes_dev-4.phar
https://jenkins.pmmp.io/job/PocketMine-MP/1811/artifact/PocketMine-MP.phar

2020-08-07 [09:04:19] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Player::getNetworkSession()" (EXCEPTION) in "plugins/Emotes_dev-4.phar/src/AndreasHGK/Emotes/emote/Emote" at line 136
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #0 plugins/Emotes_dev-4.phar/src/AndreasHGK/Emotes/listener/EmoteListener(52): AndreasHGK\Emotes\emote\Emote->broadcast()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #1 src/pocketmine/plugin/MethodEventExecutor(42): AndreasHGK\Emotes\listener\EmoteListener->onEmote(object pocketmine\event\server\DataPacketReceiveEvent)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #2 src/pocketmine/plugin/RegisteredListener(80): pocketmine\plugin\MethodEventExecutor->execute(object AndreasHGK\Emotes\listener\EmoteListener, object pocketmine\event\server\DataPacketReceiveEvent)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #3 src/pocketmine/event/Event(88): pocketmine\plugin\RegisteredListener->callEvent(object pocketmine\event\server\DataPacketReceiveEvent)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #4 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(109): pocketmine\event\Event->call()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #5 src/pocketmine/network/mcpe/protocol/BatchPacket(127): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\EmotePacket)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #6 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(110): pocketmine\network\mcpe\protocol\BatchPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #7 src/pocketmine/Player(3247): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #8 src/pocketmine/network/mcpe/RakLibInterface(169): pocketmine\Player->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #9 vendor/pocketmine/raklib/src/server/ServerHandler(99): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string[19] 77.XXX.XXX.20 56416, object raklib\protocol\EncapsulatedPacket, integer 0)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #10 src/pocketmine/network/mcpe/RakLibInterface(109): raklib\server\ServerHandler->handlePacket()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #11 src/pocketmine/network/mcpe/RakLibInterface(99): pocketmine\network\mcpe\RakLibInterface->process()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #12 vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #13 vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #14 src/pocketmine/Server(2157): pocketmine\snooze\SleeperHandler->sleepUntil(double 1596783859.6887)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #15 src/pocketmine/Server(1994): pocketmine\Server->tickProcessor()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #16 src/pocketmine/Server(1588): pocketmine\Server->start()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #17 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[16] /home/container/, string[24] /home/container/plugins/)
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #18 src/pocketmine/PocketMine(304): pocketmine\server()
2020-08-07 [09:04:19] [Server thread/CRITICAL]: #19 (11): require(string[71] phar:///home/container/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
2020-08-07 [09:04:19] [Server thread/INFO]: confiott42 [-]
2020-08-07 [09:04:19] [Server thread/INFO]: confiott42[/77.XXX.XXX.20:56416] logged out due to Internal server error
2020-08-07 [09:04:19] [RakLibServer thread/NOTICE]: Blocked 77.XXX.XXX.20 for 5 seconds

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.