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 7, 2018
1 parent 94b6b7d commit fb77df1
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 169 deletions.
5 changes: 3 additions & 2 deletions 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 All @@ -27,7 +27,8 @@ You can also customize spawn settings, spawn messages... and you can also set al

## Donate

Support the development of this plugin with a small donation by clicking [:dollar: here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&lc=US&item_name=www.evolsoft.tk&no_note=0&cn=&curency_code=EUR&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted). Thank you :smile:
Please support the development of this plugin with a small donation by clicking [:dollar: here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&lc=US&item_name=www.evolsoft.tk&no_note=0&cn=&curency_code=EUR&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted).
Your small donation will help me paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you :smile:

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: MSpawns
main: MSpawns\MSpawns
version: 2.1
version: 2.2
api: [3.0.0]
load: STARTUP
author: EvolSoft
Expand Down
22 changes: 11 additions & 11 deletions src/MSpawns/Alias.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:28 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

Expand All @@ -14,6 +13,7 @@
use pocketmine\Player;
use pocketmine\command\CommandSender;
use pocketmine\Server;
use pocketmine\utils\TextFormat;

class Alias extends AliasesMap {

Expand All @@ -26,7 +26,7 @@ public function __construct(MSpawns $plugin, $command, $desc){
public function execute(CommandSender $sender, $label, array $args) : bool {
if($sender instanceof Player){
if(!$this->plugin->cfg["enable-aliases"]){
$sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("aliases-disabled"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName()))));
$sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("aliases-disabled"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName()))));
return true;
}
if($sender->hasPermission("mspawns.spawn")){
Expand All @@ -35,22 +35,22 @@ public function execute(CommandSender $sender, $label, array $args) : bool {
$level = Server::getInstance()->getLevelByName($dest);
if($this->plugin->teleportToSpawn($sender, $level)){
if($this->plugin->isSpawnMessageEnabled()){
$sender->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedSpawnMessage($sender)));
$sender->sendMessage(TextFormat::colorize($this->plugin->getFormattedSpawnMessage($sender)));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $level->getName()))));
$sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $level->getName()))));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $dest))));
$sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $dest))));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No alias"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No alias"));
}
}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("&", MSpawns::PREFIX . "&c You can only perform this command as a player"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player"));
}
return true;
}
Expand Down
7 changes: 3 additions & 4 deletions src/MSpawns/AliasesMap.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:28 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

Expand Down
56 changes: 28 additions & 28 deletions src/MSpawns/Commands/Commands.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:30 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

namespace MSpawns\Commands;

use pocketmine\command\Command;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\utils\TextFormat;

use MSpawns\MSpawns;

