Skip to content

Commit 5dc1f55

Browse files
Add support for pmmp4
1 parent 48e0681 commit 5dc1f55

10 files changed

Lines changed: 749 additions & 1018 deletions

File tree

config.php_cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__);
5+
6+
return (new PhpCsFixer\Config)
7+
->setRiskyAllowed(true)
8+
->setRules([
9+
'align_multiline_comment' => [
10+
'comment_type' => 'phpdocs_only'
11+
],
12+
'array_indentation' => true,
13+
'array_syntax' => [
14+
'syntax' => 'short'
15+
],
16+
'blank_line_after_namespace' => true,
17+
'blank_line_after_opening_tag' => true,
18+
'blank_line_before_statement' => [
19+
'statements' => [
20+
'declare'
21+
]
22+
],
23+
'cast_spaces' => [
24+
'space' => 'single'
25+
],
26+
'concat_space' => [
27+
'spacing' => 'one'
28+
],
29+
'elseif' => true,
30+
'global_namespace_import' => [
31+
'import_constants' => true,
32+
'import_functions' => true,
33+
'import_classes' => null,
34+
],
35+
'indentation_type' => true,
36+
'native_function_invocation' => [
37+
'scope' => 'namespaced',
38+
'include' => ['@all'],
39+
],
40+
'no_closing_tag' => true,
41+
'no_empty_phpdoc' => true,
42+
'no_extra_blank_lines' => true,
43+
'no_superfluous_phpdoc_tags' => [
44+
'allow_mixed' => true,
45+
],
46+
'no_trailing_whitespace' => true,
47+
'no_trailing_whitespace_in_comment' => true,
48+
'no_whitespace_in_blank_line' => true,
49+
'no_unused_imports' => true,
50+
'ordered_imports' => [
51+
'imports_order' => [
52+
'class',
53+
'function',
54+
'const',
55+
],
56+
'sort_algorithm' => 'alpha'
57+
],
58+
'phpdoc_trim' => true,
59+
'phpdoc_trim_consecutive_blank_line_separation' => true,
60+
'single_import_per_statement' => true,
61+
'strict_param' => true,
62+
'braces' => [
63+
'allow_single_line_closure' => true,
64+
'position_after_functions_and_oop_constructs' => 'same'],
65+
])
66+
->setFinder($finder)
67+
->setIndent("\t")
68+
->setLineEnding("\n");

plugin.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: PureChat
22
main: _64FF00\PureChat\PureChat
3-
version: 1.4.11
4-
api: [3.0.0]
3+
version: 2.0.0
4+
api: [4.0.0]
55
load: POSTWORLD
66
author: 64FF00
77
website: https://github.com/PurePlugins/PureChat
88
depend: [PurePerms]
9-
softdepend: [FactionsPro, XeviousPE-Factions, FactionMaster]
9+
softdepend: [FactionMaster]
1010
commands:
1111
setformat:
12-
description: "Allows you to set default chat format of a PurePerms group"
13-
permission: pchat.command.setformat
12+
description: "Allows you to set default chat format of a PurePerms group"
13+
permission: pchat.command.setformat
1414
setnametag:
1515
description: "Allows you to set default nametag of a PurePerms group"
1616
permission: pchat.command.setnametag
@@ -22,18 +22,23 @@ commands:
2222
permission: pchat.command.setsuffix
2323
permissions:
2424
pchat:
25+
default: op
2526
description: "PureChat by 64FF00! (Twitter: @64FF00)"
26-
children:
27-
pchat.command:
28-
description: "Allows you to use all PureChat commands."
29-
children:
30-
pchat.command.setformat:
31-
description: "Allows you to set default chat format of a PurePerms group"
32-
pchat.command.setnametag:
33-
description: "Allows you to set default nametag of a PurePerms group"
34-
pchat.command.setprefix:
35-
description: "Allows you to set your PureChat prefix"
36-
pchat.command.setsuffix:
37-
description: "Allows you to set your PureChat suffix"
38-
pchat.coloredMessages:
39-
description: "Allows you to use colors in chat"
27+
pchat.command:
28+
default: op
29+
description: "Allows you to use all PureChat commands."
30+
pchat.command.setformat:
31+
default: op
32+
description: "Allows you to set default chat format of a PurePerms group"
33+
pchat.command.setnametag:
34+
default: op
35+
description: "Allows you to set default nametag of a PurePerms group"
36+
pchat.command.setprefix:
37+
default: op
38+
description: "Allows you to set your PureChat prefix"
39+
pchat.command.setsuffix:
40+
default: op
41+
description: "Allows you to set your PureChat suffix"
42+
pchat.coloredMessages:
43+
default: op
44+
description: "Allows you to use colors in chat"

resources/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
version: "1.4.10-6"
99

1010
# Set default factions plugin for PureChat
11-
# - FactionsPro / null
12-
default-factions-plugin: FactionsPro
11+
# - FactionMaster / null
12+
default-factions-plugin: FactionMaster
1313

1414
# Enable this if you want to use per-world chat formats / per-world nametags for players
1515
# - true / false

