Skip to content

Commit

Permalink
~ initial
Browse files Browse the repository at this point in the history
  • Loading branch information
jusito committed Oct 21, 2019
1 parent e679c8c commit 989d365
Show file tree
Hide file tree
Showing 12 changed files with 746 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
.gitignore
LICENSE
README.md
bin/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
bin/
.settings/
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TTT_Voice_Sync</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM maven:3.6.2-jdk-8

COPY . /home/

RUN cd /home/ && \
mvn clean package

FROM openjdk:8-jre-alpine

COPY --from=0 "/home/target/ttt_voice_sync-*-jar-with-dependencies.jar" "/home/ttt_voice_sync.jar"

WORKDIR "/home/"

ENV TTTHost="" \
TTTPort="27015" \
TTTRconPassword="" \
RefreshTimeMS=250 \
VoiceHost="" \
VoiceQueryPort=10011 \
VoiceServerID=1 \
VoiceChannelName="" \
VoiceTargetGroupName="dead" \
VoiceDefaultGroupName="alive" \
VoiceBotName="VoiceSync" \
VoiceLoginName="serveradmin" \
VoiceLoginPassword=""

ENTRYPOINT ["java", "-jar", "ttt_voice_sync.jar" ]
CMD [ "env" ]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 jusito

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.
79 changes: 77 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,77 @@
# TTT_Voice_Sync
Tool to mute ppl on TS3 as fast as possible.
# ttt\_voice\_sync
Synchronizing your voice state with TTT server.

# What is this?
If you play TTT and using TS3, you can use this tool to sync death state to TS3. If set up, the players only need to set their name on TS same as ingame. No longer someone screams in TS after dead.

# How to get it working?
## Prepare your teamspeak server
1. Create two copies of channelgroup Guest, name it alive & dead.
2. Change permission of channel group dead `Client - talk power to speak, value 0` & `Client - channel group rights skip, value [ ](false/empty)`
3. Create a moderated channel with needed talk power of 1
4. Because unknown players are still default channelgroup Guest, give the default channel group Guest talk power of at least 1
5. Join the channel and check if you can speak with Guest / alive and can't speak with channel group dead.

## How to use in docker / java

### Example 1: use environment variables in docker
```
docker run -d \
-e TTTHost="1.2.3.4" -e TTTRconPassword="MySecurePW" \
-e VoiceHost="2.3.4.5" \
-e VoiceChannelName="MyModeratedGameChannel" \
-e VoiceLoginName="VoiceSync" -e VoiceLoginPassword="AnotherSecurePW" \
jusito/ttt_voice_sync:latest
```

### Example 2: use environment variables with plain jar
```
java -jar ttt_voice_sync.jar env
```

### Example 3: docker with each argument explicit
```
docker run -d \
jusito/ttt_voice_sync:latest \
"TTTHost" "TTTPort" "TTTRconPassword" \
"RefreshTimeMS" \
"VoiceHost" "VoiceQueryPort" "VoiceServerID" "VoiceChannelName" \
"VoiceTargetGroupName" "VoiceDefaultGroupName" \
"VoiceBotName" "VoiceLoginName" "VoiceLoginPassword"
```

### Example 4: java with each argument explicit
```
java -jar ttt_voice_sync.jar \
"TTTHost" "TTTPort" "TTTRconPassword" \
"RefreshTimeMS" \
"VoiceHost" "VoiceQueryPort" "VoiceServerID" "VoiceChannelName" \
"VoiceTargetGroupName" "VoiceDefaultGroupName" \
"VoiceBotName" "VoiceLoginName" "VoiceLoginPassword"
```

## Environment variables

