From 8a5d8a57f726afe9c72fd9b98b9dece0c89e0599 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 24 Jul 2013 17:38:46 +1000 Subject: [PATCH] Don't infinite loop on tasks with no period --- .../src/main/java/net/md_5/bungee/scheduler/BungeeTask.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java index 6fb80843d..033096d26 100644 --- a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java +++ b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeTask.java @@ -61,6 +61,12 @@ public class BungeeTask implements Runnable, ScheduledTask ProxyServer.getInstance().getLogger().log( Level.SEVERE, String.format( "Task %s encountered an exception", this ), t ); } + // If we have a period of 0 or less, only run once + if ( period <= 0 ) + { + break; + } + try { Thread.sleep( period );