Skip to content

Commit

Permalink
Merge pull request #49 from KanekiLeChomeur/patch-1
Browse files Browse the repository at this point in the history
API Change and Patch
  • Loading branch information
Flavius12 authored Oct 13, 2023
2 parents 86bbdb2 + c650753 commit b1c0885
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CustomAlerts/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CustomAlerts
main: CustomAlerts\CustomAlerts
version: 2.4
api: [4.0.0]
version: 3.1
api: [5.0.0]
load: STARTUP
author: [EvolSoft, KanekiLeChomeur]
description: Customize or hide alerts (join/leave messages, whitelist messages, outdated server/client messages, etc...) plugin
Expand Down
2 changes: 1 addition & 1 deletion CustomAlerts/src/CustomAlerts/Commands/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function execute(CommandSender $sender, string $commandLabel, array $args
case "reload":
if($sender->hasPermission("customalerts.reload")){
$this->plugin->reloadConfig();
$this->plugin->cfg = $this->plugin->getConfig()->getAll();
$this->plugin->reloadCfg();
$sender->sendMessage(TextFormat::colorize(CustomAlerts::PREFIX . "&aConfiguration Reloaded."));
}else{
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
Expand Down
7 changes: 6 additions & 1 deletion CustomAlerts/src/CustomAlerts/CustomAlerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use pocketmine\event\entity\ProjectileHitEntityEvent;
use pocketmine\player\Player as PlayerPlayer;
use pocketmine\player\PlayerInfo;
use pocketmine\utils\Config;
use pocketmine\world\World;

class CustomAlerts extends PluginBase {
Expand All @@ -36,7 +37,7 @@ class CustomAlerts extends PluginBase {
/** @var string */
const API_VERSION = "2.0";

private $cfg;
protected Config $cfg;

/** @var CustomAlerts $instance */
private static $instance = null;
Expand Down Expand Up @@ -228,6 +229,10 @@ public function isFirstJoinMessageEnabled() : bool {
return $this->cfg["FirstJoin"]["enable"];
}

public function reloadCfg(){
$this->cfg = $this->getConfig()->getAll();
}

/**
* Get first join message
*
Expand Down
2 changes: 1 addition & 1 deletion CustomAlerts/src/CustomAlerts/EventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function onPlayerPreLogin(PlayerPreLoginEvent $event){
}
$cevent->call();
if($cevent->getMessage() != ""){
$event->setKickReason(PlayerPreLoginEvent::KICK_REASON_SERVER_WHITELISTED, $cevent->getMessage());
$event->setKickFlag(PlayerPreLoginEvent::KICK_FLAG_SERVER_WHITELISTED, $cevent->getMessage());
return;
}
}
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PocketMine-MP plugins

## Requirements

PocketMine-MP API 4.0.0
PocketMine-MP API 5.0.0

## Overview

Expand All @@ -24,6 +24,12 @@ PocketMine-MP API 4.0.0

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
Expand Down

0 comments on commit b1c0885

Please sign in to comment.