world/server linux support

This commit is contained in:
NOTPIES committed 2026-03-15 22:21:24 -03:00
1 parent 6d6016a403
commit 9b34142250
823 files changed
+5141 -3263

No files matched your search

+71 -17
View File
@@ -11,23 +11,27 @@
#include "PendingConnection.h"
#include "PlayerConnection.h"
#include "EntityTracker.h"
#include "..\Minecraft.World\net.minecraft.world.level.storage.h"
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
#include "..\Minecraft.World\ArrayWithLength.h"
#include "..\Minecraft.World\net.minecraft.network.packet.h"
#include "..\Minecraft.World\net.minecraft.network.h"
#include "..\Minecraft.World\Pos.h"
#include "..\Minecraft.World\ProgressListener.h"
#include "..\Minecraft.World\HellRandomLevelSource.h"
#include "..\Minecraft.World\net.minecraft.world.phys.h"
#include "..\Minecraft.World\net.minecraft.world.item.h"
#include "..\Minecraft.World\net.minecraft.world.level.storage.h"
#include "..\Minecraft.World\net.minecraft.world.level.saveddata.h"
#include "..\Minecraft.World\JavaMath.h"
#include "../Minecraft.World/net.minecraft.world.level.storage.h"
#include "../Minecraft.World/net.minecraft.world.level.dimension.h"
#include "../Minecraft.World/ArrayWithLength.h"
#include "../Minecraft.World/net.minecraft.network.packet.h"
#include "../Minecraft.World/net.minecraft.network.h"
#include "../Minecraft.World/Pos.h"
#include "../Minecraft.World/ProgressListener.h"
#include "../Minecraft.World/HellRandomLevelSource.h"
#include "../Minecraft.World/net.minecraft.world.phys.h"
#include "../Minecraft.World/net.minecraft.world.item.h"
#include "../Minecraft.World/net.minecraft.world.level.storage.h"
#include "../Minecraft.World/net.minecraft.world.level.saveddata.h"
#include "../Minecraft.World/JavaMath.h"
#if defined(_XBOX) || defined(_WINDOWS64)
#include "Xbox\Network\NetworkPlayerXbox.h"
#include "Xbox/Network/NetworkPlayerXbox.h"
#elif defined(__PS3__) || defined(__ORBIS__)
#include "Common\Network\Sony\NetworkPlayerSony.h"
#include "Common/Network/Sony/NetworkPlayerSony.h"
#endif
#ifdef _DEDICATED_SERVER
#include "../Minecraft.Server/Core/ServerLists.h"
#include "../Minecraft.Server/Commands/ServerTextList.h"
#endif
// 4J - this class is fairly substantially altered as there didn't seem any point in porting code for banning, whitelisting, ops etc.
@@ -89,6 +93,12 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
player->enableAllPlayerPrivileges(true);
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST,1);
}
#ifdef _DEDICATED_SERVER
if(ServerLists_IsPlayerOp(player->name))
{
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_Op, 1);
}
#endif
#if defined(__PS3__) || defined(__ORBIS__)
// PS3 networking library doesn't automatically assign PlayerUIDs to the network players for anything remote, so need to tell it what to set from the data in this packet now
@@ -230,10 +240,22 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
playerConnection->send( shared_ptr<PlayerAbilitiesPacket>( new PlayerAbilitiesPacket(&player->abilities)) );
delete spawnPos;
#ifdef _DEDICATED_SERVER
{
extern bool g_voiceChatEnabled;
if (g_voiceChatEnabled)
{
byteArray vcData(1);
vcData.data[0] = 1;
playerConnection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(L"MC|VoiceCfg", vcData)));
}
}
#endif
sendLevelInfo(player, level);
// 4J-PB - removed, since it needs to be localised in the language the client is in
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"�e" + playerEntity->name + L" joined the game.") ) );
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"�e" + playerEntity->name + L" joined the game.") ) );
broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) );
#ifdef WITH_SERVER_CODE
@@ -397,7 +419,7 @@ void PlayerList::add(shared_ptr<ServerPlayer> player)
// Some code from here has been moved to the above validatePlayerSpawnPosition function
// 4J Stu - Swapped these lines about so that we get the chunk visiblity packet way ahead of all the add tracked entity packets
// Fix for #9169 - ART : Sign text is replaced with the words �Awaiting approval�.
// Fix for #9169 - ART : Sign text is replaced with the words �Awaiting approval�.
changeDimension(player, NULL);
level->addEntity(player);
@@ -1011,12 +1033,20 @@ wstring PlayerList::getPlayerNames()
bool PlayerList::isWhiteListed(const wstring& name)
{
#ifdef _DEDICATED_SERVER
return ServerLists_IsPlayerWhitelisted(name);
#else
return true;
#endif
}
bool PlayerList::isOp(const wstring& name)
{
#ifdef _DEDICATED_SERVER
return ServerLists_IsPlayerOp(name);
#else
return false;
#endif
}
bool PlayerList::isOp(shared_ptr<ServerPlayer> player)
@@ -1185,14 +1215,38 @@ void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMa
void PlayerList::whiteList(const wstring& playerName)
{
#ifdef _DEDICATED_SERVER
ServerTextList* wl = ServerLists_GetWhitelist();
if (wl)
{
std::wstring lower = playerName;
for (size_t i = 0; i < lower.size(); i++)
lower[i] = towlower(lower[i]);
wl->add(lower);
}
#endif
}
void PlayerList::blackList(const wstring& playerName)
{
#ifdef _DEDICATED_SERVER
ServerTextList* wl = ServerLists_GetWhitelist();
if (wl)
{
std::wstring lower = playerName;
for (size_t i = 0; i < lower.size(); i++)
lower[i] = towlower(lower[i]);
wl->remove(lower);
}
#endif
}
void PlayerList::reloadWhitelist()
{
#ifdef _DEDICATED_SERVER
ServerTextList* wl = ServerLists_GetWhitelist();
if (wl) wl->load();
#endif
}
void PlayerList::sendLevelInfo(shared_ptr<ServerPlayer> player, ServerLevel *level)