feat: add FourKit plugin host with dual server build

Adds the FourKit .NET 10 plugin host as a second dedicated server
build flavour alongside the existing vanilla server. Both flavours
build from the same source tree, with FourKit gated by the
MINECRAFT_SERVER_FOURKIT_BUILD preprocessor define.

Build layout:

  Minecraft.Server         vanilla, no plugin support, no .NET dep
  Minecraft.Server.FourKit FourKit-enabled, ships with bundled
                           .NET 10 self-contained runtime in runtime/
                           and an empty plugins/ folder

Both produce a Minecraft.Server.exe in their own per-target output
dir. The variant identity lives in the directory name, not the
binary name, so either flavour can be shipped as a drop-in.

Native bridge (Minecraft.Server/FourKit*.{cpp,h}):

* FourKitRuntime: hosts CoreCLR via hostfxr's command-line init API
  (the runtime-config API does not support self-contained components)
* FourKitBridge: ~50 Fire* event entry points, with inline no-op
  stubs for the standalone build so gameplay code can call them
  unconditionally
* FourKitNatives: ~80 native callbacks the managed side invokes
  for player/world/inventory mutations
* FourKitMappers: type and enum mapping helpers

Managed plugin host (Minecraft.Server.FourKit/):

* Bukkit-style API: Player, World, Block, Inventory, Command,
  Listener, EventHandler attribute, ~54 event classes
* PluginLoader with per-plugin AssemblyLoadContext
* FourKitHost as the [UnmanagedCallersOnly] entry point table
* Runtime resolves plugins relative to the host process so they
  always live next to Minecraft.Server.exe regardless of where the
  managed assembly itself is loaded from

Engine hooks (Minecraft.Client/, Minecraft.World/):

* Player lifecycle (PreLogin, Login, Join, Quit, Kick, Move,
  Teleport, Portal, Death) wired into PendingConnection and
  PlayerConnection without disturbing the cipher handshake or
  identity-token security flow
* Inventory open/click/drop hooks across every container menu type
* Block place/break/grow/burn/spread/from-to hooks across the
  full tile family
* Bed enter/leave, sign change, entity damage/death, ender pearl
  teleport hooks

Regression fixes preserved while applying donor diffs:

* ServerPlayer::die() retains the LCE-Revelations hardcore branch
  (setGameMode(ADVENTURE) + banPlayerForHardcoreDeath) in both the
  FourKit and non-FourKit code paths
* ServerLevel::entityAdded() retains the sub-entity ID reassignment
  loop required by the client's handleAddMob offset, fixing Ender
  Dragon and Wither boss multi-part hit detection
* LivingEntity::travel() retains the raw Player* cast and the
  cached frictionTile, both Revelations perf wins that the donor
  silently reverted
* ServerLogger.cpp keeps the file-logging code donor stripped
* PlayerList.cpp end portal transition fix and UIScene_EndPoem
  bounds-check are intact

Build system:

* Top-level CMakeLists.txt adds the Minecraft.Server.FourKit
  subdirectory and pulls in the new shared cmake/ServerTarget.cmake
  helper
* Minecraft.Server/cmake/sources/Common.cmake is now location
  independent (uses CMAKE_CURRENT_LIST_DIR) so the source list
  can be consumed from either server target's CMakeLists.txt
* The seven FourKit*.cpp/h files live in their own
  _MINECRAFT_SERVER_COMMON_SERVER_FOURKIT variable so the
  standalone target omits them
* configure-time .NET 10 SDK check fails fast with a clear
  download link if the SDK is missing
* global.json pins the SDK to 10.0.100 with latestFeature
  rollforward

Sample plugin (samples/HelloPlugin/) demonstrates the loader and
the PlayerJoinEvent listener pattern.

CI:

* nightly.yml builds both server flavours, ships
  LCE-Revelations-Server-Win64.zip and
  LCE-Revelations-Server-Win64-FourKit.zip, attests both, and
  updates release notes for the dual-flavour layout
* pull-request.yml pulls in actions/setup-dotnet so the FourKit
  publish step works in PR validation
* All zip artifacts and the client zip are renamed from
  LCREWindows64 to LCE-Revelations-{Client,Server}-Win64

Documentation:

* COMPILE.md gets a VS 2022 quick start, .NET 10 prereq section,
  server flavours explanation, and a troubleshooting section
* docs/FOURKIT_PORT_RECON.md captures the file-by-file recon that
  drove the port
* docs/FOURKIT_PARITY.md is the canonical reference for which
  events FourKit fires

Docker:

* docker-compose.dedicated-server.yml MC_RUNTIME_DIR default points
  at the vanilla CMake output. The FourKit Docker image is
  intentionally NOT shipped yet because hosting .NET 10 self
  contained inside Wine has not been smoke-tested
