Skip to content

Commit

Permalink
Updated to PocketMine-MP API 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Flavius12 committed Jul 6, 2018
1 parent b24f022 commit 5aa3a83
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PocketMine-MP plugins

## Requirements

PocketMine-MP 1.7dev API 3.0.0-ALPHA7 -> 3.0.0-ALPHA12
PocketMine-MP API 3.0.0

## Overview

Expand Down
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ServerChannels
main: ServerChannels\ServerChannels
version: 2.2
api: [3.0.0-ALPHA7, 3.0.0-ALPHA8, 3.0.0-ALPHA9, 3.0.0-ALPHA10, 3.0.0-ALPHA11, 3.0.0-ALPHA12]
version: 2.3
api: [3.0.0]
load: STARTUP
author: EvolSoft
description: A powerful chat channelling plugin for PocketMine-MP
Expand Down
81 changes: 41 additions & 40 deletions src/ServerChannels/Commands/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat;

use ServerChannels\ServerChannels;

class Commands extends PluginBase implements CommandExecutor {
class Commands extends PluginCommand implements CommandExecutor {

/** @var ServerChannels */
private $plugin;
Expand All @@ -37,23 +38,23 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
if($sender->hasPermission("serverchannels.commands.create")){
if(isset($args[1])){
$this->plugin->createChannel($args[1]);
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&aChannel &b" . strtolower($args[1]) . "&a created!"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&aChannel &b" . strtolower($args[1]) . "&a created!"));
}else{
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cUsage: /sch create <channel>"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cUsage: /sch create <channel>"));
}
break;
}
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
break;
case "help":
goto help;
case "info":
if($sender->hasPermission("serverchannels.commands.info")){
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&eServerChannels &bv" . $this->plugin->getVersion() . "&e developed by &bEvolSoft"));
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&eWebsite &b" . $this->plugin->getDescription()->getWebsite()));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&eServerChannels &bv" . $this->plugin->getVersion() . "&e developed by &bEvolSoft"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&eWebsite &b" . $this->plugin->getDescription()->getWebsite()));
break;
}
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
break;
case "join":
if($sender instanceof Player){
Expand All @@ -63,35 +64,35 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$cmessage = null;
switch($this->plugin->joinChannel($sender, $args[1], isset($args[2]) ? $args[2] : null, $cmessage)){
case ServerChannels::SUCCESS:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&aYou joined &b" . strtolower($args[1]) . "&a channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&aYou joined &b" . strtolower($args[1]) . "&a channel"));
break;
case ServerChannels::ERR_WRONG_PASS:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cWrong password"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cWrong password"));
break;
case ServerChannels::ERR_NOT_WHITELISTED:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cYou are not whitelisted on this channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cYou are not whitelisted on this channel"));
break;
case ServerChannels::ERR_CHANNEL_NOT_FOUND:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cChannel not found"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cChannel not found"));
break;
case ServerChannels::CANCELLED:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . $cmessage));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . $cmessage));
break;
default:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cAn error has occurred while joining the channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cAn error has occurred while joining the channel"));
break;
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cYou don't have permissions to join in this channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cYou don't have permissions to join in this channel"));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cUsage: /sch join <channel> [password]"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cUsage: /sch join <channel> [password]"));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cYou can only perform this command as a player"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cYou can only perform this command as a player"));
}
break;
case "leave":
Expand All @@ -101,67 +102,67 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$cmessage = null;
switch($this->plugin->leaveChannel($sender, $cmessage)){
case ServerChannels::SUCCESS:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&aYou left &b" . $channel . "&a channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&aYou left &b" . $channel . "&a channel"));
break;
case ServerChannels::ERR_NO_CHANNEL:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cYou haven't joined on a channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cYou haven't joined on a channel"));
break;
case ServerChannels::CANCELLED:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . $cmessage));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . $cmessage));
break;
default:
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cAn error has occurred while leaving the channel"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cAn error has occurred while leaving the channel"));
break;

}
}else{
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cYou can only perform this command as a player"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cYou can only perform this command as a player"));
}
break;
case "list":
if($sender->hasPermission("serverchannels.commands.list")){
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&b>> &aAvailable Channels &b<<"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&b>> &aAvailable Channels &b<<"));
foreach($this->plugin->getAllChannels() as $k => $v){
if($sender->hasPermission(strtolower("serverchannels.channels." . $k))){
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&b- &a" . $k));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&b- &a" . $k));
}
}
break;
}
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
break;
case "reload":
if($sender->hasPermission("serverchannels.commands.reload")){
$this->plugin->reload();
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&aConfiguration reloaded"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&aConfiguration reloaded"));
break;
}
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
break;
default:
if($sender->hasPermission("serverchannels")){
$sender->sendMessage($this->plugin->translateColors("&", ServerChannels::PREFIX . "&cSubcommand &a" . $args[0] . "&c not found. Use &a/sch help&c to show available commands"));
$sender->sendMessage(TextFormat::colorize(ServerChannels::PREFIX . "&cSubcommand &a" . $args[0] . "&c not found. Use &a/sch help&c to show available commands"));
break;
}
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
break;
}
}else{
help:
if($sender->hasPermission("serverchannels.commands.help")){
$sender->sendMessage($this->plugin->translateColors("&", "&b>> &aAvailable Commands &b<<"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch info &b>>&e Show info about this plugin"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch help &b>>&e Show help about this plugin"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch reload &b>>&e Reload the config"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch create &b>>&e Create new channel"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch list &b>>&e Show the list of all channels"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch join &b>>&e Join a channel"));
$sender->sendMessage($this->plugin->translateColors("&", "&a/sch leave &b>>&e Leave the current channel"));
$sender->sendMessage(TextFormat::colorize("&b>> &aAvailable Commands &b<<"));
$sender->sendMessage(TextFormat::colorize("&a/sch info &b>>&e Show info about this plugin"));
$sender->sendMessage(TextFormat::colorize("&a/sch help &b>>&e Show help about this plugin"));
$sender->sendMessage(TextFormat::colorize("&a/sch reload &b>>&e Reload the config"));
$sender->sendMessage(TextFormat::colorize("&a/sch create &b>>&e Create new channel"));
$sender->sendMessage(TextFormat::colorize("&a/sch list &b>>&e Show the list of all channels"));
$sender->sendMessage(TextFormat::colorize("&a/sch join &b>>&e Join a channel"));
$sender->sendMessage(TextFormat::colorize("&a/sch leave &b>>&e Leave the current channel"));
}else{
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
$sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command"));
}
}
return true;
Expand Down
10 changes: 4 additions & 6 deletions src/ServerChannels/EventListener.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* ServerChannels (v2.2) by EvolSoft
* Developer: EvolSoft (Flavius12)
* ServerChannels v2.3 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 14/02/2018 10:03 AM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerChannels/blob/master/LICENSE)
*/

