mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 05:34:54 +00:00
ItemStackRequestExecutor: added a sanity check for recipe repetitions
This commit is contained in:
parent
f90315c4a2
commit
e57fbff28c
@ -211,6 +211,12 @@ final class ItemStackRequestExecutor{
|
||||
if($repetitions < 1){ //TODO: upper bound?
|
||||
throw new ItemStackRequestProcessException("Cannot craft a recipe less than 1 time");
|
||||
}
|
||||
if($repetitions > 256){
|
||||
//TODO: we can probably lower this limit to 64, but I'm unsure if there are cases where the client may
|
||||
//request more than 64 repetitions of a recipe.
|
||||
//It's already hard-limited to 256 repetitions in the protocol, so this is just a sanity check.
|
||||
throw new ItemStackRequestProcessException("Cannot craft a recipe more than 256 times");
|
||||
}
|
||||
$craftingManager = $this->player->getServer()->getCraftingManager();
|
||||
$recipe = $craftingManager->getCraftingRecipeFromIndex($recipeId);
|
||||
if($recipe === null){
|
||||
|
Loading…
x
Reference in New Issue
Block a user