mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite
This commit is contained in:
commit
29caf1363f
@ -70,7 +70,7 @@ rm -f start.bat
|
|||||||
echo "[2/3] Downloading PocketMine-MP $PMMP_VERSION..."
|
echo "[2/3] Downloading PocketMine-MP $PMMP_VERSION..."
|
||||||
set +e
|
set +e
|
||||||
download_file "https://github.com/PocketMine/PocketMine-MP/releases/download/$PMMP_VERSION/PocketMine-MP.phar" > PocketMine-MP.phar
|
download_file "https://github.com/PocketMine/PocketMine-MP/releases/download/$PMMP_VERSION/PocketMine-MP.phar" > PocketMine-MP.phar
|
||||||
if ! [ -s "PocketMine-MP.phar" ]; then
|
if ! [ -s "PocketMine-MP.phar" ] || [ "$(head -n 1 PocketMine-MP.phar)" == '<!DOCTYPE html>' ]; then
|
||||||
rm "PocketMine-MP.phar" > /dev/null
|
rm "PocketMine-MP.phar" > /dev/null
|
||||||
download_file "https://github.com/PocketMine/PocketMine-MP/archive/$PMMP_VERSION.tar.gz" | tar -zx > /dev/null
|
download_file "https://github.com/PocketMine/PocketMine-MP/archive/$PMMP_VERSION.tar.gz" | tar -zx > /dev/null
|
||||||
COMPILE_SCRIPT="./src/build/compile.sh"
|
COMPILE_SCRIPT="./src/build/compile.sh"
|
||||||
|
@ -890,7 +890,7 @@ class Server{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($generator !== false and class_exists($generator) and is_subclass_of($generator, "pocketmine\\level\\generator\\Generator")){
|
if($generator !== null and class_exists($generator) and is_subclass_of($generator, "pocketmine\\level\\generator\\Generator")){
|
||||||
$generator = new $generator($options);
|
$generator = new $generator($options);
|
||||||
}else{
|
}else{
|
||||||
if(strtoupper($this->getLevelType()) == "FLAT"){
|
if(strtoupper($this->getLevelType()) == "FLAT"){
|
||||||
@ -1568,7 +1568,7 @@ class Server{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ini_set("memory_limit", "-1"); //Fix error dump not dumped on memory problems
|
ini_set("memory_limit", "-1"); //Fix error dump not dumped on memory problems
|
||||||
console("[SEVERE] An unrecovereable has ocurred and the server has crashed. Creating an error dump");
|
console("[SEVERE] An unrecoverable has occurred and the server has crashed. Creating an error dump");
|
||||||
$dump = "```\r\n# PocketMine-MP Error Dump " . date("D M j H:i:s T Y") . "\r\n";
|
$dump = "```\r\n# PocketMine-MP Error Dump " . date("D M j H:i:s T Y") . "\r\n";
|
||||||
$er = error_get_last();
|
$er = error_get_last();
|
||||||
$errorConversion = array(
|
$errorConversion = array(
|
||||||
|
@ -301,4 +301,11 @@ abstract class Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString(){
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
}
|
}
|
@ -53,6 +53,7 @@ use pocketmine\command\defaults\TellCommand;
|
|||||||
use pocketmine\command\defaults\VanillaCommand;
|
use pocketmine\command\defaults\VanillaCommand;
|
||||||
use pocketmine\command\defaults\VersionCommand;
|
use pocketmine\command\defaults\VersionCommand;
|
||||||
use pocketmine\command\defaults\WhitelistCommand;
|
use pocketmine\command\defaults\WhitelistCommand;
|
||||||
|
use pocketmine\command\defaults\TimeCommand;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
|
|
||||||
class SimpleCommandMap implements CommandMap{
|
class SimpleCommandMap implements CommandMap{
|
||||||
@ -101,6 +102,7 @@ class SimpleCommandMap implements CommandMap{
|
|||||||
$this->register("pocketmine", new SetWorldSpawnCommand("setworldspawn"));
|
$this->register("pocketmine", new SetWorldSpawnCommand("setworldspawn"));
|
||||||
$this->register("pocketmine", new TeleportCommand("tp"));
|
$this->register("pocketmine", new TeleportCommand("tp"));
|
||||||
$this->register("pocketmine", new ReloadCommand("reload"));
|
$this->register("pocketmine", new ReloadCommand("reload"));
|
||||||
|
$this->register("pocketmine", new TimeCommand("time"));
|
||||||
|
|
||||||
if($this->server->getConfigBoolean("debug.commands", false) === true){
|
if($this->server->getConfigBoolean("debug.commands", false) === true){
|
||||||
$this->register("pocketmine", new StatusCommand("status"));
|
$this->register("pocketmine", new StatusCommand("status"));
|
||||||
|
67
src/pocketmine/command/defaults/TimeCommand.php
Normal file
67
src/pocketmine/command/defaults/TimeCommand.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace pocketmine\command\defaults;
|
||||||
|
|
||||||
|
use pocketmine\command\Command;
|
||||||
|
use pocketmine\command\CommandSender;
|
||||||
|
use pocketmine\Server;
|
||||||
|
use pocketmine\utils\TextFormat;
|
||||||
|
use pocketmine\network\protocol\SetTimePacket;
|
||||||
|
|
||||||
|
class TimeCommand extends VanillaCommand{
|
||||||
|
public function __construct($name){
|
||||||
|
parent::__construct(
|
||||||
|
$name,
|
||||||
|
"Changes the time on each world",
|
||||||
|
"/time set <value>\n/time add <value>"
|
||||||
|
);
|
||||||
|
$this->setPermission("pocketmine.command.time.add;pocketmine.command.set;");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(CommandSender $sender, $label, array $args){
|
||||||
|
if (count($args) < 2) {
|
||||||
|
$sender->sendMessage(TextFormat::RED."Incorrect usage. Correct usage:\n".$this->getUsage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(strtolower($args[0])){
|
||||||
|
case "set":
|
||||||
|
if(!$sender->hasPermission("pocketmine.command.time.add")){
|
||||||
|
$sender->sendMessage(TextFormat::RED."You don't have permission to set the time");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($args[1] === "day"){
|
||||||
|
$value = 0;
|
||||||
|
}elseif($args[1] === "night"){
|
||||||
|
$value = 12500;
|
||||||
|
}else{
|
||||||
|
$value = $this->getInteger($sender, $args[1], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(Server::getInstance()->getLevels() as $level){
|
||||||
|
$level->setTime($value);
|
||||||
|
}
|
||||||
|
Command::broadcastCommandMessage($sender, "Set time to ".$value);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
case "add":
|
||||||
|
if (!$sender->hasPermission("pocketmine.command.time.add")){
|
||||||
|
$sender->sendMessage(TextFormat::RED."You don't have permission to set the time");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $this->getInteger($sender, $args[1], 0);
|
||||||
|
|
||||||
|
foreach(Server::getInstance()->getLevels() as $level){
|
||||||
|
$level->setTime($level->getTime() + $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Command::broadcastCommandMessage($sender, "Added ".$value." to time");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
$sender->sendMessage("Unknown method. Usage: ".$this->getUsage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,7 +69,7 @@ class PermissibleBase implements Permissible{
|
|||||||
*/
|
*/
|
||||||
public function setOp($value){
|
public function setOp($value){
|
||||||
if($this->opable === null){
|
if($this->opable === null){
|
||||||
trigger_error("Cannot change ip value as no ServerOperator is set", E_USER_WARNING);
|
trigger_error("Cannot change op value as no ServerOperator is set", E_USER_WARNING);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
|
@ -36,9 +36,6 @@ use pocketmine\Server;
|
|||||||
*/
|
*/
|
||||||
class PluginManager{
|
class PluginManager{
|
||||||
|
|
||||||
/** @var PluginManager */
|
|
||||||
private static $instance = null;
|
|
||||||
|
|
||||||
/** @var Server */
|
/** @var Server */
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
@ -85,13 +82,6 @@ class PluginManager{
|
|||||||
*/
|
*/
|
||||||
protected $fileAssociations = array();
|
protected $fileAssociations = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return PluginManager
|
|
||||||
*/
|
|
||||||
public static function getInstance(){
|
|
||||||
return self::$instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @param SimpleCommandMap $commandMap
|
* @param SimpleCommandMap $commandMap
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
namespace pocketmine\scheduler;
|
namespace pocketmine\scheduler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows the creation if simple callbacks with extra data
|
* Allows the creation of simple callbacks with extra data
|
||||||
* The last parameter in the callback will be this object
|
* The last parameter in the callback will be this object
|
||||||
*
|
*
|
||||||
* If you want to do a task in a Plugin, consider extending PluginTask to your needs
|
* If you want to do a task in a Plugin, consider extending PluginTask to your needs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user