Skip to content

Commit 97841fd

Browse files
committed
feat: impl particlesAmount
1 parent 97b1000 commit 97841fd

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

resources/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
worlds:
2-
- world
2+
- world
3+
4+
particlesAmount: 5000

src/Snow/SnowPlugin.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class SnowPlugin extends PluginBase implements Listener
2323
*/
2424
private array $worlds;
2525

26+
private int $particlesAmount;
27+
2628
protected function onEnable(): void
2729
{
2830
$this->saveDefaultConfig();
@@ -31,6 +33,10 @@ protected function onEnable(): void
3133
$worlds = (array) $this->getConfig()->get('worlds', []);
3234
$this->worlds = $worlds;
3335

36+
/** @var int $particlesAmount */
37+
$particlesAmount = $this->getConfig()->get('particlesAmount', 5000);
38+
$this->particlesAmount = $particlesAmount;
39+
3440
$this->getServer()->getPluginManager()->registerEvents($this, $this);
3541

3642
$this->getLogger()->info(TextFormat::GREEN . 'Snow plugin has been enabled!');
@@ -93,7 +99,7 @@ private function handleSetRaining(Player $player): void
9399
if (!in_array($player->getWorld()->getFolderName(), $this->worlds)) {
94100
$player->getNetworkSession()->sendDataPacket(LevelEventPacket::create(
95101
LevelEvent::STOP_RAIN,
96-
6000000,
102+
0,
97103
$player->getPosition()
98104
));
99105

@@ -102,7 +108,7 @@ private function handleSetRaining(Player $player): void
102108

103109
$player->getNetworkSession()->sendDataPacket(LevelEventPacket::create(
104110
LevelEvent::START_RAIN,
105-
6000000,
111+
$this->particlesAmount,
106112
$player->getPosition()
107113
));
108114
}), 10);

0 commit comments

Comments
 (0)