This commit is contained in:
itsRevela
2026-04-08 03:02:48 -05:00
parent 5d56f5080f
commit 42a582fb9f
197 changed files with 20946 additions and 788 deletions
+162
View File
@@ -19,6 +19,8 @@
#include "..\Minecraft.Server\Access\Access.h"
#include "..\Minecraft.Server\Security\SecurityConfig.h"
#include "..\Minecraft.World\Socket.h"
#include <FourKitBridge.h>
#include <Windows64/Network/WinsockNetLayer.h>
#endif
// #ifdef __PS3__
// #include "PS3\Network\NetworkPlayerSony.h"
@@ -112,6 +114,54 @@ void PendingConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
}
return;
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
std::string connectionIp = "";
int connectionPort = 0;
if (connection && connection->getSocket()) {
unsigned char smallId = connection->getSocket()->getSmallId();
if (smallId != 0) {
if (!ServerRuntime::ServerLogManager::TryGetConnectionRemoteIp(smallId, &connectionIp))
{
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
{
char ipBuf[64] = {};
if (inet_ntop(AF_INET, &addr.sin_addr, ipBuf, sizeof(ipBuf)))
{
connectionIp = ipBuf;
connectionPort = (int)ntohs(addr.sin_port);
}
}
}
} else {
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
connectionPort = (int)ntohs(addr.sin_port);
}
}
if (!connectionIp.empty()) {
if (FourKitBridge::FirePlayerPreLogin(packet->loginKey, connectionIp, connectionPort)) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
}
}
}
}
#endif
// printf("Server: handlePreLogin\n");
name = packet->loginKey; // 4J Stu - Change from the login packet as we know better on client end during the pre-login packet
sendPreLoginResponse();
@@ -201,6 +251,62 @@ void PendingConnection::handleLogin(shared_ptr<LoginPacket> packet)
//if (true)// 4J removed !server->onlineMode)
bool sentDisconnect = false;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
std::string connectionIp = "";
int connectionPort = 0;
if (!connection || !connection->getSocket()) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
unsigned char smallId = connection->getSocket()->getSmallId();
if (smallId == 0) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
if (!ServerRuntime::ServerLogManager::TryGetConnectionRemoteIp(smallId, &connectionIp))
{
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
{
char ipBuf[64] = {};
if (inet_ntop(AF_INET, &addr.sin_addr, ipBuf, sizeof(ipBuf)))
{
connectionIp = ipBuf;
connectionPort = (int)ntohs(addr.sin_port);
}
}
}
if (connectionIp.empty()) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
}
else {
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
connectionPort = (int)ntohs(addr.sin_port);
}
}
if (FourKitBridge::FirePlayerLogin(packet->userName, connectionIp, connectionPort, 1, &packet->m_onlineXuid, &packet->m_offlineXuid)) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
}
#endif
// Use the same Xuid choice as handleAcceptedLogin (offline first, online fallback).
//
PlayerUID loginXuid = packet->m_offlineXuid;
@@ -395,6 +501,62 @@ void PendingConnection::handleAcceptedLogin(shared_ptr<LoginPacket> packet)
return;
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
std::string connectionIp = "";
int connectionPort = 0;
if (!connection || !connection->getSocket()) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
unsigned char smallId = connection->getSocket()->getSmallId();
if (smallId == 0) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
if (!ServerRuntime::ServerLogManager::TryGetConnectionRemoteIp(smallId, &connectionIp))
{
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
{
char ipBuf[64] = {};
if (inet_ntop(AF_INET, &addr.sin_addr, ipBuf, sizeof(ipBuf)))
{
connectionIp = ipBuf;
connectionPort = (int)ntohs(addr.sin_port);
}
}
}
if (connectionIp.empty()) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
}
else {
SOCKET sock = WinsockNetLayer::GetSocketForSmallId(smallId);
if (sock != INVALID_SOCKET)
{
sockaddr_in addr;
int addrLen = sizeof(addr);
if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0)
connectionPort = (int)ntohs(addr.sin_port);
}
}
if (FourKitBridge::FirePlayerLogin(packet->userName, connectionIp, connectionPort, 2, &packet->m_onlineXuid, &packet->m_offlineXuid)) {
disconnect(DisconnectPacket::eDisconnect_EndOfStream);
return;
}
}
#endif
// Guests use the online xuid, everyone else uses the offline one
PlayerUID playerXuid = packet->m_offlineXuid;
if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid;
+361 -14
View File
@@ -41,6 +41,7 @@
#include "..\Minecraft.Server\Security\IdentityTokenManager.h"
#include "..\Minecraft.Server\Security\SecurityConfig.h"
#include "..\Minecraft.Server\Security\ConnectionCipher.h"
#include "..\Minecraft.Server\FourKitBridge.h"
extern bool g_Win64DedicatedServer;
#endif
@@ -68,6 +69,7 @@ PlayerConnection::PlayerConnection(MinecraftServer *server, Connection *connecti
aboveGroundTickCount = 0;
xLastOk = yLastOk = zLastOk = 0;
synched = true;
hasDoneFirstTickFourKit = false;
didTick = false;
lastKeepAliveId = 0;
lastKeepAliveTime = 0;
@@ -122,6 +124,14 @@ unsigned char PlayerConnection::getLogSmallId()
void PlayerConnection::tick()
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (!hasDoneFirstTickFourKit)
{
FourKitBridge::FirePlayerJoin(player->entityId, player->name, player->getUUID(), (unsigned long long)player->getOnlineXuid(), (unsigned long long)player->getXuid());
hasDoneFirstTickFourKit = true;
}
#endif
if( done ) return;
if( m_bCloseOnTick )
@@ -170,12 +180,27 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
return;
}
std::wstring kickLeaveMessage;
bool fourKitHandledQuit = false;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (reason != DisconnectPacket::eDisconnect_Closed &&
reason != DisconnectPacket::eDisconnect_ConnectionCreationFailed &&
reason != DisconnectPacket::eDisconnect_Quitting)
{
if (FourKitBridge::FirePlayerKick(player->entityId, (int)reason, kickLeaveMessage))
{
m_bWasKicked.store(false);
LeaveCriticalSection(&done_cs);
return;
}
}
ServerRuntime::ServerLogManager::OnPlayerDisconnected(
getLogSmallId(),
(player != NULL) ? player->name : std::wstring(),
reason,
true);
fourKitHandledQuit = FourKitBridge::FirePlayerQuit(player->entityId);
#endif
app.DebugPrintf("PlayerConnection disconect reason: %d\n", reason );
player->disconnect();
@@ -186,13 +211,20 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
connection->sendAndQuit();
// 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" + player->name + L" left the game.") ) );
if(getWasKicked())
if (!kickLeaveMessage.empty())
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(kickLeaveMessage));
}
else
else if (!fourKitHandledQuit)
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
if(getWasKicked())
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
}
else
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
}
}
server->getPlayers()->remove(player);
@@ -281,6 +313,8 @@ void PlayerConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
float yRotT = player->yRot;
float xRotT = player->xRot;
const float yRotOld = yRotT;
const float xRotOld = xRotT;
if (packet->hasPos && packet->y == -999 && packet->yView == -999)
{
@@ -344,6 +378,31 @@ void PlayerConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
return;
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (xLastOk != xt || yLastOk != yt || zLastOk != zt || yRotT != yRotOld || xRotT != xRotOld)
{
double moveToX, moveToY, moveToZ;
bool cancelled = FourKitBridge::FirePlayerMove(player->entityId,
xLastOk, yLastOk, zLastOk,
xt, yt, zt,
&moveToX, &moveToY, &moveToZ);
if (cancelled)
{
teleport(xLastOk, yLastOk, zLastOk, yRotT, xRotT);
return;
}
if (moveToX != xt || moveToY != yt || moveToZ != zt)
{
xt = moveToX;
yt = moveToY;
zt = moveToZ;
xDist = xt - player->x;
yDist = yt - player->y;
zDist = zt - player->z;
}
}
#endif
float r = 1 / 16.0f;
bool oldOk = level->getCubes(player, player->bb->copy()->shrink(r, r, r))->empty();
@@ -450,11 +509,55 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
if (packet->action == PlayerActionPacket::DROP_ITEM)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
shared_ptr<ItemInstance> selected = player->inventory->getSelected();
if (selected != nullptr && selected->count > 0)
{
int outId = selected->id, outCount = 1, outAux = selected->getAuxValue();
bool cancelled = FourKitBridge::FirePlayerDropItem(
player->entityId, selected->id, 1, selected->getAuxValue(),
&outId, &outCount, &outAux);
if (cancelled)
return;
player->inventory->removeItem(player->inventory->selected, 1);
shared_ptr<ItemInstance> dropItem = (outId == selected->id)
? selected->copy()
: std::make_shared<ItemInstance>(outId, outCount, outAux);
dropItem->count = outCount;
if (outAux != selected->getAuxValue()) dropItem->setAuxValue(outAux);
player->drop(dropItem);
return;
}
}
#endif
player->drop(false);
return;
}
else if (packet->action == PlayerActionPacket::DROP_ALL_ITEMS)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
shared_ptr<ItemInstance> selected = player->inventory->getSelected();
if (selected != nullptr && selected->count > 0)
{
int outId = selected->id, outCount = selected->count, outAux = selected->getAuxValue();
bool cancelled = FourKitBridge::FirePlayerDropItem(
player->entityId, selected->id, selected->count, selected->getAuxValue(),
&outId, &outCount, &outAux);
if (cancelled)
return;
player->inventory->removeItem(player->inventory->selected, selected->count);
shared_ptr<ItemInstance> dropItem = (outId == selected->id)
? selected->copy()
: std::make_shared<ItemInstance>(outId, outCount, outAux);
dropItem->count = outCount;
if (outAux != selected->getAuxValue()) dropItem->setAuxValue(outAux);
player->drop(dropItem);
return;
}
}
#endif
player->drop(true);
return;
}
@@ -492,6 +595,23 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
lastLeftClickTick = tickCount;
{
shared_ptr<ItemInstance> heldItem = player->inventory->getSelected();
int iId = heldItem ? heldItem->id : 0;
int iCount = heldItem ? heldItem->count : 0;
int iAux = heldItem ? heldItem->getAuxValue() : 0;
int useItemInHand = 1;
bool cancelled = FourKitBridge::FirePlayerInteract(
player->entityId, 1 /* LEFT_CLICK_BLOCK */,
iId, iCount, iAux,
x, y, z, packet->face, player->dimension,
&useItemInHand);
if (cancelled)
return;
}
#endif
// Anti-cheat: validate spawn protection on the server for mining start.
if (!server->isUnderSpawnProtection(level, x, y, z, player)) player->gameMode->startDestroyBlock(x, y, z, packet->face);
else player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
@@ -499,9 +619,9 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
}
else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK)
{
bool destroyed = player->gameMode->stopDestroyBlock(x, y, z);
player->gameMode->stopDestroyBlock(x, y, z);
server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates
if (!destroyed && level->getTile(x, y, z) != 0) player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
if (level->getTile(x, y, z) != 0) player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
}
else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK)
{
@@ -524,19 +644,128 @@ void PlayerConnection::handleUseItem(shared_ptr<UseItemPacket> packet)
if (packet->getFace() == 255)
{
if (item == nullptr) return;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
int iId = item->id;
int iCount = item->count;
int iAux = item->getAuxValue();
int useItemInHand = 1;
bool cancelled = FourKitBridge::FirePlayerInteract(
player->entityId, 2,
iId, iCount, iAux,
0, 0, 0, 6, player->dimension,
&useItemInHand);
if (cancelled || !useItemInHand)
return;
}
#endif
player->gameMode->useItem(player, level, item);
}
else if ((packet->getY() < server->getMaxBuildHeight() - 1) || (packet->getFace() != Facing::UP && packet->getY() < server->getMaxBuildHeight()))
{
if (synched && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) < 8 * 8)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
int iId = item ? item->id : 0;
int iCount = item ? item->count : 0;
int iAux = item ? item->getAuxValue() : 0;
int useItemInHand = 1;
bool cancelled = FourKitBridge::FirePlayerInteract(
player->entityId, 3 /* RIGHT_CLICK_BLOCK */,
iId, iCount, iAux,
x, y, z, face, player->dimension,
&useItemInHand);
if (cancelled || !useItemInHand)
{
informClient = true;
goto skipUseItemOn;
}
}
#endif
// Anti-cheat: block placement/use must pass server-side spawn protection.
if (!server->isUnderSpawnProtection(level, x, y, z, player))
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int placeX = x, placeY = y, placeZ = z;
bool validFace = true;
if (face == 0) placeY--;
else if (face == 1) placeY++;
else if (face == 2) placeZ--;
else if (face == 3) placeZ++;
else if (face == 4) placeX--;
else if (face == 5) placeX++;
else validFace = false;
int oldTileId = validFace ? level->getTile(placeX, placeY, placeZ) : 0;
int oldTileData = validFace ? level->getData(placeX, placeY, placeZ) : 0;
int oldClickedId = level->getTile(x, y, z);
int oldClickedData = level->getData(x, y, z);
int savedItemId = item ? item->id : 0;
int savedItemCount = item ? item->count : 0;
#endif
player->gameMode->useItemOn(player, level, item, x, y, z, face, packet->getClickX(), packet->getClickY(), packet->getClickZ());
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (validFace)
{
int newTileId = level->getTile(placeX, placeY, placeZ);
int newClickedId = level->getTile(x, y, z);
int fireX = placeX, fireY = placeY, fireZ = placeZ;
int againstX = x, againstY = y, againstZ = z;
int revertId = oldTileId, revertData = oldTileData;
bool shouldFire = false;
if (newTileId != 0 && newTileId != oldTileId)
{
shouldFire = true;
}
else if (newClickedId != 0 && newClickedId != oldClickedId)
{
shouldFire = true;
fireX = x; fireY = y; fireZ = z;
revertId = oldClickedId; revertData = oldClickedData;
againstX = x; againstY = y; againstZ = z;
if (face == 0) againstY++;
else if (face == 1) againstY--;
else if (face == 2) againstZ++;
else if (face == 3) againstZ--;
else if (face == 4) againstX++;
else if (face == 5) againstX--;
}
if (shouldFire)
{
bool cancelled = FourKitBridge::FireBlockPlace(
player->entityId, player->dimension,
fireX, fireY, fireZ,
againstX, againstY, againstZ,
savedItemId, savedItemCount, true);
if (cancelled)
{
level->setTileAndData(fireX, fireY, fireZ, revertId, revertData, Tile::UPDATE_ALL);
auto &slot = player->inventory->items[player->inventory->selected];
if (slot != nullptr)
{
slot->count = savedItemCount;
}
else if (savedItemId > 0 && savedItemId < 256 && Tile::tiles[savedItemId] != nullptr && savedItemCount > 0)
{
slot = std::make_shared<ItemInstance>(Tile::tiles[savedItemId], savedItemCount);
}
informClient = true;
}
}
}
#endif
}
}
skipUseItemOn:
informClient = true;
}
else
@@ -605,23 +834,28 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
LeaveCriticalSection(&done_cs);
return;
}
bool fourKitHandledQuit = false;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
ServerRuntime::ServerLogManager::OnPlayerDisconnected(
getLogSmallId(),
(player != NULL) ? player->name : std::wstring(),
reason,
false);
fourKitHandledQuit = FourKitBridge::FirePlayerQuit(player->entityId);
#endif
// logger.info(player.name + " lost connection: " + reason);
// 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" + player->name + L" left the game.") ) );
if(getWasKicked())
if (!fourKitHandledQuit)
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
}
else
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
if(getWasKicked())
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
}
else
{
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
}
}
server->getPlayers()->remove(player);
done = true;
@@ -744,8 +978,20 @@ void PlayerConnection::handleChat(shared_ptr<ChatPacket> packet)
handleCommand(message);
return;
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
std::wstring formatted;
if (!FourKitBridge::FirePlayerChat(player->entityId, message, formatted))
{
if (formatted.empty())
formatted = L"<" + player->name + L"> " + message;
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(formatted));
}
}
#else
wstring formatted = L"<" + player->name + L"> " + message;
server->getPlayers()->broadcastAll(shared_ptr<ChatPacket>(new ChatPacket(formatted)));
#endif
chatSpamTickCount += SharedConstants::TICKS_PER_SECOND;
if (chatSpamTickCount > SharedConstants::TICKS_PER_SECOND * 10)
{
@@ -755,6 +1001,13 @@ void PlayerConnection::handleChat(shared_ptr<ChatPacket> packet)
void PlayerConnection::handleCommand(const wstring& message)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
std::wstring commandLine = message;
if (FourKitBridge::FireCommandPreprocess(player->entityId, commandLine, commandLine))
return;
if (FourKitBridge::HandlePlayerCommand(player->entityId, commandLine))
return;
#endif
// 4J - TODO
#if 0
server.getCommandDispatcher().performCommand(player, message);
@@ -766,6 +1019,23 @@ void PlayerConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
player->resetLastActionTime();
if (packet->action == AnimatePacket::SWING)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (lastLeftClickTick != tickCount)
{
int useItemInHand = 1;
auto item = player->inventory->getSelected();
int iId = item ? item->id : 0;
int iCount = item ? item->count : 0;
int iAux = item ? item->getAuxValue() : 0;
bool cancelled = FourKitBridge::FirePlayerInteract(
player->entityId, 0,
iId, iCount, iAux,
0, 0, 0, 6, player->dimension,
&useItemInHand);
if (cancelled)
return;
}
#endif
player->swing();
}
}
@@ -876,10 +1146,31 @@ void PlayerConnection::handleInteract(shared_ptr<InteractPacket> packet)
if (packet->action == InteractPacket::INTERACT)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
int mappedType = FourKitBridge::MapEntityType((int)target->GetType());
float targetHealth = 0, targetMaxHealth = 0, targetEyeHeight = 0;
auto living = dynamic_pointer_cast<LivingEntity>(target);
if (living)
{
targetHealth = living->getHealth();
targetMaxHealth = living->getMaxHealth();
targetEyeHeight = living->getHeadHeight();
}
if (FourKitBridge::FirePlayerInteractEntity(
player->entityId, target->entityId, mappedType,
player->dimension, target->x, target->y, target->z,
targetHealth, targetMaxHealth, targetEyeHeight))
return;
}
#endif
player->interact(target);
}
else if (packet->action == InteractPacket::ATTACK)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
lastLeftClickTick = tickCount;
#endif
if ((target->GetType() == eTYPE_ITEMENTITY) || (target->GetType() == eTYPE_EXPERIENCEORB) || (target->GetType() == eTYPE_ARROW) || target == player)
{
return;
@@ -1247,7 +1538,13 @@ void PlayerConnection::handleClientCommand(shared_ptr<ClientCommandPacket> packe
{
if (player->wonGame)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int oldEntityId = player->entityId;
#endif
player = server->getPlayers()->respawn(player, player->m_enteredEndExitPortal?0:player->dimension, true);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
FourKitBridge::UpdatePlayerEntityId(oldEntityId, player->entityId);
#endif
}
else if (player->level->getLevelData()->isHardcore())
{
@@ -1258,7 +1555,13 @@ void PlayerConnection::handleClientCommand(shared_ptr<ClientCommandPacket> packe
else
{
if (player->getHealth() > 0) return;
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int oldEntityId = player->entityId;
#endif
player = server->getPlayers()->respawn(player, 0, false);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
FourKitBridge::UpdatePlayerEntityId(oldEntityId, player->entityId);
#endif
}
}
}
@@ -1318,6 +1621,20 @@ void PlayerConnection::handleContainerClick(shared_ptr<ContainerClickPacket> pac
player->resetLastActionTime();
if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player))
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int fourKitClickResult = FourKitBridge::FireInventoryClick(player->entityId, packet->slotNum, packet->buttonNum, packet->clickType);
if (fourKitClickResult == 1)
{
expectedAcks[player->containerMenu->containerId] = packet->uid;
player->connection->send(std::make_shared<ContainerAckPacket>(packet->containerId, packet->uid, false));
player->containerMenu->setSynched(player, false);
vector<shared_ptr<ItemInstance>> items;
for (unsigned int i = 0; i < player->containerMenu->slots.size(); i++)
items.push_back(player->containerMenu->slots.at(i)->getItem());
player->refreshContainer(player->containerMenu, &items);
return;
}
#endif
shared_ptr<ItemInstance> clicked = player->containerMenu->clicked(packet->slotNum, packet->buttonNum, packet->clickType, player);
if (ItemInstance::matches(packet->item, clicked))
@@ -1345,6 +1662,15 @@ void PlayerConnection::handleContainerClick(shared_ptr<ContainerClickPacket> pac
// player.containerMenu.broadcastChanges();
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (fourKitClickResult == 2)
{
vector<shared_ptr<ItemInstance>> refreshItems;
for (unsigned int i = 0; i < player->containerMenu->slots.size(); i++)
refreshItems.push_back(player->containerMenu->slots.at(i)->getItem());
player->refreshContainer(player->containerMenu, &refreshItems);
}
#endif
}
}
@@ -1482,10 +1808,31 @@ void PlayerConnection::handleSignUpdate(shared_ptr<SignUpdatePacket> packet)
int y = packet->y;
int z = packet->z;
shared_ptr<SignTileEntity> ste = dynamic_pointer_cast<SignTileEntity>(te);
wstring lines[4];
for (int i = 0; i < 4; i++)
{
wstring lineText = packet->lines[i].substr(0,15);
ste->SetMessage( i, lineText );
lines[i] = packet->lines[i].substr(0,15);
}
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
std::wstring outLines[4];
bool cancelled = FourKitBridge::FireSignChange(
player->entityId, player->dimension,
x, y, z,
lines[0], lines[1], lines[2], lines[3],
outLines);
if (cancelled)
return;
for (int i = 0; i < 4; i++)
lines[i] = outLines[i];
}
#endif
for (int i = 0; i < 4; i++)
{
ste->SetMessage( i, lines[i] );
}
ste->SetVerified(false);
ste->setChanged();
+2
View File
@@ -30,6 +30,8 @@ private:
int aboveGroundTickCount;
bool didTick;
bool hasDoneFirstTickFourKit;
int lastLeftClickTick = 0;
int lastKeepAliveId;
int64_t lastKeepAliveTime;
static Random random;
+22 -9
View File
@@ -39,6 +39,9 @@
#include "..\Minecraft.World\ProgressListener.h"
#include "PS3\PS3Extras\ShutdownManager.h"
#include "PlayerChunkMap.h"
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#include "..\Minecraft.Server\FourKitBridge.h"
#endif
WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS;
@@ -324,6 +327,8 @@ void ServerLevel::updateSleepingPlayerList()
for (auto& player : players)
{
if (player->fk_sleepingIgnored)
continue;
if (!player->isSleeping())
{
allPlayersSleeping = false;
@@ -368,6 +373,8 @@ bool ServerLevel::allPlayersAreSleeping()
// all players are sleeping, but have they slept long enough?
for (auto& player : players)
{
if (player->fk_sleepingIgnored)
continue;
// System.out.println(player->entityId + ": " + player->getSleepTimer());
if (!player->isSleepingLongEnough())
{
@@ -507,15 +514,21 @@ void ServerLevel::tickTiles()
int val = (randValue >> 2);
int x = (val & 15);
int z = ((val >> 8) & 15);
int yy = getTopRainBlock(x + xo, z + zo);
if (shouldFreeze(x + xo, yy - 1, z + zo))
{
setTileAndUpdate(x + xo, yy - 1, z + zo, Tile::ice_Id);
}
if (isRaining() && shouldSnow(x + xo, yy, z + zo))
{
setTileAndUpdate(x + xo, yy, z + zo, Tile::topSnow_Id);
}
int yy = getTopRainBlock(x + xo, z + zo);
if (shouldFreeze(x + xo, yy - 1, z + zo))
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (!FourKitBridge::FireBlockForm(dimension->id, x + xo, yy - 1, z + zo, Tile::ice_Id, 0))
#endif
setTileAndUpdate(x + xo, yy - 1, z + zo, Tile::ice_Id);
}
if (isRaining() && shouldSnow(x + xo, yy, z + zo))
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (!FourKitBridge::FireBlockForm(dimension->id, x + xo, yy, z + zo, Tile::topSnow_Id, 0))
#endif
setTileAndUpdate(x + xo, yy, z + zo, Tile::topSnow_Id);
}
if (isRaining())
{
Biome *b = getBiome(x + xo, z + zo);
+388 -16
View File
@@ -33,6 +33,154 @@
#include "..\Minecraft.World\LevelChunk.h"
#include "LevelRenderer.h"
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#include "..\Minecraft.Server\FourKitBridge.h"
#include "..\Minecraft.World\ChatPacket.h"
static std::wstring FormatDeathMessage(const shared_ptr<ChatPacket>& packet)
{
if (!packet) return L"";
std::wstring message;
bool replacePlayer = false;
bool replaceEntitySource = false;
bool replaceItem = false;
// coug chough
// de hättn echt an gscheidern string konverter für de todesmeldungen macha soin
// a globaler helfer waar wahrscheinlich ganz bärig gwen
// waaaah
switch (packet->m_messageType)
{
case ChatPacket::e_ChatCustom:
return packet->m_stringArgs.size() > 0 ? packet->m_stringArgs[0] : L"";
case ChatPacket::e_ChatDeathInFire:
message = app.GetString(IDS_DEATH_INFIRE); replacePlayer = true; break;
case ChatPacket::e_ChatDeathOnFire:
message = app.GetString(IDS_DEATH_ONFIRE); replacePlayer = true; break;
case ChatPacket::e_ChatDeathLava:
message = app.GetString(IDS_DEATH_LAVA); replacePlayer = true; break;
case ChatPacket::e_ChatDeathInWall:
message = app.GetString(IDS_DEATH_INWALL); replacePlayer = true; break;
case ChatPacket::e_ChatDeathDrown:
message = app.GetString(IDS_DEATH_DROWN); replacePlayer = true; break;
case ChatPacket::e_ChatDeathStarve:
message = app.GetString(IDS_DEATH_STARVE); replacePlayer = true; break;
case ChatPacket::e_ChatDeathCactus:
message = app.GetString(IDS_DEATH_CACTUS); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFall:
message = app.GetString(IDS_DEATH_FALL); replacePlayer = true; break;
case ChatPacket::e_ChatDeathOutOfWorld:
message = app.GetString(IDS_DEATH_OUTOFWORLD); replacePlayer = true; break;
case ChatPacket::e_ChatDeathGeneric:
message = app.GetString(IDS_DEATH_GENERIC); replacePlayer = true; break;
case ChatPacket::e_ChatDeathExplosion:
message = app.GetString(IDS_DEATH_EXPLOSION); replacePlayer = true; break;
case ChatPacket::e_ChatDeathMagic:
message = app.GetString(IDS_DEATH_MAGIC); replacePlayer = true; break;
case ChatPacket::e_ChatDeathWither:
message = app.GetString(IDS_DEATH_WITHER); replacePlayer = true; break;
case ChatPacket::e_ChatDeathDragonBreath:
message = app.GetString(IDS_DEATH_DRAGON_BREATH); replacePlayer = true; break;
case ChatPacket::e_ChatDeathAnvil:
message = app.GetString(IDS_DEATH_FALLING_ANVIL); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFallingBlock:
message = app.GetString(IDS_DEATH_FALLING_TILE); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFellAccidentLadder:
message = app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFellAccidentVines:
message = app.GetString(IDS_DEATH_FELL_ACCIDENT_VINES); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFellAccidentWater:
message = app.GetString(IDS_DEATH_FELL_ACCIDENT_WATER); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFellAccidentGeneric:
message = app.GetString(IDS_DEATH_FELL_ACCIDENT_GENERIC); replacePlayer = true; break;
case ChatPacket::e_ChatDeathFellKiller:
message = app.GetString(IDS_DEATH_FALL); replacePlayer = true; break;
case ChatPacket::e_ChatDeathMob:
message = app.GetString(IDS_DEATH_MOB); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathPlayer:
message = app.GetString(IDS_DEATH_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathArrow:
message = app.GetString(IDS_DEATH_ARROW); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathFireball:
message = app.GetString(IDS_DEATH_FIREBALL); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathThrown:
message = app.GetString(IDS_DEATH_THROWN); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathIndirectMagic:
message = app.GetString(IDS_DEATH_INDIRECT_MAGIC); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathThorns:
message = app.GetString(IDS_DEATH_THORNS); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathExplosionPlayer:
message = app.GetString(IDS_DEATH_EXPLOSION_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathInFirePlayer:
message = app.GetString(IDS_DEATH_INFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathOnFirePlayer:
message = app.GetString(IDS_DEATH_ONFIRE_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathLavaPlayer:
message = app.GetString(IDS_DEATH_LAVA_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathDrownPlayer:
message = app.GetString(IDS_DEATH_DROWN_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathCactusPlayer:
message = app.GetString(IDS_DEATH_CACTUS_PLAYER); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathFellAssist:
message = app.GetString(IDS_DEATH_FELL_ASSIST); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathFellFinish:
message = app.GetString(IDS_DEATH_FELL_FINISH); replacePlayer = true; replaceEntitySource = true; break;
case ChatPacket::e_ChatDeathPlayerItem:
message = app.GetString(IDS_DEATH_PLAYER_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathArrowItem:
message = app.GetString(IDS_DEATH_ARROW_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathFireballItem:
message = app.GetString(IDS_DEATH_FIREBALL_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathThrownItem:
message = app.GetString(IDS_DEATH_THROWN_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathIndirectMagicItem:
message = app.GetString(IDS_DEATH_INDIRECT_MAGIC_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathFellAssistItem:
message = app.GetString(IDS_DEATH_FELL_ASSIST_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
case ChatPacket::e_ChatDeathFellFinishItem:
message = app.GetString(IDS_DEATH_FELL_FINISH_ITEM); replacePlayer = true; replaceEntitySource = true; replaceItem = true; break;
default:
message = app.GetString(IDS_DEATH_GENERIC); replacePlayer = true; break;
}
if (replacePlayer)
{
std::wstring playerName = packet->m_stringArgs.size() > 0 ? packet->m_stringArgs[0] : L"";
message = replaceAll(message, L"{*PLAYER*}", playerName);
}
if (replaceEntitySource)
{
std::wstring sourceName;
if (!packet->m_intArgs.empty() && packet->m_intArgs[0] == eTYPE_SERVERPLAYER)
{
sourceName = packet->m_stringArgs.size() > 1 ? packet->m_stringArgs[1] : L"";
}
else
{
if (packet->m_stringArgs.size() > 1 && !packet->m_stringArgs[1].empty())
{
sourceName = packet->m_stringArgs[1];
}
else if (!packet->m_intArgs.empty())
{
sourceName = app.getEntityName((eINSTANCEOF)packet->m_intArgs[0]);
}
}
message = replaceAll(message, L"{*SOURCE*}", sourceName);
}
if (replaceItem)
{
std::wstring itemName = packet->m_stringArgs.size() > 2 ? packet->m_stringArgs[2] : L"";
message = replaceAll(message, L"{*ITEM*}", itemName);
}
return message;
}
#endif
ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring& name, ServerPlayerGameMode *gameMode) : Player(level, name)
{
@@ -567,6 +715,45 @@ shared_ptr<ItemInstance> ServerPlayer::getCarried(int slot)
void ServerPlayer::die(DamageSource *source)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
shared_ptr<ChatPacket> deathPacket = getCombatTracker()->getDeathMessagePacket();
std::wstring deathMsg = FormatDeathMessage(deathPacket);
int exp = getExperienceReward(nullptr);
std::wstring outDeathMsg;
int keepInventory = 0;
int outNewExp = 0, outNewLevel = 0, outKeepLevel = 0;
int outExp = FourKitBridge::FirePlayerDeath(entityId, deathMsg, exp, outDeathMsg, &keepInventory,
&outNewExp, &outNewLevel, &outKeepLevel);
fk_hasDeathState = true;
fk_deathKeepInventory = (keepInventory != 0);
fk_deathKeepLevel = (outKeepLevel != 0);
fk_deathNewExp = outNewExp;
fk_deathNewLevel = outNewLevel;
if (!outDeathMsg.empty())
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(outDeathMsg));
// LCE-Revelations: Hardcore mode enforcement. Donor's FourKit-aware die()
// rewrite dropped this branch; we restore it AFTER FirePlayerDeath so
// plugins still see the death event before the player is banned and
// switched to Adventure mode.
if (level->getLevelData()->isHardcore())
{
setGameMode(GameType::ADVENTURE);
// Ban this player's XUID and queue disconnect.
// The force-save is triggered inside banPlayerForHardcoreDeath after
// the disconnect is queued, so the client doesn't get stuck on a save
// screen.
server->getPlayers()->banPlayerForHardcoreDeath(this);
}
if (keepInventory == 0 && !level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY))
{
inventory->dropAll();
}
#else
server->getPlayers()->broadcastAll(getCombatTracker()->getDeathMessagePacket());
// 4J Added: Hardcore mode — switch to Adventure mode on death (can look but not break/place blocks)
@@ -584,6 +771,7 @@ void ServerPlayer::die(DamageSource *source)
{
inventory->dropAll();
}
#endif
vector<Objective *> *objectives = level->getScoreboard()->findObjectiveFor(ObjectiveCriteria::DEATH_COUNT);
if(objectives)
@@ -776,6 +964,10 @@ void ServerPlayer::changeDimension(int i)
}
else
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
bool portalDestModified = false;
double portalOutX = 0, portalOutY = 0, portalOutZ = 0;
#endif
if (dimension == 0 && i == 1)
{
awardStat(GenericStats::theEnd(), GenericStats::param_theEnd());
@@ -783,7 +975,24 @@ void ServerPlayer::changeDimension(int i)
Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn();
if (pos != nullptr)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
double outX, outY, outZ;
bool cancelled = FourKitBridge::FirePlayerPortal(entityId,
x, y, z, dimension,
pos->x, pos->y, pos->z, i,
4,
&outX, &outY, &outZ);
if (cancelled)
{
delete pos;
return;
}
connection->teleport(outX, outY, outZ, 0, 0);
}
#else
connection->teleport(pos->x, pos->y, pos->z, 0, 0);
#endif
delete pos;
}
@@ -791,10 +1000,48 @@ void ServerPlayer::changeDimension(int i)
}
else
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
double scale = server->getLevel(i)->getLevelData()->getHellScale();
double toX = x, toY = y, toZ = z;
if (i == -1)
{
toX = x / scale;
toZ = z / scale;
}
else if (dimension == -1 && i == 0)
{
toX = x * scale;
toZ = z * scale;
}
double outX, outY, outZ;
bool cancelled = FourKitBridge::FirePlayerPortal(entityId,
x, y, z, dimension,
toX, toY, toZ, i,
3,
&outX, &outY, &outZ);
if (cancelled)
return;
if (outX != toX || outY != toY || outZ != toZ)
{
portalDestModified = true;
portalOutX = outX;
portalOutY = outY;
portalOutZ = outZ;
}
}
#endif
// 4J: Removed on the advice of the mighty King of Achievments (JV)
// awardStat(GenericStats::portal(), GenericStats::param_portal());
}
server->getPlayers()->toggleDimension( dynamic_pointer_cast<ServerPlayer>(shared_from_this()), i);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (portalDestModified)
{
connection->teleport(portalOutX, portalOutY, portalOutZ, yRot, xRot);
}
#endif
lastSentExp = -1;
lastSentHealth = -1;
lastSentFood = -1;
@@ -824,6 +1071,10 @@ void ServerPlayer::take(shared_ptr<Entity> e, int orgCount)
Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, bool bTestUse)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (!bTestUse && FourKitBridge::FireBedEnter(entityId, dimension, x, y, z))
return OTHER_PROBLEM;
#endif
BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse);
if (result == OK)
{
@@ -837,12 +1088,22 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo
void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint)
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int bedX = bedPosition ? bedPosition->x : 0;
int bedY = bedPosition ? bedPosition->y : 0;
int bedZ = bedPosition ? bedPosition->z : 0;
bool wasSleeping = isSleeping();
#endif
if (isSleeping())
{
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::WAKE_UP));
}
Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (wasSleeping)
FourKitBridge::FireBedLeave(entityId, dimension, bedX, bedY, bedZ);
#endif
}
void ServerPlayer::ride(shared_ptr<Entity> e)
@@ -885,10 +1146,18 @@ bool ServerPlayer::startCrafting(int x, int y, int z)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false));
containerMenu = new CraftingMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::WORKBENCH, L"", 9))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false));
refreshContainer(containerMenu);
}
else
{
@@ -903,20 +1172,36 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
refreshContainer(containerMenu);
}
else if(dynamic_cast<CraftingMenu *>(containerMenu) != nullptr)
{
closeContainer();
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
containerMenu = new FireworksMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
refreshContainer(containerMenu);
}
else
{
@@ -931,10 +1216,18 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9, !name.empty()));
containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9, !name.empty()));
refreshContainer(containerMenu);
}
else
{
@@ -949,10 +1242,18 @@ bool ServerPlayer::startRepairing(int x, int y, int z)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false));
containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast<Player>(shared_from_this()));
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::REPAIR_TABLE, L"", 9))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false));
refreshContainer(containerMenu);
}
else
{
@@ -972,11 +1273,18 @@ bool ServerPlayer::openContainer(shared_ptr<Container> container)
int containerType = container->getContainerType();
assert(containerType >= 0);
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
containerMenu = new ContainerMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, containerType, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -991,10 +1299,18 @@ bool ServerPlayer::openHopper(shared_ptr<HopperTileEntity> container)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1009,10 +1325,18 @@ bool ServerPlayer::openHopper(shared_ptr<MinecartHopper> container)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
containerMenu = new HopperMenu(inventory, container);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1027,10 +1351,18 @@ bool ServerPlayer::openFurnace(shared_ptr<FurnaceTileEntity> furnace)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()));
containerMenu = new FurnaceMenu(inventory, furnace);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1045,10 +1377,18 @@ bool ServerPlayer::openTrap(shared_ptr<DispenserTileEntity> trap)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName()));
containerMenu = new TrapMenu(inventory, trap);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1063,10 +1403,18 @@ bool ServerPlayer::openBrewingStand(shared_ptr<BrewingStandTileEntity> brewingSt
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName()));
containerMenu = new BrewingStandMenu(inventory, brewingStand);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1081,10 +1429,18 @@ bool ServerPlayer::openBeacon(shared_ptr<BeaconTileEntity> beacon)
if(containerMenu == inventoryMenu)
{
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName()));
containerMenu = new BeaconMenu(inventory, beacon);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName()));
refreshContainer(containerMenu);
}
else
{
@@ -1104,7 +1460,15 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
containerMenu->addSlotListener(this);
shared_ptr<Container> container = static_cast<MerchantMenu *>(containerMenu)->getTradeContainer();
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize(), !name.empty()));
refreshContainer(containerMenu);
MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast<Player>(shared_from_this()));
if (offers != nullptr)
@@ -1134,10 +1498,18 @@ bool ServerPlayer::openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<
closeContainer();
}
nextContainerCounter();
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId));
containerMenu = new HorseInventoryMenu(inventory, container, horse);
containerMenu->containerId = containerCounter;
containerMenu->addSlotListener(this);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize()))
{
doCloseContainer();
return true;
}
#endif
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId));
refreshContainer(containerMenu);
return true;
}
@@ -1620,9 +1992,9 @@ bool ServerPlayer::hasPermission(EGameCommand command)
//
// // 4J - Don't need
// //if (server.isSingleplayer() && server.getSingleplayerName().equals(name))
/// //{
// //{
// // server.setDifficulty(packet.getDifficulty());
/// //}
// //}
//}
int ServerPlayer::getViewDistance()
+62 -5
View File
@@ -10,9 +10,16 @@
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "..\Minecraft.World\net.minecraft.world.level.chunk.h"
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#include "..\Minecraft.World\EnchantmentHelper.h"
#include "..\Minecraft.World\ExperienceOrb.h"
#include "..\Minecraft.Server\FourKitBridge.h"
#endif
#include "MultiPlayerLevel.h"
#include "LevelRenderer.h"
extern bool g_suppressExpDrops;
ServerPlayerGameMode::ServerPlayerGameMode(Level *level)
{
// 4J - added initialisers
@@ -172,7 +179,7 @@ void ServerPlayerGameMode::startDestroyBlock(int x, int y, int z, int face)
}
}
bool ServerPlayerGameMode::stopDestroyBlock(int x, int y, int z)
void ServerPlayerGameMode::stopDestroyBlock(int x, int y, int z)
{
if (x == xDestroyBlock && y == yDestroyBlock && z == zDestroyBlock)
{
@@ -188,7 +195,6 @@ bool ServerPlayerGameMode::stopDestroyBlock(int x, int y, int z)
isDestroyingBlock = false;
level->destroyTileProgress(player->entityId, x, y, z, -1);
destroyBlock(x, y, z);
return true;
}
else if (!hasDelayedDestroy)
{
@@ -199,11 +205,9 @@ bool ServerPlayerGameMode::stopDestroyBlock(int x, int y, int z)
delayedDestroyY = y;
delayedDestroyZ = z;
delayedTickStart = destroyProgressStart;
return true;
}
}
}
return false;
}
void ServerPlayerGameMode::abortDestroyBlock(int x, int y, int z)
@@ -250,7 +254,43 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
int t = level->getTile(x, y, z);
int data = level->getData(x, y, z);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
int eventExp = 0;
if (!isCreative() && !gameModeForPlayer->isAdventureRestricted())
{
Tile *tile = Tile::tiles[t];
if (tile != nullptr && player->canDestroy(tile))
{
if (!EnchantmentHelper::hasSilkTouch(player))
{
// (SYLV)todo: shouldnt we get these values from the actual blocks?
if (t == Tile::coalOre_Id)
eventExp = Mth::nextInt(level->random, 0, 2);
else if (t == Tile::diamondOre_Id)
eventExp = Mth::nextInt(level->random, 3, 7);
else if (t == Tile::emeraldOre_Id)
eventExp = Mth::nextInt(level->random, 3, 7);
else if (t == Tile::lapisOre_Id)
eventExp = Mth::nextInt(level->random, 2, 5);
else if (t == Tile::netherQuartz_Id)
eventExp = Mth::nextInt(level->random, 2, 5);
else if (t == Tile::redStoneOre_Id || t == Tile::redStoneOre_lit_Id)
eventExp = 1 + level->random->nextInt(5);
else if (t == Tile::mobSpawner_Id)
eventExp = 15 + level->random->nextInt(15) + level->random->nextInt(15);
}
}
}
int dimId = level->dimension ? level->dimension->id : 0;
int breakResult = FourKitBridge::FireBlockBreak(player->entityId, dimId, x, y, z, t, data, eventExp);
if (breakResult < 0)
{
player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
return false;
}
int finalExp = breakResult;
#endif
level->levelEvent(player, LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, t + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT));
// 4J - In creative mode, the point where we need to tell the renderer that we are about to destroy a tile via destroyingTileAt is quite complicated.
@@ -308,8 +348,25 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
}
}
if (changed && canDestroy)
{
{
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
g_suppressExpDrops = true;
#endif
Tile::tiles[t]->playerDestroy(level, player, x, y, z, data);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
g_suppressExpDrops = false;
if (finalExp > 0)
{
while (finalExp > 0)
{
int xpDrop = ExperienceOrb::getExperienceValue(finalExp);
finalExp -= xpDrop;
level->addEntity(std::make_shared<ExperienceOrb>(level, x + .5, y + .5, z + .5, xpDrop));
}
}
#endif
}
}
return changed;
+1 -1
View File
@@ -45,7 +45,7 @@ public:
void tick();
void startDestroyBlock(int x, int y, int z, int face);
bool stopDestroyBlock(int x, int y, int z);
void stopDestroyBlock(int x, int y, int z);
void abortDestroyBlock(int x, int y, int z);
private:
+17
View File
@@ -8,6 +8,9 @@
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
#include "TeleportCommand.h"
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
#include "..\Minecraft.Server\FourKitBridge.h"
#endif
EGameCommand TeleportCommand::getId()
{
@@ -32,7 +35,21 @@ void TeleportCommand::execute(shared_ptr<CommandSender> source, byteArray comman
if(subject != nullptr && destination != nullptr && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() )
{
subject->ride(nullptr);
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
{
double outX, outY, outZ;
bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId,
subject->x, subject->y, subject->z, subject->dimension,
destination->x, destination->y, destination->z, destination->dimension,
1 /* COMMAND */,
&outX, &outY, &outZ);
if (cancelled)
return;
subject->connection->teleport(outX, outY, outZ, destination->yRot, destination->xRot);
}
#else
subject->connection->teleport(destination->x, destination->y, destination->z, destination->yRot, destination->xRot);
#endif
//logAdminAction(source, "commands.tp.success", subject->getAName(), destination->getAName());
logAdminAction(source, ChatPacket::e_ChatCommandTeleportSuccess, subject->getName(), eTYPE_SERVERPLAYER, destination->getName());