1
0
Fork 0
Commit Graph

192 Commits

Author SHA1 Message Date
x12xx12x 3ff57559e3
ItemHandler initialisation is a constant expression (#5344)
* Transition to non-pointer item handler
* That is my destructor - I decide when I leave this world
* I declare your destruction private and you final
2021-12-01 23:31:10 +00:00
Tiger Wang 1a0d9450ea
Authentication flow: move construction, slim down classes (#5312)
- Remove extra members in ForgeHandshake
2021-10-02 21:27:32 +01:00
Morritz a4eba7639e
Fix: GetPhysicalRamUsage on FreeBSD (UNIX) - webadmin display (#5213)
* Fix: GetPhysicalRamUsage on FreeBSD (UNIX) - webadmin display

* fixed cast type

* Fix: GetPhysicalRamUsage on FreeBSD - webadmin display / style and failing build fixes

* added myself to contributors

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-04-30 13:23:31 +00:00
Tiger Wang 5123850db0
Fix Windows XP to 7 compatibility (#5167)
* Partially reverts 01a4e696b
* Unify thread names
- Remove use of GetThreadId API
2021-03-28 13:34:57 +01:00
dImrich 925f960ea2 Adds playerlist header and footer broadcasting (1.8-1.13) 2021-02-06 14:14:40 +00:00
Tiger Wang 054a89dd9e Clarify cClientHandle, cPlayer ownership semantics
+ A cPlayer, once created, has a strong pointer to the cClientHandle. The player ticks the clienthandle. If he finds the handle destroyed, he destroys himself in turn. Nothing else can kill the player.
* The client handle has a pointer to the player. Once a player is created, the client handle never outlasts the player, nor does it manage the player's lifetime. The pointer is always safe to use after FinishAuthenticate, which is also the point where cProtocol is put into the Game state that allows player manipulation.
+ Entities are once again never lost by constructing a chunk when they try to move into one that doesn't exist.
* Fixed a forgotten Super invocation in cPlayer::OnRemoveFromWorld.
* Fix SaveToDisk usage in destructor by only saving things cPlayer owns, instead of accessing cWorld.
2021-01-12 12:34:34 +00:00
Tiger Wang 090d8305e4 Warnings improvements
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality
* Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already
* Reduced GetStackValue verbosity
+ Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness
+ Give SettingsRepositoryInterface a move constructor to simplify main.cpp code
- Remove do {} while (false) construction in redstone handler
2020-12-18 21:03:40 +00:00
Bart Ribbers 2ca2a50b47
Include sys/select.h on non-glibc Linux platforms (#4977)
Otherwise fd_set will be unknown for example on Musl libc systems
2020-10-09 13:38:41 +00:00
peterbell10 a9031b6bae
Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)
* Fix cmake not adding Werror on clang, and _lots_ of warnings

* WIP: Build fixes

* Cannot make intermediate blockhandler instance

* Tiger's changes

* Fix BitIndex check

* Handle invalid NextState values in cMultiVersionProtocol

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-05 10:27:14 +00:00
Tiger Wang c158569af3 Remove unused Temporary namespace 2020-09-25 14:51:57 +01:00
Alexander Harkness 8de71fc9d6
Synchronously save chunks on server shutdown (#4900)
+ Synchronously save chunks on server shutdown. Fixes #4884
2020-09-21 13:12:09 +01:00
Tiger Wang 040380321c WriteConsoleInput can return FALSE when running as servic 2020-09-05 14:23:54 +01:00
Tiger Wang 1bc12ba2b3 Streamline startup sequence
* Clean up cRoot & main
* Move some OS-specifics into OSSupport
2020-09-05 13:16:52 +01:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang 3dae696b41 Remove ProtocolPalettes 2020-07-19 21:20:27 +01:00
Tiger Wang 5141d05ba6 Delete duplicated status request handlers
Here we go again...
2020-07-18 19:23:10 +01:00
Tiger Wang 7425305154 1.13 items support
+ Add 1.16 block and item definitions
2020-07-18 19:23:10 +01:00
Tiger Wang ff2c246de2
cProtocolRecognizer goes on a diet (#4770)
- Removed inheritance from cProtocol
2020-07-17 18:46:50 +01:00
Tiger Wang 9d277f1d10
cWorld * -> cWorld (#4771)
* cWorld * -> cWorld
2020-07-14 17:57:30 +01:00
Tobias Wilken 36eab1b323
Introduce recipe book functionality (#4493)
* Introduce recipe book functionality

The recipe book helps especially new players. Missing it gives the
impression that cuberite is not as advanced as it is.

The handling of the recipe book uses the following functions:

- Unlock Recipes
(https://wiki.vg/index.php?title=Protocol&oldid=14204#Unlock_Recipes) to
make recipes available and show the notification for new recipes.
Initialization is done on player login for known ones, the update is done
when new items are discovered.
- Craft Recipe Request
(https://wiki.vg/index.php?title=Protocol&oldid=14204#Craft_Recipe_Request)
when the user selects a recipe from the recipe book to fill the slots.

Known recipes are initialized on player login via `Unlock Recipes` with
`Action` 0.
As soon as a new recipe is discovered this is added via `Unlock Recipes`
with `Action` 1.

To be able to know and recognize new recipes the player class is
extended with `KnownItems` and `KnownRecipes`. As soon as a player
touches an item this is compared to the list of `KnownItems`, if the
item is unknown the recipes are checked for this item and the other
ingredients are checked with the list of `KnownItems`. If a full match
is discovered the recipe is unlocked with the client and stored in the
`KnownRecipes`.

To unlock recipes the recipe ID is sent to the client. A mapping file
(for protocol 1.12.2) translated the minecraft recipe names to ids. The
crafting.txt is extended with and minecraft recipe names is possible.

Limitations:
Only a single recipe is added to the crafting area. Multiple clicks or
shift click does not increase the number of builds.

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

* Address first issues mentioned by @peterbell10

- Some linting
- Extract loading of recipe specific protocol mapping into a function
- Build `RecipeNameMap` only once
- Use `std::optional`
- Extract `LoadRecipe` from `Window`

* Start to implement new suggestions

* Update with suggestions from @peterbell10

* Some minor cleanup

* Update protocol packet IDs
* Remove unused include
* Include header in cmake
* Change a vector to integer counter

* Change dromedaryCase method names to PascalCase

* Address suggestions from @madmaxoft

* Read Protocol subdirectories to load recipe books

To load all recipebooks iterate over the `Protocol` subdirectories
to find mapping files.

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-07-14 17:56:42 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mattes D 4aef80b47e Added temporary block type mapping for 1.13+ protocols. 2020-01-07 06:53:17 +01:00
Mattes D b63bb2f694 Root: Load the UpgradeBlockTypePalette on startup. 2020-01-07 06:53:17 +01:00
Mattes D 180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01:00
Mattes D 8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
Bond-009 b9fdaf8a94 Use clang-tidy to check more code conventions (#4214)
* Create clang-tidy.sh
* Add clang-tidy to circle.yml
* Fixed some naming violations

Fixes #4164
2018-05-06 18:07:34 +01:00
mathiascode a879778968 Broadcast playerlist removal in every world (#4201) 2018-04-02 18:39:54 +01:00
peterbell10 757231cc6e
Add the fmt library (#4065)
* Replaces AppendVPrintf with fmt::sprintf
* fmt::ArgList now used as a type safe alternative to varargs.
* Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu.
* Adds FLOG functions to log with fmt's native formatting style.
2018-01-03 17:41:16 +00:00
bibo38 532731e6f4 Fixed Clang 5.0 compile errors (#4085)
* Fixed Clang 5.0 compile errors

* Fixed wrong comment

* Only disable warnings in Clang 5 or higher

* Added a CMake condition for the Clang 5 no-zero-as-null-pointer-constant warning

* Now using the use_nullptr branch of the Cuberite specific SQLiteCpp fork
2017-12-21 11:36:58 +00:00
peterbell10 1537ebed6f cWorld: Move Initialization from Start to the constructor.
Start now does nothing more than launch the world's threads.
2017-10-21 19:33:22 +02:00
peterbell10 8835bf344d cRoot: Make PollPeriod representation 32 bit (#4030) 2017-09-19 14:14:44 +01:00
Lukas Pioch c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
Alexander Harkness 0968a4d360 Fix error with implicit cast from long long to long (#4026) 2017-09-14 13:11:22 +02:00
peterbell10 3ec9e6ec87 Limit how long cRoot::InputThread may block (#4019)
Limit how long cRoot::InputThread may block
Only calls `std::getline` when there is input available
which removes the need to "notify" the input thread.
Fixes #2494 and fixes #3177
2017-09-12 07:41:39 +01:00
peterbell10 e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
Lane Kolbly b12f4ef7d5 Made world data paths adjustable, and added API to temporarily disable saving chunks to disk. (#3912) 2017-09-07 13:41:16 +01:00
LogicParrot 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
peterbell10 f4f2fc7c3d Add cUUID class (#3871) 2017-08-25 13:43:18 +01:00
worktycho 832298e7aa Add command line argument for disabling the logfile 2017-06-03 21:40:35 +02:00
josh-parris 05c3e8bed8 Prevent infinite loop when logging fails (#3693)
Prevent infinite loop when logging fails
2017-05-05 13:02:54 +01:00
johnsoch f269565e73 Fixed looping when unable to bind port (#3621)
Fixes #3593
2017-03-17 13:44:28 +01:00
Bond-009 ca3aa4ca06 Changed world_end to world_the_end #3531 (#3538) 2017-02-24 10:02:16 +01:00
Gareth Nelson 1c31cb7eec Add support for alternate config file locations (#3578) 2017-02-22 14:10:32 +01:00
Mattes D 7cc3fb098d DeadlockDetect now lists some tracked CS's stats. 2017-01-18 09:03:05 +01:00
sweetgiorni 6522385897 Disconnect sent flag added
Truthiness no longer assumed
2017-01-03 13:14:28 -08:00
sweetgiorni 0718d82e1a Player check
Checks if there are any players connected to the server before running
PlayerCallback and waiting 1 second.
2017-01-03 12:31:07 -08:00
sweetgiorni 78b6d54bf8 Api Documentation
Added API documentation for GetShutdownMessage.
Style fix in Root.cpp
2017-01-03 12:18:53 -08:00
sweetgiorni 25e4f15488 Custom Disconnect Message
Adds a m_ShutdownMessage option to the settings. When the stop command
is issued, players are kicked with said message before the server shuts
down.
2017-01-03 11:15:34 -08:00
Fabian Stein ad476e1cf9 Fix crash after attempting to kill a non-running thread (#3504)
Fixes #3221
2017-01-01 22:43:24 +01:00