Skip to content

Commit

Permalink
Version 2.2
Browse files Browse the repository at this point in the history
* support for 2.0.0 and also 0.16 :-)
* Fixed a bug which would let you set incomplete pairs in /mine set

THIS WILL LIKELY BE THE LAST VERSION TO SUPPORT API 1.0.0
  • Loading branch information
falkirks committed Nov 23, 2016
1 parent dcd01f7 commit 81c0d0e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: MineReset
main: minereset\MineReset
version: 2.1
version: 2.2
author: Falk
api: [1.0.0, 2.0.0]
load: POSTWORLD
Expand Down
27 changes: 16 additions & 11 deletions src/minereset/MineReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,25 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar
if (isset($this->mines[$args[1]])) {
$sets = array_slice($args, 2);
$save = [];
foreach ($sets as $key => $item) {
if ( $key & 1 ) {
if(isset($save[$sets[$key-1]])){
$save[$sets[$key-1]] += $item;
}
else {
$save[$sets[$key - 1]] = $item;
if(count($sets) % 2 === 0) {
foreach ($sets as $key => $item) {
if ($key & 1) {
if (isset($save[$sets[$key - 1]])) {
$save[$sets[$key - 1]] += $item;
} else {
$save[$sets[$key - 1]] = $item;
}
}
}
$this->mines[$args[1]]->setData($save);
$sender->sendMessage("Mine setted.");
$this->saveConfig();
return true;
}
else{
$sender->sendMessage(TextFormat::RED . "Your format string looks corrupted." . TextFormat::RESET);
return true;
}
$this->mines[$args[1]]->setData($save);
$sender->sendMessage("Mine setted.");
$this->saveConfig();
return true;
}
else{
$sender->sendMessage(TextFormat::RED . "Mine doesn't exist." . TextFormat::RESET);
Expand Down
4 changes: 4 additions & 0 deletions src/minereset/MineResetTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ class MineResetTask extends AsyncTask{
private $a;
private $b;
private $ratioData;
private $regionId;
private $levelId;
private $chunkClass;

public function __construct(array $chunks, Vector3 $a, Vector3 $b, array $data, $levelId, $regionId, $chunkClass){
parent::__construct(null);
$this->chunks = serialize($chunks);
$this->a = $a;
$this->b = $b;
Expand Down

0 comments on commit 81c0d0e

Please sign in to comment.