Music expensive 3.1

Read Only
Read Only
Статус
Оффлайн
Регистрация
26 Авг 2024
Сообщения
638
Реакции
1
SS - просто при включении модуля врубается музыка

Код:
Expand Collapse Copy
@RegisterModules(
        name = "Music",
        type = Category.Player
)
public class Music extends Function {
    private boolean isActionEnabled;
    private Clip clip;
    private final String musicFolderPath = "C:\\acid client\\acidclient\\music"; // укаж свой путь к папке с музыкой пжж сука
    private final Random random = new Random();

    @Override
    public boolean onEnable() {
        playRandomSong();
        this.performActionIfRequired(false);
        super.onEnable();
        return true;
    }

    private void performActionIfRequired(boolean DO) {
        if (DO) {
            mc.gameSettings.keyBindSneak.pressed = mc.player.ticksExisted % 2 == 0;
            if (!this.isActionEnabled) {
                this.isActionEnabled = true;
            }
        } else if (this.isActionEnabled) {
            mc.gameSettings.keyBindSneak.pressed = false;
            this.isActionEnabled = false;
        }
    }

    private void playRandomSong() {
        File musicFolder = new File(musicFolderPath);
        File[] musicFiles = musicFolder.listFiles((dir, name) -> name.endsWith(".wav"));

        if (musicFiles != null && musicFiles.length > 0) {
            int randomIndex = random.nextInt(musicFiles.length);
            File selectedFile = musicFiles[randomIndex];

            try (AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(selectedFile)) {
                clip = AudioSystem.getClip();
                clip.open(audioInputStream);
                clip.start();
                clip.loop(Clip.LOOP_CONTINUOUSLY);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            System.out.println("Нет доступных музыкальных файлов в папке: " + musicFolderPath);
        }
    }

    @Override
    public void onDisable() {
        if (clip != null && clip.isRunning()) {
            clip.stop();
            clip.close();
        }
        super.onDisable();
    }
}
 
я командой давно ещё делал
 
Я ж те написал утилка есть ?
 
Щас запащу
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
SS - просто при включении модуля врубается музыка

Код:
Expand Collapse Copy
@RegisterModules(
        name = "Music",
        type = Category.Player
)
public class Music extends Function {
    private boolean isActionEnabled;
    private Clip clip;
    private final String musicFolderPath = "C:\\acid client\\acidclient\\music"; // укаж свой путь к папке с музыкой пжж сука
    private final Random random = new Random();

    @Override
    public boolean onEnable() {
        playRandomSong();
        this.performActionIfRequired(false);
        super.onEnable();
        return true;
    }

    private void performActionIfRequired(boolean DO) {
        if (DO) {
            mc.gameSettings.keyBindSneak.pressed = mc.player.ticksExisted % 2 == 0;
            if (!this.isActionEnabled) {
                this.isActionEnabled = true;
            }
        } else if (this.isActionEnabled) {
            mc.gameSettings.keyBindSneak.pressed = false;
            this.isActionEnabled = false;
        }
    }

    private void playRandomSong() {
        File musicFolder = new File(musicFolderPath);
        File[] musicFiles = musicFolder.listFiles((dir, name) -> name.endsWith(".wav"));

        if (musicFiles != null && musicFiles.length > 0) {
            int randomIndex = random.nextInt(musicFiles.length);
            File selectedFile = musicFiles[randomIndex];

            try (AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(selectedFile)) {
                clip = AudioSystem.getClip();
                clip.open(audioInputStream);
                clip.start();
                clip.loop(Clip.LOOP_CONTINUOUSLY);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            System.out.println("Нет доступных музыкальных файлов в папке: " + musicFolderPath);
        }
    }

    @Override
    public void onDisable() {
        if (clip != null && clip.isRunning()) {
            clip.stop();
            clip.close();
        }
        super.onDisable();
    }
}
пасщу :seemsgood:
 
у меня в джарке музыка есть и я через это команду и сделал, вот ток бывает баг то что музыка не выключается с помощью ClientUtil.stopsound
У меня норм работает в метод onDisable в твоей функции закинь это
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
SS - просто при включении модуля врубается музыка

Код:
Expand Collapse Copy
@RegisterModules(
        name = "Music",
        type = Category.Player
)
public class Music extends Function {
    private boolean isActionEnabled;
    private Clip clip;
    private final String musicFolderPath = "C:\\acid client\\acidclient\\music"; // укаж свой путь к папке с музыкой пжж сука
    private final Random random = new Random();

