mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 21:37:28 +01:00
Only allow non-zero value maxDistances for BlockIterators
Prevents them from iterating infinitely and hanging the server
This commit is contained in:
parent
e0b057c30f
commit
1aa718c217
1 changed files with 21 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Tue, 12 Apr 2016 23:06:56 -0500
|
||||
Subject: [PATCH] Only allow non-zero maxDistance BlockIterators
|
||||
|
||||
They can iterate infinitely causing the server to hang.
|
||||
Fix your plugins!
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/util/BlockIterator.java b/src/main/java/org/bukkit/util/BlockIterator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/util/BlockIterator.java
|
||||
+++ b/src/main/java/org/bukkit/util/BlockIterator.java
|
||||
@@ -0,0 +0,0 @@ public class BlockIterator implements Iterator<Block> {
|
||||
*
|
||||
*/
|
||||
public BlockIterator(World world, Vector start, Vector direction, double yOffset, int maxDistance) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(maxDistance != 0, "maxDistance cannot be 0!"); // Paper - Only allow non-zero maxDistance
|
||||
this.world = world;
|
||||
this.maxDistance = maxDistance;
|
||||
|
||||
--
|
Loading…
Add table
Reference in a new issue