class Commands extends PluginCommand implements CommandExecutor {

/** @var MSpawns */
private $plugin;

public function __construct(MSpawns $plugin){
$this->plugin = $plugin;
Expand All @@ -32,49 +35,46 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
goto help;
case "info":
if($sender->hasPermission("mspawns.info")){
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&6 MSpawns &cv" . $this->plugin->getDescription()->getVersion() . "&6 developed by &cEvolSoft"));
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&6 Website &c" . $this->plugin->getDescription()->getWebsite()));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&6 MSpawns &cv" . $this->plugin->getDescription()->getVersion() . "&6 developed by &cEvolSoft"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&6 Website &c" . $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 "reload":
if($sender->hasPermission("mspawns.reload")){
$this->plugin->reloadConfig();
$this->plugin->cfg = $this->plugin->getConfig()->getAll();
$this->plugin->spawns->reload();
$this->plugin->aliases->reload();
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Configuration Reloaded."));
$this->plugin->reload();
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Configuration 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("mspawns")){
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Subcommand &b" . $args[0] . " &cnot found. Use &b/ms &cto see available commands"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Subcommand &b" . $args[0] . " &cnot found. Use &b/ms &cto see 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;
}
return true;
}
help:
if($sender->hasPermission("mspawns")){
$sender->sendMessage($this->plugin->translateColors("&", "&c>> &6Available Commands &c<<"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/sethub &c>> &6Set hub"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/delhub &c>> &6Delete hub"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/hub &c>> &6Teleport player to hub"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/setspawn &c>> &6Set world spawn"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/delspawn &c>> &6Delete world spawn"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/spawn &c>> &6Teleport player to world spawn"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/setalias &c>> &6Set alias"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/delalias &c>> &6Delete alias"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/ms info &c>> &6Show info about this plugin"));
$sender->sendMessage($this->plugin->translateColors("&", "&6/ms reload &c>> &6Reload the config"));
$sender->sendMessage(TextFormat::colorize("&c>> &6Available Commands &c<<"));
$sender->sendMessage(TextFormat::colorize("&6/sethub &c>> &6Set hub"));
$sender->sendMessage(TextFormat::colorize("&6/delhub &c>> &6Delete hub"));
$sender->sendMessage(TextFormat::colorize("&6/hub &c>> &6Teleport player to hub"));
$sender->sendMessage(TextFormat::colorize("&6/setspawn &c>> &6Set world spawn"));
$sender->sendMessage(TextFormat::colorize("&6/delspawn &c>> &6Delete world spawn"));
$sender->sendMessage(TextFormat::colorize("&6/spawn &c>> &6Teleport player to world spawn"));
$sender->sendMessage(TextFormat::colorize("&6/setalias &c>> &6Set alias"));
$sender->sendMessage(TextFormat::colorize("&6/delalias &c>> &6Delete alias"));
$sender->sendMessage(TextFormat::colorize("&6/ms info &c>> &6Show info about this plugin"));
$sender->sendMessage(TextFormat::colorize("&6/ms reload &c>> &6Reload the config"));
return true;
}
$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;
}
}
21 changes: 12 additions & 9 deletions src/MSpawns/Commands/DelAlias.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:30 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

namespace MSpawns\Commands;

use pocketmine\command\Command;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\utils\TextFormat;

use MSpawns\MSpawns;

class DelAlias extends PluginCommand implements CommandExecutor {

/** @var MSpawns */
private $plugin;

public function __construct(MSpawns $plugin){
$this->plugin = $plugin;
}
Expand All @@ -28,15 +31,15 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
if($sender->hasPermission("mspawns.delalias")){
if(isset($args[0])){
if($this->plugin->removeAlias($args[0])){
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Alias " . $args[0] . " removed"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Alias " . $args[0] . " removed"));
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Alias " . $args[0] . " doesn't exist"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Alias " . $args[0] . " doesn't exist"));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Usage /delalias <alias>"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Usage /delalias <alias>"));
}
}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
19 changes: 11 additions & 8 deletions src/MSpawns/Commands/DelHub.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:29 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

namespace MSpawns\Commands;

use pocketmine\command\Command;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\utils\TextFormat;

use MSpawns\MSpawns;

class DelHub extends PluginCommand implements CommandExecutor {

/** @var MSpawns */
private $plugin;

public function __construct(MSpawns $plugin){
$this->plugin = $plugin;
}

public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) : bool {
if($sender->hasPermission("mspawns.delhub")){
if($this->plugin->removeHub()){
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Hub deleted"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Hub deleted"));
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No hub set"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No hub set"));
}
}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
21 changes: 12 additions & 9 deletions src/MSpawns/Commands/DelSpawn.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<?php

/*
* MSpawns (v2.1) by EvolSoft
* Developer: EvolSoft (Flavius12)
* MSpawns v2.2 by EvolSoft
* Developer: Flavius12
* Website: https://www.evolsoft.tk
* Date: 07/01/2018 04:29 PM (UTC)
* Copyright & License: (C) 2014-2018 EvolSoft
* Copyright (C) 2014-2018 EvolSoft
* Licensed under MIT (https://github.com/EvolSoft/MSpawns/blob/master/LICENSE)
*/

namespace MSpawns\Commands;

use pocketmine\Player;
use pocketmine\command\Command;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\utils\TextFormat;

use MSpawns\MSpawns;

class DelSpawn extends PluginCommand implements CommandExecutor {

/** @var MSpawns */
private $plugin;

public function __construct(MSpawns $plugin){
$this->plugin = $plugin;
}
Expand All @@ -35,16 +38,16 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
$level = $sender->getLevel()->getName();
delspw:
if($this->plugin->removeSpawn($level)){
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Spawn removed on world &e" . $level));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Spawn removed on world &e" . $level));
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No spawn found on world " . $level));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No spawn found on world " . $level));
}
}else{
$sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Usage /delspawn <world>"));
$sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Usage /delspawn <world>"));
}
}
}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
Loading

0 comments on commit fb77df1

Please sign in to comment.