Commit Graph

1140 Commits

Author SHA1 Message Date
4274640845 Player: fixed on-ground state not being updated when walking horizontally
it's possible to walk off a tower while flying without moving vertically, and this code previously wouldn't detect that, leaving a gaping hole in the anti-cheat.
2018-07-18 15:14:18 +01:00
ebbbc581ca Player: clean up cursor inventory when closing main inventory 2018-07-12 17:52:22 +01:00
905259a4e1 Fixed not being able to place blocks inside dead players
closes #2265
2018-06-29 16:38:35 +01:00
6c6630d845 Player: avoid doing some post-melee attack actions if attacking killed the attacker
This can happen when an attacker attacks a victim wearing thorns armour while having low health, which prior to this commit would cause the tool to be duplicated.
2018-06-22 17:17:40 +01:00
2d3ce9e8b0 Remove some fully qualified function calls
PhpStorm can't see these or understand how they are being called, which is very annoying for bug hunting. Additionally, we already have the CodeOptimizer for this.
2018-06-18 12:23:19 +01:00
a080a9b75c Player: remove redundant parameter from checkNearEntities() 2018-06-11 12:25:01 +01:00
137a05c418 Player: remove useless return value from orderChunks() 2018-06-11 12:22:46 +01:00
245f5c6bef Player: remove obsolete TODO 2018-06-11 12:20:11 +01:00
47742d74c8 Player: Drop load queue on level switch
This ensures that the player doesn't request bad chunks if it was teleported from an invalid level.
2018-06-09 16:21:41 +01:00
601811f0f8 Player: Account for the possibility of Level being null in switchLevel()
the Entity base also accounts for this, and assuming that this is automatically valid is causing lots of crashes. I am not sure of the circumstances under which this is suddenly becoming null, but this shouldn't assume that the level is valid nonetheless.
2018-06-09 16:20:51 +01:00
37b445f210 Updated Math dependency 2018-06-09 13:05:25 +01:00
d03f36ebee First look at splitting up AsyncPool and ServerScheduler
This commit contains quite a few breaking changes with respect to how AsyncTasks are handled. This is necessary to allow separation of the ServerScheduler and the AsyncPool, because in the future the ServerScheduler may be removed and instead there will be isolated per-plugin sync-task schedulers - but we cannot have every plugin with its own worker pool for memory usage reasons if nothing else.

The following things have changed:
- ServerScheduler: scheduleAsyncTask(), scheduleAsyncTaskToWorker(), getAsyncTaskPoolSize(), increaseAsyncTaskPoolSize() and similar methods have all been removed. Additionally the static \$WORKERS field has been removed.
- Server: added API method getAsyncPool(). This grants you direct access to the server's AsyncPool. Calls to getScheduler()->scheduleAsyncTask() and scheduleAsyncTaskToWorker() should be replaced with getAsyncPool()->submitTask() and submitTaskToWorker() respectively.
2018-05-30 12:20:10 +01:00
b003295d01 Player: reduce duplicated code in PlayerActionPacket handler 2018-05-28 19:38:29 +01:00
87ff1c0382 Player: don't catch Throwable on transaction creation failure 2018-05-28 17:00:59 +01:00
2eaba7c936 Timings: added timings for Player->checkNearEntities() 2018-05-28 16:27:03 +01:00
8cf0fc63d8 Player: spawn at safe-spawn on level not found, instead of real spawn 2018-05-26 12:20:58 +01:00
9dd0ee7f05 Entity: replaced motion and lastMotion fields with vectors 2018-05-24 12:11:41 +01:00
1c4dd4f280 Player: broadcast entity event to self as well when sending to all viewers
this fixes several bugs with entity events and removes the need for a hit animation hack.
2018-05-23 09:28:46 +01:00
faa88a55e4 EntityDamageEvent: break API
The general purpose of this is to split up base damage from modifiers.

