Bug fixes

This commit is contained in:
Max Chaev 2025-03-04 20:39:51 +03:00
parent 0d337e7b7f
commit 6f3a12ae17
3 changed files with 12 additions and 20 deletions

View File

@ -12,7 +12,7 @@ public class Plugin extends JavaPlugin {
saveDefaultConfig();
String botToken = getConfig().getString("telegram.bot-token");
long chatId = getConfig().getLong("telegram.chat-id");
getLogger().info("Bombezhka mod has been baked by @zelenichai ");
getLogger().info("has been baked by @zelenichai ");
TelegramMessageListener telegramListener = new TelegramMessageListener(this, botToken, chatId);
getServer().getPluginManager().registerEvents(telegramListener, this);

View File

@ -34,10 +34,10 @@ public class TntSpawner {
// Spawn primed TNT with 4-second fuse
TNTPrimed tnt = world.spawn(tntLocation, TNTPrimed.class);
tnt.setFuseTicks(80); // 80 ticks = 4 seconds
tnt.setFuseTicks(1200); // 80 ticks = 4 seconds
// Broadcast coordinates
String coords = String.format("TNT spawned at [X: %d, Y: %d, Z: %d]",
String coords = String.format("[X: %d, Y: %d, Z: %d]",
tntLocation.getBlockX(),
tntLocation.getBlockY(),
tntLocation.getBlockZ()

View File

@ -23,28 +23,20 @@ public class RocketWarningListener implements Listener {
Random rand = new Random();
//_plugin.getServer().broadcastMessage("[Telegram] " + event.getMessage());
_plugin.getLogger().info("ROKETNAYA TREVOGA OBNARUZHENA!!");
if (_plugin.getServer().getOnlinePlayers().isEmpty()) return;
_plugin.getLogger().info("Launching rockets.");
_plugin.getServer().broadcastMessage("§4 РАКЕТНАЯ ОПАСНОСТЬ ВСЕМ СРОЧНО НАПРАВИТСЯ В БОМБОУБЕЖИЩЕ!!!");
new Thread(() -> {
try
for (Player player : _plugin.getServer().getOnlinePlayers()) {
for (int i = 0; i < rand.nextInt(1,20) ; i++)
{
TimeUnit.SECONDS.sleep(rand.nextInt(10,20));
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
String coords = TntSpawner.spawnTntNearPlayer(player);
_plugin.getServer().broadcastMessage("§4 [РАКЕТНАЯ ОПАСНОСТЬ] Ракеты летят в " + coords);
}
}
for (Player player : _plugin.getServer().getOnlinePlayers()) {
for (int i = 0; i < rand.nextInt(1,4) ; i++)
{
String coords = TntSpawner.spawnTntNearPlayer(player);
_plugin.getServer().broadcastMessage("§4 [РАКЕТНАЯ ОПАСНОСТЬ] Прилет в " + coords);
}
}
}).run();
}
}