Skip to content

EvolSoft/CustomAlerts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

start2

CustomAlerts

Customize or hide alerts (join/leave messages, whitelist messages, outdated server/client messages, etc...) plugin for PocketMine-MP.

Download!

Category

PocketMine-MP plugins

Requirements

PocketMine-MP API 5.0.0

Overview

CustomAlerts lets you customize or hide all PocketMine alerts (join/leave messages, whitelist messages, outdated server/client messages, etc...)

EvolSoft Website: Downed

This Plugin uses the New API. You can't install it on old versions of PocketMine.

With CustomAlerts you can customize or hide whitelist kick messages, outdated server/client messages, join/leave messages, first join messages, death messages, world change messages... (read documentation)

Changelogs - 13/10/2023

  • Applied PocketMine-MP API 5.0.0 changes
  • Bumped version from 2.4 to 3.1
  • Patched Config Reload Command

Features

  • Customize or hide join, quit and death messages
  • Add first join and world change messages
  • Customize Motd (from MCPE 0.11.0)
  • Customize Outdated Server/Client kick messages (from MCPE 0.11.0 BUILD 11)
  • Customize Whitelist kick messages (from MCPE 0.11.0 BUILD 11)
  • Customize Full Server kick messages (from MCPE 0.11.0 BUILD 11) [Please keep in mind that if you have VIP or additional slots on your server you MUST disable this feature from config]
  • Customize Death messages (There a problem for the moment due to PocketMine-MP 4)

What is included?

In the ZIP file you will find:
- CustomAlerts_v2.phar : CustomAlerts Plugin + API
- CustomAlertsExample_v1.5.zip : Example Plugin source code

Commands:

/customalerts - CustomAlerts commands

Donate

Please support the development of this plugin with a small donation by clicking 💵 here. Your small donation will help me paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you 😄

Documentation

Text format (Available on PocketMine console and on MCPE since v0.11.0):

Colors:

Black ("&0");
Dark Blue ("&1");
Dark Green ("&2");
Dark Aqua ("&3");
Dark Red ("&4");
Dark Purple ("&5");
Gold ("&6");
Gray ("&7");
Dark Gray ("&8");
Blue ("&9");
Green ("&a");
Aqua ("&b");
Red ("&c");
Light Purple ("&d");
Yellow ("&e");
White ("&f");

Special:

Obfuscated ("&k");
Bold ("&l");
Strikethrough ("&m");
Underline ("&n");
Italic ("&o");
Reset ("&r");

Configuration (config.yml):

---
#REMEMBER THAT IF YOU USE CustomAlerts EXTENSIONS, MESSAGES MAY NOT FOLLOW THE DEFAULT CONFIG
#Date/Time format (replaced in {TIME}). For format codes read http://php.net/manual/en/datetime.formats.php
datetime-format: "H:i:s"
#Server Motd message settings (available from MCPE 0.11.0 and later)
Motd:
  #Motd update timeout
  update-timeout: 1
  #Show custom Motd
  custom: true
  #Motd message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&e[{TIME}] &aWelcome to your server! &n&b[{MAXPLAYERS}/{TOTALPLAYERS}]"
#Outdated Client message (available from MCPE 0.11.0 BUILD 11 and later)
OutdatedClient:
  #Show custom Outdated Client message
  custom: true
  #Outdated Client message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&cYour MCPE client is outdated!"
#Outdated Server message (available from MCPE 0.11.0 BUILD 11 and later)
OutdatedServer:
  #Show custom Outdated Server message
  custom: true
  #Outdated Server message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&cOops! Server outdated!"
#Whitelisted Server message (available from MCPE 0.11.0 BUILD 11 and later)
WhitelistedServer:
  #Show custom Whitelisted Server message
  custom: true
  #Whitelisted Server message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&c&oThis Server is whitelisted!"