Expand All @@ -15,9 +14,8 @@
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\plugin\PluginBase;

class EventListener extends PluginBase implements Listener {
class EventListener implements Listener {

/** @var ServerChannels */
private $plugin;
Expand Down
7 changes: 3 additions & 4 deletions src/ServerChannels/Events/ServerChannelsChatEvent.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* ServerChannels (v2.2) by EvolSoft
* Developer: EvolSoft (Flavius12)
* ServerChannels v2.3 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 14/02/2018 10:03 AM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerChannels/blob/master/LICENSE)
*/

Expand Down
7 changes: 3 additions & 4 deletions src/ServerChannels/Events/ServerChannelsEvent.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* ServerChannels (v2.2) by EvolSoft
* Developer: EvolSoft (Flavius12)
* ServerChannels v2.3 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 14/02/2018 10:03 AM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerChannels/blob/master/LICENSE)
*/

Expand Down
7 changes: 3 additions & 4 deletions src/ServerChannels/Events/ServerChannelsJoinEvent.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* ServerChannels (v2.2) by EvolSoft
* Developer: EvolSoft (Flavius12)
* ServerChannels v2.3 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 14/02/2018 10:03 AM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerChannels/blob/master/LICENSE)
*/

Expand Down
7 changes: 3 additions & 4 deletions src/ServerChannels/Events/ServerChannelsLeaveEvent.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* ServerChannels (v2.2) by EvolSoft
* Developer: EvolSoft (Flavius12)
* ServerChannels v2.3 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 14/02/2018 10:03 AM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/ServerChannels/blob/master/LICENSE)
*/

Expand Down
Loading

0 comments on commit 5aa3a83

Please sign in to comment.