Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Jul 2, 2016
1 parent b30b823 commit 99f1241
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* Summary: Manage Multiple Worlds
* Dependency Plugins: n/a
* PocketMine-MP version: 1.4 (API:1.10.0)
* PocketMine-MP version: 1.6+php7 (API:2.0.0)
* OptionalPlugins: n/a
* Categories: Admin Tools, Teleportation
* Plugin Access: Commands, Manages Worlds
Expand Down Expand Up @@ -182,6 +182,7 @@ for sample files.

# Changes

* 2.1.0: Updating to new API
* 2.0.3: Bugfix update
* Fixes bug reported by @thebigsmileXD
* 2.0.2: Bug fix
Expand Down
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
main: aliuly\manyworlds\Main
api: 1.10.0
api: 2.0.0
load: POSTWORLD

name: ManyWorlds
description: Manage Multiple Worlds
version: 2.0.3
version: 2.1.0
author: aliuly

commands:
Expand Down
2 changes: 1 addition & 1 deletion src/aliuly/manyworlds/MwGenLst.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct($owner) {
public function onSCommand(CommandSender $c,Command $cc,$scmd,$data,array $args) {
if (count($args) != 0) return false;

if (MPMU::apiVersion("1.12.0")) {
if (MPMU::apiVersion("1.12.0")||MPMU::apiVersion("2.0.0")) {
$c->sendMessage(implode(", ",Generator::getGeneratorList()));
} else {
$c->sendMessage("normal, flat");
Expand Down
16 changes: 8 additions & 8 deletions src/aliuly/manyworlds/MwLvDat.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

use pocketmine\level\generator\Generator;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\Long;
use pocketmine\nbt\tag\Compound;
//use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
//use pocketmine\nbt\tag\LongTag;
//use pocketmine\nbt\tag\CompoundTag;
use pocketmine\math\Vector3;

class MwLvDat extends BasicCli {
Expand Down Expand Up @@ -110,23 +110,23 @@ public function onSCommand(CommandSender $c,Command $cc,$scmd,$data,array $args)
continue;
}
$changed = true; $unload = true;
$provider->getLevelData()->LevelName = new String("LevelName",$v);
$provider->getLevelData()->LevelName = new StringTag("LevelName",$v);
break;
case "generator": // generatorName(String)
if ($provider->getLevelData()->generatorName == $v) {
$c->sendMessage(mc::_("Generator unchanged"));
continue;
}
$changed=true; $unload=true;
$provider->getLevelData()->generatorName=new String("generatorName",$v);
$provider->getLevelData()->generatorName=new StringTag("generatorName",$v);
break;
case "preset": // String("generatorOptions");
case "preset": // StringTag("generatorOptions");
if ($provider->getLevelData()->generatorOptions == $v) {
$c->sendMessage(mc::_("Preset unchanged"));
continue;
}
$changed=true; $unload=true;
$provider->getLevelData()->generatorOptions =new String("generatorOptions",$v);
$provider->getLevelData()->generatorOptions =new StringTag("generatorOptions",$v);
break;
default:
$c->sendMessage(mc::_("Unknown key %1%, ignored",$k));
Expand Down
6 changes: 3 additions & 3 deletions src/aliuly/manyworlds/common/MPMU.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class MPMU {
/** @var str[] $items Nice names for items */
static protected $items = [];
/** @const str VERSION plugin version string */
const VERSION = "1.91.0dev1";
const VERSION = "1.92.0";

/**
* libcommon library version. If a version is provided it will check
Expand Down Expand Up @@ -137,7 +137,7 @@ static public function inGame(CommandSender $sender,$msg = true) {
* @return str
*/
static public function iName($player) {
if ($player instanceof Player) {
if ($player instanceof CommandSender) {
$player = strtolower($player->getName());
}
return $player;
Expand Down Expand Up @@ -182,7 +182,7 @@ static public function callPlugin($server,$plug,$method,$args,$default = null) {
$v = null;
if (is_array($plug)) list($plug,$v) = $plug;
if (($plugin = $server->getPluginManager()->getPlugin($plug)) === null
|| $plugin->isEnabled()) return $default;
|| !$plugin->isEnabled()) return $default;

if ($v !== null && !self::apiCheck($plugin->getDescription()->getVersion(),$v)) return $default;
if (property_exists($plugin,"api")) {
Expand Down
14 changes: 6 additions & 8 deletions src/aliuly/manyworlds/common/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\plugin\PluginBase;
use pocketmine\command\CommandSender;

use aliuly\manyworlds\common\MPMU;

/**
* Basic Session Manager functionality
Expand All @@ -29,7 +30,7 @@ public function __construct(PluginBase $owner) {
* @param PlayerQuitEvent $ev - Quit event
*/
public function onPlayerQuit(PlayerQuitEvent $ev) {
$n = strtolower($ev->getPlayer()->getName());
$n = MPMU::iName($ev->getPlayer());
if (isset($this->state[$n])) unset($this->state[$n]);
}
/**
Expand All @@ -41,8 +42,7 @@ public function onPlayerQuit(PlayerQuitEvent $ev) {
* @return mixed
*/
public function getState($label,$player,$default) {
if ($player instanceof CommandSender) $player = $player->getName();
$player = strtolower($player);
$player = MPMU::iName($player);
if (!isset($this->state[$player])) return $default;
if (!isset($this->state[$player][$label])) return $default;
return $this->state[$player][$label];
Expand All @@ -56,8 +56,7 @@ public function getState($label,$player,$default) {
* @return mixed
*/
public function setState($label,$player,$val) {
if ($player instanceof CommandSender) $player = $player->getName();
$player = strtolower($player);
$player = MPMU::iName($player);
if (!isset($this->state[$player])) $this->state[$player] = [];
$this->state[$player][$label] = $val;
return $val;
Expand All @@ -69,8 +68,7 @@ public function setState($label,$player,$val) {
* @param Player|str $player - intance of Player or their name
*/
public function unsetState($label,$player) {
if ($player instanceof CommandSender) $player = $player->getName();
$player = strtolower($player);
$player = MPMU::iName($player);
if (!isset($this->state[$player])) return;
if (!isset($this->state[$player][$label])) return;
unset($this->state[$player][$label]);
Expand Down

2 comments on commit 99f1241

@HimbeersaftLP
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the new API version 2.1.0?

@alejandroliu
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this should work with 2.1.0 and 2.0.0.

Please sign in to comment.