src/_64FF00/PureChat/PCListener.php

Lines changed: 55 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,68 @@
88
use pocketmine\event\player\PlayerChatEvent;
99
use pocketmine\event\player\PlayerJoinEvent;
1010

11-
use pocketmine\Player;
12-
13-
class PCListener implements Listener
14-
{
15-
/*
16-
PureChat by 64FF00 (Twitter: @64FF00)
17-
18-
888 888 .d8888b. d8888 8888888888 8888888888 .d8888b. .d8888b.
19-
888 888 d88P Y88b d8P888 888 888 d88P Y88b d88P Y88b
20-
888888888888 888 d8P 888 888 888 888 888 888 888
21-
888 888 888d888b. d8P 888 8888888 8888888 888 888 888 888
22-
888 888 888P "Y88b d88 888 888 888 888 888 888 888
23-
888888888888 888 888 8888888888 888 888 888 888 888 888
24-
888 888 Y88b d88P 888 888 888 Y88b d88P Y88b d88P
25-
888 888 "Y8888P" 888 888 888 "Y8888P" "Y8888P"
26-
*/
27-
28-
private $plugin;
29-
30-
/**
31-
* @param PureChat $plugin
32-
*/
33-
public function __construct(PureChat $plugin)
34-
{
35-
$this->plugin = $plugin;
36-
}
37-
38-
public function onGroupChanged(PPGroupChangedEvent $event)
39-
{
40-
/** @var \pocketmine\IPlayer $player */
41-
$player = $event->getPlayer();
42-
43-
if($player instanceof Player)
44-
{
45-
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getLevel()->getName() : null;
11+
use pocketmine\player\Player;
12+
13+
class PCListener implements Listener {
14+
/*
15+
PureChat by 64FF00 (Twitter: @64FF00)
16+
17+
888 888 .d8888b. d8888 8888888888 8888888888 .d8888b. .d8888b.
18+
888 888 d88P Y88b d8P888 888 888 d88P Y88b d88P Y88b
19+
888888888888 888 d8P 888 888 888 888 888 888 888
20+
888 888 888d888b. d8P 888 8888888 8888888 888 888 888 888
21+
888 888 888P "Y88b d88 888 888 888 888 888 888 888
22+
888888888888 888 888 8888888888 888 888 888 888 888 888
23+
888 888 Y88b d88P 888 888 888 Y88b d88P Y88b d88P
24+
888 888 "Y8888P" 888 888 888 "Y8888P" "Y8888P"
25+
*/
26+
27+
private $plugin;
28+
29+
public function __construct(PureChat $plugin) {
30+
$this->plugin = $plugin;
31+
}
32+
33+
public function onGroupChanged(PPGroupChangedEvent $event) {
34+
/** @var \pocketmine\player\IPlayer $player */
35+
$player = $event->getPlayer();
36+
37+
if ($player instanceof Player) {
38+
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getWorld()->getDisplayName() : null;
4639

4740
$nameTag = $this->plugin->getNametag($player, $levelName);
4841

4942
$player->setNameTag($nameTag);
5043
}
51-
}
52-
53-
/**
54-
* @param PlayerJoinEvent $event
55-
* @priority HIGH
56-
*/
57-
public function onPlayerJoin(PlayerJoinEvent $event)
58-
{
59-
/** @var \pocketmine\Player $player */
60-
$player = $event->getPlayer();
61-
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getLevel()->getName() : null;
62-
63-
$nameTag = $this->plugin->getNametag($player, $levelName);
64-
65-
$player->setNameTag($nameTag);
66-
}
67-
68-
/**
69-
* @param PlayerChatEvent $event
70-
* @priority HIGH
71-
*/
72-
public function onPlayerChat(PlayerChatEvent $event)
73-
{
74-
if ($event->isCancelled()) return;
44+
}
45+
46+
/**
47+
* @priority HIGH
48+
*/
49+
public function onPlayerJoin(PlayerJoinEvent $event) {
50+
/** @var \pocketmine\player\Player $player */
51+
$player = $event->getPlayer();
52+
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getWorld()->getDisplayName() : null;
53+
54+
$nameTag = $this->plugin->getNametag($player, $levelName);
55+
56+
$player->setNameTag($nameTag);
57+
}
58+
59+
/**
60+
* @priority HIGH
61+
*/
62+
public function onPlayerChat(PlayerChatEvent $event) {
63+
if ($event->isCancelled()) {
64+
return;
65+
}
7566
$player = $event->getPlayer();
76-
$message = $event->getMessage();
67+
$message = $event->getMessage();
7768

78-
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getLevel()->getName() : null;
69+
$levelName = $this->plugin->getConfig()->get("enable-multiworld-chat") ? $player->getWorld()->getDisplayName() : null;
7970

80-
$chatFormat = $this->plugin->getChatFormat($player, $message, $levelName);
71+
$chatFormat = $this->plugin->getChatFormat($player, $message, $levelName);
8172

82-
$event->setFormat($chatFormat);
83-
}
73+
$event->setFormat($chatFormat);
74+
}
8475
}

0 commit comments

Comments
 (0)