2016-06-10 15:05:56 +00:00
|
|
|
<?php
|
|
|
|
# _ _ _ _ _____
|
|
|
|
# | | | | | | |/ ____|
|
|
|
|
# | | | | |__| | |
|
|
|
|
# | | | | __ | |
|
|
|
|
# | |__| | | | | |____
|
|
|
|
# \____/|_| |_|\_____|
|
|
|
|
# The most customisable UHC plugin for Minecraft PE !
|
|
|
|
namespace Ad5001\UHC\scenario;
|
|
|
|
use pocketmine\command\CommandExecutor;
|
|
|
|
use pocketmine\command\Command;
|
|
|
|
use pocketmine\command\CommandSender;
|
|
|
|
use pocketmine\command\PluginIdentifiableCommand;
|
|
|
|
use pocketmine\Server;
|
2016-08-20 05:15:03 +00:00
|
|
|
use pocketmine\event\Listener;
|
2016-06-10 15:05:56 +00:00
|
|
|
use pocketmine\utils\Config;
|
|
|
|
use Ad5001\UHC\scenario\ScenarioInt;
|
2016-08-20 05:15:03 +00:00
|
|
|
use Ad5001\UHC\Main;
|
2016-06-10 15:05:56 +00:00
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
abstract class Scenario implements ScenarioInt, Listener {
|
2016-06-10 15:05:56 +00:00
|
|
|
|
|
|
|
private $server;
|
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
private $game;
|
2016-06-10 15:05:56 +00:00
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
private $level;
|
2016-06-10 15:05:56 +00:00
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
public function __construct(Server $server, UHCGame $game, UHCWorld $level) {
|
|
|
|
$this->server = $server;
|
|
|
|
$this->game = $game;
|
|
|
|
$this->level = $level;
|
|
|
|
}
|
2016-06-10 15:05:56 +00:00
|
|
|
|
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
public function onStart()
|
2016-06-10 15:05:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
public function onStop() {}
|
2016-08-20 06:31:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
public function onJoin(Player $player) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onQuit(Player $player) {}
|
2016-08-20 05:59:12 +00:00
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
|
|
|
|
public function onInteract(\pocketmine\event\player\PlayerInteractEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onChat(\pocketmine\event\player\PlayerChatEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerChat(\pocketmine\event\player\PlayerChatEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerCommand(\pocketmine\event\player\PlayerCommandPreprocessEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onDeath(\pocketmine\event\player\PlayerDeathEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerDeath(\pocketmine\event\player\PlayerDeathEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerDropItem(\pocketmine\event\player\PlayerDropItemEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onDrop(\pocketmine\event\player\PlayerDropItemEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerMove(\pocketmine\event\player\PlayerMoveEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onMove(\pocketmine\event\player\PlayerMoveEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerItemConsume(\pocketmine\event\player\PlayerItemConsumeEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onItemConsume(\pocketmine\event\player\PlayerItemConsumeEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlayerItemHeld(\pocketmine\event\player\PlayerItemHeldEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onItemHeld(\pocketmine\event\player\PlayerItemHeldEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onDataPacketReceive(\pocketmine\event\server\DataPacketReceiveEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onDataPacketSend(\pocketmine\event\server\DataPacketSendEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onServerCommand(\pocketmine\event\server\ServerCommandEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onBlockBreak(\pocketmine\event\block\BlockBreakEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onBreak(\pocketmine\event\block\BlockBreakEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onBlockPlace(\pocketmine\event\block\BlockPlaceEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onPlace(\pocketmine\event\block\BlockPlaceEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onEntityDamage(\pocketmine\event\entity\EntityDamageEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onProjectileLaunch(\pocketmine\event\entity\ProjectileLauchEvent $event) {}
|
|
|
|
|
|
|
|
|
|
|
|
public function onProjectileHit(\pocketmine\event\entity\ProjectileHitEvent $event) {}
|
2016-06-10 15:05:56 +00:00
|
|
|
|
|
|
|
|
2016-08-20 05:15:03 +00:00
|
|
|
public function getMain() {
|
|
|
|
return $this->server->getPluginManager()->getPlugin("UHC");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-10 15:05:56 +00:00
|
|
|
public function getServer() {
|
2016-08-20 05:15:03 +00:00
|
|
|
return $this->main->getServer();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getLogger() {
|
|
|
|
return $this->getMain()->getLogger();
|
2016-06-10 15:05:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getConfig() {
|
2016-08-20 05:15:03 +00:00
|
|
|
return $this->getMain()->getConfig()->get("Scenarios")[$this->name];
|
2016-06-10 15:05:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function reloadConfig() {
|
2016-08-20 05:15:03 +00:00
|
|
|
$this->getMain()->reloadConfig();
|
|
|
|
return $this->getMain()->getConfig()->get("Scenarios")[$this->name];
|
2016-06-10 15:05:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function saveConfig($cfg) {
|
2016-08-20 05:15:03 +00:00
|
|
|
$scenarios = $this->getMain()->getConfig()->get("Scenarios");
|
2016-06-10 15:05:56 +00:00
|
|
|
$scenarios[$this->name] = $cfg;
|
2016-08-20 05:15:03 +00:00
|
|
|
$this->getMain()->getConfig()->set("Scenarios", $scenarios);
|
|
|
|
return $this->getMain()->getConfig->save();
|
2016-06-10 15:05:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getScenarioFolder() {
|
2016-08-20 05:59:12 +00:00
|
|
|
return realPath($this->getMain()->getDataFolder() . "scenarios/");
|
2016-06-10 15:05:56 +00:00
|
|
|
}
|
|
|
|
}
|