SteamWar/FightSystem
Archiviert
13
1

Hotfix FightSchematic public choosing with no publics abailable in schematictype
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-05 15:36:40 +01:00
Ursprung ad7a42a685
Commit 4f65023491

Datei anzeigen

@ -33,6 +33,7 @@ import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.WorldeditWrapper; import de.steamwar.fightsystem.utils.WorldeditWrapper;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -44,6 +45,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Stream;
public class FightSchematic extends StateDependent { public class FightSchematic extends StateDependent {
@ -100,8 +102,17 @@ public class FightSchematic extends StateDependent {
if(clipboard == null){ if(clipboard == null){
List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.SchematicType.toDB()); List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.SchematicType.toDB());
if(publics.isEmpty()) if(publics.isEmpty()) {
for (SchematicType type : Config.SubTypes) {
publics = SchematicNode.getAllSchematicsOfType(0, type.toDB());
if (!publics.isEmpty()) {
break;
}
}
if (publics.isEmpty()) {
return; return;
}
}
setSchematic(publics.get(new Random().nextInt(publics.size()))); setSchematic(publics.get(new Random().nextInt(publics.size())));
} }