Compare commits
12 Commits
ios-suppor
...
plugins-su
| Author | SHA1 | Date | |
|---|---|---|---|
| 867114b0f3 | |||
| 1a8ead4955 | |||
| dddd69472a | |||
| 881c1188a1 | |||
| f1ff828027 | |||
| f93521a879 | |||
| d9dfff3339 | |||
| c62daa9c1c | |||
| f6377bc5a2 | |||
| 431b2a2704 | |||
| 67acd7f9a6 | |||
| 6f1ca8fc3b |
@@ -3,10 +3,9 @@ project(MinecraftPE)
|
|||||||
|
|
||||||
include(cmake/CPM.cmake)
|
include(cmake/CPM.cmake)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
|
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
|
||||||
|
|
||||||
include(cmake/EnumOption.cmake)
|
include(cmake/EnumOption.cmake)
|
||||||
|
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
@@ -34,9 +33,11 @@ if (${PLATFORM} STREQUAL "Desktop")
|
|||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
include_directories(misc/windows)
|
include_directories(misc/windows)
|
||||||
set(EXTRA_LIBS ws2_32 winhttp)
|
set(EXTRA_LIBS ws2_32 winhttp)
|
||||||
|
add_definitions(-DLUA_DL_DLL=1)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
set(EXTRA_LIBS pthread m)
|
set(EXTRA_LIBS pthread m)
|
||||||
|
add_definitions(-DLUA_USE_DLOPEN=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif (${PLATFORM} STREQUAL "Web")
|
elseif (${PLATFORM} STREQUAL "Web")
|
||||||
@@ -95,6 +96,46 @@ else()
|
|||||||
"GLFW_BUILD_TESTS OFF"
|
"GLFW_BUILD_TESTS OFF"
|
||||||
"GLFW_BUILD_DOCS OFF"
|
"GLFW_BUILD_DOCS OFF"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
CPMAddPackage("gh:halx99/sol2#support-lua-5.5")
|
||||||
|
CPMAddPackage("gh:lua/lua#master")
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
lua STATIC
|
||||||
|
${lua_SOURCE_DIR}/lapi.c
|
||||||
|
${lua_SOURCE_DIR}/lauxlib.c
|
||||||
|
${lua_SOURCE_DIR}/lbaselib.c
|
||||||
|
${lua_SOURCE_DIR}/lcode.c
|
||||||
|
${lua_SOURCE_DIR}/lcorolib.c
|
||||||
|
${lua_SOURCE_DIR}/lctype.c
|
||||||
|
${lua_SOURCE_DIR}/ldblib.c
|
||||||
|
${lua_SOURCE_DIR}/ldebug.c
|
||||||
|
${lua_SOURCE_DIR}/ldo.c
|
||||||
|
${lua_SOURCE_DIR}/ldump.c
|
||||||
|
${lua_SOURCE_DIR}/lfunc.c
|
||||||
|
${lua_SOURCE_DIR}/lgc.c
|
||||||
|
${lua_SOURCE_DIR}/linit.c
|
||||||
|
${lua_SOURCE_DIR}/liolib.c
|
||||||
|
${lua_SOURCE_DIR}/llex.c
|
||||||
|
${lua_SOURCE_DIR}/lmathlib.c
|
||||||
|
${lua_SOURCE_DIR}/lmem.c
|
||||||
|
${lua_SOURCE_DIR}/loadlib.c
|
||||||
|
${lua_SOURCE_DIR}/lobject.c
|
||||||
|
${lua_SOURCE_DIR}/lopcodes.c
|
||||||
|
${lua_SOURCE_DIR}/loslib.c
|
||||||
|
${lua_SOURCE_DIR}/lparser.c
|
||||||
|
${lua_SOURCE_DIR}/lstate.c
|
||||||
|
${lua_SOURCE_DIR}/lstring.c
|
||||||
|
${lua_SOURCE_DIR}/lstrlib.c
|
||||||
|
${lua_SOURCE_DIR}/ltable.c
|
||||||
|
${lua_SOURCE_DIR}/ltablib.c
|
||||||
|
${lua_SOURCE_DIR}/ltm.c
|
||||||
|
${lua_SOURCE_DIR}/lua.c
|
||||||
|
${lua_SOURCE_DIR}/lundump.c
|
||||||
|
${lua_SOURCE_DIR}/lutf8lib.c
|
||||||
|
${lua_SOURCE_DIR}/lvm.c
|
||||||
|
${lua_SOURCE_DIR}/lzio.c
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
@@ -215,6 +256,8 @@ file(GLOB SERVER_SOURCES
|
|||||||
|
|
||||||
"src/world/phys/HitResult.cpp"
|
"src/world/phys/HitResult.cpp"
|
||||||
"src/commands/*.cpp"
|
"src/commands/*.cpp"
|
||||||
|
|
||||||
|
"src/plugins/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB CLIENT_SOURCES
|
file(GLOB CLIENT_SOURCES
|
||||||
@@ -300,6 +343,8 @@ file(GLOB CLIENT_SOURCES
|
|||||||
"src/main.cpp"
|
"src/main.cpp"
|
||||||
|
|
||||||
"src/commands/*.cpp"
|
"src/commands/*.cpp"
|
||||||
|
"src/plugins/*.cpp"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${PLATFORM} STREQUAL "Desktop")
|
if (${PLATFORM} STREQUAL "Desktop")
|
||||||
@@ -308,17 +353,20 @@ endif()
|
|||||||
|
|
||||||
# Server
|
# Server
|
||||||
add_executable("${PROJECT_NAME}-server" ${SERVER_SOURCES})
|
add_executable("${PROJECT_NAME}-server" ${SERVER_SOURCES})
|
||||||
|
set_target_properties("${PROJECT_NAME}-server" PROPERTIES ENABLE_EXPORTS TRUE)
|
||||||
target_compile_definitions("${PROJECT_NAME}-server" PUBLIC "STANDALONE_SERVER" "SERVER_PROFILER")
|
target_compile_definitions("${PROJECT_NAME}-server" PUBLIC "STANDALONE_SERVER" "SERVER_PROFILER")
|
||||||
|
|
||||||
target_include_directories("${PROJECT_NAME}-server" PUBLIC
|
target_include_directories("${PROJECT_NAME}-server" PUBLIC
|
||||||
"${CMAKE_SOURCE_DIR}/src/"
|
"${CMAKE_SOURCE_DIR}/src/"
|
||||||
|
"${lua_SOURCE_DIR}/"
|
||||||
|
|
||||||
"project/lib_projects/raknet/jni/RaknetSources"
|
"project/lib_projects/raknet/jni/RaknetSources"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBS})
|
target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBS} lua sol2::sol2)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS TRUE)
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PLATFORM_CPP})
|
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PLATFORM_CPP})
|
||||||
|
|
||||||
@@ -328,6 +376,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
|||||||
"${openal_SOURCE_DIR}/include"
|
"${openal_SOURCE_DIR}/include"
|
||||||
"${glfw_SOURCE_DIR}/include"
|
"${glfw_SOURCE_DIR}/include"
|
||||||
"lib/include"
|
"lib/include"
|
||||||
|
"${lua_SOURCE_DIR}/"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${PLATFORM} MATCHES "Web")
|
if(${PLATFORM} MATCHES "Web")
|
||||||
@@ -375,7 +425,7 @@ endif()
|
|||||||
|
|
||||||
# Client
|
# Client
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
|
||||||
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS})
|
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS} lua sol2::sol2)
|
||||||
|
|
||||||
if (OpenSSL_FOUND)
|
if (OpenSSL_FOUND)
|
||||||
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
|||||||
44
README.md
44
README.md
@@ -1,6 +1,6 @@
|
|||||||
# MinecraftPE
|
# MinecraftPE
|
||||||
> [!Warning]
|
> [!Warning]
|
||||||
> [Github repository](https://github.com/Minecraft-PE-0-6-1/minecraft-pe-0.6.1-on-all) **isnt main**. All issues and pull requests should be send in [Gitea Repository](https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1).
|
> Github repository **isnt main**. All issues and pull requests should be send in [Gitea Repository](https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1).
|
||||||
|
|
||||||
> [!Important]
|
> [!Important]
|
||||||
> We have a discord server, where you can report bugs or send feedback https://discord.gg/c58YesBxve
|
> We have a discord server, where you can report bugs or send feedback https://discord.gg/c58YesBxve
|
||||||
@@ -9,20 +9,23 @@ Source code for **Minecraft Pocket Edition 0.6.1 alpha** with various fixes and
|
|||||||
|
|
||||||
This project aims to preserve and improve this early version of Minecraft PE.
|
This project aims to preserve and improve this early version of Minecraft PE.
|
||||||
|
|
||||||
# Features
|
# TODO / Roadmap
|
||||||
- Support for modern IOS and Android, Linux, Web
|
- [x] Add platform GLFW
|
||||||
- Improved Dedicated Server (Windows build, anticheat, commands, etc)
|
- [x] Compile for Linux
|
||||||
- Features from Beta version of Minecraft (Grass tint, Beta sky, Smooth lighting, etc) and other tweaks
|
- [x] Compile for android aarch64
|
||||||
|
- [x] Touch control improvements
|
||||||
# Screenshots
|
- [ ] Screen fixes
|
||||||
<p align="center">
|
- [ ] Rewrite platform logic
|
||||||
|
- [x] Fix sound
|
||||||
<img width="49%" alt="menu" src="https://sffempire.ru/mcpe-screenshots/menu.png" />
|
- [x] Do a server connection GUI
|
||||||
<img width="49%" alt="settings" src="https://sffempire.ru/mcpe-screenshots/settings.png" />
|
- [ ] Controller support
|
||||||
<img width="49%" alt="worlds" src="https://sffempire.ru/mcpe-screenshots/worlds.png" />
|
- [x] Minecraft server hosting
|
||||||
<img width="49%" alt="gameplay" src="https://sffempire.ru/mcpe-screenshots/gameplay.png" />
|
- [x] Screen fixess
|
||||||
|
- [x] Fix fog
|
||||||
</p>
|
- [x] Add sprinting
|
||||||
|
- [x] Chat (semi working) and commands
|
||||||
|
- [x] Implementing options
|
||||||
|
- [x] Better F3
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
|
||||||
@@ -76,14 +79,8 @@ cmake --build .
|
|||||||
```
|
```
|
||||||
C:\android-ndk-r14b
|
C:\android-ndk-r14b
|
||||||
```
|
```
|
||||||
3. Install **Build tools 35** with [SDKManager](https://dl.google.com/android/repository/commandlinetools-win-15859902_latest.zip) (build-tools should be in AppData):
|
|
||||||
|
|
||||||
```powershell
|
3. Run the build script:
|
||||||
sdkmanager "build-tools;35.0.0" --sdk_root="%LocalAppData%\Android\Sdk"
|
|
||||||
sdkmanager "build-tools;android-36" --sdk_root="%LocalAppData%\Android\Sdk"
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Run the build script:
|
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Full build (NDK + Java + APK + install)
|
# Full build (NDK + Java + APK + install)
|
||||||
@@ -157,6 +154,7 @@ sdkmanager "build-tools;android-36" --sdk_root="%LocalAppData%\Android\Sdk"
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
35.0.0
|
35.0.0
|
||||||
|
33.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Download **Android NDK r14b**:
|
6. Download **Android NDK r14b**:
|
||||||
@@ -202,7 +200,7 @@ sdkmanager "build-tools;android-36" --sdk_root="%LocalAppData%\Android\Sdk"
|
|||||||
```
|
```
|
||||||
## iOS
|
## iOS
|
||||||
### Xcode
|
### Xcode
|
||||||
> [!Note]
|
> [Note!]
|
||||||
> There's a precompiled IPA artifact in the GitHub mirror under Actions for those who either don't have Macs or don't want to build themself. But if you want to build youself, you'll need a Mac with Xcode. Download Xcode from the Mac App Store.
|
> There's a precompiled IPA artifact in the GitHub mirror under Actions for those who either don't have Macs or don't want to build themself. But if you want to build youself, you'll need a Mac with Xcode. Download Xcode from the Mac App Store.
|
||||||
|
|
||||||
### 1. Clone
|
### 1. Clone
|
||||||
|
|||||||
@@ -47,8 +47,6 @@
|
|||||||
9D293CE816071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; };
|
9D293CE816071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; };
|
||||||
9D293CEB160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; };
|
9D293CEB160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; };
|
||||||
9D293CEC160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; };
|
9D293CEC160720D6000305C8 /* worldname_iphone5_3.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */; };
|
||||||
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
|
||||||
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
|
||||||
D506D3E2161288BD0099FA65 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */; };
|
D506D3E2161288BD0099FA65 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */; };
|
||||||
D51DC73614581D4E00E3D761 /* itemframe.png in Resources */ = {isa = PBXBuildFile; fileRef = D51DC73514581D4E00E3D761 /* itemframe.png */; };
|
D51DC73614581D4E00E3D761 /* itemframe.png in Resources */ = {isa = PBXBuildFile; fileRef = D51DC73514581D4E00E3D761 /* itemframe.png */; };
|
||||||
D51DC74314592B8B00E3D761 /* PVRTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = D51DC74214592B8A00E3D761 /* PVRTexture.m */; };
|
D51DC74314592B8B00E3D761 /* PVRTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = D51DC74214592B8A00E3D761 /* PVRTexture.m */; };
|
||||||
@@ -1181,19 +1179,8 @@
|
|||||||
F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; };
|
F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; };
|
||||||
F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
||||||
F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
||||||
F9E5A772300E7A8700164066 /* LevelConstants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A771300E7A8700164066 /* LevelConstants.cpp */; };
|
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
||||||
F9E5A775300E7AB700164066 /* CommandManager.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A773300E7AB700164066 /* CommandManager.hpp */; };
|
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
||||||
F9E5A776300E7AB700164066 /* CommandManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A774300E7AB700164066 /* CommandManager.cpp */; };
|
|
||||||
F9E5A779300E7AD500164066 /* CommandBan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A777300E7AD500164066 /* CommandBan.cpp */; };
|
|
||||||
F9E5A77A300E7AD500164066 /* CommandBan.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A778300E7AD500164066 /* CommandBan.hpp */; };
|
|
||||||
F9E5A77D300E7AF400164066 /* CommandHelp.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77B300E7AF400164066 /* CommandHelp.hpp */; };
|
|
||||||
F9E5A77E300E7AF400164066 /* CommandHelp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77C300E7AF400164066 /* CommandHelp.cpp */; };
|
|
||||||
F9E5A783300E7B0B00164066 /* CommandKick.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A77F300E7B0A00164066 /* CommandKick.hpp */; };
|
|
||||||
F9E5A784300E7B0B00164066 /* CommandOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A780300E7B0A00164066 /* CommandOp.cpp */; };
|
|
||||||
F9E5A785300E7B0B00164066 /* CommandKick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A781300E7B0B00164066 /* CommandKick.cpp */; };
|
|
||||||
F9E5A786300E7B0B00164066 /* CommandOp.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A782300E7B0B00164066 /* CommandOp.hpp */; };
|
|
||||||
F9E5A789300E7B3400164066 /* Command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A787300E7B3400164066 /* Command.cpp */; };
|
|
||||||
F9E5A78A300E7B3400164066 /* Command.hpp in Sources */ = {isa = PBXBuildFile; fileRef = F9E5A788300E7B3400164066 /* Command.hpp */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -1261,7 +1248,6 @@
|
|||||||
9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CreateNewWorld_iphone.xib; path = minecraftpe/dialogs/CreateNewWorld_iphone.xib; sourceTree = "<group>"; };
|
9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CreateNewWorld_iphone.xib; path = minecraftpe/dialogs/CreateNewWorld_iphone.xib; sourceTree = "<group>"; };
|
||||||
9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = worldname_iphone5_3.png; sourceTree = "<group>"; };
|
9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = worldname_iphone5_3.png; sourceTree = "<group>"; };
|
||||||
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||||
BEEF202614CFF670005F0001 /* Lighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lighting.cpp; sourceTree = "<group>"; };
|
|
||||||
D51A8B01146A200000E5D720 /* minecraftpedemo-info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "minecraftpedemo-info.plist"; sourceTree = "<group>"; };
|
D51A8B01146A200000E5D720 /* minecraftpedemo-info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "minecraftpedemo-info.plist"; sourceTree = "<group>"; };
|
||||||
D51DC73514581D4E00E3D761 /* itemframe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = itemframe.png; sourceTree = "<group>"; };
|
D51DC73514581D4E00E3D761 /* itemframe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = itemframe.png; sourceTree = "<group>"; };
|
||||||
D51DC74114592B8A00E3D761 /* PVRTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTexture.h; sourceTree = "<group>"; };
|
D51DC74114592B8A00E3D761 /* PVRTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTexture.h; sourceTree = "<group>"; };
|
||||||
@@ -2482,19 +2468,7 @@
|
|||||||
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = "<group>"; };
|
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = "<group>"; };
|
||||||
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = "<group>"; };
|
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = "<group>"; };
|
||||||
F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
|
F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
|
||||||
F9E5A771300E7A8700164066 /* LevelConstants.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LevelConstants.cpp; path = ../../src/world/level/LevelConstants.cpp; sourceTree = "<group>"; };
|
BEEF202614CFF670005F0001 /* Lighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Lighting.cpp; path = Lighting.cpp; sourceTree = "<group>"; };
|
||||||
F9E5A773300E7AB700164066 /* CommandManager.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandManager.hpp; path = ../../src/commands/CommandManager.hpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A774300E7AB700164066 /* CommandManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandManager.cpp; path = ../../src/commands/CommandManager.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A777300E7AD500164066 /* CommandBan.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandBan.cpp; path = ../../src/commands/CommandBan.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A778300E7AD500164066 /* CommandBan.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandBan.hpp; path = ../../src/commands/CommandBan.hpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A77B300E7AF400164066 /* CommandHelp.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandHelp.hpp; path = ../../src/commands/CommandHelp.hpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A77C300E7AF400164066 /* CommandHelp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandHelp.cpp; path = ../../src/commands/CommandHelp.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A77F300E7B0A00164066 /* CommandKick.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandKick.hpp; path = ../../src/commands/CommandKick.hpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A780300E7B0A00164066 /* CommandOp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandOp.cpp; path = ../../src/commands/CommandOp.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A781300E7B0B00164066 /* CommandKick.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandKick.cpp; path = ../../src/commands/CommandKick.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A782300E7B0B00164066 /* CommandOp.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = CommandOp.hpp; path = ../../src/commands/CommandOp.hpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A787300E7B3400164066 /* Command.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Command.cpp; path = ../../src/commands/Command.cpp; sourceTree = "<group>"; };
|
|
||||||
F9E5A788300E7B3400164066 /* Command.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Command.hpp; path = ../../src/commands/Command.hpp; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -4345,19 +4319,6 @@
|
|||||||
D5CF9C37144C225000E4244F = {
|
D5CF9C37144C225000E4244F = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
F9E5A788300E7B3400164066 /* Command.hpp */,
|
|
||||||
F9E5A787300E7B3400164066 /* Command.cpp */,
|
|
||||||
F9E5A77F300E7B0A00164066 /* CommandKick.hpp */,
|
|
||||||
F9E5A781300E7B0B00164066 /* CommandKick.cpp */,
|
|
||||||
F9E5A782300E7B0B00164066 /* CommandOp.hpp */,
|
|
||||||
F9E5A780300E7B0A00164066 /* CommandOp.cpp */,
|
|
||||||
F9E5A77B300E7AF400164066 /* CommandHelp.hpp */,
|
|
||||||
F9E5A77C300E7AF400164066 /* CommandHelp.cpp */,
|
|
||||||
F9E5A778300E7AD500164066 /* CommandBan.hpp */,
|
|
||||||
F9E5A777300E7AD500164066 /* CommandBan.cpp */,
|
|
||||||
F9E5A773300E7AB700164066 /* CommandManager.hpp */,
|
|
||||||
F9E5A774300E7AB700164066 /* CommandManager.cpp */,
|
|
||||||
F9E5A771300E7A8700164066 /* LevelConstants.cpp */,
|
|
||||||
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */,
|
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */,
|
||||||
D5E1BA9A1451C8A0007DCC4F /* Default@2x.png */,
|
D5E1BA9A1451C8A0007DCC4F /* Default@2x.png */,
|
||||||
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */,
|
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */,
|
||||||
@@ -5490,19 +5451,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
F9E5A789300E7B3400164066 /* Command.cpp in Sources */,
|
|
||||||
F9E5A78A300E7B3400164066 /* Command.hpp in Sources */,
|
|
||||||
F9E5A783300E7B0B00164066 /* CommandKick.hpp in Sources */,
|
|
||||||
F9E5A784300E7B0B00164066 /* CommandOp.cpp in Sources */,
|
|
||||||
F9E5A785300E7B0B00164066 /* CommandKick.cpp in Sources */,
|
|
||||||
F9E5A786300E7B0B00164066 /* CommandOp.hpp in Sources */,
|
|
||||||
F9E5A77D300E7AF400164066 /* CommandHelp.hpp in Sources */,
|
|
||||||
F9E5A77E300E7AF400164066 /* CommandHelp.cpp in Sources */,
|
|
||||||
F9E5A779300E7AD500164066 /* CommandBan.cpp in Sources */,
|
|
||||||
F9E5A77A300E7AD500164066 /* CommandBan.hpp in Sources */,
|
|
||||||
F9E5A775300E7AB700164066 /* CommandManager.hpp in Sources */,
|
|
||||||
F9E5A776300E7AB700164066 /* CommandManager.cpp in Sources */,
|
|
||||||
F9E5A772300E7A8700164066 /* LevelConstants.cpp in Sources */,
|
|
||||||
F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */,
|
F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */,
|
||||||
D5CF9C57144C225000E4244F /* main.mm in Sources */,
|
D5CF9C57144C225000E4244F /* main.mm in Sources */,
|
||||||
D5CF9C5B144C225000E4244F /* minecraftpeAppDelegate.mm in Sources */,
|
D5CF9C5B144C225000E4244F /* minecraftpeAppDelegate.mm in Sources */,
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &l
|
|||||||
// so-- that's why the only change I made is to restrict to odd seeds.
|
// so-- that's why the only change I made is to restrict to odd seeds.
|
||||||
//
|
//
|
||||||
|
|
||||||
register unsigned int x = ( seed | 1U ) & 0xFFFFFFFFU, *s = state;
|
unsigned int x = ( seed | 1U ) & 0xFFFFFFFFU, *s = state;
|
||||||
register int j;
|
int j;
|
||||||
|
|
||||||
for ( left = 0, *s++ = x, j = N; --j;
|
for ( left = 0, *s++ = x, j = N; --j;
|
||||||
*s++ = ( x *= 69069U ) & 0xFFFFFFFFU )
|
*s++ = ( x *= 69069U ) & 0xFFFFFFFFU )
|
||||||
@@ -154,8 +154,8 @@ void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &l
|
|||||||
|
|
||||||
unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left )
|
unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left )
|
||||||
{
|
{
|
||||||
register unsigned int * p0 = state, *p2 = state + 2, *pM = state + M, s0, s1;
|
unsigned int * p0 = state, *p2 = state + 2, *pM = state + M, s0, s1;
|
||||||
register int j;
|
int j;
|
||||||
|
|
||||||
if ( left < -1 )
|
if ( left < -1 )
|
||||||
seedMT( 4357U );
|
seedMT( 4357U );
|
||||||
|
|||||||
@@ -287,11 +287,7 @@ void Minecraft::setLevel(Level* level, const std::string& message /* ="" */, Loc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->level = level;
|
this->level = level;
|
||||||
// So uhhh
|
|
||||||
std::string op = options.getStringValue(OPTIONS_USERNAME);
|
|
||||||
std::transform(op.begin(), op.end(), op.begin(), ::tolower);
|
|
||||||
|
|
||||||
level->ops.emplace(op);
|
|
||||||
_hasSignaledGeneratingLevelFinished = false;
|
_hasSignaledGeneratingLevelFinished = false;
|
||||||
#ifdef STANDALONE_SERVER
|
#ifdef STANDALONE_SERVER
|
||||||
const bool threadedLevelCreation = false;
|
const bool threadedLevelCreation = false;
|
||||||
@@ -1214,6 +1210,8 @@ void Minecraft::init()
|
|||||||
checkGlError("Init complete");
|
checkGlError("Init complete");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PluginsManager::get().init(*this);
|
||||||
|
|
||||||
options.load();
|
options.load();
|
||||||
|
|
||||||
setIsCreativeMode(false); // false means it's Survival Mode
|
setIsCreativeMode(false); // false means it's Survival Mode
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
#include "commands/CommandManager.hpp"
|
#include "commands/CommandManager.hpp"
|
||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
#include "MouseHandler.h"
|
#include "MouseHandler.h"
|
||||||
#include "gui/Gui.h"
|
#include "gui/Gui.h"
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ void ConsoleScreen::execute()
|
|||||||
return minecraft->setScreen(NULL);
|
return minecraft->setScreen(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_input[0] == '/') {
|
// if (_input[0] == '/') {
|
||||||
// Command
|
// // Command
|
||||||
_input = Util::stringTrim(_input.substr(1));
|
// _input = Util::stringTrim(_input.substr(1));
|
||||||
|
|
||||||
std::istringstream iss(minecraft->commandManager().execute(*minecraft, *minecraft->player, _input));
|
// std::istringstream iss(minecraft->commandManager().execute(*minecraft, *minecraft->player, _input));
|
||||||
for (std::string line; std::getline(iss, line); ) {
|
// for (std::string line; std::getline(iss, line); ) {
|
||||||
minecraft->gui.addMessage(line);
|
// minecraft->gui.addMessage(line);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
// @ai @rewrite
|
// @ai @rewrite
|
||||||
if (minecraft->netCallback && minecraft->raknetInstance->isServer()) {
|
if (minecraft->netCallback && minecraft->raknetInstance->isServer()) {
|
||||||
static_cast<ServerSideNetworkHandler*>(minecraft->netCallback)->displayGameMessage(_input);
|
static_cast<ServerSideNetworkHandler*>(minecraft->netCallback)->displayGameMessage(_input);
|
||||||
@@ -81,7 +81,7 @@ void ConsoleScreen::execute()
|
|||||||
} else {
|
} else {
|
||||||
minecraft->gui.addMessage("<" + minecraft->player->name + "> " + _input);
|
minecraft->gui.addMessage("<" + minecraft->player->name + "> " + _input);
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
//Textures* textures = entityRenderDispatcher->textures;
|
//Textures* textures = entityRenderDispatcher->textures;
|
||||||
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
||||||
Textures* textures = entityRenderDispatcher->textures;
|
Textures* textures = entityRenderDispatcher->textures;
|
||||||
textures->loadAndBindTexture("misc/shadow.png");
|
textures->loadAndBindTexture("/misc/shadow.png");
|
||||||
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
@@ -298,7 +298,6 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
tt.draw();
|
tt.draw();
|
||||||
|
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
// tt.color(1.f, 1.f, 1.f, 1.f);
|
|
||||||
glDisable2(GL_BLEND);
|
glDisable2(GL_BLEND);
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
@@ -316,7 +315,7 @@ void EntityRenderer::renderTileShadow(Tile* tt, float x, float y, float z, int x
|
|||||||
float a = ((pow - (y - (yt + yo)) / 2) * 0.5f) * getLevel()->getBrightness(xt, yt, zt);
|
float a = ((pow - (y - (yt + yo)) / 2) * 0.5f) * getLevel()->getBrightness(xt, yt, zt);
|
||||||
if (a < 0) return;
|
if (a < 0) return;
|
||||||
if (a > 1) a = 1;
|
if (a > 1) a = 1;
|
||||||
// t.color(1.f, 1.f, 1.f, (float) a);
|
// t.color(1, 1, 1, (float) a);
|
||||||
glColor4f2(1, 1, 1, (float) a);
|
glColor4f2(1, 1, 1, (float) a);
|
||||||
|
|
||||||
float x0 = xt + tt->xx0 + xo;
|
float x0 = xt + tt->xx0 + xo;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "world/level/Level.h"
|
#include "world/level/Level.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <client/Minecraft.h>
|
#include <client/Minecraft.h>
|
||||||
|
#include <network/packet/LoginStatusPacket.h>
|
||||||
|
|
||||||
CommandBan::CommandBan() : Command("ban") {}
|
CommandBan::CommandBan() : Command("ban") {}
|
||||||
|
|
||||||
@@ -20,25 +21,21 @@ std::string CommandBan::execute(Minecraft& mc, Player& player, const std::vector
|
|||||||
std::string nicknameLower = args[0];
|
std::string nicknameLower = args[0];
|
||||||
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
||||||
|
|
||||||
auto it = std::find_if(mc.level->players.begin(), mc.level->players.end(), [args, nicknameLower] (auto& it) -> bool {
|
auto it = std::find_if(mc.level->players.begin(), mc.level->players.end(), [nicknameLower] (auto& it) -> bool {
|
||||||
std::string lower = it->name;
|
std::string lower = it->name;
|
||||||
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
||||||
|
|
||||||
return lower == nicknameLower;
|
return lower == nicknameLower;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (*it == (Player*)mc.player) {
|
|
||||||
return "ban: you can't ban urself lol";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it != mc.level->players.end()) {
|
if (it != mc.level->players.end()) {
|
||||||
mc.level->removePlayer(*it);
|
if (*it == (Player*)mc.player) {
|
||||||
(*it)->remove();
|
return "banip: you can't ban urself lol";
|
||||||
mc.raknetInstance->getPeer()->CloseConnection((*it)->owner, true);
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto& banned : mc.level->bannedPpl) {
|
for (auto& banned : mc.level->bannedPpl) {
|
||||||
if (nicknameLower == banned) {
|
if (nicknameLower == banned) {
|
||||||
return args[0] + "already banned!";
|
return args[0] + " already banned!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
65
src/commands/CommandBanIp.cpp
Normal file
65
src/commands/CommandBanIp.cpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#include "CommandBanIp.hpp"
|
||||||
|
#include "commands/Command.hpp"
|
||||||
|
#include "network/RakNetInstance.h"
|
||||||
|
#include "raknet/RakPeerInterface.h"
|
||||||
|
#include "world/level/Level.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <client/Minecraft.h>
|
||||||
|
|
||||||
|
CommandBanIp::CommandBanIp() : Command("banip") {}
|
||||||
|
|
||||||
|
std::string CommandBanIp::execute(Minecraft& mc, Player& player, const std::vector<std::string>& args) {
|
||||||
|
if (!isPlayerOp(mc, player)) {
|
||||||
|
return "You aren't enough priveleged to run this command";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.empty()) {
|
||||||
|
return help(mc);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string nicknameLower = args[0];
|
||||||
|
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
||||||
|
|
||||||
|
auto it = std::find_if(mc.level->players.begin(), mc.level->players.end(), [nicknameLower] (auto& it) -> bool {
|
||||||
|
std::string lower = it->name;
|
||||||
|
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
||||||
|
|
||||||
|
return lower == nicknameLower;
|
||||||
|
});
|
||||||
|
|
||||||
|
std::string clientIp;
|
||||||
|
|
||||||
|
if (it != mc.level->players.end()) {
|
||||||
|
if (*it == (Player*)mc.player) {
|
||||||
|
return "banip: you can't ban urself lol";
|
||||||
|
}
|
||||||
|
|
||||||
|
RakNet::SystemAddress sysAddress = mc.raknetInstance->getPeer()->GetSystemAddressFromGuid((*it)->owner);
|
||||||
|
|
||||||
|
char ip[32];
|
||||||
|
sysAddress.ToString(false, ip);
|
||||||
|
|
||||||
|
clientIp = ip;
|
||||||
|
|
||||||
|
auto sourceId = (*it)->owner;
|
||||||
|
|
||||||
|
(*it)->reallyRemoveIfPlayer = true;
|
||||||
|
mc.level->removeEntity((*it));
|
||||||
|
mc.raknetInstance->getPeer()->CloseConnection(sourceId, true);
|
||||||
|
} else {
|
||||||
|
for (auto& banned : mc.level->bannedIps) {
|
||||||
|
if (clientIp == banned) {
|
||||||
|
return args[0] + " already banned!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clientIp = args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
mc.level->bannedIps.insert(clientIp);
|
||||||
|
return "banip: successfully banned player by ip " + args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CommandBanIp::help(Minecraft& mc) {
|
||||||
|
return "Usage: /banip <player>";
|
||||||
|
}
|
||||||
9
src/commands/CommandBanIp.hpp
Normal file
9
src/commands/CommandBanIp.hpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "Command.hpp"
|
||||||
|
|
||||||
|
class CommandBanIp : public Command {
|
||||||
|
public:
|
||||||
|
CommandBanIp();
|
||||||
|
|
||||||
|
std::string execute(Minecraft& mc, Player& player, const std::vector<std::string>& args);
|
||||||
|
std::string help(Minecraft& mc);
|
||||||
|
};
|
||||||
@@ -35,9 +35,11 @@ std::string CommandKick::execute(Minecraft& mc, Player& player, const std::vecto
|
|||||||
return "kick: you can't kick urself lol";
|
return "kick: you can't kick urself lol";
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.level->removePlayer(*it);
|
auto sourceId = (*it)->owner;
|
||||||
(*it)->remove();
|
|
||||||
mc.raknetInstance->getPeer()->CloseConnection((*it)->owner, true);
|
(*it)->reallyRemoveIfPlayer = true;
|
||||||
|
mc.level->removeEntity((*it));
|
||||||
|
mc.raknetInstance->getPeer()->CloseConnection(sourceId, true);
|
||||||
return "kick: successfully kicked player " + args[0];
|
return "kick: successfully kicked player " + args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include "commands/CommandKick.hpp"
|
#include "commands/CommandKick.hpp"
|
||||||
#include "commands/CommandOp.hpp"
|
#include "commands/CommandOp.hpp"
|
||||||
#include "commands/CommandBan.hpp"
|
#include "commands/CommandBan.hpp"
|
||||||
|
#include "commands/CommandBanIp.hpp"
|
||||||
|
#include "commands/CommandPardon.hpp"
|
||||||
#include "network/packet/ChatPacket.h"
|
#include "network/packet/ChatPacket.h"
|
||||||
#include "network/RakNetInstance.h"
|
#include "network/RakNetInstance.h"
|
||||||
#include "world/level/Level.h"
|
#include "world/level/Level.h"
|
||||||
@@ -21,6 +23,8 @@ void CommandManager::registerAllCommands() {
|
|||||||
m_commands.push_back(new CommandKick());
|
m_commands.push_back(new CommandKick());
|
||||||
m_commands.push_back(new CommandOp());
|
m_commands.push_back(new CommandOp());
|
||||||
m_commands.push_back(new CommandBan());
|
m_commands.push_back(new CommandBan());
|
||||||
|
m_commands.push_back(new CommandBanIp());
|
||||||
|
m_commands.push_back(new CommandPardon());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> CommandManager::getListAllCommands() {
|
std::vector<std::string> CommandManager::getListAllCommands() {
|
||||||
|
|||||||
40
src/commands/CommandPardon.cpp
Normal file
40
src/commands/CommandPardon.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include "CommandPardon.hpp"
|
||||||
|
#include "commands/Command.hpp"
|
||||||
|
#include "network/RakNetInstance.h"
|
||||||
|
#include "raknet/RakPeerInterface.h"
|
||||||
|
#include "world/level/Level.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <client/Minecraft.h>
|
||||||
|
|
||||||
|
CommandPardon::CommandPardon() : Command("pardon") {}
|
||||||
|
|
||||||
|
std::string CommandPardon::execute(Minecraft& mc, Player& player, const std::vector<std::string>& args) {
|
||||||
|
if (!isPlayerOp(mc, player)) {
|
||||||
|
return "You aren't enough priveleged to run this command";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.empty()) {
|
||||||
|
return help(mc);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string nicknameLower = args[0];
|
||||||
|
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
||||||
|
|
||||||
|
if (mc.level->bannedPpl.find(nicknameLower) != mc.level->bannedPpl.end()) {
|
||||||
|
mc.level->bannedPpl.erase(nicknameLower);
|
||||||
|
|
||||||
|
return "pardon: successfully unbanned player " + args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mc.level->bannedIps.find(nicknameLower) != mc.level->bannedIps.end()) {
|
||||||
|
mc.level->bannedIps.erase(nicknameLower);
|
||||||
|
|
||||||
|
return "pardon: successfully unbanned ip " + args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Player/Ip doesnt banned";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CommandPardon::help(Minecraft& mc) {
|
||||||
|
return "Usage: /pardon <player>";
|
||||||
|
}
|
||||||
9
src/commands/CommandPardon.hpp
Normal file
9
src/commands/CommandPardon.hpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "Command.hpp"
|
||||||
|
|
||||||
|
class CommandPardon : public Command {
|
||||||
|
public:
|
||||||
|
CommandPardon();
|
||||||
|
|
||||||
|
std::string execute(Minecraft& mc, Player& player, const std::vector<std::string>& args);
|
||||||
|
std::string help(Minecraft& mc);
|
||||||
|
};
|
||||||
@@ -15,15 +15,16 @@
|
|||||||
#include "platform/time.h"
|
#include "platform/time.h"
|
||||||
#include "SharedConstants.h"
|
#include "SharedConstants.h"
|
||||||
#include "world/level/LevelConstants.h"
|
#include "world/level/LevelConstants.h"
|
||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
|
||||||
#define MAIN_CLASS NinecraftApp
|
#define MAIN_CLASS NinecraftApp
|
||||||
static App* g_app = 0;
|
static App* g_app = 0;
|
||||||
static int g_exitCode = 0;
|
static int g_exitCode = 0;
|
||||||
void signal_callback_handler(int signum) {
|
void signal_callback_handler(int signum) {
|
||||||
std::cout << "Signum caught: " << signum << std::endl;
|
std::cout << "Signum caught: " << signum << std::endl;
|
||||||
if(signum == 2 || signum == 3){ // SIGINT || SIGQUIT
|
|
||||||
|
|
||||||
if(g_app != 0) {
|
if (signum == 2 || signum == 3) { // SIGINT || SIGQUIT
|
||||||
|
if (g_app != 0) {
|
||||||
g_app->quit();
|
g_app->quit();
|
||||||
} else {
|
} else {
|
||||||
exit(g_exitCode);
|
exit(g_exitCode);
|
||||||
@@ -64,7 +65,6 @@ std::string findStringInConfig(std::string line, std::string config) {
|
|||||||
return valueStr;
|
return valueStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int numArguments, char* pszArgs[]) {
|
int main(int numArguments, char* pszArgs[]) {
|
||||||
std::ifstream serverProperties("server.properties");
|
std::ifstream serverProperties("server.properties");
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ int main(int numArguments, char* pszArgs[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Level Name: %s\n", levelName.c_str());
|
printf("Level Name: %s\n", levelName.c_str());
|
||||||
|
|
||||||
AppContext appContext;
|
AppContext appContext;
|
||||||
appContext.platform = new AppPlatform();
|
appContext.platform = new AppPlatform();
|
||||||
App* app = new MAIN_CLASS();
|
App* app = new MAIN_CLASS();
|
||||||
@@ -162,6 +162,7 @@ int main(int numArguments, char* pszArgs[]) {
|
|||||||
float startTime = getTimeS();
|
float startTime = getTimeS();
|
||||||
((MAIN_CLASS*)g_app)->selectLevel(levelDir, levelName, settings);
|
((MAIN_CLASS*)g_app)->selectLevel(levelDir, levelName, settings);
|
||||||
((MAIN_CLASS*)g_app)->hostMultiplayer(port);
|
((MAIN_CLASS*)g_app)->hostMultiplayer(port);
|
||||||
|
PluginsManager::get().loadPlugins();
|
||||||
|
|
||||||
// Reading ops
|
// Reading ops
|
||||||
std::ifstream ops("ops.txt");
|
std::ifstream ops("ops.txt");
|
||||||
@@ -201,9 +202,28 @@ int main(int numArguments, char* pszArgs[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ifstream bannedIps("banned-ips.txt");
|
||||||
|
|
||||||
|
if (bannedIps.is_open()) {
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
while (std::getline(bannedIps, line)) {
|
||||||
|
if (!line.empty()) {
|
||||||
|
((MAIN_CLASS*)g_app)->level->bannedIps.insert(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::ofstream bannedIp("banned-ips.txt");
|
||||||
|
|
||||||
|
if (!bannedIp.is_open()) {
|
||||||
|
throw std::runtime_error("Cannot create banned players list.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << "Level has been generated in " << getTimeS() - startTime << std::endl;
|
std::cout << "Level has been generated in " << getTimeS() - startTime << std::endl;
|
||||||
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
||||||
std::cout << "Level has been saved!" << std::endl;
|
std::cout << "Level has been saved!" << std::endl;
|
||||||
|
PluginsManager::get().emit("ServerLoaded");
|
||||||
|
|
||||||
while(!app->wantToQuit()) {
|
while(!app->wantToQuit()) {
|
||||||
app->update();
|
app->update();
|
||||||
@@ -232,7 +252,20 @@ int main(int numArguments, char* pszArgs[]) {
|
|||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Cannot open banned players list.");
|
throw std::runtime_error("Cannot open banned players list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ofstream bannedIpsWrite("banned-ips.txt");
|
||||||
|
|
||||||
|
if (bannedIpsWrite.is_open()) {
|
||||||
|
for (auto& banned : ((MAIN_CLASS*)g_app)->level->bannedIps) {
|
||||||
|
bannedIpsWrite << banned << std::endl;
|
||||||
|
}
|
||||||
|
bannedIpsWrite.close();
|
||||||
|
} else {
|
||||||
|
throw std::runtime_error("Cannot open banned players list.");
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginsManager::get().emit("ServerShutdown");
|
||||||
|
|
||||||
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
||||||
|
|
||||||
delete app;
|
delete app;
|
||||||
|
|||||||
@@ -448,7 +448,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TakeItem
|
|||||||
|
|
||||||
LOGI("TakeItemPacket\n");
|
LOGI("TakeItemPacket\n");
|
||||||
|
|
||||||
ItemInstance* item;
|
ItemInstance* item = new ItemInstance();
|
||||||
|
|
||||||
item->count = packet->count;
|
item->count = packet->count;
|
||||||
item->id = packet->itemId;
|
item->id = packet->itemId;
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ bool RakNetInstance::isMyLocalGuid(const RakNet::RakNetGUID& guid)
|
|||||||
void RakNetInstance::runEvents(NetEventCallback* callback)
|
void RakNetInstance::runEvents(NetEventCallback* callback)
|
||||||
{
|
{
|
||||||
RakNet::Packet* currentEvent;
|
RakNet::Packet* currentEvent;
|
||||||
|
bool disconnect = false;
|
||||||
|
|
||||||
while ((currentEvent = rakPeer->Receive()) != NULL)
|
while ((currentEvent = rakPeer->Receive()) != NULL)
|
||||||
{
|
{
|
||||||
@@ -200,6 +201,7 @@ void RakNetInstance::runEvents(NetEventCallback* callback)
|
|||||||
case ID_DISCONNECTION_NOTIFICATION:
|
case ID_DISCONNECTION_NOTIFICATION:
|
||||||
case ID_CONNECTION_LOST:
|
case ID_CONNECTION_LOST:
|
||||||
callback->onDisconnect(currentEvent->guid);
|
callback->onDisconnect(currentEvent->guid);
|
||||||
|
disconnect = true;
|
||||||
break;
|
break;
|
||||||
case ID_UNCONNECTED_PONG:
|
case ID_UNCONNECTED_PONG:
|
||||||
{
|
{
|
||||||
@@ -233,8 +235,9 @@ void RakNetInstance::runEvents(NetEventCallback* callback)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!disconnect) {
|
||||||
rakPeer->DeallocatePacket(currentEvent);
|
rakPeer->DeallocatePacket(currentEvent);
|
||||||
|
}
|
||||||
//delete activeBitStream;
|
//delete activeBitStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "../server/ServerPlayer.h"
|
#include "../server/ServerPlayer.h"
|
||||||
#include "../world/entity/item/FallingTile.h"
|
#include "../world/entity/item/FallingTile.h"
|
||||||
|
#include <plugins/LuaPlayer.hpp>
|
||||||
|
#include <plugins/MessageEvent.hpp>
|
||||||
|
|
||||||
#define TIMES(x) for(int itc ## __LINE__ = 0; itc ## __LINE__ < x; ++ itc ## __LINE__)
|
#define TIMES(x) for(int itc ## __LINE__ = 0; itc ## __LINE__ < x; ++ itc ## __LINE__)
|
||||||
|
|
||||||
@@ -155,20 +157,62 @@ void ServerSideNetworkHandler::displayGameMessage(const std::string& message)
|
|||||||
raknetInstance->send(packet);
|
raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MessagePacket* packet)
|
||||||
|
{
|
||||||
|
auto player = getPlayer(source);
|
||||||
|
|
||||||
|
if (player == nullptr) return; // @todo maybe kick?
|
||||||
|
|
||||||
|
auto msg = std::string(packet->message.C_String());
|
||||||
|
|
||||||
|
MessageEvent event;
|
||||||
|
event.m_decline = false;
|
||||||
|
|
||||||
|
PluginsManager::get().emit("Message", LuaPlayer(source), msg, event);
|
||||||
|
|
||||||
|
if (!event.m_decline) {
|
||||||
|
if (packet->message[0] == '/') {
|
||||||
|
// This is a command
|
||||||
|
auto cmd = Util::stringTrim(msg.substr(1));
|
||||||
|
|
||||||
|
if (PluginsManager::get().emitCommands(cmd, source)) {
|
||||||
|
ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, cmd));
|
||||||
|
return sendPrivate(resp, source);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displayGameMessage("<" + player->name + "> " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChatPacket* packet)
|
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChatPacket* packet)
|
||||||
{
|
{
|
||||||
auto player = getPlayer(source);
|
auto player = getPlayer(source);
|
||||||
|
|
||||||
if (player == nullptr) return; // @todo maybe kick?
|
if (player == nullptr) return; // @todo maybe kick?
|
||||||
|
|
||||||
if (packet->message[0] == '/') {
|
MessageEvent event;
|
||||||
// This is a command
|
event.m_decline = false;
|
||||||
|
|
||||||
|
PluginsManager::get().emit("Message", LuaPlayer(source), packet->message, event);
|
||||||
|
|
||||||
|
if (!event.m_decline) {
|
||||||
|
if (packet->message[0] == '/') {
|
||||||
|
// This is a command
|
||||||
|
auto cmd = Util::stringTrim(packet->message.substr(1));
|
||||||
|
|
||||||
ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, Util::stringTrim(packet->message.substr(1))));
|
if (PluginsManager::get().emitCommands(cmd, source)) {
|
||||||
return sendPrivate(resp, source);
|
ChatPacket resp(minecraft->commandManager().execute(*minecraft, *player, cmd));
|
||||||
|
return sendPrivate(resp, source);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displayGameMessage("<" + player->name + "> " + packet->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayGameMessage("<" + player->name + "> " + packet->message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerSideNetworkHandler::onNewClient(const RakNet::RakNetGUID& clientGuid)
|
void ServerSideNetworkHandler::onNewClient(const RakNet::RakNetGUID& clientGuid)
|
||||||
@@ -188,6 +232,7 @@ void ServerSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid)
|
|||||||
|
|
||||||
if (player->owner == guid)
|
if (player->owner == guid)
|
||||||
{
|
{
|
||||||
|
PluginsManager::get().emit("PlayerDisconnect", LuaPlayer(guid));
|
||||||
minecraft->level->getLevelStorage()->savePlayer(*player);
|
minecraft->level->getLevelStorage()->savePlayer(*player);
|
||||||
|
|
||||||
std::string message = player->name;
|
std::string message = player->name;
|
||||||
@@ -226,7 +271,10 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginPac
|
|||||||
std::string nicknameLower = packet->clientName.C_String();
|
std::string nicknameLower = packet->clientName.C_String();
|
||||||
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
std::transform(nicknameLower.begin(), nicknameLower.end(), nicknameLower.begin(), ::tolower);
|
||||||
|
|
||||||
printf("%s lower \n", nicknameLower.c_str());
|
RakNet::SystemAddress sysAddress = rakPeer->GetSystemAddressFromGuid(source);
|
||||||
|
char clientIp[32];
|
||||||
|
sysAddress.ToString(false, clientIp);
|
||||||
|
|
||||||
for (int i = 0; i < level->players.size(); i++) {
|
for (int i = 0; i < level->players.size(); i++) {
|
||||||
ServerPlayer* player = (ServerPlayer*) level->players.at(i);
|
ServerPlayer* player = (ServerPlayer*) level->players.at(i);
|
||||||
|
|
||||||
@@ -247,6 +295,13 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginPac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& banned : level->bannedIps) {
|
||||||
|
if (clientIp == banned) {
|
||||||
|
loginStatus = packet->newProto ? LoginStatus::Failed_Banned : LoginStatus::Failed_ClientOld;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RakNet::BitStream bitStream;
|
RakNet::BitStream bitStream;
|
||||||
LoginStatusPacket(loginStatus).write(&bitStream);
|
LoginStatusPacket(loginStatus).write(&bitStream);
|
||||||
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false);
|
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false);
|
||||||
@@ -306,8 +361,6 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ReadyPac
|
|||||||
|
|
||||||
if (packet->type == ReadyPacket::READY_REQUESTEDCHUNKS)
|
if (packet->type == ReadyPacket::READY_REQUESTEDCHUNKS)
|
||||||
onReady_RequestedChunks(source);
|
onReady_RequestedChunks(source);
|
||||||
|
|
||||||
LOGI("Ready player two ready ready player two!!\n ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID& source)
|
void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID& source)
|
||||||
@@ -352,7 +405,6 @@ void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID
|
|||||||
#else
|
#else
|
||||||
LOGW("%s joined the game\n", newPlayer->name.c_str());
|
LOGW("%s joined the game\n", newPlayer->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Send all Entities to the new player
|
// Send all Entities to the new player
|
||||||
for (unsigned int i = 0; i < level->entities.size(); ++i) {
|
for (unsigned int i = 0; i < level->entities.size(); ++i) {
|
||||||
Entity* e = level->entities[i];
|
Entity* e = level->entities[i];
|
||||||
@@ -408,6 +460,8 @@ void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID
|
|||||||
bitStream.Reset();
|
bitStream.Reset();
|
||||||
AddPlayerPacket(newPlayer).write(&bitStream);
|
AddPlayerPacket(newPlayer).write(&bitStream);
|
||||||
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, true);
|
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, true);
|
||||||
|
|
||||||
|
PluginsManager::get().emit("PlayerJoin", LuaPlayer(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -451,17 +505,23 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlay
|
|||||||
// return raknetInstance->send(refuse);
|
// return raknetInstance->send(refuse);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
PluginsManager::get().emit(
|
||||||
|
"PlayerMovement",
|
||||||
|
LuaPlayer(source),
|
||||||
|
packet->x, packet->y, packet->z, packet->yRot, packet->xRot, // newPos
|
||||||
|
player->x, player->y, player->z, player->yRot, player->xRot // oldPos
|
||||||
|
);
|
||||||
|
|
||||||
entity->xd = entity->yd = entity->zd = 0;
|
entity->xd = entity->yd = entity->zd = 0;
|
||||||
entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3);
|
entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3);
|
||||||
|
|
||||||
// broadcast this packet to other clients
|
// broadcast this packet to other clients
|
||||||
redistributePacket(packet, source);
|
redistributePacket(packet, source);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveBlockPacket* packet){
|
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveBlockPacket* packet) {
|
||||||
if (!level) return;
|
if (!level) return;
|
||||||
|
|
||||||
Player* player = getPlayer(source);
|
Player* player = getPlayer(source);
|
||||||
@@ -499,6 +559,8 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveBl
|
|||||||
|
|
||||||
|
|
||||||
oldTile->destroy(level, x, y, z, data);
|
oldTile->destroy(level, x, y, z, data);
|
||||||
|
// RemoveEntityPacket packet(e->entityId);
|
||||||
|
// redistributePacket(&packet, rakPeer->GetMyGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGI("Remove block [%i, %i, %i]\n", packet->x, packet->y, packet->z);
|
LOGI("Remove block [%i, %i, %i]\n", packet->x, packet->y, packet->z);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
virtual void handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet);
|
virtual void handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet);
|
||||||
virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet);
|
virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet);
|
||||||
virtual void handle(const RakNet::RakNetGUID& source, ChatPacket* packet);
|
virtual void handle(const RakNet::RakNetGUID& source, ChatPacket* packet);
|
||||||
|
virtual void handle(const RakNet::RakNetGUID& source, MessagePacket* packet);
|
||||||
virtual void handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet);
|
virtual void handle(const RakNet::RakNetGUID& source, WantCreatePacket* packet);
|
||||||
|
|
||||||
bool allowsIncomingConnections() { return _allowIncoming; }
|
bool allowsIncomingConnections() { return _allowIncoming; }
|
||||||
@@ -66,7 +67,7 @@ public:
|
|||||||
Player* popPendingPlayer(const RakNet::RakNetGUID& source);
|
Player* popPendingPlayer(const RakNet::RakNetGUID& source);
|
||||||
|
|
||||||
void displayGameMessage(const std::string& message);
|
void displayGameMessage(const std::string& message);
|
||||||
private:
|
|
||||||
/**
|
/**
|
||||||
* @brief Send packet to all players
|
* @brief Send packet to all players
|
||||||
*/
|
*/
|
||||||
@@ -78,6 +79,8 @@ private:
|
|||||||
void sendPrivate(Packet& packet, const RakNet::RakNetGUID& source);
|
void sendPrivate(Packet& packet, const RakNet::RakNetGUID& source);
|
||||||
|
|
||||||
Player* getPlayer(const RakNet::RakNetGUID& source);
|
Player* getPlayer(const RakNet::RakNetGUID& source);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Minecraft* minecraft;
|
Minecraft* minecraft;
|
||||||
Level* level;
|
Level* level;
|
||||||
|
|||||||
160
src/plugins/LuaPlayer.hpp
Normal file
160
src/plugins/LuaPlayer.hpp
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <raknet/RakNetTypes.h>
|
||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
#include <network/ServerSideNetworkHandler.h>
|
||||||
|
#include <world/entity/player/Player.h>
|
||||||
|
#include <client/Minecraft.h>
|
||||||
|
#include <network/packet/ChatPacket.h>
|
||||||
|
#include <network/packet/MovePlayerPacket.h>
|
||||||
|
#include <network/packet/RemoveItemPacket.h>
|
||||||
|
#include <network/packet/SetHealthPacket.h>
|
||||||
|
#include <network/packet/TakeItemPacket.h>
|
||||||
|
#include <world/entity/player/Inventory.h>
|
||||||
|
|
||||||
|
// TODO: Optimize includes
|
||||||
|
class LuaPlayer {
|
||||||
|
public:
|
||||||
|
LuaPlayer(const RakNet::RakNetGUID source) : m_source(source) {}
|
||||||
|
|
||||||
|
Player* getPlayer() {
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
auto plr = ss->getPlayer(m_source);
|
||||||
|
|
||||||
|
return plr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getNickname() {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr != nullptr) return plr->name;
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::tuple<float, float, float, float, float> getPos() {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr != nullptr) return {plr->x, plr->y, plr->z, plr->yRot, plr->xRot};
|
||||||
|
|
||||||
|
return {0, 0, 0, 0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPos(float x, float y, float z, float yRot, float xRot) {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return;
|
||||||
|
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
|
||||||
|
|
||||||
|
// plr->x = x;
|
||||||
|
// plr->y = y;
|
||||||
|
// plr->z = z;
|
||||||
|
// plr->yRot = yRot;
|
||||||
|
// plr->xRot = xRot;
|
||||||
|
plr->xd = plr->yd = plr->zd = 0;
|
||||||
|
plr->lerpTo(x, y, z, yRot, xRot, 3);
|
||||||
|
|
||||||
|
MovePlayerPacket move(plr->entityId, x, y, z, yRot, xRot);
|
||||||
|
|
||||||
|
ss->sendPrivate(move, m_source);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendMessage(std::string msg) {
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
ChatPacket packet(msg);
|
||||||
|
|
||||||
|
ss->sendPrivate(packet, m_source);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addItem(int id, int count, int auxValue) {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return;
|
||||||
|
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
auto item = new ItemInstance(id, count, auxValue);
|
||||||
|
|
||||||
|
if (!plr->inventory->add(item)) {
|
||||||
|
plr->inventory->add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
TakeItemPacket itemAdd(plr->entityId, count, auxValue, id);
|
||||||
|
ss->sendPrivate(itemAdd, m_source);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::tuple<int, int, int> getItem(int index) {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return {0, 0, 0};
|
||||||
|
|
||||||
|
auto item = plr->inventory->getItem(index);
|
||||||
|
|
||||||
|
if (item != nullptr) {
|
||||||
|
return {item->id, item->count, item->getAuxValue()};
|
||||||
|
} else {
|
||||||
|
return {0, 0, 0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearInventory() {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return;
|
||||||
|
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
|
||||||
|
for (int i = Inventory::MAX_SELECTION_SIZE; i < plr->inventory->getContainerSize(); i++) {
|
||||||
|
auto itm = plr->inventory->getItem(i);
|
||||||
|
|
||||||
|
if (itm != NULL) {
|
||||||
|
printf("remove %d \n", plr->inventory->removeResource(ItemInstance(itm->id, itm->count, itm->getAuxValue())));
|
||||||
|
RemoveItemPacket itemAdd(plr->entityId, itm->count, itm->getAuxValue(), itm->id);
|
||||||
|
ss->sendPrivate(itemAdd, m_source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sol::table getInventory() {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return {};
|
||||||
|
|
||||||
|
sol::table inv = PluginsManager::get().getLua().create_table();
|
||||||
|
|
||||||
|
for (int i = Inventory::MAX_SELECTION_SIZE; i < plr->inventory->getContainerSize(); i++) {
|
||||||
|
auto itm = plr->inventory->getItem(i);
|
||||||
|
|
||||||
|
if (itm != NULL) {
|
||||||
|
inv[i - 8] = {itm->id, itm->count, itm->getAuxValue()};
|
||||||
|
} else {
|
||||||
|
inv[i - 8] = sol::lua_nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return inv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getHp() {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return -1;
|
||||||
|
|
||||||
|
return plr->health;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setHp(int hp) {
|
||||||
|
auto plr = getPlayer();
|
||||||
|
if (plr == nullptr) return;
|
||||||
|
|
||||||
|
plr->health = hp;
|
||||||
|
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
|
||||||
|
SetHealthPacket hpPacket(plr->health);
|
||||||
|
ss->sendPrivate(hpPacket, m_source);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const RakNet::RakNetGUID m_source;
|
||||||
|
};
|
||||||
11
src/plugins/LuaServer.cpp
Normal file
11
src/plugins/LuaServer.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include <plugins/LuaServer.hpp>
|
||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
#include <network/ServerSideNetworkHandler.h>
|
||||||
|
#include <client/Minecraft.h>
|
||||||
|
|
||||||
|
void LuaServer::sendServerMessage(std::string msg) {
|
||||||
|
auto mc = PluginsManager::get().getMinecraft();
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) mc->netCallback;
|
||||||
|
|
||||||
|
ss->displayGameMessage(msg);
|
||||||
|
}
|
||||||
7
src/plugins/LuaServer.hpp
Normal file
7
src/plugins/LuaServer.hpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class LuaServer {
|
||||||
|
public:
|
||||||
|
void sendServerMessage(std::string msg);
|
||||||
|
};
|
||||||
9
src/plugins/MessageEvent.hpp
Normal file
9
src/plugins/MessageEvent.hpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class MessageEvent {
|
||||||
|
public:
|
||||||
|
bool m_decline;
|
||||||
|
|
||||||
|
void setDecline(bool decline) { m_decline = decline; }
|
||||||
|
private:
|
||||||
|
};
|
||||||
103
src/plugins/PluginsManager.cpp
Normal file
103
src/plugins/PluginsManager.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
#include <plugins/LuaPlayer.hpp>
|
||||||
|
#include <plugins/LuaServer.hpp>
|
||||||
|
|
||||||
|
#include <client/Minecraft.h>
|
||||||
|
#include <filesystem>
|
||||||
|
#include "MessageEvent.hpp"
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
int PluginsManager::emitCommands(std::string command, const RakNet::RakNetGUID& source) {
|
||||||
|
std::vector<std::string> args;
|
||||||
|
std::string cmd;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
std::string word;
|
||||||
|
std::stringstream ss(command);
|
||||||
|
|
||||||
|
while (ss >> word) {
|
||||||
|
if (i == 0) {
|
||||||
|
cmd = word;
|
||||||
|
} else {
|
||||||
|
args.push_back(word);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto it = m_luaCommands.find(cmd);
|
||||||
|
|
||||||
|
if (it == m_luaCommands.end()) return 1;
|
||||||
|
|
||||||
|
for (auto& callback : it->second) {
|
||||||
|
sol::protected_function_result result = callback(LuaPlayer(source), sol::as_table(args));
|
||||||
|
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cout << err.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginsManager::init(Minecraft& minecraft) {
|
||||||
|
m_lua.open_libraries(sol::lib::base, sol::lib::package, sol::lib::string, sol::lib::math, sol::lib::table, sol::lib::io);
|
||||||
|
registerTypes();
|
||||||
|
|
||||||
|
m_minecraft = &minecraft;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginsManager::registerTypes() {
|
||||||
|
// @note you cant just do that, because lua doesnt have access to the class in this case
|
||||||
|
// m_lua.set_function("subscribe", &PluginsManager::subscribe);
|
||||||
|
|
||||||
|
m_lua.set_function("subscribe", [this](std::string event, sol::protected_function func) {
|
||||||
|
m_callbacks[event].push_back(func);
|
||||||
|
});
|
||||||
|
|
||||||
|
m_lua.set_function("addCommand", [this](std::string commandName, sol::function func) {
|
||||||
|
m_luaCommands[commandName].push_back(func);
|
||||||
|
});
|
||||||
|
|
||||||
|
m_lua.new_usertype<LuaServer>(
|
||||||
|
"Server",
|
||||||
|
"sendMessage", &LuaServer::sendServerMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
m_lua.new_usertype<LuaPlayer>(
|
||||||
|
"Player",
|
||||||
|
"getNickname", &LuaPlayer::getNickname,
|
||||||
|
"getPos", &LuaPlayer::getPos,
|
||||||
|
"setPos", &LuaPlayer::setPos,
|
||||||
|
"sendMessage", &LuaPlayer::sendMessage,
|
||||||
|
"getInventory", &LuaPlayer::getInventory,
|
||||||
|
"addItem", &LuaPlayer::addItem,
|
||||||
|
"getItem", &LuaPlayer::getItem,
|
||||||
|
"clearInventory", &LuaPlayer::clearInventory,
|
||||||
|
"getHp", &LuaPlayer::getHp,
|
||||||
|
"setHp", &LuaPlayer::setHp
|
||||||
|
);
|
||||||
|
|
||||||
|
m_lua.new_usertype<MessageEvent>(
|
||||||
|
"MessageEvent",
|
||||||
|
"setDecline", &MessageEvent::setDecline
|
||||||
|
);
|
||||||
|
|
||||||
|
m_lua["Server"] = &m_srv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginsManager::loadPlugins() {
|
||||||
|
std::string path = "plugins/";
|
||||||
|
|
||||||
|
if (fs::exists(path)) {
|
||||||
|
for (const auto& entry : fs::directory_iterator(path)) {
|
||||||
|
if (!fs::is_directory(entry.path().string())) {
|
||||||
|
m_lua.script_file(entry.path().string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::filesystem::create_directory(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
56
src/plugins/PluginsManager.hpp
Normal file
56
src/plugins/PluginsManager.hpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <sol/sol.hpp>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <plugins/LuaServer.hpp>
|
||||||
|
#include <raknet/RakNetTypes.h>
|
||||||
|
|
||||||
|
class Minecraft;
|
||||||
|
|
||||||
|
class PluginsManager {
|
||||||
|
public:
|
||||||
|
static inline PluginsManager& get() {
|
||||||
|
static PluginsManager inst;
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(Minecraft& minecraft);
|
||||||
|
|
||||||
|
void registerTypes();
|
||||||
|
|
||||||
|
void loadPlugins();
|
||||||
|
|
||||||
|
sol::state& getLua() { return m_lua; }
|
||||||
|
|
||||||
|
// @ai @note maybe we should rewrite it...
|
||||||
|
// problem that i dont know how to pass args in sol::function dynamically
|
||||||
|
// so i used ai
|
||||||
|
// sry :(
|
||||||
|
template<typename... Args>
|
||||||
|
void emit(std::string event, Args&&... args) {
|
||||||
|
auto it = m_callbacks.find(event);
|
||||||
|
|
||||||
|
if (it == m_callbacks.end()) return;
|
||||||
|
|
||||||
|
for (auto& callback : it->second) {
|
||||||
|
sol::protected_function_result result = callback(std::forward<Args>(args)...);
|
||||||
|
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cout << err.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int emitCommands(std::string command, const RakNet::RakNetGUID& source);
|
||||||
|
|
||||||
|
Minecraft* getMinecraft() { return m_minecraft; }
|
||||||
|
private:
|
||||||
|
std::unordered_map<std::string, std::vector<sol::function>> m_callbacks;
|
||||||
|
std::unordered_map<std::string, std::vector<sol::function>> m_luaCommands;
|
||||||
|
|
||||||
|
LuaServer m_srv;
|
||||||
|
sol::state m_lua;
|
||||||
|
Minecraft* m_minecraft;
|
||||||
|
};
|
||||||
@@ -142,8 +142,8 @@ void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &l
|
|||||||
// so-- that's why the only change I made is to restrict to odd seeds.
|
// so-- that's why the only change I made is to restrict to odd seeds.
|
||||||
//
|
//
|
||||||
|
|
||||||
register unsigned int x = ( seed | 1U ) & 0xFFFFFFFFU, *s = state;
|
unsigned int x = ( seed | 1U ) & 0xFFFFFFFFU, *s = state;
|
||||||
register int j;
|
int j;
|
||||||
|
|
||||||
for ( left = 0, *s++ = x, j = N; --j;
|
for ( left = 0, *s++ = x, j = N; --j;
|
||||||
*s++ = ( x *= 69069U ) & 0xFFFFFFFFU )
|
*s++ = ( x *= 69069U ) & 0xFFFFFFFFU )
|
||||||
@@ -154,8 +154,8 @@ void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &l
|
|||||||
|
|
||||||
unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left )
|
unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left )
|
||||||
{
|
{
|
||||||
register unsigned int * p0 = state, *p2 = state + 2, *pM = state + M, s0, s1;
|
unsigned int * p0 = state, *p2 = state + 2, *pM = state + M, s0, s1;
|
||||||
register int j;
|
int j;
|
||||||
|
|
||||||
if ( left < -1 )
|
if ( left < -1 )
|
||||||
seedMT( 4357U );
|
seedMT( 4357U );
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
//package net.minecraft.world.item;
|
//package net.minecraft.world.item;
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <plugins/PluginsManager.hpp>
|
||||||
|
#include <plugins/LuaPlayer.hpp>
|
||||||
|
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "ItemInstance.h"
|
#include "ItemInstance.h"
|
||||||
@@ -61,7 +63,7 @@ public:
|
|||||||
if (level->setTileAndData(x, y, z, tileId, data)) {
|
if (level->setTileAndData(x, y, z, tileId, data)) {
|
||||||
Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player);
|
Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player);
|
||||||
level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getStepSound(), (tile->soundType->getVolume() + 1) / 2, tile->soundType->getPitch() * 0.8f);
|
level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getStepSound(), (tile->soundType->getVolume() + 1) / 2, tile->soundType->getPitch() * 0.8f);
|
||||||
printf("%f %f %f \n", player->x, player->y, player->z);
|
PluginsManager::get().emit("PlayerPlaceBlock", LuaPlayer(player->owner), x, y, z, face, tileId, instance->getAuxValue());
|
||||||
/*
|
/*
|
||||||
PlaceBlockPacket packet(player->entityId, x, y, z, face, tileId, instance->getAuxValue());
|
PlaceBlockPacket packet(player->entityId, x, y, z, face, tileId, instance->getAuxValue());
|
||||||
//LOGI("Place block at @ %d, %d, %d\n", x, y, z);
|
//LOGI("Place block at @ %d, %d, %d\n", x, y, z);
|
||||||
|
|||||||
@@ -313,6 +313,7 @@ public:
|
|||||||
|
|
||||||
std::set<std::string> ops;
|
std::set<std::string> ops;
|
||||||
std::set<std::string> bannedPpl;
|
std::set<std::string> bannedPpl;
|
||||||
|
std::set<std::string> bannedIps;
|
||||||
protected:
|
protected:
|
||||||
bool isFindingSpawn;
|
bool isFindingSpawn;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user