Auth Object

This commit is contained in:
71616 2018-11-15 14:59:08 +01:00
parent 68dd59b519
commit a6a2d77c4e
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,10 @@
package cf.semikolon.teamspeak;
public class Messages
{
public final static String PREFIX = "§9[TeamSpeakAuth]";
public final static String YOUR_VERIFY_CODE ="§7Dein Verifizierungscode: %s";
}

View File

@ -0,0 +1,20 @@
package cf.semikolon.teamspeak.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class VerifyCommand implements CommandExecutor
{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(sender instanceof Player) {
}
return false;
}
}

View File

@ -0,0 +1,64 @@
package cf.semikolon.teamspeak.objects;
import java.util.ArrayList;
import java.util.UUID;
public class Authentication
{
private static ArrayList<Authentication> list = new ArrayList<>();
private UUID uuid;
private String authKey;
public Authentication(UUID uuid, String authKey)
{
this.uuid = uuid;
this.authKey = authKey;
this.list.add(this);
}
public UUID getUUID()
{
return uuid;
}
public String getUUIDString()
{
return uuid.toString();
}
public String getAuthKey()
{
return authKey;
}
public boolean authenticate(String authKey) {
if(this.authKey.equals(authKey)) {
this.list.remove(this);
return true;
}
return false;
}
public static Authentication getAuthenticationbyUUID(UUID uuid) {
for (Authentication authentication : list)
{
if(authentication.getUUID().equals(uuid)) {
return authentication;
}
}
return null;
}
public static Authentication getAuthenticationbyUUID(String uuid) {
for (Authentication authentication : list)
{
if(authentication.getUUID().toString().equals(uuid)) {
return authentication;
}
}
return null;
}
}