#Full Server message (available from MCPE 0.11.0 BUILD 11 and later)
FullServer:
  #Show custom Full Server message
  custom: true
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&e{PLAYER}&b, The Server is full &c[{TOTALPLAYERS}/{MAXPLAYERS}]&b!\n&l&dTry to join later :)"
#First Join message settings
FirstJoin:
  #Enable First Join message
  enable: true
  #First Join message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {PLAYER}: Show player name
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&2[{TIME}] &a{PLAYER}&d joined the game for the first time."
#Join message settings
Join:
  #Hide Join message
  hide: false
  #Show custom Join message 
  custom: true
  #Join message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {PLAYER}: Show player name
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&2[{TIME}] &a{PLAYER}&e joined the game."
#Quit message settings
Quit:
  #Hide Quit message
  hide: true
  #Show custom Quit message 
  custom: false
  #Quit message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {PLAYER}: Show player name
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&4[{TIME}] &c{PLAYER}&e has left the game"
#World Change message settings
WorldChange:
  #Enable World Change message
  enable: true
  #World Change message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {ORIGIN}: Show origin world name
  # - {PLAYER}: Show player name
  # - {TARGET}: Show target world name
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&2[{TIME}] &a{PLAYER}&e moved from &c{ORIGIN}&e to &a{TARGET}"
#Death message settings
Death:
  #Hide deafult Death message
  hide: false
  #Show custom default Death message
  custom: true
  #Default Death message
  #Available Tags:
  # - {MAXPLAYERS}: Show the maximum number of players supported by the server
  # - {PLAYER}: Show player name
  # - {TIME}: Show current time
  # - {TOTALPLAYERS}: Show the number of all online players
  message: "&c{PLAYER} died"
  #Death by contact message
  death-contact-message:
    #Hide Death by contact message
    hide: false
    #Show custom Death by contact message
    custom: true
    #Death by contact message
    #Available Tags:
    # - {BLOCK}: The name of the block which killed the player
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&cOops! {PLAYER} was killed by {BLOCK}"
  #Death by entity message (players and mobs)
  kill-message:
    #Hide Death by entity message
    hide: false
    #Show custom Death by entity message
    custom: true
    #Death by entity message
    # - {KILLER}: The name of the killer entity
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&9{PLAYER} &ewas killed by &c{KILLER}"
  #Death by projectile message
  death-projectile-message:
    #Hide Death by projectile message
    hide: false
    #Show custom Death by projectile message
    custom: true
    #Death by projectile message
    # - {KILLER}: The name of the killer entity
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} was killed by {KILLER} by arrow"
  #Death by suffocation message
  death-suffocation-message:
    #Hide Death by suffocation message
    hide: false
    #Show custom Death by suffocation message
    custom: true
    #Death by suffocation message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} suffocated"
  #Death by fall message
  death-fall-message:
    #Hide Death by fall message
    hide: false
    #Show custom Death by fall message
    custom: true
    #Death by fall message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} fell from a high place"
  #Death by fire message
  death-fire-message:
    #Hide Death by fire message
    hide: false
    #Show custom Death by fire message
    custom: true
    #Death by fire message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} went up in flames"
  #Death on fire message
  death-on-fire-message:
    #Hide Death on fire message
    hide: false
    #Show custom Death on fire message
    custom: true
    #Death on fire message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} burned"
  #Death by lava message
  death-lava-message:
    #Hide Death by lava message
    hide: false
    #Show custom Death by lava message
    custom: true
    #Death by lava message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} tried to swim in lava"
  #Death by drowning message
  death-drowning-message:
    #Hide Death by drowning message
    hide: false
    #Show custom Death by drowning message
    custom: true
    #Death by drowning message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} drowned"
  #Death by explosion message
  death-explosion-message:
    #Hide Death by explosion message
    hide: false
    #Show custom Death by explosion message
    custom: true
    #Death by explosion message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} exploded"
  #Death by void message
  death-void-message:
    #Hide Death by void message
    hide: false
    #Show custom Death by void message
    custom: true
    #Death by void message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} fell into the void"
  #Death by suicide message
  death-suicide-message:
    #Hide Death by suicide message
    hide: false
    #Show custom Death by suicide message
    custom: true
    #Death by suicide message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} committed suicide"
  #Death magic message
  death-magic-message:
    #Hide Death magic message
    hide: false
    #Show custom Death magic message
    custom: true
    #Death magic message
    # - {MAXPLAYERS}: Show the maximum number of players supported by the server
    # - {PLAYER}: Show player name
    # - {TIME}: Show current time
    # - {TOTALPLAYERS}: Show the number of all online players
    message: "&c{PLAYER} was killed by a spell"

