This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,605 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,10 @@ | ||
name: WoolBattle | ||
main: Fludixx\WoolBattle\Main | ||
version: 1.2.2 | ||
api: [3.0.0-ALPHA12, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5] | ||
name: Woolbattle | ||
description: "Woolbattle Plugin for Pocketmine" | ||
version: 2.0 | ||
author: Fludixx | ||
description: WoolBatlle Plugin for pmmp | ||
website: https://github.com/Fludixx/ | ||
website: github.com/Fludixx/WoolBattle | ||
api: [3.0.0, 4.0.0] | ||
main: Fludixx\Woolbattle\Woolbattle | ||
commands: | ||
eq: | ||
description: "Gives you Woolbattle Equip" | ||
perkshop: | ||
description: "WoolBattle PerkShop" | ||
cords: | ||
description: "Cords -> Woolbattle" | ||
spectate: | ||
description: "Spectate -> Woolbattle" | ||
aliases: ["spec", "zuschauen"] | ||
lobby: | ||
description: "Teleport to Woolbattle Lobby" | ||
aliases: ["l", "leave"] | ||
group: | ||
description: "Woolbattle Group (ClanWar) System" | ||
aliases: ["gp", "g", "gruppe"] | ||
lastaction: | ||
description: "Output the last registered Action!" | ||
aliases: ["la", "letzteaction"] | ||
woolbattle: | ||
description: "Woolbattle Command" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
cloud: /cloud | ||
config_type: 1 | ||
cooldown: 5 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Fludixx\Woolbattle; | ||
|
||
use pocketmine\Player; | ||
use pocketmine\scheduler\Task; | ||
|
||
class Cooldown extends Task { | ||
|
||
public $pl; | ||
public $player; | ||
|
||
public function __construct(Woolbattle $pl, Player $player) | ||
{ | ||
$this->pl = $pl; | ||
$this->player = $player; | ||
} | ||
|
||
public function onRun(int $currentTick) | ||
{ | ||
$this->pl->players[$this->player->getName()]["cooldown"] = FALSE; | ||
$this->pl->getScheduler()->cancelTask($this->getTaskId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace Fludixx\Woolbattle; | ||
|
||
use pocketmine\item\Item; | ||
use pocketmine\level\Level; | ||
use pocketmine\scheduler\Task; | ||
use pocketmine\utils\Config; | ||
use pocketmine\utils\TextFormat as f; | ||
|
||
class DuellTask extends Task { | ||
|
||
public $level; | ||
public $pl; | ||
|
||
public function __construct(Woolbattle $pl, Level $level) | ||
{ | ||
$this->level = $level; | ||
$this->pl = $pl; | ||
} | ||
|
||
public function onRun(int $currentTick) | ||
{ | ||
$level = $this->level; | ||
$players = $level->getPlayers(); | ||
$inLevel = count($players); | ||
foreach($players as $player) { | ||
$lifes = $this->pl->players[$player->getName()]["lifes"]; | ||
$pos = $this->pl->players[$player->getName()]["pos"]; | ||
$oplayername = $this->pl->players[$player->getName()]["ms"]; | ||
$olifes = $this->pl->players[$oplayername]["lifes"]; | ||
if($lifes < 0) { | ||
$oplayer = $this->pl->getServer()->getPlayer($oplayername); | ||
mt_srand(ip2long($player->getAddress())+time()); | ||
$elo = mt_rand(1, 45); | ||
$player->sendMessage($this->pl::PREFIX."You lost aginst {$oplayer->getName()}! ".f::RED." - $elo ELO"); | ||
$c = new Config($this->pl->playercfg.$player->getName() | ||
.$this->pl->endings[$this->pl->configtype], $this->pl->configtype); | ||
$c->set("elo", (int)$c->get("elo")-$elo); | ||
$c->save(); | ||
$oplayer->sendMessage($this->pl::PREFIX."You won aginst {$player->getName()}! ".f::GREEN." + $elo ELO"); | ||
$c = new Config($this->pl->playercfg.$oplayer->getName() | ||
.$this->pl->endings[$this->pl->configtype], $this->pl->configtype); | ||
$c->set("elo", (int)$c->get("elo")+$elo); | ||
$c->save(); | ||
$player->teleport($this->pl->getServer()->getDefaultLevel()->getSafeSpawn()); | ||
$oplayer->teleport($this->pl->getServer()->getDefaultLevel()->getSafeSpawn()); | ||
$level->unload(); | ||
$id = (int) filter_var($level->getFolderName(), FILTER_SANITIZE_NUMBER_INT); | ||
$this->pl->resetArena($id); | ||
$this->pl->PlayerResetArray($player); | ||
$this->pl->PlayerResetArray($oplayer); | ||
$this->pl->getEq($player); | ||
$this->pl->getEq($oplayer); | ||
$this->pl->getScheduler()->cancelTask($this->getTaskId()); | ||
return true; | ||
} | ||
if($inLevel == 1) { | ||
mt_srand(ip2long($player->getAddress())+time()); | ||
$elo = mt_rand(1, 45); | ||
$player->sendMessage($this->pl::PREFIX."Looks like your opponent left the Game!".f::GREEN." + $elo ELO"); | ||
$this->pl->PlayerResetArray($player); | ||
$c = new Config($this->pl->playercfg.$player->getName() | ||
.$this->pl->endings[$this->pl->configtype], $this->pl->configtype); | ||
$c->set("elo", (int)$c->get("elo")+$elo); | ||
$c->save(); | ||
$player->teleport($this->pl->getServer()->getDefaultLevel()->getSafeSpawn()); | ||
$level->unload(); | ||
$id = (int) filter_var($level->getFolderName(), FILTER_SANITIZE_NUMBER_INT); | ||
$this->pl->resetArena($id); | ||
$this->pl->PlayerResetArray($player); | ||
$this->pl->getEq($player); | ||
$this->pl->getScheduler()->cancelTask($this->getTaskId()); | ||
return true; | ||
} | ||
$player->addActionBarMessage(f::GRAY.$player->getName().f::YELLOW."($lifes)".f::WHITE." vs ".f::GRAY."$oplayername".f::YELLOW."($olifes)"); | ||
$c = new Config($this->pl->playercfg.$player->getName() | ||
.$this->pl->endings[$this->pl->configtype], $this->pl->configtype); | ||
if($c->get("perk") == "enderpearl" and !$player->getInventory()->contains(Item::get(Item::ENDER_PEARL))) { | ||
$player->getInventory()->addItem(Item::get(Item::ENDER_PEARL)->setCustomName(f::LIGHT_PURPLE."Enderpearl")); | ||
} | ||
if($c->get("perk") == "switcher" and !$player->getInventory()->contains(Item::get(Item::SNOWBALL))) { | ||
$player->getInventory()->addItem(Item::get(Item::SNOWBALL)->setCustomName(f::YELLOW."Switcher")); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
namespace Fludixx\Woolbattle; | ||
use Fludixx\Woolbattle\Woolbattle; | ||
use pocketmine\inventory\transaction\action\SlotChangeAction; | ||
use pocketmine\item\Item; | ||
use pocketmine\level\sound\AnvilBreakSound; | ||
use pocketmine\level\sound\ClickSound; | ||
use pocketmine\level\sound\NoteblockSound; | ||
use pocketmine\network\mcpe\protocol\LevelEventPacket; | ||
use pocketmine\Player; | ||
use pocketmine\utils\TextFormat as f; | ||
use pocketmine\utils\Config; | ||
use pocketmine\item\enchantment\Enchantment; | ||
use pocketmine\item\enchantment\EnchantmentInstance; | ||
|
||
class PerkshopListener | ||
{ | ||
protected $plugin; | ||
public function __construct(Woolbattle $plugin) | ||
{ | ||
$this->plugin = $plugin; | ||
} | ||
|
||
public function onTransaction(Player $player, Item $itemClickedOn, Item $itemClickedWith): bool | ||
{ | ||
$itemname = $itemClickedOn->getCustomName(); | ||
if($itemname == f::LIGHT_PURPLE."Enderpearl") { | ||
$c = new Config($this->plugin->playercfg.$player->getName() | ||
.$this->plugin->endings[$this->plugin->configtype], $this->plugin->configtype); | ||
$elo = $c->get("elo"); | ||
$c->set("perk", "enderpearl"); | ||
$c->save(); | ||
$player->sendMessage($this->plugin::PREFIX."Sucessfully selected ".f::GRAY."ENDERPEARL".f::WHITE." Perk!"); | ||
$player->getLevel()->addSound(new ClickSound($player->asVector3())); | ||
} | ||
if($itemname == f::GREEN."Powerjump") { | ||
$c = new Config($this->plugin->playercfg.$player->getName() | ||
.$this->plugin->endings[$this->plugin->configtype], $this->plugin->configtype); | ||
$elo = $c->get("elo"); | ||
if($elo >= 200) { | ||
$c->set("perk", "jump"); | ||
$c->save(); | ||
$player->sendMessage($this->plugin::PREFIX."Sucessfully selected ".f::GRAY."POWERJUMP".f::WHITE." Perk!"); | ||
$player->getLevel()->addSound(new ClickSound($player->asVector3())); | ||
return true; | ||
} else { | ||
$player->sendMessage($this->plugin::PREFIX."Sorry! You need at least ".f::GRAY."200 ELO".f::WHITE." to equip that!"); | ||
$player->getLevel()->addSound(new AnvilBreakSound($player->asVector3())); | ||
return false; | ||
} | ||
} | ||
if($itemname == f::YELLOW."Switcher") { | ||
$c = new Config($this->plugin->playercfg.$player->getName() | ||
.$this->plugin->endings[$this->plugin->configtype], $this->plugin->configtype); | ||
$elo = $c->get("elo"); | ||
if($elo >= 500) { | ||
$c->set("perk", "switcher"); | ||
$c->save(); | ||
$player->sendMessage($this->plugin::PREFIX."Sucessfully selected ".f::GRAY."SWITCHER".f::WHITE." Perk!"); | ||
$player->getLevel()->addSound(new ClickSound($player->asVector3())); | ||
return true; | ||
} else { | ||
$player->sendMessage($this->plugin::PREFIX."Sorry! You need at least ".f::GRAY."500 ELO".f::WHITE." to equip that!"); | ||
$player->getLevel()->addSound(new AnvilBreakSound($player->asVector3())); | ||
return false; | ||
} | ||
} | ||
if($itemname == f::GOLD."Plattform") { | ||
$c = new Config($this->plugin->playercfg.$player->getName() | ||
.$this->plugin->endings[$this->plugin->configtype], $this->plugin->configtype); | ||
$elo = $c->get("elo"); | ||
if($elo >= 800) { | ||
$c->set("perk", "plattform"); | ||
$c->save(); | ||
$player->sendMessage($this->plugin::PREFIX."Sucessfully selected ".f::GRAY."PLATTFORM".f::WHITE." Perk!"); | ||
$player->getLevel()->addSound(new ClickSound($player->asVector3())); | ||
return true; | ||
} else { | ||
$player->sendMessage($this->plugin::PREFIX."Sorry! You need at least ".f::GRAY."800 ELO".f::WHITE." to equip that!"); | ||
$player->getLevel()->addSound(new AnvilBreakSound($player->asVector3())); | ||
return false; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.