mirror of
https://github.com/lukasabbe/VoiceChatGroupMsg.git
synced 2026-04-30 10:50:53 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7075963597 | |||
| 1c487409a1 | |||
| da64223e29 | |||
| e3141bef06 | |||
| 2b650b5e89 | |||
| 7633b6918d | |||
| 434e07e62e | |||
| c3116f0f6f | |||
| 0e084d7e7c | |||
| 684af95851 | |||
| 33396fc5e2 | |||
| 31314430f3 |
@@ -0,0 +1,37 @@
|
|||||||
|
# Automatically build the project and run any configured tests for every push
|
||||||
|
# and submitted pull request. This can help catch issues that only occur on
|
||||||
|
# certain platforms or Java versions, and provides a first line of defence
|
||||||
|
# against bad commits.
|
||||||
|
|
||||||
|
name: build
|
||||||
|
on: [pull_request, push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# Use these Java versions
|
||||||
|
java: [
|
||||||
|
21, # Current Java LTS
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: validate gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
- name: setup jdk ${{ matrix.java }}
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.java }}
|
||||||
|
distribution: 'microsoft'
|
||||||
|
- name: make gradle wrapper executable
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
- name: build
|
||||||
|
run: ./gradlew build
|
||||||
|
- name: capture build artifacts
|
||||||
|
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: Artifacts
|
||||||
|
path: build/libs/
|
||||||
@@ -113,7 +113,6 @@ gradle-app.setting
|
|||||||
|
|
||||||
# Common working directory
|
# Common working directory
|
||||||
run/
|
run/
|
||||||
runs/
|
|
||||||
|
|
||||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
!gradle-wrapper.jar
|
!gradle-wrapper.jar
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2024
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Simple voice chat group message system
|
||||||
|
It comes with a new command to write to other players in your voice chat group.
|
||||||
|
|
||||||
|
# Commands
|
||||||
|
/msgvc <message>
|
||||||
+81
-37
@@ -1,52 +1,96 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'fabric-loom' version '1.8-SNAPSHOT'
|
||||||
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'me.lukasabbe'
|
version = project.mod_version
|
||||||
version = '1.0+1.21'
|
group = project.maven_group
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
|
||||||
maven {
|
|
||||||
name = "spigotmc-repo"
|
|
||||||
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/groups/public/"
|
|
||||||
}
|
|
||||||
maven { url = 'https://maven.maxhenkel.de/repository/public' }
|
maven { url = 'https://maven.maxhenkel.de/repository/public' }
|
||||||
|
maven {
|
||||||
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
content {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
|
// To change the versions see the gradle.properties file
|
||||||
implementation("de.maxhenkel.voicechat:voicechat-api:2.5.0")
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
modRuntimeOnly "maven.modrinth:simple-voice-chat:fabric-${voicechat_version}"
|
||||||
|
|
||||||
}
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
def targetJavaVersion = 21
|
implementation "de.maxhenkel.voicechat:voicechat-api:${voicechat_api_version}"
|
||||||
java {
|
|
||||||
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
|
||||||
sourceCompatibility = javaVersion
|
|
||||||
targetCompatibility = javaVersion
|
|
||||||
if (JavaVersion.current() < javaVersion) {
|
|
||||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
options.encoding = 'UTF-8'
|
|
||||||
|
|
||||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
|
||||||
options.release.set(targetJavaVersion)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
def props = [version: version]
|
inputs.property "version", project.version
|
||||||
inputs.properties props
|
inputs.property "minecraft_version", project.minecraft_version
|
||||||
filteringCharset 'UTF-8'
|
inputs.property "loader_version", project.loader_version
|
||||||
filesMatching('plugin.yml') {
|
inputs.property "voicechat_api_version", project.voicechat_api_version
|
||||||
expand props
|
filteringCharset "UTF-8"
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": project.version,
|
||||||
|
"minecraft_version": project.minecraft_version,
|
||||||
|
"loader_version": project.loader_version,
|
||||||
|
"voicechat_api_version": project.voicechat_api_version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def targetJavaVersion = 21
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
|
// this fixes some edge cases with special characters not displaying correctly
|
||||||
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
|
// If Javadoc is generated, this must be specified in that task too.
|
||||||
|
it.options.encoding = "UTF-8"
|
||||||
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||||
|
it.options.release.set(targetJavaVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||||
|
if (JavaVersion.current() < javaVersion) {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||||
|
}
|
||||||
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
|
// if it is present.
|
||||||
|
// If you remove this line, sources will not be generated.
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure the maven publication
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create("mavenJava", MavenPublication) {
|
||||||
|
artifactId = project.archives_base_name
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
|
repositories {
|
||||||
|
// Add repositories to publish to here.
|
||||||
|
// Notice: This block does NOT have the same function as the block in the top level.
|
||||||
|
// The repositories here will be used for publishing your artifact, not for
|
||||||
|
// retrieving dependencies.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Done to increase the memory available to gradle.
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
|
# Fabric Properties
|
||||||
|
# check these on https://modmuss50.me/fabric.html
|
||||||
|
minecraft_version=1.21.4-rc3
|
||||||
|
yarn_mappings=1.21.4-rc3+build.3
|
||||||
|
loader_version=0.16.9
|
||||||
|
|
||||||
|
# Mod Properties
|
||||||
|
mod_version = 1.0.1+1.21.4
|
||||||
|
maven_group = me.lukasabbe
|
||||||
|
archives_base_name = VoiceChatGroupMsg
|
||||||
|
|
||||||
|
#mod dev
|
||||||
|
voicechat_version=1.21.4-rc3-2.5.26
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
# check this on https://modmuss50.me/fabric.html
|
||||||
|
fabric_version=0.110.2+1.21.4
|
||||||
|
voicechat_api_version=2.5.0
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
|||||||
+9
-1
@@ -1 +1,9 @@
|
|||||||
rootProject.name = 'VoiceChatGroupMsgPlugin'
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package me.lukasabbe.voiceChatGroupMsgPlugin;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class MsgVCCommand implements CommandExecutor {
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
|
||||||
if(!(commandSender instanceof Player)){
|
|
||||||
commandSender.sendMessage("only players can execute this command");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(strings.length == 0){
|
|
||||||
commandSender.sendMessage("Make sure to write a message");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Player player = (Player) commandSender;
|
|
||||||
if(!VoiceChatGroupMsgPlugin.isPlayerInGroup(player)){
|
|
||||||
commandSender.sendMessage("You need to be in a voice chat group to use this command");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package me.lukasabbe.voiceChatGroupMsgPlugin;
|
|
||||||
|
|
||||||
import de.maxhenkel.voicechat.api.Group;
|
|
||||||
import de.maxhenkel.voicechat.api.VoicechatPlugin;
|
|
||||||
import de.maxhenkel.voicechat.api.VoicechatServerApi;
|
|
||||||
import de.maxhenkel.voicechat.api.events.EventRegistration;
|
|
||||||
import de.maxhenkel.voicechat.api.events.VoicechatServerStartedEvent;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public final class VoiceChatGroupMsgPlugin extends JavaPlugin implements VoicechatPlugin {
|
|
||||||
private static VoicechatServerApi API = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
this.getCommand("msgvc").setExecutor(new MsgVCCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPluginId() {
|
|
||||||
return "voice_chat_group_msg_plugin";
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void registerEvents(EventRegistration registration) {
|
|
||||||
registration.registerEvent(VoicechatServerStartedEvent.class, this::onServerStarted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerStarted(VoicechatServerStartedEvent event) {
|
|
||||||
API = event.getVoicechat();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPlayerInGroup(Player player){
|
|
||||||
try{
|
|
||||||
return API.getConnectionOf(player.getUniqueId()).isInGroup();
|
|
||||||
}catch (NullPointerException ignore){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static boolean isPlayerInGroup(Player player, UUID groupID){
|
|
||||||
try{
|
|
||||||
if(!API.getConnectionOf(player.getUniqueId()).isInGroup()) return false;
|
|
||||||
return API.getConnectionOf(player.getUniqueId()).getGroup().getId().equals(groupID);
|
|
||||||
|
|
||||||
}catch (NullPointerException ignore){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static Group getPlayerGroup(Player player){
|
|
||||||
return API.getConnectionOf(player.getUniqueId()).getGroup();
|
|
||||||
}
|
|
||||||
public static List<Player> GroupPlayers(UUID groupUUID, World serverWorld){
|
|
||||||
return serverWorld.getPlayers().stream().filter(p -> isPlayerInGroup(p, groupUUID)).toList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package me.lukasabbe.voicechatgroupmsg;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import de.maxhenkel.voicechat.api.Group;
|
||||||
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
|
import net.minecraft.command.argument.MessageArgumentType;
|
||||||
|
import net.minecraft.network.message.MessageType;
|
||||||
|
import net.minecraft.network.message.SentMessage;
|
||||||
|
import net.minecraft.server.command.CommandManager;
|
||||||
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Commands {
|
||||||
|
public static void CreateGroupMsgCommand(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) {
|
||||||
|
dispatcher.register(CommandManager
|
||||||
|
.literal("msgvc")
|
||||||
|
.then(CommandManager
|
||||||
|
.argument("message", MessageArgumentType.message())
|
||||||
|
.executes(Commands::runCommand)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int runCommand(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
|
||||||
|
final ServerCommandSource source = ctx.getSource();
|
||||||
|
if(!source.isExecutedByPlayer()) {
|
||||||
|
source.sendError(Text.literal("You can't send msgvc as the console"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
final ServerPlayerEntity player = source.getPlayer();
|
||||||
|
if(!VoiceChatGroupMsg.isPlayerInGroup(player)){
|
||||||
|
source.sendError(Text.literal("You need to be in a voice chat group to use this command"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Group group = VoiceChatGroupMsg.getPlayerGroup(player);
|
||||||
|
List<ServerPlayerEntity> players = VoiceChatGroupMsg.GroupPlayers(group.getId(), source.getWorld());
|
||||||
|
MessageArgumentType.getSignedMessage(ctx, "message", signedMessage -> {
|
||||||
|
player.sendChatMessage(
|
||||||
|
SentMessage.of(signedMessage),
|
||||||
|
true,
|
||||||
|
MessageType.params(MessageType.TEAM_MSG_COMMAND_OUTGOING,source).withTargetName(Text.of(group.getName())));
|
||||||
|
players.forEach(player1 -> {
|
||||||
|
if(!player1.getUuid().equals(player.getUuid())){
|
||||||
|
player1.sendChatMessage(
|
||||||
|
SentMessage.of(signedMessage),
|
||||||
|
true,
|
||||||
|
MessageType.params(MessageType.TEAM_MSG_COMMAND_INCOMING,source).withTargetName(Text.of(group.getName())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package me.lukasabbe.voicechatgroupmsg;
|
||||||
|
|
||||||
|
import de.maxhenkel.voicechat.api.Group;
|
||||||
|
import de.maxhenkel.voicechat.api.VoicechatPlugin;
|
||||||
|
import de.maxhenkel.voicechat.api.VoicechatServerApi;
|
||||||
|
import de.maxhenkel.voicechat.api.events.EventRegistration;
|
||||||
|
import de.maxhenkel.voicechat.api.events.VoicechatServerStartedEvent;
|
||||||
|
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class VoiceChatGroupMsg implements DedicatedServerModInitializer, VoicechatPlugin {
|
||||||
|
public final static String MOD_ID = "voicechatgroupmsg";
|
||||||
|
private static VoicechatServerApi API = null;
|
||||||
|
@Override
|
||||||
|
public void onInitializeServer() {
|
||||||
|
CommandRegistrationCallback.EVENT.register(Commands::CreateGroupMsgCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return MOD_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerEvents(EventRegistration registration) {
|
||||||
|
registration.registerEvent(VoicechatServerStartedEvent.class, this::onServerStarted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onServerStarted(VoicechatServerStartedEvent event) {
|
||||||
|
API = event.getVoicechat();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPlayerInGroup(ServerPlayerEntity player){
|
||||||
|
try{
|
||||||
|
return API.getConnectionOf(player.getUuid()).isInGroup();
|
||||||
|
}catch (NullPointerException ignore){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean isPlayerInGroup(ServerPlayerEntity player, UUID groupID){
|
||||||
|
try{
|
||||||
|
if(!API.getConnectionOf(player.getUuid()).isInGroup()) return false;
|
||||||
|
return API.getConnectionOf(player.getUuid()).getGroup().getId().equals(groupID);
|
||||||
|
|
||||||
|
}catch (NullPointerException ignore){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Group getPlayerGroup(ServerPlayerEntity player){
|
||||||
|
return API.getConnectionOf(player.getUuid()).getGroup();
|
||||||
|
}
|
||||||
|
public static List<ServerPlayerEntity> GroupPlayers(UUID groupUUID, ServerWorld serverWorld){
|
||||||
|
return serverWorld.getPlayers(player -> isPlayerInGroup(player, groupUUID));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"schemaVersion": 1,
|
||||||
|
"id": "voicechatgroupmsg",
|
||||||
|
"version": "${version}",
|
||||||
|
"name": "Voice Chat Group Msg",
|
||||||
|
"description": "Adds a way to message a whole group if you don't have a microphone. When you are in a group you can now use /msgvc <message>",
|
||||||
|
"authors": ["Lukasabbe"],
|
||||||
|
"contact": {
|
||||||
|
"repo": "https://github.com/lukasabbe/VoiceChatGroupMsg"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"icon": "assets/voicechatgroupmsg/icon.png",
|
||||||
|
"environment": "server",
|
||||||
|
"entrypoints": {
|
||||||
|
"server": [
|
||||||
|
"me.lukasabbe.voicechatgroupmsg.VoiceChatGroupMsg"
|
||||||
|
],
|
||||||
|
"voicechat": [
|
||||||
|
"me.lukasabbe.voicechatgroupmsg.VoiceChatGroupMsg"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"depends": {
|
||||||
|
"fabricloader": ">=${loader_version}",
|
||||||
|
"fabric": "*",
|
||||||
|
"minecraft": ">=${minecraft_version}",
|
||||||
|
"voicechat": ">=${minecraft_version}-${voicechat_api_version}"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
name: VoiceChatGroupMsgPlugin
|
|
||||||
version: '1.0+1.21'
|
|
||||||
main: me.lukasabbe.voiceChatGroupMsgPlugin.VoiceChatGroupMsgPlugin
|
|
||||||
api-version: '1.21'
|
|
||||||
authors: [ Lukasabbe ]
|
|
||||||
depend: [ voicechat ]
|
|
||||||
commands:
|
|
||||||
msgvc:
|
|
||||||
description: Send a msg to the voicechat group you are in
|
|
||||||
usage: /<command> message
|
|
||||||
Reference in New Issue
Block a user