    @Override
    public boolean onEnable() {
        playRandomSong();
        this.performActionIfRequired(false);
        super.onEnable();
        return true;
    }

    private void performActionIfRequired(boolean DO) {
        if (DO) {
            mc.gameSettings.keyBindSneak.pressed = mc.player.ticksExisted % 2 == 0;
            if (!this.isActionEnabled) {
                this.isActionEnabled = true;
            }
        } else if (this.isActionEnabled) {
            mc.gameSettings.keyBindSneak.pressed = false;
            this.isActionEnabled = false;
        }
    }

    private void playRandomSong() {
        File musicFolder = new File(musicFolderPath);
        File[] musicFiles = musicFolder.listFiles((dir, name) -> name.endsWith(".wav"));

        if (musicFiles != null && musicFiles.length > 0) {
            int randomIndex = random.nextInt(musicFiles.length);
            File selectedFile = musicFiles[randomIndex];

            try (AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(selectedFile)) {
                clip = AudioSystem.getClip();
                clip.open(audioInputStream);
                clip.start();
                clip.loop(Clip.LOOP_CONTINUOUSLY);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            System.out.println("Нет доступных музыкальных файлов в папке: " + musicFolderPath);
        }
    }

    @Override
    public void onDisable() {
        if (clip != null && clip.isRunning()) {
            clip.stop();
            clip.close();
        }
        super.onDisable();
    }
}
с визуалочкой получше было бы
 
SS - просто при включении модуля врубается музыка

Код:
Expand Collapse Copy
@RegisterModules(
        name = "Music",
        type = Category.Player
)
public class Music extends Function {
    private boolean isActionEnabled;
    private Clip clip;
    private final String musicFolderPath = "C:\\acid client\\acidclient\\music"; // укаж свой путь к папке с музыкой пжж сука
    private final Random random = new Random();

    @Override
    public boolean onEnable() {
        playRandomSong();
        this.performActionIfRequired(false);
        super.onEnable();
        return true;
    }

    private void performActionIfRequired(boolean DO) {
        if (DO) {
            mc.gameSettings.keyBindSneak.pressed = mc.player.ticksExisted % 2 == 0;
            if (!this.isActionEnabled) {
                this.isActionEnabled = true;
            }
        } else if (this.isActionEnabled) {
            mc.gameSettings.keyBindSneak.pressed = false;
            this.isActionEnabled = false;
        }
    }

    private void playRandomSong() {
        File musicFolder = new File(musicFolderPath);
        File[] musicFiles = musicFolder.listFiles((dir, name) -> name.endsWith(".wav"));

        if (musicFiles != null && musicFiles.length > 0) {
            int randomIndex = random.nextInt(musicFiles.length);
            File selectedFile = musicFiles[randomIndex];

            try (AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(selectedFile)) {
                clip = AudioSystem.getClip();
                clip.open(audioInputStream);
                clip.start();
                clip.loop(Clip.LOOP_CONTINUOUSLY);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            System.out.println("Нет доступных музыкальных файлов в папке: " + musicFolderPath);
        }
    }

    @Override
    public void onDisable() {
        if (clip != null && clip.isRunning()) {
            clip.stop();
            clip.close();
        }
        super.onDisable();
    }
}
chat gpt :roflanEbalo:
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Назад
Сверху Снизу