- Added methods getBaseDamage(), setBaseDamage(), getOriginalBaseDamage(), getModifiers(), getOriginalModifiers()
- setDamage() renamed to setModifier() and type is now mandatory
- getDamage() renamed to getModifier() and type is now mandatory
- getOriginalDamage() renamed to getOriginalModifier() and type is now mandatory
- Removed MODIFIER_BASE constant
- Constructors now accept: float baseDamage, float[] modifiers instead of just float[] modifiers
2018-05-22 19:05:25 +01:00
2f03f5f6d5 Fix a grammar error in Player (#2197) 2018-05-20 21:27:40 +01:00
adb9390b53 Entity: Rename isInsideOfWater() to isUnderwater() 2018-05-19 18:10:43 +01:00
807af2e6fb Human: change doFoodTick() visibility to protected 2018-05-19 16:30:41 +01:00
0bb5e88b5c Hinting up Entity API to PHP 7.2 standards 2018-05-19 10:46:47 +01:00
f757ba1851 Merge branch 'release/alpha12' 2018-05-17 19:27:26 -04:00
8c1c8f34cc Player: confine command data resending on permission recalculate to post-spawn only
this fixes crashes when PurePerms causes this to be recalculated on player login - the client doesn't like receiving this before StartGame and crashes.

Confining this to post-spawn should not cause any issues since any permission recalculation in login events will be reflected immediately afterwards when the initial command data is sent anyway.

This same bug popped up at 1.1... I don't know why it wasn't fixed properly back then.
2018-05-17 19:26:42 -04:00
c285295037 Merge branch 'release/alpha12' 2018-05-17 18:40:24 +01:00
7e70569ba2 Player: Send all open inventories instead of hardcoded selection
Players have a few associated inventories which might need sending nowadays, such as main, armour, offhand (not implemented yet), cursor, crafting (if it ever worked). Under these conditions we should be sending all open windows.
2018-05-11 09:28:59 +01:00
b21572774a Tool: cleanup durability handling, closes #379
long overdue... this isn't quite as extensible as the original api3/blocks system was, but this is primarily intended to replace Item->useOn(). If plugins want to use it it can be extended later on.
2018-05-10 19:48:51 +01:00
b8523cb304 Merge branch 'remove-weak-position' 2018-05-10 13:53:07 +01:00
38c3f00ef7 avoid crashes when XUID is null 2018-05-05 13:33:13 +01:00
68638f9779 Fixed translations
Apparently the translation type doesn't translate unless this flag is set now...
2018-05-04 22:14:02 +01:00
fe8102c062 Silence another stupid spam bug 2018-05-02 12:03:29 +01:00
0247dff909 Fixed mis-uses of Item->isTool()
this has been wrongly used to indicate a durable item, but not just tools are durable items.
2018-05-01 20:05:02 +01:00
a889a0e517 Workaround for player hitbox bug on respawn
this happens when a player respawns before their death animation ends. I don't know why, but their bounding box height suddenly becomes zero. This solves the bug by simply resending the height and width properties to viewers on respawn.

Closes #2135.
2018-04-04 20:11:16 +01:00
ef2dd1de92 Inventory: Use exceptions to report back why a transaction failed
Returning false all the time could mean any one of a range of things. Throwing exceptions is better in that it allows us to catch them and see what actually broke.
2018-04-04 12:11:24 +01:00
5b7b2dd0e2 Merge changes from ALPHA11 for 1.2.13 2018-04-04 11:31:39 +01:00
5ce55bd3b0 duct tape for block ID remapping 2018-04-04 11:00:39 +01:00
fc795b80ae Protocol changes for 1.2.10 2018-04-04 10:58:49 +01:00
b9d3bd22a3 Player: fixed getLastPlayed() being useless
this should only be set on quit, not on join.
2018-03-31 10:44:59 +01:00
4ce1f228e6 Player: removed checkBlockCollision() override 2018-03-30 12:23:00 +01:00
8572e9e560 Crafting: nuke
This commit brings in a much-needed rewrite of crafting transaction handling.

The following classes have been removed:
- CraftingTransferMaterialAction
- CraftingTakeResultAction

The following classes have significant changes:
- CraftingTransaction
	- All API methods have been removed and are now handled in CraftItemEvent
- CraftItemEvent
	- added the following:
		- getInputs()
		- getOutputs()
		- getRepetitions() (tells how many times a recipe was crafted in this event)
- Recipe interface:
	- Removed getResult() (individual recipes may handle this differently)
- CraftingRecipe interface
	- removed the following:
		- matchItems()
		- getExtraResults()
		- getAllResults()
	- added the following
		- getResults()
		- getIngredientList() : Item[], which must return a 1D array of items that should be consumed (wildcards accepted).
		- matchesCraftingGrid(CraftingGrid)
- ShapedRecipe
	- constructor now accepts string[], Item[], Item[]
- ShapelessRecipe
	- constructor now accepts Item[], Item[]
2018-03-29 12:05:22 +01:00
1f4f8ab3f0 Inventory: Removed BigCraftingGrid, allow arbitrary size parameter
This is more flexible and requires less classes.
2018-03-29 11:24:28 +01:00
be7c27f60d Player: explicitly load chunk for player to spawn, fixes #2115
this is an ugly fix, but it'll do for now...
2018-03-25 12:45:51 +01:00
2b37b4a659 Player: close session in interface right at the top
I don't know why this would be anywhere _but_ here...
2018-03-24 13:00:44 +00:00
a4c50d3204 Remove unused imports 2018-03-24 11:59:15 +00:00
071aa44d29 Player: fixed facepalm 2018-03-24 11:05:03 +00:00
25089f5e70 Player: use setPosition() when jumping to off position 2018-03-24 10:58:31 +00:00
22dd8faf1d Player: don't jump to bad position when reverting movement 2018-03-24 10:57:59 +00:00
7354a55af8 Player: use vector methods for calculating diff on move 2018-03-24 10:50:09 +00:00
611f5d684b Player: removed redundant isFirst check for movement
Since the addition of resetLastMovements(), this code is useless.

Additionally, it doesn't make sense to ignore the first movement, because the first movement still _moves the player_ from point A to point B.
2018-03-24 10:40:30 +00:00