From 40c37640491ce69046e9c05e9da775e88bdcf7c0 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 9 Apr 2011 19:51:40 -0500 Subject: [PATCH] should fix ConcurrentModificationException error --- .../wimbli/WorldBorder/BorderCheckTask.java | 19 ++++++++++++++----- src/plugin.yml | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/com/wimbli/WorldBorder/BorderCheckTask.java b/src/com/wimbli/WorldBorder/BorderCheckTask.java index af5a6a0..bdd8b54 100644 --- a/src/com/wimbli/WorldBorder/BorderCheckTask.java +++ b/src/com/wimbli/WorldBorder/BorderCheckTask.java @@ -1,5 +1,6 @@ package com.wimbli.WorldBorder; +import java.util.ConcurrentModificationException; import java.util.Iterator; import org.bukkit.ChatColor; @@ -11,7 +12,7 @@ import org.bukkit.World; public class BorderCheckTask implements Runnable { - Server server; + Server server = null; public BorderCheckTask(Server theServer) { @@ -20,14 +21,22 @@ public class BorderCheckTask implements Runnable public void run() { - if (Config.movedPlayers.isEmpty()) + if (Config.movedPlayers.isEmpty() || server == null) return; for (Iterator p = Config.movedPlayers.iterator(); p.hasNext();) { - String playerName = p.next(); - Player player = server.getPlayer(playerName); - p.remove(); + Player player = null; + try + { + String playerName = p.next(); + player = server.getPlayer(playerName); + p.remove(); + } + catch (ConcurrentModificationException ex) + { + continue; + } if (player == null || !player.isOnline()) continue; diff --git a/src/plugin.yml b/src/plugin.yml index 0a62236..0c311fe 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,7 +1,7 @@ name: WorldBorder author: Brettflan description: Limit the size of your worlds with a border, round or square. -version: 1.1 +version: 1.1.1 main: com.wimbli.WorldBorder.WorldBorder commands: wborder: