anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: mockbukkit/mockbukkit
Issue: Using runTaskTimer with a 0 delay doesnt execute the first cycle.

`BukkitTask task = Bukkit.getScheduler().runTaskTimer(plugin, this::doTimer, 0, 20L); `

This creates a repeating task with a scheduledtick at 0 but the current tick is 0 yet it doesnt actually trigger the task instantly.

Hence it appears the task wont trigger.

```		AtomicInteger count = new AtomicInteger(0);
		Runnable callback = () -> count.incrementAndGet();
		BukkitTask task = scheduler.runTaskTimer(null, callback, 0, 2L);
		assertNotNull(task);
		assertEquals(0, count.get());
		scheduler.performTicks(1L);
		assertEquals(1, count.get());```
will cause a test failure. Actually the first assert should fail but it doesnt ...the second fails.

Changed files:
src/main/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMock.java, src/test/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMockTest.java

diff --git a/src/main/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMock.java b/src/main/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMock.java
index 51dbf710..e3948aee 100644
--- a/src/main/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMock.java
+++ b/src/main/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMock.java
@@ -143,6 +143,7 @@ public class BukkitSchedulerMock implements BukkitScheduler
 	@Override
 	public BukkitTask runTaskLater(Plugin plugin, Runnable task, long delay)
 	{
+		delay = Math.max(delay, 1);
 		ScheduledTask scheduledTask = new ScheduledTask(id++, plugin, true, currentTick + delay, task);
 		tasks.add(scheduledTask);
 		return scheduledTask;
@@ -151,6 +152,7 @@ public class BukkitSchedulerMock implements BukkitScheduler
 	@Override
 	public BukkitTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period)
 	{
+		delay = Math.max(delay, 1);
 		RepeatingTask repeatingTask = new RepeatingTask(id++, plugin, true, currentTick + delay, period, task);
 		tasks.add(repeatingTask);
 		return repeatingTask;
diff --git a/src/test/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMockTest.java b/src/test/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMockTest.java
index 4077ffca..1ad845e2 100644
--- a/src/test/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMockTest.java
+++ b/src/test/java/be/seeseemelk/mockbukkit/scheduler/BukkitSchedulerMockTest.java
@@ -100,6 +100,17 @@ public class BukkitSchedulerMockTest
 		assertEquals(2, count.get());
 	}
 	
+	@Test
+	public void runTaskTimer_ZeroDelay_DoesntExecuteTaskImmediately()
+	{
+		AtomicInteger count = new AtomicInteger(0);
+		Runnable callback = () -> count.incrementAndGet();
+		scheduler.runTaskTimer(null, callback, 0, 2L);
+		assertEquals(0, count.get());
+		scheduler.performTicks(1L);
+		assertEquals(1, count.get());
+	}
+	
 	@Test
 	public void runTaskAsynchronously_TaskExecutedOnSeperateThread() throws InterruptedException, BrokenBarrierException, TimeoutException
 	{