Commands:

/customalerts - CustomAlerts commands Not usable for the moment

Permissions:

  • customalerts.* - CustomAlerts permissions.
  • customalerts.help - CustomAlerts command Help permission.
  • customalerts.info - CustomAlerts command Info permission.
  • customalerts.reload - CustomAlerts command Reload permission.

API

Almost all our plugins have API access to widely extend their features.

Basic Tutorial:

1. Define the plugin dependency in plugin.yml (you can check if CustomAlerts is installed in different ways):

depend: [CustomAlerts]

2. Include CustomAlerts API and CustomAlerts Events in your php code:

//PocketMine Event Listener
use pocketmine\event\Listener;
//CustomAlerts API
use CustomAlerts\CustomAlerts;
//CustomAlerts Events
use CustomAlerts\Events\CustomAlertsJoinEvent;

3. Create the class:

class Example extends PluginBase implements Listener {
}

4. Check if CustomAlerts API is compatible (insert this code in onEnable():void function)

if(CustomAlerts::getAPI()->getAPIVersion() == "(used API version)"){
            //API compatible
            //Register Events
            $this->getServer()->getPluginManager()->registerEvents($this, $this);
        }else{
            //API not compatible
            $this->getPluginLoader()->disablePlugin($this);
        }
  }

5. Handle a CustomAlerts event (in this tutorial we will handle the CustomAlertsJoinEvent):

public function onCAJoinEvent(CustomAlertsJoinEvent $event){
  $event->setMessage("Example Join message: " . $event->getPlayer()->getName());
}

6. Access the API by doing:

CustomAlerts::getAPI()->api_function();

A full plugin example using CustomAlerts API and CustomAlerts Events is included in the ZIP file.

CustomAlerts API Events:

Each CustomAlerts event has two global functions:

Set Message:
setMessage($message);

Description:
Set event message.
Parameters:
$message

Get Message:
getMessage();

Description:
Get event message.
Return:
string

CustomAlertsDeathEvent:

This event is handled when a player dies.

Event functions are:

Get Player:
Player getPlayer()

Description:
Get death event player.
Return:
The death event player

Get Cause:
EntityDamageEvent|null getCause()

Description:
Get death event cause.
Return:
The death event cause

CustomAlertsFullServerKickEvent:

This event is handled when a player is kicked due to full server.

Event functions are:

Get NetworkSession:
NetworkSession getOrigin()

Description:
Get event NetworkSession.
Return:
The event NetworkSession (instance of pocketmine\Player)

CustomAlertsJoinEvent:

This event is handled when a player joins.

Event functions are:

Get Player:
Player getPlayer()

Description:
Get join event player.
Return:
The join event player (instance of pocketmine\player\Player)

Get default PocketMine join message:
string getPocketMineJoinMessage()

Description:
Get default PocketMine join message.
Return:
The default PocketMine join message

CustomAlertsMotdUpdateEvent:

This event is handled when the motd is updated

Event functions are:

Get default PocketMine Motd:
string getPocketMineMotd()

Description:
Get default PocketMine Motd.
Return:
The default PocketMine Motd

CustomAlertsOutdatedClientKickEvent:

This event is handled when a player is kicked due to outdated client.

Event functions are:

Get NetworkSession:
NetworkSession getOrigin()

Description:
Get event NetworkSession.
Return:
The event NetworkSession (instance of pocketmine\network\mcpe\NetworkSession)

CustomAlertsOutdatedServerKickEvent:

This event is handled when a player is kicked due to outdated server.

Event functions are:

Get NetworkSession:
NetworkSession getOrigin()

Description:
Get event player.
Return:
The event NetworkSession (instance of pocketmine\network\mcpe\NetworkSession)

CustomAlertsQuitEvent:

This event is handled when a player quits. It must be declared:

Event functions are:

Get Player:
Player getPlayer()

Description:
Get quit event player.
Return:
The quit event player (instance of pocketmine\player\Player)

Get default PocketMine quit message:
string getPocketMineQuitMessage()

Description:
Get default PocketMine quit message.
Return:
The default PocketMine quit message

CustomAlertsWhitelistKickEvent:

This event is handled when a player is kicked due to whitelisted server.

