From 0d54e71294456b30a01b6a6718129b3372142e69 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Fri, 13 Dec 2024 13:46:47 +0100 Subject: [PATCH] Remove unused module --- .../eu/m724/tweaks/player/MusicPlayer.java | 74 ------------------- .../m724/tweaks/player/MyVoicechatPlugin.java | 41 ---------- src/main/resources/plugin.yml | 1 - 3 files changed, 116 deletions(-) delete mode 100644 src/main/java/eu/m724/tweaks/player/MusicPlayer.java delete mode 100644 src/main/java/eu/m724/tweaks/player/MyVoicechatPlugin.java diff --git a/src/main/java/eu/m724/tweaks/player/MusicPlayer.java b/src/main/java/eu/m724/tweaks/player/MusicPlayer.java deleted file mode 100644 index a1b475e..0000000 --- a/src/main/java/eu/m724/tweaks/player/MusicPlayer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2024 Minecon724 - * Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file - * in the project root for the full license text. - */ - -package eu.m724.tweaks.player; - -import de.maxhenkel.voicechat.api.BukkitVoicechatService; -import de.maxhenkel.voicechat.api.VoicechatServerApi; -import de.maxhenkel.voicechat.api.VolumeCategory; -import de.maxhenkel.voicechat.api.audiochannel.AudioPlayer; -import de.maxhenkel.voicechat.api.audiochannel.EntityAudioChannel; -import de.maxhenkel.voicechat.api.opus.OpusEncoderMode; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.UnsupportedAudioFileException; -import java.io.IOException; -import java.util.UUID; - -public class MusicPlayer { - private static final String PLAYER_CATEGORY = "music_player"; - - private VoicechatServerApi voicechat = null; - - private final Plugin plugin; - - public MusicPlayer(Plugin plugin) { - this.plugin = plugin; - } - - public void init() { - BukkitVoicechatService service = plugin.getServer().getServicesManager().load(BukkitVoicechatService.class); - service.registerPlugin(new MyVoicechatPlugin(this)); - } - - void unlock(VoicechatServerApi voicechat) { - VolumeCategory category = voicechat.volumeCategoryBuilder() - .setId(PLAYER_CATEGORY) - .setName("Music players") - .build(); - - voicechat.registerVolumeCategory(category); - - this.voicechat = voicechat; - } - - public void create(Player player) { - UUID channelID = UUID.randomUUID(); - EntityAudioChannel channel = voicechat.createEntityAudioChannel(channelID, voicechat.fromEntity(player)); - - channel.setCategory(PLAYER_CATEGORY); - channel.setDistance(10); - - short[] arr; - try { - AudioInputStream audio = AudioSystem.getAudioInputStream(plugin.getResource("music.flac")); - int samples = (int) (audio.available() / audio.getFrameLength()); - arr = new short[samples]; - for (int i=0; i