1.21.11
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package de.winniepat.voiceChatInteraction;
|
||||
|
||||
import de.maxhenkel.voicechat.api.BukkitVoicechatService;import de.winniepat.voiceChatInteraction.config.ServerConfig;
|
||||
import org.bukkit.GameEvent;import org.bukkit.Server;import org.bukkit.configuration.file.FileConfiguration;import org.bukkit.plugin.java.JavaPlugin;
|
||||
import javax.annotation.Nullable;import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public final class VoiceChatInteraction extends JavaPlugin {
|
||||
|
||||
public static final String PLUGIN_ID = "voicechat_interaction";
|
||||
public static final Logger LOGGER = LogManager.getLogManager().getLogger(PLUGIN_ID);
|
||||
public static ServerConfig SERVER_CONFIG;
|
||||
public static Server SERVER;
|
||||
public static GameEvent VOICE_GAME_EVENT;
|
||||
public static VoiceChatInteraction INSTANCE;
|
||||
|
||||
@Nullable
|
||||
public static VoiceChatInteractionPlugin voicechatPlugin;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
SERVER = getServer();
|
||||
VOICE_GAME_EVENT = GameEvent.PRIME_FUSE;
|
||||
INSTANCE = this;
|
||||
|
||||
FileConfiguration config = this.getConfig();
|
||||
config.addDefault("group_interaction", false);
|
||||
config.addDefault("whisper_interaction", false);
|
||||
config.addDefault("sneak_interaction", false);
|
||||
config.addDefault("minimum_activation_threshold", -50);
|
||||
config.addDefault("default_interaction_toggle", true);
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
|
||||
SERVER_CONFIG = new ServerConfig(config);
|
||||
|
||||
BukkitVoicechatService service = getServer().getServicesManager().load(BukkitVoicechatService.class);
|
||||
if (service != null) {
|
||||
voicechatPlugin = new VoiceChatInteractionPlugin();
|
||||
service.registerPlugin(voicechatPlugin);
|
||||
getLogger().info("Successfully registered voicechat_interaction plugin");
|
||||
} else {
|
||||
getLogger().info("Failed to register voicechat_interaction plugin");
|
||||
}
|
||||
|
||||
this.getCommand("voicechat_interaction").setExecutor(new VoiceChatInteractionCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (voicechatPlugin != null) {
|
||||
getServer().getServicesManager().unregister(voicechatPlugin);
|
||||
getLogger().info("Successfully unregistered voicechat_interaction plugin");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user