13
0

Fix AI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-04-01 14:19:17 +02:00
Ursprung ccdfb40d71
Commit c664e08fa6

Datei anzeigen

@ -26,9 +26,9 @@ import de.steamwar.schematicsystem.commands.schematiccommand.SchematicCommand;
import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import lombok.SneakyThrows;
import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.List;
import java.util.Random;
@ -40,17 +40,24 @@ public class AprilPart extends SWCommand {
super(null);
}
@SneakyThrows
@Register("prompt")
public void prompt(Player player, String... prompt) {
SteamwarUser user = SteamwarUser.get(player.getName());
String message = String.join(" ", prompt);
SchematicSystem.MESSAGE.send("AI_START", player, message);
Thread.sleep(random.nextInt(3000));
try {
Thread.sleep(random.nextInt(3000));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
int randomInt = random.nextInt(100);
if (randomInt < 33) {
List<SchematicNode> nodes = SchematicNode.getAll(user);
new SchematicData(nodes.get(random.nextInt(nodes.size()))).loadToPlayer(player);
try {
new SchematicData(nodes.get(random.nextInt(nodes.size()))).loadToPlayer(player);
} catch (IOException e) {
throw new RuntimeException(e);
}
SchematicSystem.MESSAGE.send("AI_FINISH", player);
} else if (randomInt < 66) {
SchematicSystem.MESSAGE.send("AI_NO_STEAMIES", player);