Hotfix FightSchematic public choosing with no publics abailable in schematictype
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
ad7a42a685
Commit
4f65023491
@ -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()) {
|
||||||
return;
|
for (SchematicType type : Config.SubTypes) {
|
||||||
|
publics = SchematicNode.getAllSchematicsOfType(0, type.toDB());
|
||||||
|
if (!publics.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (publics.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren