diff --git a/.poggit.yml b/.poggit.yml
index 6149b0b..370025f 100644
--- a/.poggit.yml
+++ b/.poggit.yml
@@ -5,5 +5,5 @@ branches:
projects:
WelcomeMessage:
path: ""
- icon: "Icon.png"
+ icon: "Icon.webp"
...
diff --git a/DOCS/2.1.md b/DOCS/2.1.md
index 84d78a5..740c72b 100644
--- a/DOCS/2.1.md
+++ b/DOCS/2.1.md
@@ -7,7 +7,7 @@
> - The Ability to chose to have a leave message and if you want the welcome message in a form or chat
## How To Install:
-> 1. Download the Plugin Here
+> 1. Download the Plugin Here
> 2. Put the Plugin in your Plugins Folder
> 3. Restart/Start/Stop & Start your Server
> 4. go to `plugin_data -> WelcomeMessage -> Config.yml` and Edit the values to how you like it
@@ -15,6 +15,34 @@
**Done**
# Disclaimer
-** if you have a previous version of this plugin you must delete the config in `plugin_data -> WelcomeMessage -> config.yml` and delete the prexesisting plugin phar file, then reinstall the plugin for it to work!**
-** Required Dependencies:**
+** if you have a previous version of this plugin you must delete the config in `plugin_data -> WelcomeMessage -> config.yml` and delete the prexesisting plugin phar file, then reinstall the plugin for it to work! **
+
+**Required Dependencies:**
+jojoe77777/FormAPI
+
+# 2.1.1:
+## Features in this Version:
+> - Customisable Prefix,
+> - Customisable Message,
+> - Customisable ServerName Customisable In a Form,
+> - The Ability to chose to have a leave message and if you want the welcome message in a form or chat
+> - Daily Cash
+>
+## How To Install:
+> 1. Download the Plugin Here
+> 2. Put the Plugin in your Plugins Folder
+> 3. Restart/Start/Stop & Start your Server
+> 4. go to `plugin_data -> WelcomeMessage -> Config.yml` and Edit the values to how you like it
+>
+**Done**
+
+**Important Changes:**
+
+```$xuid = $player->getXuid();``` Added. If A Player is Not Logged into Xbox Auth Then This will Come out as Empty and The Player will not receive cash.
+
+# Disclaimer
+** if you have a previous version of this plugin you must delete the config in `plugin_data -> WelcomeMessage -> config.yml` and delete the prexesisting plugin phar file, then reinstall the plugin for it to work! **
+
+**Required Dependencies:**
jojoe77777/FormAPI
+cooldogepm/BedrockEconomy
diff --git a/Icon.png b/Icon.png
deleted file mode 100644
index 4ac6847..0000000
Binary files a/Icon.png and /dev/null differ
diff --git a/Icon.webp b/Icon.webp
new file mode 100644
index 0000000..6e416c9
Binary files /dev/null and b/Icon.webp differ
diff --git a/README.md b/README.md
index 18452af..7b3be87 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ Simple on the fly customisable welcome message.
## API COMPATIBLE:
- 5.X.X
+ **Note: Support for API 4.0.0 - 4.25.6 has Been Ended.**
# thanks to the following for helping me construct this plugin:
- SOFe
diff --git a/plugin.yml b/plugin.yml
index b8d41a3..d46554d 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,6 +1,6 @@
name: WelcomeMessage
main: skyss0fly\WelcomeMessage\Main
-version: 2.1
+version: 2.1.1
api: 5.0.0
author: ["skyss0fly", "Inaayat"]
description: A simple welcome message plugin thats customizable
diff --git a/resources/config.yml b/resources/config.yml
index dc6d1bb..51365a0 100644
--- a/resources/config.yml
+++ b/resources/config.yml
@@ -6,7 +6,8 @@ Btn1: "Rules"
UseFormInsteadOfChat: true
# set to false if you want to use chat instead of form as welcoming..
-
+Whisper: false
+# if true and UseFormInsteadOfChat is true then instead of broadcasting the message, it will be whispered to the player
JoinMessage: "{player} Welcome to the Server"
# if the UseFormInsteadOfChat is false then this will show instead of form
@@ -17,3 +18,12 @@ JoinMessage: "{player} Welcome to the Server"
LeaveMessage: "{player} Has left the server"
LeaveMessageEnabled: true
+
+
+UseBedrockEconomy: true
+DailyAmount: 1000
+# Every Join gets you 1000 Cash?
+
+# Do Not touch this:
+Cooldown: 1728000
+# This is How Many Ticks in a Real Life Day
diff --git a/src/skyss0fly/WelcomeMessage/Main.php b/src/skyss0fly/WelcomeMessage/Main.php
index 10f53fc..8c895bc 100644
--- a/src/skyss0fly/WelcomeMessage/Main.php
+++ b/src/skyss0fly/WelcomeMessage/Main.php
@@ -7,17 +7,50 @@
use pocketmine\event\player\{PlayerJoinEvent, PlayerQuitEvent};
use skyss0fly\WelcomeMessage\Form\{Form, SimpleForm};
use pocketmine\player\Player;
+use cooldogepm\BedrockEconomy\api\BedrockEconomyAPI;
class Main extends PluginBase implements Listener {
+ private $cooldown;
+
public function onEnable(): void {
$this->saveDefaultConfig();
$this->getServer()->getPluginManager()->registerEvents($this, $this);
+ $this->cooldown = $this->getConfig()->get("Cooldown");
+ // Initialise Daily Cooldown
}
-
+
public function onPlayerJoin(PlayerJoinEvent $event): void {
$player = $event->getPlayer();
+ $xuid = $player->getXuid();
+ // Returns Empty if Player is not Logged into Xbox Auth.
+
$config = $this->getConfig();
+ // if ($config->get("UseBedrockEconomy") === true) {
+$currentTime = time();
+ if (isset($this->cooldowns[$player_name]) && $this->cooldowns[$player_name] > $currentTime && !$sender->hasPermission("WelcomeMessage.cooldownbypass")) {
+ $remainingTime = $this->cooldowns[$player_name] - $currentTime;
+
+ return;
+
+ } else {
+ BedrockEconomyAPI::CLOSURE()->add(
+ xuid: $xuid,
+ username: $player->getNameExact(),
+ amount: $this->getConfig()->get("Amount"),
+ decimals: 0,
+ onSuccess: static function (): void {
+ echo 'Balance updated successfully.';
+ },
+ onError: static function (SQLException $exception): void {
+ if ($exception instanceof RecordNotFoundException) {
+ echo 'Account not found';
+ return;
+ }
+
+ echo 'An error occurred while updating the balance.';
+ }
+);
if ($config->get("UseFormInsteadOfChat") === true) {
$joinForm = new SimpleForm(function (Player $player, $data) {
@@ -35,12 +68,20 @@ public function onPlayerJoin(PlayerJoinEvent $event): void {
$joinForm->addButton("§d§lSubmit!");
$player->sendForm($joinForm);
} else {
+ if ($config->get("Whisper") === false){
$rawMessage = $config->get("JoinMessage");
$message = str_replace("{player}", $player->getName(), $rawMessage);
$this->getServer()->broadcastMessage($message);
}
+ else {
+ $rawMessage = $config->get("JoinMessage");
+ $message = str_replace("{player}", $player->getName(), $rawMessage);
+ $player->sendMessage($message);
+
+ }
+ }
+ }
}
-
public function onPlayerLeave(PlayerQuitEvent $event): void {
$player = $event->getPlayer();
$config = $this->getConfig();