|Variable|Default|Description|
|--------|-------|-----------|
|TTTHost||IP to your TTT server|
|TTTPort|27015|TCP Port for RCON, most of the time game port|
|TTTRconPassword||password to your RCON|
|RefreshTimeMS|250|Time between two syncs (if to low crashes may occur)|
|VoiceHost||IP to your TS3 server|
|VoiceQueryPort|10011|Port to serverquery|
|VoiceServerID|1|Virtual server id|
|VoiceChannelName||Name of the channel to join|
|VoiceTargetGroupName|dead|Channelgroup for dead state|
|VoiceDefaultGroupName|alive|Channelgroup for alive state(careful with Guest if you have multiple virtual server)|
|VoiceBotName|VoiceSync|Name for the tool on your TS server|
|VoiceLoginName|serveradmin|server query login name|
|VoiceLoginPassword||server query login password|

## How to use ingame
1. Set your name in Teamspeak the same as ingame, you are done.
2. If the round is over, but still someone is dead, enter the chat `!reset` if the tool is ok, it will set all alive and write in the channel.

# Credits
* (koraktor github.com)[https://github.com/koraktor/steam-condenser-java]
* (TheHolyWaffle github.com)[https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API]
70 changes: 70 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.de.jusito</groupId>
<artifactId>ttt_voice_sync</artifactId>
<version>1.0.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>

<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version> <!-- 2.6/3.1.0 -->
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.github.jusito.teamspeak.ttt_voice_sync.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.github.theholywaffle</groupId>
<artifactId>teamspeak3-api</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.github.koraktor</groupId>
<artifactId>steam-condenser</artifactId>
<version>1.3.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.github.jusito.teamspeak.ttt_voice_sync;

public class Config {
public final String TTTHost;
public final int TTTPort;
public final String TTTRconPassword;
public final int RefreshTimeMS;

public final String VoiceHost;
public final int VoiceQueryPort;
public final int VoiceServerID;
public final String VoiceChannelName;
public final String VoiceTargetGroupName;
public final String VoiceDefaultGroupName;

public final String VoiceBotName;
public final String VoiceLoginName;
public final String VoiceLoginPassword;



Config(final String[] args) {
final boolean useEnvironmentVariables = args.length == 1 && args[0].equals("env");

if (args == null || (args.length != 13 && !useEnvironmentVariables )) {
throw new IllegalArgumentException("java -jar ttt_voice_sync.jar " +
"TTTHost TTTPort TTTRconPassword " +
"RefreshTimeMS " +
"VoiceHost VoiceQueryPort VoiceServerID " +
"VoiceChannelName VoiceTargetGroupName VoiceDefaultGroupName " +
"VoiceBotName VoiceLoginName VoiceLoginPassword (given " + args.length + "/13)" +
"\n or java -jar ttt_voice_sync.jar env (you need to provide equal named env variables)");
}

this.TTTHost = useEnvironmentVariables ? System.getenv("TTTHost") : args[0];
this.TTTPort = Integer.parseInt(useEnvironmentVariables ? System.getenv("TTTPort") : args[1]);
this.TTTRconPassword = useEnvironmentVariables ? System.getenv("TTTRconPassword") : args[2];
this.RefreshTimeMS = Integer.parseInt(useEnvironmentVariables ? System.getenv("RefreshTimeMS") : args[3]);

this.VoiceHost = useEnvironmentVariables ? System.getenv("VoiceHost") : args[4];
this.VoiceQueryPort = Integer.parseInt(useEnvironmentVariables ? System.getenv("VoiceQueryPort") : args[5]);
this.VoiceServerID = Integer.parseInt(useEnvironmentVariables ? System.getenv("VoiceServerID") : args[6]);
this.VoiceChannelName = useEnvironmentVariables ? System.getenv("VoiceChannelName") : args[7];
this.VoiceTargetGroupName = useEnvironmentVariables ? System.getenv("VoiceTargetGroupName") : args[8];
this.VoiceDefaultGroupName = useEnvironmentVariables ? System.getenv("VoiceDefaultGroupName") : args[9];

this.VoiceBotName = useEnvironmentVariables ? System.getenv("VoiceBotName") : args[10];
this.VoiceLoginName = useEnvironmentVariables ? System.getenv("VoiceLoginName") : args[11];
this.VoiceLoginPassword = useEnvironmentVariables ? System.getenv("VoiceLoginPassword") : args[12];
}
}
Loading

0 comments on commit 989d365

Please sign in to comment.