mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
Merge remote-tracking branch 'origin/3.7'
This commit is contained in:
commit
5f23fffdda
@ -194,6 +194,14 @@ namespace pocketmine {
|
|||||||
mkdir(\pocketmine\DATA, 0777, true);
|
mkdir(\pocketmine\DATA, 0777, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define('pocketmine\LOCK_FILE_PATH', \pocketmine\DATA . 'server.lock');
|
||||||
|
define('pocketmine\LOCK_FILE', fopen(\pocketmine\LOCK_FILE_PATH, "cb"));
|
||||||
|
if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){
|
||||||
|
critical_error("Another " . \pocketmine\NAME . " instance is already using this folder (" . realpath(\pocketmine\DATA) . ").");
|
||||||
|
critical_error("Please stop the other server first before running a new one.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//Logger has a dependency on timezone
|
//Logger has a dependency on timezone
|
||||||
Timezone::init();
|
Timezone::init();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class KillCommand extends VanillaCommand{
|
|||||||
|
|
||||||
if(count($args) === 1){
|
if(count($args) === 1){
|
||||||
if(!$sender->hasPermission("pocketmine.command.kill.other")){
|
if(!$sender->hasPermission("pocketmine.command.kill.other")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ class KillCommand extends VanillaCommand{
|
|||||||
|
|
||||||
if($sender instanceof Player){
|
if($sender instanceof Player){
|
||||||
if(!$sender->hasPermission("pocketmine.command.kill.self")){
|
if(!$sender->hasPermission("pocketmine.command.kill.self")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class TimeCommand extends VanillaCommand{
|
|||||||
|
|
||||||
if($args[0] === "start"){
|
if($args[0] === "start"){
|
||||||
if(!$sender->hasPermission("pocketmine.command.time.start")){
|
if(!$sender->hasPermission("pocketmine.command.time.start")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ class TimeCommand extends VanillaCommand{
|
|||||||
return true;
|
return true;
|
||||||
}elseif($args[0] === "stop"){
|
}elseif($args[0] === "stop"){
|
||||||
if(!$sender->hasPermission("pocketmine.command.time.stop")){
|
if(!$sender->hasPermission("pocketmine.command.time.stop")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class TimeCommand extends VanillaCommand{
|
|||||||
return true;
|
return true;
|
||||||
}elseif($args[0] === "query"){
|
}elseif($args[0] === "query"){
|
||||||
if(!$sender->hasPermission("pocketmine.command.time.query")){
|
if(!$sender->hasPermission("pocketmine.command.time.query")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ class TimeCommand extends VanillaCommand{
|
|||||||
|
|
||||||
if($args[0] === "set"){
|
if($args[0] === "set"){
|
||||||
if(!$sender->hasPermission("pocketmine.command.time.set")){
|
if(!$sender->hasPermission("pocketmine.command.time.set")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ class TimeCommand extends VanillaCommand{
|
|||||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.time.set", [$value]));
|
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.time.set", [$value]));
|
||||||
}elseif($args[0] === "add"){
|
}elseif($args[0] === "add"){
|
||||||
if(!$sender->hasPermission("pocketmine.command.time.add")){
|
if(!$sender->hasPermission("pocketmine.command.time.add")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class WhitelistCommand extends VanillaCommand{
|
|||||||
|
|
||||||
private function badPerm(CommandSender $sender, string $perm) : bool{
|
private function badPerm(CommandSender $sender, string $perm) : bool{
|
||||||
if(!$sender->hasPermission("pocketmine.command.whitelist.$perm")){
|
if(!$sender->hasPermission("pocketmine.command.whitelist.$perm")){
|
||||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,10 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_TYPE_LONG = 7;
|
public const DATA_TYPE_LONG = 7;
|
||||||
public const DATA_TYPE_VECTOR3F = 8;
|
public const DATA_TYPE_VECTOR3F = 8;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Readers beware: this isn't a nice list. Some of the properties have different types for different entities, and
|
||||||
|
* are used for entirely different things.
|
||||||
|
*/
|
||||||
public const DATA_FLAGS = 0;
|
public const DATA_FLAGS = 0;
|
||||||
public const DATA_HEALTH = 1; //int (minecart/boat)
|
public const DATA_HEALTH = 1; //int (minecart/boat)
|
||||||
public const DATA_VARIANT = 2; //int
|
public const DATA_VARIANT = 2; //int
|
||||||
@ -111,17 +115,21 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_PADDLE_TIME_RIGHT = 14; //float
|
public const DATA_PADDLE_TIME_RIGHT = 14; //float
|
||||||
public const DATA_EXPERIENCE_VALUE = 15; //int (xp orb)
|
public const DATA_EXPERIENCE_VALUE = 15; //int (xp orb)
|
||||||
public const DATA_MINECART_DISPLAY_BLOCK = 16; //int (id | (data << 16))
|
public const DATA_MINECART_DISPLAY_BLOCK = 16; //int (id | (data << 16))
|
||||||
|
public const DATA_HORSE_FLAGS = 16; //int
|
||||||
|
/* 16 (byte) used by wither skull */
|
||||||
public const DATA_MINECART_DISPLAY_OFFSET = 17; //int
|
public const DATA_MINECART_DISPLAY_OFFSET = 17; //int
|
||||||
|
public const DATA_SHOOTER_ID = 17; //long (used by arrows)
|
||||||
public const DATA_MINECART_HAS_DISPLAY = 18; //byte (must be 1 for minecart to show block inside)
|
public const DATA_MINECART_HAS_DISPLAY = 18; //byte (must be 1 for minecart to show block inside)
|
||||||
|
public const DATA_HORSE_TYPE = 19; //byte
|
||||||
//TODO: add more properties
|
/* 20 (unknown)
|
||||||
|
* 21 (unknown) */
|
||||||
|
public const DATA_CHARGE_AMOUNT = 22; //int8, used for ghasts and also crossbow charging
|
||||||
public const DATA_ENDERMAN_HELD_ITEM_ID = 23; //short
|
public const DATA_ENDERMAN_HELD_ITEM_ID = 23; //short
|
||||||
public const DATA_ENTITY_AGE = 24; //short
|
public const DATA_ENTITY_AGE = 24; //short
|
||||||
|
/* 25 (int) used by horse, (byte) used by witch */
|
||||||
/* 26 (byte) player-specific flags
|
public const DATA_PLAYER_FLAGS = 26; //byte
|
||||||
* 27 (int) player "index"?
|
public const DATA_PLAYER_INDEX = 27; //int, used for marker colours and agent nametag colours
|
||||||
* 28 (block coords) bed position */
|
public const DATA_PLAYER_BED_POSITION = 28; //blockpos
|
||||||
public const DATA_FIREBALL_POWER_X = 29; //float
|
public const DATA_FIREBALL_POWER_X = 29; //float
|
||||||
public const DATA_FIREBALL_POWER_Y = 30;
|
public const DATA_FIREBALL_POWER_Y = 30;
|
||||||
public const DATA_FIREBALL_POWER_Z = 31;
|
public const DATA_FIREBALL_POWER_Z = 31;
|
||||||
@ -132,7 +140,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_POTION_AUX_VALUE = 36; //short
|
public const DATA_POTION_AUX_VALUE = 36; //short
|
||||||
public const DATA_LEAD_HOLDER_EID = 37; //long
|
public const DATA_LEAD_HOLDER_EID = 37; //long
|
||||||
public const DATA_SCALE = 38; //float
|
public const DATA_SCALE = 38; //float
|
||||||
public const DATA_INTERACTIVE_TAG = 39; //string (button text)
|
public const DATA_HAS_NPC_COMPONENT = 39; //byte (???)
|
||||||
public const DATA_NPC_SKIN_ID = 40; //string
|
public const DATA_NPC_SKIN_ID = 40; //string
|
||||||
public const DATA_URL_TAG = 41; //string
|
public const DATA_URL_TAG = 41; //string
|
||||||
public const DATA_MAX_AIR = 42; //short
|
public const DATA_MAX_AIR = 42; //short
|
||||||
@ -182,8 +190,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_BOAT_BUBBLE_TIME = 86; //int (time in bubble column)
|
public const DATA_BOAT_BUBBLE_TIME = 86; //int (time in bubble column)
|
||||||
public const DATA_PLAYER_AGENT_EID = 87; //long
|
public const DATA_PLAYER_AGENT_EID = 87; //long
|
||||||
/* 88 (float) related to panda sitting
|
/* 88 (float) related to panda sitting
|
||||||
* 89 (float) related to panda sitting
|
* 89 (float) related to panda sitting */
|
||||||
* 90 (unknown) */
|
public const DATA_EAT_COUNTER = 90; //int (used by pandas)
|
||||||
public const DATA_FLAGS2 = 91; //long (extended data flags)
|
public const DATA_FLAGS2 = 91; //long (extended data flags)
|
||||||
/* 92 (float) related to panda lying down
|
/* 92 (float) related to panda lying down
|
||||||
* 93 (float) related to panda lying down */
|
* 93 (float) related to panda lying down */
|
||||||
@ -192,7 +200,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS_PER_TICK = 96; //float, usually negative
|
public const DATA_AREA_EFFECT_CLOUD_RADIUS_PER_TICK = 96; //float, usually negative
|
||||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS_CHANGE_ON_PICKUP = 97; //float
|
public const DATA_AREA_EFFECT_CLOUD_RADIUS_CHANGE_ON_PICKUP = 97; //float
|
||||||
public const DATA_AREA_EFFECT_CLOUD_PICKUP_COUNT = 98; //int
|
public const DATA_AREA_EFFECT_CLOUD_PICKUP_COUNT = 98; //int
|
||||||
|
public const DATA_INTERACTIVE_TAG = 99; //string (button text)
|
||||||
|
public const DATA_TRADE_TIER = 100; //int
|
||||||
|
public const DATA_MAX_TRADE_TIER = 101; //int
|
||||||
|
|
||||||
public const DATA_FLAG_ONFIRE = 0;
|
public const DATA_FLAG_ONFIRE = 0;
|
||||||
public const DATA_FLAG_SNEAKING = 1;
|
public const DATA_FLAG_SNEAKING = 1;
|
||||||
@ -265,6 +275,18 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
public const DATA_FLAG_IN_SCAFFOLDING = 68;
|
public const DATA_FLAG_IN_SCAFFOLDING = 68;
|
||||||
public const DATA_FLAG_OVER_SCAFFOLDING = 69;
|
public const DATA_FLAG_OVER_SCAFFOLDING = 69;
|
||||||
public const DATA_FLAG_FALL_THROUGH_SCAFFOLDING = 70;
|
public const DATA_FLAG_FALL_THROUGH_SCAFFOLDING = 70;
|
||||||
|
public const DATA_FLAG_BLOCKING = 71; //shield
|
||||||
|
public const DATA_FLAG_DISABLE_BLOCKING = 72;
|
||||||
|
//73 is set when a player is attacked while using shield, unclear on purpose
|
||||||
|
public const DATA_FLAG_SLEEPING = 74;
|
||||||
|
//75 related to sleeping, unclear usage
|
||||||
|
public const DATA_FLAG_TRADE_INTEREST = 76;
|
||||||
|
public const DATA_FLAG_DOOR_BREAKER = 77; //...
|
||||||
|
public const DATA_FLAG_BREAKING_OBSTRUCTION = 78;
|
||||||
|
public const DATA_FLAG_DOOR_OPENER = 79; //...
|
||||||
|
|
||||||
|
public const DATA_PLAYER_FLAG_SLEEP = 1;
|
||||||
|
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,13 +73,6 @@ use const INT32_MIN;
|
|||||||
|
|
||||||
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||||
|
|
||||||
public const DATA_PLAYER_FLAG_SLEEP = 1;
|
|
||||||
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
|
||||||
|
|
||||||
public const DATA_PLAYER_FLAGS = 26;
|
|
||||||
|
|
||||||
public const DATA_PLAYER_BED_POSITION = 28;
|
|
||||||
|
|
||||||
/** @var PlayerInventory */
|
/** @var PlayerInventory */
|
||||||
protected $inventory;
|
protected $inventory;
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ use const PHP_INT_MAX;
|
|||||||
|
|
||||||
abstract class Projectile extends Entity{
|
abstract class Projectile extends Entity{
|
||||||
|
|
||||||
public const DATA_SHOOTER_ID = 17;
|
|
||||||
|
|
||||||
/** @var float */
|
/** @var float */
|
||||||
protected $damage = 0.0;
|
protected $damage = 0.0;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ abstract class TextFormat{
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function tokenize(string $string) : array{
|
public static function tokenize(string $string) : array{
|
||||||
return preg_split("/(" . TextFormat::ESCAPE . "[0-9a-fk-or])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
return preg_split("/(" . TextFormat::ESCAPE . "[0-9a-fk-or])/u", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user