Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
svilex committed May 13, 2016
1 parent 334e134 commit bf118af
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Genisys.phar
*.phar
.idea/*
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This is a [PocketMine-MP](https://github.com/PocketMine/PocketMine-MP) (or forks

######This plugin was tested (and should work) on:
- [ ] **[PocketMine-MP](https://github.com/PocketMine/PocketMine-MP)**
- [x] **[ClearSky](https://github.com/ClearSkyTeam/ClearSky/)**
- [ ] **[ImagicalMine](https://github.com/ImagicalCorp/ImagicalMine)**
- [x] **[ClearSky](https://github.com/ClearSkyTeam/ClearSky)**
- [x] **[Genisys](https://github.com/iTXTech/Genisys)**

---
Expand Down
6 changes: 6 additions & 0 deletions SW/resources/SW_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ banned.commands.while.in.game:
- /back
- /home
- /f
- /kill

# If this option is "true" , the game will start once all the slots will be finished , regardless from countdown.
start.when.full: true
Expand Down Expand Up @@ -116,6 +117,11 @@ reward.command: '/'
1st line: '§l§c[§bSW§c]'
2nd line: '§l§e{SWNAME}'

# Refreshes signs each 5 seconds.
# Hint : This is useful if you often see signs displaying wrong info about SW games.
# Hint : Only enable if you've noticed the above problem.
sign.tick: false

# This pushes players away from signs , like when damaged in PvP.
sign.knockBack: true

Expand Down
13 changes: 9 additions & 4 deletions SW/src/svile/sw/SWarena.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function join(Player $player)
$player->setMaxHealth($this->pg->configs['join.max.health']);
$player->setMaxHealth($player->getMaxHealth());
$player->setHealth($this->pg->configs['join.health']);
$player->setFood($player->getMaxFood());
$player->setFood(20);

$this->pg->getServer()->loadLevel($this->world);
$level = $this->pg->getServer()->getLevelByName($this->world);
Expand Down Expand Up @@ -432,8 +432,13 @@ public function closePlayer(Player $p, $left = false, $spectate = false)
$p->removeAllEffects();
$p->setMaxHealth(20);
$p->setMaxHealth($p->getMaxHealth());
$p->setHealth($p->getMaxHealth());
$p->setFood($p->getMaxFood());
if ($p->isAlive()) {
$p->setSprinting(false);
$p->setSneaking(false);
$p->extinguish();
$p->setHealth($p->getMaxHealth());
$p->setFood(20);
}
if (!$spectate) {
$p->teleport($p->getServer()->getDefaultLevel()->getSpawnLocation());
} elseif ($this->GAME_STATE == 1 && 1 < count($this->players)) {
Expand Down Expand Up @@ -463,7 +468,7 @@ private function start()
$p->setMaxHealth($this->pg->configs['join.max.health']);
$p->setMaxHealth($p->getMaxHealth());
$p->setHealth($this->pg->configs['join.health']);
$p->setFood($p->getMaxFood());
$p->setFood(20);
$p->sendMessage($this->pg->lang['game.start']);
if ($p->getLevel()->getBlock($p->floor()->subtract(0, 2))->getId() == 20)
$p->getLevel()->setBlock($p->floor()->subtract(0, 2), Block::get(0), true, false);
Expand Down
3 changes: 2 additions & 1 deletion SW/src/svile/sw/SWcommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public function onCommand(CommandSender $sender, Command $command, $label, array
}

$SWname = array_shift($args);
if (!($SWname && ctype_alpha($SWname) && strlen($SWname) < 0x10 && strlen($SWname) > 0b10 && array_key_exists($SWname, $this->pg->arenas))) {
if (!array_key_exists($SWname, $this->pg->arenas)) {
if ($SWname == 'all') {
//Deleting SW signs blocks
foreach ($this->pg->signs as $loc => $name) {
Expand All @@ -461,6 +461,7 @@ public function onCommand(CommandSender $sender, Command $command, $label, array
}
break;
}
$this->pg->arenas[$SWname]->stop();
foreach ($this->pg->signs as $loc => $name) {
if ($SWname == $name) {
$ex = explode(':', $loc);
Expand Down
2 changes: 1 addition & 1 deletion SW/src/svile/sw/SWlistener.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public function onDeath(PlayerDeathEvent $event)

endswitch;

foreach ($p->getLevel()->getPlayers() as $pl)
foreach ($this->pg->getServer()->getLevelByName($a->getWorld())->getPlayers() as $pl)
$pl->sendMessage($message);

if (!$this->pg->configs['drops.on.death'])
Expand Down
3 changes: 2 additions & 1 deletion SW/src/svile/sw/SWmain.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function onEnable()
*/
$this->configs = new Config($this->getDataFolder() . 'SW_configs.yml', CONFIG::YAML, [
'CONFIG_VERSION' => self::SW_VERSION,
'banned.commands.while.in.game' => array('/hub', '/lobby', '/spawn', '/tpa', '/tp', '/tpaccept', '/back', '/home', '/f'),
'banned.commands.while.in.game' => array('/hub', '/lobby', '/spawn', '/tpa', '/tp', '/tpaccept', '/back', '/home', '/f', '/kill'),
'start.when.full' => true,
'needed.players.to.run.countdown' => 1,
'join.max.health' => 20,
Expand All @@ -179,6 +179,7 @@ public function onEnable()
'reward.command' => '/',
'1st line' => '§l§c[§bSW§c]',
'2nd line' => '§l§e{SWNAME}',
'sign.tick' => false,
'sign.knockBack' => true,
'knockBack.radius.from.sign' => 1,
'knockBack.intensity' => 0b10,
Expand Down
13 changes: 12 additions & 1 deletion SW/src/svile/sw/SWtimer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,26 @@

class SWtimer extends PluginTask
{
/** @var int */
private $seconds = 0;
/** @var bool */
private $tick = false;

public function __construct(SWmain $plugin)
{
parent::__construct($plugin);
$this->tick = (bool)$plugin->configs['sign.tick'];
}

public function onRun($tick)
{
foreach ($this->getOwner()->arenas as $SWname => $SWarena) {
foreach ($this->getOwner()->arenas as $SWname => $SWarena)
$SWarena->tick();

if ($this->tick) {
if (($this->seconds % 5 == 0))
$this->getOwner()->refreshSigns();
$this->seconds++;
}
}
}

0 comments on commit bf118af

Please sign in to comment.