Files
src
build.gradle
settings.gradle
Code
9 619
src/main/java/com/kodari/voicechat/VoiceChatPlugin.java
package com.kodari.voicechat;
import com.kodari.voicechat.command.VoiceChatCommand;
import com.kodari.voicechat.integration.VoiceChatIntegration;
import com.kodari.voicechat.manager.PrivateVoiceManager;
import com.kodari.voicechat.listener.BukkitVoiceChatListener;
import de.maxhenkel.voicechat.api.BukkitVoicechatService;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class VoiceChatPlugin extends JavaPlugin {
private PrivateVoiceManager privateVoiceManager;
@Override
public void onEnable() {
saveDefaultConfig();
privateVoiceManager = new PrivateVoiceManager(this);
Bukkit.getPluginManager().registerEvents(new BukkitVoiceChatListener(privateVoiceManager), this);
VoiceChatCommand command = new VoiceChatCommand(privateVoiceManager);
if (getCommand("voicechat") != null) {
getCommand("voicechat").setExecutor(command);
getCommand("voicechat").setTabCompleter(command);
}
BukkitVoicechatService service = getServer().getServicesManager().load(BukkitVoicechatService.class);
if (service == null) {
getLogger().severe("Simple Voice Chat was not available. Disabling plugin.");
getServer().getPluginManager().disablePlugin(this);
return;
}
service.registerPlugin(new VoiceChatIntegration(privateVoiceManager));
getLogger().info("Automatic proximity voice chat enabled.");
}
@Override
public void onDisable() {
if (privateVoiceManager != null) {
privateVoiceManager.shutdown();
}
}
}