mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 10:15:54 +01:00
Fix ConcurrentModificationException for async ScoreBoard [SD-8398]
This commit is contained in:
parent
7d8a5e9b32
commit
cc99b9c856
@ -30,14 +30,14 @@ class Driver extends BukkitRunnable {
|
|||||||
|
|
||||||
ConfigurationSection config = scoreboardLoad.getConfigurationSection(boardType.getConfigSection());
|
ConfigurationSection config = scoreboardLoad.getConfigurationSection(boardType.getConfigSection());
|
||||||
|
|
||||||
if(config != null) {
|
if (config != null) {
|
||||||
List<String> lines = config.getStringList("Title.Content");
|
List<String> lines = config.getStringList("Title.Content");
|
||||||
int interval = config.getInt("Title.Interval");
|
int interval = config.getInt("Title.Interval");
|
||||||
title = new Row(lines, interval);
|
title = new Row(lines, interval);
|
||||||
|
|
||||||
for(int i = 1; i<16; i++) {
|
for (int i = 1; i < 16; i++) {
|
||||||
List<String> rowLines = config.getStringList("Rows." + i + ".Content");
|
List<String> rowLines = config.getStringList("Rows." + i + ".Content");
|
||||||
if(!rowLines.isEmpty()) {
|
if (!rowLines.isEmpty()) {
|
||||||
Row row = new Row(rowLines, config.getInt("Rows." + i + ".Interval"));
|
Row row = new Row(rowLines, config.getInt("Rows." + i + ".Interval"));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
}
|
}
|
||||||
@ -56,33 +56,41 @@ class Driver extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void registerHolder(Holder holder) {
|
void registerHolder(Holder holder) {
|
||||||
holders.add(holder);
|
synchronized (this.holders) {
|
||||||
|
this.holders.add(holder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregisterHolder(Holder holder) {
|
void unregisterHolder(Holder holder) {
|
||||||
holders.remove(holder);
|
synchronized (this.holders) {
|
||||||
|
this.holders.remove(holder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregisterHolder(Player player) {
|
void unregisterHolder(Player player) {
|
||||||
Iterator<Holder> it = holders.iterator();
|
synchronized (this.holders) {
|
||||||
while(it.hasNext()) {
|
Iterator<Holder> it = this.holders.iterator();
|
||||||
Holder holder = it.next();
|
while (it.hasNext()) {
|
||||||
if(holder.getPlayer().equals(player)) {
|
Holder holder = it.next();
|
||||||
it.remove();
|
if (holder.getPlayer().equals(player)) {
|
||||||
break;
|
it.remove();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
title.update();
|
title.update();
|
||||||
for(Row row : rows) {
|
for (Row row : rows) {
|
||||||
row.update();
|
row.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Holder holder : holders) {
|
synchronized (this.holders) {
|
||||||
holder.update();
|
for (Holder holder : holders) {
|
||||||
|
holder.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user