18 Commits

Author SHA1 Message Date
lukas 0445b23bb2 26.1 2026-03-26 15:03:35 +01:00
lukasabbe 075bfd21b2 1.21.11 2025-12-09 19:19:40 +01:00
lukasabbe dd8cf78b93 Fixed up the code a bit 2025-04-22 19:37:13 +02:00
Lukas 9dcededc87 Merge pull request #3 from lukasabbe/1.21.5
1.21.5
2025-04-22 18:37:03 +02:00
lukasabbe 82b94c78ee 1.21.5 2025-04-22 18:37:59 +02:00
Lukas 74a0712878 Merge pull request #2 from lukasabbe/1.21.5
1.21.5
2025-03-25 21:27:10 +01:00
lukasabbe 7075963597 1.21.4 2024-11-29 22:47:12 +01:00
lukasabbe 1c487409a1 1.21.2 version 2024-10-22 19:22:07 +02:00
Lukas da64223e29 Merge pull request #1 from lukasabbe/1.21.2
1.21.2
2024-10-22 19:18:03 +02:00
Lukas e3141bef06 1.21.2-pre4 2024-10-15 18:23:01 +02:00
Lukas 2b650b5e89 Gradle wrapper 2024-10-14 10:27:25 +02:00
Lukas 7633b6918d Loom bump 2024-10-14 10:26:21 +02:00
Lukas 434e07e62e 1.21.2-pre3 2024-10-14 10:24:40 +02:00
lukasabbe c3116f0f6f fixed so it works with newers versions 2024-08-08 22:05:54 +02:00
lukasabbe 0e084d7e7c check on code, fixed some cursed formating 2024-08-07 21:00:51 +02:00
Lukas 684af95851 Create README.md 2024-07-19 18:19:23 +02:00
lukasabbe 33396fc5e2 Fixed so Incoming and outgoing messages are using team commands message type 2024-07-19 18:03:47 +02:00
lukasabbe 31314430f3 First commit 2024-07-19 17:42:12 +02:00
16 changed files with 322 additions and 135 deletions
+44
View File
@@ -0,0 +1,44 @@
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/
- name: Read values from gradle properties file
id: read_property
uses: christian-draeger/read-properties@1.1.1
with:
path: "./gradle.properties"
properties: "mod_version minecraft_version archives_base_name"
- name: Upload artifacts to discord
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
content: "Git hub action build. **THIS MAY NOT BE A FUNCTIONAL BUILD**\nMod: ${{steps.read_property.outputs.archives_base_name}}\nMCVersion: ${{steps.read_property.outputs.minecraft_version}}\nMod version: ${{steps.read_property.outputs.mod_version}}"
filename: build/libs/${{ steps.read_property.outputs.archives_base_name }}-${{steps.read_property.outputs.mod_version}}.jar
-1
View File
@@ -113,7 +113,6 @@ gradle-app.setting
# Common working directory
run/
runs/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
+21
View File
@@ -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.
+5
View File
@@ -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>
+55 -37
View File
@@ -1,52 +1,70 @@
plugins {
id 'java'
id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT'
id 'maven-publish'
}
group = 'me.lukasabbe'
version = '1.0+1.21'
version = project.mod_version
group = project.maven_group
base {
archivesName = project.archives_base_name
}
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 {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
implementation("de.maxhenkel.voicechat:voicechat-api:2.5.0")
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
def targetJavaVersion = 21
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)
}
// Simple Voice chat
implementation "de.maxhenkel.voicechat:voicechat-api:${voicechat_api_version}"
runtimeOnly "maven.modrinth:simple-voice-chat:fabric-${voicechat_version}"
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
inputs.property "voicechat_api_version", project.voicechat_api_version
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 = 25
tasks.withType(JavaCompile).configureEach {
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)
}
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archives_base_name}"}
}
}
+21
View File
@@ -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=26.1
loader_version=0.18.5
# Mod Properties
mod_version = 1.1+26.1
maven_group = me.lukasabbe
archives_base_name = VoiceChatGroupMsg
#mod dev
voicechat_version=2.6.12+26.1
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.144.3+26.1
#https://maven.maxhenkel.de/#/releases/de/maxhenkel/voicechat/voicechat-api
voicechat_api_version=2.6.0
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -1
View File
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (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.
#
# You can find Gradle at https://github.com/gradle/gradle/.
+9 -1
View File
@@ -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,19 @@
package me.lukasabbe.voicechatgroupmsg;
import me.lukasabbe.voicechatgroupmsg.command.MsgVcCommand;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
public class VoiceChatGroupMsg implements DedicatedServerModInitializer {
public final static String MOD_ID = "voicechatgroupmsg";
@Override
public void onInitializeServer() {
registerCommands();
}
private static void registerCommands() {
CommandRegistrationCallback.EVENT.register(MsgVcCommand::CreateGroupMsgCommand);
}
}
@@ -0,0 +1,64 @@
package me.lukasabbe.voicechatgroupmsg.command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import de.maxhenkel.voicechat.api.Group;
import me.lukasabbe.voicechatgroupmsg.util.VoiceChatUtil;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.MessageArgument;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.OutgoingChatMessage;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerPlayer;
import java.util.List;
public class MsgVcCommand {
public static void CreateGroupMsgCommand(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) {
dispatcher.register(
Commands
.literal("msgvc")
.requires(CommandSourceStack::isPlayer)
.then(
Commands
.argument("message", MessageArgument.message())
.executes(MsgVcCommand::runCommand)));
}
private static int runCommand(CommandContext<CommandSourceStack> ctx) throws CommandSyntaxException {
final CommandSourceStack source = ctx.getSource();
final ServerPlayer player = source.getPlayer();
if(!VoiceChatUtil.isPlayerInGroup(player)){
source.sendFailure(Component.literal("You need to be in a voice chat group to use this command"));
return 0;
}
Group group = VoiceChatUtil.getPlayerGroup(player);
List<ServerPlayer> players = VoiceChatUtil.GroupPlayers(group.getId(), source.getLevel());
MessageArgument.resolveChatMessage(ctx, "message", signedMessage -> {
sendMessage(player, signedMessage, ChatType.TEAM_MSG_COMMAND_OUTGOING, source, group);
players.forEach(voiceChatMember -> {
if(voiceChatMember.getUUID().equals(player.getUUID())) return;
sendMessage(voiceChatMember, signedMessage, ChatType.TEAM_MSG_COMMAND_INCOMING, source, group);
});
});
return 1;
}
private static void sendMessage(ServerPlayer player, PlayerChatMessage signedMessage, ResourceKey<ChatType> teamMsgCommandOutgoing, CommandSourceStack source, Group group) {
player.sendChatMessage(
OutgoingChatMessage.create(signedMessage),
true,
ChatType.bind(teamMsgCommandOutgoing, source)
.withTargetName(Component.nullToEmpty(group.getName()))
);
}
}
@@ -0,0 +1,56 @@
package me.lukasabbe.voicechatgroupmsg.util;
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.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import java.util.List;
import java.util.UUID;
import static me.lukasabbe.voicechatgroupmsg.VoiceChatGroupMsg.MOD_ID;
public class VoiceChatUtil implements VoicechatPlugin {
private static VoicechatServerApi API = null;
@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(ServerPlayer player){
try{
return API.getConnectionOf(player.getUUID()).isInGroup();
}catch (NullPointerException ignore){
return false;
}
}
public static boolean isPlayerInGroup(ServerPlayer 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(ServerPlayer player){
return API.getConnectionOf(player.getUUID()).getGroup();
}
public static List<ServerPlayer> GroupPlayers(UUID groupUUID, ServerLevel serverWorld){
return serverWorld.getPlayers(player -> isPlayerInGroup(player, groupUUID));
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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.util.VoiceChatUtil"
]
},
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": ">=${minecraft_version}"
}
}
-10
View File
@@ -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