diff --git a/src/Ad5001/UHC/Main.php b/src/Ad5001/UHC/Main.php index 8d2d98b..9645fa5 100644 --- a/src/Ad5001/UHC/Main.php +++ b/src/Ad5001/UHC/Main.php @@ -163,6 +163,25 @@ switch($cmd->getName()){ } } break; + case "scenarios" { + if(isset($args[2])) { + if(isset($this->worlds[$sender->getLevel()->getName()]) and !isset($this->games[$sender->getLevel()->getName()])) { + if(file_exists($this->getDataFolder() . "scenarios/" . $args[2] . ".php")) { // yes, I'm treating args[2] before args[1] but who cares x) ? + switch($args[1]) { + case "add": + $sl = new \pocketmine\plugin\ScriptPluginLoader($this->getServer()); + $scenarios[$args[2]] = $sl->load(realpath($this->getDataFolder() . "scenarios/" . $args[2] . ".php")); + $scenarios[$args[2]]->onEnable(); + break; + case "remove": + $scenarios[$args[2]]->onStop(); + unset($scenarios[$args[2]]); + break; + } + } + } + } + } } return false; } diff --git a/src/Ad5001/UHC/scenario/Scenario.php b/src/Ad5001/UHC/scenario/Scenario.php new file mode 100644 index 0000000..b7b9a41 --- /dev/null +++ b/src/Ad5001/UHC/scenario/Scenario.php @@ -0,0 +1,67 @@ +get("Scenarios")[$this->name]; + } + + + + public function reloadConfig() { + Main::reloadConfig(); + return Main::getConfig()->get("Scenarios")[$this->name]; + } + + + + public function saveConfig($cfg) { + $scenarios = Main::getConfig()->get("Scenarios"); + $scenarios[$this->name] = $cfg; + Main::getConfig()->set("Scenarios", $scenarios); + return Main::getConfig->save(); + } + + + + public function getScenarioFolder() { + return realPath(Main::getDataFolder . "scenarios/"); + } +} \ No newline at end of file diff --git a/src/Ad5001/UHC/scenario/ScenarioInt.php b/src/Ad5001/UHC/scenario/ScenarioInt.php new file mode 100644 index 0000000..9ae0b81 --- /dev/null +++ b/src/Ad5001/UHC/scenario/ScenarioInt.php @@ -0,0 +1,39 @@ +