mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-24 16:31:38 +01:00
Fixed iterator remove
This commit is contained in:
parent
ab85621f67
commit
eab672dc01
@ -10,7 +10,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
class Driver extends BukkitRunnable {
|
||||
@ -60,6 +60,11 @@ class Driver extends BukkitRunnable {
|
||||
}
|
||||
|
||||
public void registerHolder(Holder holder) {
|
||||
try {
|
||||
throw new Exception();
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
holders.add(holder);
|
||||
}
|
||||
|
||||
@ -68,11 +73,14 @@ class Driver extends BukkitRunnable {
|
||||
}
|
||||
|
||||
public void unregisterHolder(Player player) {
|
||||
for(Holder holder : holders)
|
||||
Iterator<Holder> it = holders.iterator();
|
||||
while(it.hasNext()) {
|
||||
Holder holder = it.next();
|
||||
if(holder.player.equals(player)) {
|
||||
holders.remove(holder);
|
||||
it.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user