mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
Fixed casing: Gamemode -> GameMode
it's two words, not one.
This commit is contained in:
parent
a756519e6b
commit
27761ac26e
@ -23,12 +23,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine;
|
||||
|
||||
final class Gamemode{
|
||||
final class GameMode{
|
||||
public const SURVIVAL = 0;
|
||||
public const CREATIVE = 1;
|
||||
public const ADVENTURE = 2;
|
||||
public const SPECTATOR = 3;
|
||||
public const VIEW = Gamemode::SPECTATOR;
|
||||
public const VIEW = GameMode::SPECTATOR;
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
@ -1302,8 +1302,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
*/
|
||||
public static function getClientFriendlyGamemode(int $gamemode) : int{
|
||||
$gamemode &= 0x03;
|
||||
if($gamemode === Gamemode::SPECTATOR){
|
||||
return Gamemode::CREATIVE;
|
||||
if($gamemode === GameMode::SPECTATOR){
|
||||
return GameMode::CREATIVE;
|
||||
}
|
||||
|
||||
return $gamemode;
|
||||
@ -1348,10 +1348,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->resetFallDistance();
|
||||
|
||||
if(!$client){ //Gamemode changed by server, do not send for client changes
|
||||
if(!$client){ //GameMode changed by server, do not send for client changes
|
||||
$this->sendGamemode();
|
||||
}else{
|
||||
Command::broadcastCommandMessage($this, new TranslationContainer("commands.gamemode.success.self", [Gamemode::toTranslation($gm)]));
|
||||
Command::broadcastCommandMessage($this, new TranslationContainer("commands.gamemode.success.self", [GameMode::toTranslation($gm)]));
|
||||
}
|
||||
|
||||
$this->sendSettings();
|
||||
@ -1400,7 +1400,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
*/
|
||||
public function isSurvival(bool $literal = false) : bool{
|
||||
if($literal){
|
||||
return $this->gamemode === Gamemode::SURVIVAL;
|
||||
return $this->gamemode === GameMode::SURVIVAL;
|
||||
}else{
|
||||
return ($this->gamemode & 0x01) === 0;
|
||||
}
|
||||
@ -1416,7 +1416,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
*/
|
||||
public function isCreative(bool $literal = false) : bool{
|
||||
if($literal){
|
||||
return $this->gamemode === Gamemode::CREATIVE;
|
||||
return $this->gamemode === GameMode::CREATIVE;
|
||||
}else{
|
||||
return ($this->gamemode & 0x01) === 1;
|
||||
}
|
||||
@ -1432,7 +1432,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
*/
|
||||
public function isAdventure(bool $literal = false) : bool{
|
||||
if($literal){
|
||||
return $this->gamemode === Gamemode::ADVENTURE;
|
||||
return $this->gamemode === GameMode::ADVENTURE;
|
||||
}else{
|
||||
return ($this->gamemode & 0x02) > 0;
|
||||
}
|
||||
@ -1442,7 +1442,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @return bool
|
||||
*/
|
||||
public function isSpectator() : bool{
|
||||
return $this->gamemode === Gamemode::SPECTATOR;
|
||||
return $this->gamemode === GameMode::SPECTATOR;
|
||||
}
|
||||
|
||||
public function isFireProof() : bool{
|
||||
@ -1887,7 +1887,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->firstPlayed = $nbt->getLong("firstPlayed", $now = (int) (microtime(true) * 1000));
|
||||
$this->lastPlayed = $nbt->getLong("lastPlayed", $now);
|
||||
|
||||
$this->gamemode = $nbt->getInt("playerGameType", Gamemode::SURVIVAL) & 0x03;
|
||||
$this->gamemode = $nbt->getInt("playerGameType", GameMode::SURVIVAL) & 0x03;
|
||||
if($this->server->getForceGamemode()){
|
||||
$this->gamemode = $this->server->getGamemode();
|
||||
}
|
||||
|
@ -2167,7 +2167,7 @@ class Server{
|
||||
$this->dispatchSignals = true;
|
||||
}
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [Gamemode::toTranslation($this->getGamemode())]));
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [GameMode::toTranslation($this->getGamemode())]));
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\Gamemode;
|
||||
use pocketmine\GameMode;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use function count;
|
||||
|
||||
@ -49,11 +49,11 @@ class DefaultGamemodeCommand extends VanillaCommand{
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$gameMode = Gamemode::fromString($args[0]);
|
||||
$gameMode = GameMode::fromString($args[0]);
|
||||
|
||||
if($gameMode !== -1){
|
||||
$sender->getServer()->setConfigInt("gamemode", $gameMode);
|
||||
$sender->sendMessage(new TranslationContainer("commands.defaultgamemode.success", [Gamemode::toTranslation($gameMode)]));
|
||||
$sender->sendMessage(new TranslationContainer("commands.defaultgamemode.success", [GameMode::toTranslation($gameMode)]));
|
||||
}else{
|
||||
$sender->sendMessage("Unknown game mode");
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\command\defaults;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\Gamemode;
|
||||
use pocketmine\GameMode;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\utils\TextFormat;
|
||||
@ -52,7 +52,7 @@ class GamemodeCommand extends VanillaCommand{
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$gameMode = Gamemode::fromString($args[0]);
|
||||
$gameMode = GameMode::fromString($args[0]);
|
||||
|
||||
if($gameMode === -1){
|
||||
$sender->sendMessage("Unknown game mode");
|
||||
@ -77,10 +77,10 @@ class GamemodeCommand extends VanillaCommand{
|
||||
$sender->sendMessage("Game mode change for " . $target->getName() . " failed!");
|
||||
}else{
|
||||
if($target === $sender){
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.gamemode.success.self", [Gamemode::toTranslation($gameMode)]));
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.gamemode.success.self", [GameMode::toTranslation($gameMode)]));
|
||||
}else{
|
||||
$target->sendMessage(new TranslationContainer("gameMode.changed", [Gamemode::toTranslation($gameMode)]));
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.gamemode.success.other", [Gamemode::toTranslation($gameMode), $target->getName()]));
|
||||
$target->sendMessage(new TranslationContainer("gameMode.changed", [GameMode::toTranslation($gameMode)]));
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.gamemode.success.other", [GameMode::toTranslation($gameMode), $target->getName()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe;
|
||||
|
||||
use pocketmine\Gamemode;
|
||||
use pocketmine\GameMode;
|
||||
use pocketmine\network\AdvancedNetworkInterface;
|
||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||
use pocketmine\network\Network;
|
||||
@ -197,7 +197,7 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
|
||||
$info->getMaxPlayerCount(),
|
||||
$this->rakLib->getServerId(),
|
||||
$this->server->getName(),
|
||||
Gamemode::toString($this->server->getGamemode())
|
||||
GameMode::toString($this->server->getGamemode())
|
||||
]) . ";"
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user