mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-07-17 19:40:45 +00:00
feat: ItemNameMap
fix: ItemNameMap regex fix(cmake): custom target fix(cmake): regex again, add support for Tile.h fix(cmake): deps fix(cmake): windows oh man fix(cmake): windows, again
This commit is contained in:
@@ -59,6 +59,9 @@
|
||||
extern bool g_Win64DedicatedServer;
|
||||
#endif
|
||||
|
||||
//neo: added
|
||||
#include "../Minecraft.World/ItemNameMap.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
// Anti-cheat thresholds. Keep server-side checks authoritative even in host mode.
|
||||
@@ -1135,7 +1138,7 @@ void PlayerConnection::handleCommand(const wstring& message)
|
||||
wstring targetName, itemStr, amountStr, auxStr;
|
||||
ss >> targetName >> itemStr >> amountStr >> auxStr;
|
||||
if (targetName.empty() || itemStr.empty()) {
|
||||
warn(L"Usage: /give <player> <item_id> [amount] [data]");
|
||||
warn(L"Usage: /give <player> <item_id>|minecraft:<item_name> [amount] [data]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1144,14 +1147,14 @@ void PlayerConnection::handleCommand(const wstring& message)
|
||||
warn(L"Player not found: " + targetName);
|
||||
return;
|
||||
}
|
||||
|
||||
int item, amount = 1, aux = 0;
|
||||
int item = 0;
|
||||
int amount = 1, aux = 0;
|
||||
try {
|
||||
item = std::stoi(itemStr);
|
||||
item = itemStr.find(L"minecraft:") == 0 ? GetItemIdByName(itemStr.substr(10)) : std::stoi(itemStr);
|
||||
if (!amountStr.empty()) amount = std::stoi(amountStr);
|
||||
if (!auxStr.empty()) aux = std::stoi(auxStr);
|
||||
} catch (...) {
|
||||
warn(L"Invalid item ID or amount");
|
||||
warn(L"Invalid item ID/Name or amount");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user