Auth Object

This commit is contained in:
71616 2018-11-15 14:57:07 +01:00
parent 8ec66238aa
commit 68dd59b519
5 changed files with 33 additions and 4 deletions

3
.gitignore vendored
View File

@ -86,4 +86,5 @@ com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Created by .ignore support plugin (hsz.mobi)
# Created by .ignore support plugin (hsz.mobi)
/target/

13
pom.xml
View File

@ -8,6 +8,18 @@
<artifactId>teamspeak</artifactId>
<version>1.0-SNAPSHOT</version>
<organization>
<name>Tysox.de</name>
<url>tysox.de</url>
</organization>
<developers>
<developer>
<name>Jan-Lukas Pagel</name>
<email>jan-lukas.pagel@tysox.de</email>
</developer>
</developers>
<repositories>
<repository>
@ -82,4 +94,5 @@
</plugins>
</build>
</project>

View File

@ -6,7 +6,7 @@ import java.io.File;
import java.io.IOException;
/**
* Created by jan on 25.07.16.
* Created by Jan-Lukas Pagel on 25.07.16.
*
* @version 4.0
*/

View File

@ -1,6 +1,9 @@
package cf.semikolon.teamspeak.query;
import cf.semikolon.teamspeak.MainClass;
import cf.semikolon.teamspeak.Messages;
import cf.semikolon.teamspeak.objects.Authentication;
import com.github.theholywaffle.teamspeak3.api.TextMessageTargetMode;
import com.github.theholywaffle.teamspeak3.api.event.*;
import org.bukkit.Bukkit;
@ -30,8 +33,21 @@ public class QueryEvents implements TS3Listener {
Player player = Bukkit.getPlayer(mcNick);
if (player != null) {
String authKey = MainClass.getInstance().getRandomString().nextString();
player.sendMessage("§9[TeamSpeakAuth] §7Dein Verifizierungscode:" + authKey);
Authentication authentication = new Authentication(player.getUniqueId(), authKey);
player.sendMessage(Messages.PREFIX + String.format(Messages.YOUR_VERIFY_CODE, authKey));
MainClass.getInstance().getServerQuery().getApi().sendPrivateMessage(textMessageEvent.getInvokerId(), "Sie haben nun in Minecraft eine VerifizierungsNummer erhalten");
} else {
/**
* Spieler nicht Online
*/
}
} else {
/**
* Keine korrekte Syntax
*/
}
}
}

View File

@ -17,7 +17,6 @@ public class ServerQuery {
public ServerQuery(String host, int queryPort, int tsPort, String queryUser, String queryPassword, String nickname) {
this.tsconfig.setHost(host);
this.tsconfig.setQueryPort(queryPort);
this.tsconfig.setDebugLevel(Level.ALL);
this.query = new TS3Query(tsconfig);
this.query.connect();
System.out.println("Successfully connected to TeamSpeak!\n Logging in...");