Event functions are:

Get Player:
PlayerInfo getPlayerInfo()

Description:
Get event player.
Return:
The event PlayerInfo (instance of pocketmine\player\PlayerInfo)

CustomAlertsWorldChangeEvent:

This event is handled when a player changes world. It must be declared:

Event functions are:

Get Player:
Player getPlayer()

Description:
Get world change event player.
Return:
The world change event player (instance of pocketmine\player\Player)

Get Origin World:
World getFrom()

Description:
Get origin world.
Return:
The origin world (instance of pocketmine\world\World)

Get Target World:
World getTarget()

Description:
Get target world.
Return:
The target world (instance of pocketmine\world\World)

CustomAlerts API Functions:

Get Version:
string getVersion()

Description:
Get CustomAlerts plugin version.
Return:
plugin version

Get API Version:
string getAPIVersion()

Description:
Get the CustomAlerts API version.
Return:
plugin API version

Check if motd message is custom:
boolean isMotdCustom()

Description:
Check if motd message is custom.
Return:
bool

Get default motd message:
string getMotdMessage()

Description:
Get motd message.
Return:
string

Check if outdated client message is custom:
boolean isOutdatedClientMessageCustom()

Description:
Check if outdated client message is custom.
Return:
bool

Get outdated client message:
string getOutdatedClientMessage()

Description:
Get outdated client message.
Parameters:
Return:
string

Check if outdated server message is custom:
boolean isOutdatedServerMessageCustom()

Description:
Check if outdated server message is custom.
Return:
bool

Get outdated server message:
string getOutdatedServerMessage()

Description:
Get outdated server message.
Parameters:
Return:
string

Check if whitelist message is custom:
boolean isWhitelistMessageCustom()

Description:
Check if whitelist message is custom.
Return:
bool

Get whitelist message:
string getWhitelistMessage()

Description:
Get whitelist message.
Parameters:
Return:
string

Check if full server message is custom:
boolean isFullServerMessageCustom()

Description:
Check if full server message is custom.
Return:
bool

Get full server message:
string getFullServerMessage()

Description:
Get full server message.
Parameters:
$player the current player
Return:
string

Check if first join message is enabled:
boolean isFirstJoinMessageEnabled()

Description:
Check if first join message is enabled.
Return:
bool

Get first join message:
string getFirstJoinMessage(Player $player)

Description:
Get first join message.
Parameters:
$player the current player
Return:
string

Check if join message is custom:
boolean isJoinMessageCustom()

Description:
Check if join message is custom.
Return:
bool

Check if join message is hidden:
boolean isJoinMessageHidden()

Description:
Check if join message is hidden.
Return:
bool

Get join message:
string getJoinMessage(Player $player)

Description:
Get join message.
Parameters:
$player the current player
Return:
string

Check if quit message is custom:
boolean isQuitMessageCustom()

Description:
Check if quit message is custom.
Return:
bool

Check if quit message is hidden:
boolean isQuitMessageHidden()

Description:
Check if quit message is hidden.
Return:
bool

Get quit message:
string getQuitMessage(Player $player)

Description:
Get quit message.
Parameters:
$player the current player
Return:
string

Check if world change message is enabled:
boolean isWorldChangeMessageEnabled()

Description:
Check if world change message is enabled.
Return:
bool

Get world change message:
string getWorldChangeMessage(Player $player, World $origin, World $target)

Description:
Get default world change message.
Parameters:
$player the current player
$origin the origin level
$target the target level
Return:
string

Check if death messages are custom:
boolean isDeathMessageCustom($cause = null)

Description:
Check if death messages are custom.
Parameters:
$cause Check message by cause
Return:
boolean

Check if death messages are hidden:
boolean isDeathMessageHidden($cause = null)

Description:
Check if death messages are hidden.
Parameters:
$cause Check message by cause
Return:
bool

Get death message for the specified cause:
string getDeathMessage(Player $player, $cause = null)

Description:
Get default death message related to the specified cause.
Parameters:
$player the current player
$cause the cause of death (instanceof EntityDamageEvent). If it's null, the function will return the default death message Return:
string

About

Customize or hide alerts (join/leave messages, whitelist messages, outdated server/client messages, etc...) plugin for PocketMine-MP

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages