OSPL20 will be replaced with MPL2.0 after 1st February 2021! Read more here
OSPL18 and OSPL19 will be replaced with MIT after 1st February2021! Read more here

Verified Commit 8674b714 authored by AtjonTV's avatar AtjonTV

Release 3.4.0

* Added
  * Sending Plugin Version to remote for statistics
  * Adding in '/aaab token <token>' command
  * Implemented remote and refresh_limit usage
Signed-off-by: AtjonTV's avatarAtjonTV <thomas.obernosterer@atvg-studios.com>
parent 4b3c83b2
......@@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
[3.4.0] - 02.06.2019
### Added
* Sending Plugin Version to remote for statistics
* Adding in '/aaab token <token>' command
* Implemented remote and refresh_limit usage
[3.3.0] - 01.06.2019
### Added
......
......@@ -12,7 +12,7 @@ plugins {
}
group 'com.atvgstudios'
version '3.3.0'
version '3.4.0'
repositories {
mavenCentral()
......
package com.atvgstudios.aaab
import com.atvgstudios.aaab.api.UserAPI
import com.atvgstudios.aaab.extensions.sendMsg
import klib.annotations.Experimental
import org.bukkit.command.Command
......@@ -14,10 +15,15 @@ class Commands : CommandExecutor {
if(cmd.name == "aaab") {
if(params.isNotEmpty()) {
when{
params[0] == "settings" && sender.hasPermission("aaab.see_settings") -> {
params[0] == "settings" && sender.hasPermission("aaab.see_settings") -> {
Console.log("Player ${sender.name} issued command '/aaab settings', got: ${Config.configs}")
sender.sendMsg("Settings: ${Config.configs}")
}
params[0] == "token" && params[1].length == 16 -> {
Console.log("Player ${sender.name} issued command '/aaab token ${params[1]}', sending to remote")
UserAPI.sendToken(params[1])
sender.sendMsg("The token has been send to the AAAB-Server!")
}
else -> {
Console.log("Player ${sender.name} tried issued command '/aaab ${params[0]}', but has no perms or the command is unknown")
return false
......
package com.atvgstudios.aaab
import com.atvgstudios.aaab.api.UserAPI
import klib.annotations.Experimental
import klib.objects.Konfig
import java.io.File
......@@ -16,6 +17,14 @@ object Config {
for (config in fileData) {
configs[config.key] = config.value
}
if("remote" in configs) {
UserAPI.remote = configs["remote"] as String
}
if("refresh_limit" in configs) {
Listener.refreshCount = Integer.parseInt(configs["refresh_limit"] as String)
}
}
}
......
......@@ -12,7 +12,10 @@ import org.bukkit.event.player.PlayerJoinEvent
class Listener : Listener {
private val cosnixDB = CosnixDB(CacheDB.DATABASE_KEY)
private var joinCount = 0
private val refreshCount = 10
companion object {
var refreshCount = 10
}
@EventHandler
fun onPlayerJoin(e: PlayerJoinEvent) {
......
......@@ -3,6 +3,7 @@ package com.atvgstudios.aaab
import com.atvgstudios.aaab.api.UserAPI
import com.atvgstudios.aaab.db.CacheDB
import com.atvgstudios.cosnixdb.CosnixDB
import com.github.kittinunf.fuel.Fuel
import com.google.gson.Gson
import klib.annotations.Experimental
import klib.interfaces.Json
......@@ -14,7 +15,7 @@ import java.lang.reflect.Type
@Experimental
class Plugin : JavaPlugin() {
companion object {
var version: String = "3.3.0"
var version: String = "3.4.0"
val prefix = "AAAB-v3 »"
}
......@@ -22,6 +23,7 @@ class Plugin : JavaPlugin() {
Console.log("Initializing AAAB-v3 [Running: $version]")
createkLibJsonHandler()
Config.loadConfig()
val cosnixDB = CosnixDB(CacheDB.DATABASE_KEY)
cosnixDB[CacheDB.PROFILES_KEY] = UserAPI.getAll()
......@@ -31,8 +33,6 @@ class Plugin : JavaPlugin() {
version = Bukkit.getServer().pluginManager.getPlugin("AAAB-v3")?.description?.version ?: version
Config.loadConfig()
Console.log("Initialized AAAB-v3!")
Updater.update()
......
package com.atvgstudios.aaab.api
import com.atvgstudios.aaab.Console
import com.atvgstudios.aaab.Plugin
import com.atvgstudios.aaab.extensions.setDefaultHeaders
import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.gson.responseObject
import com.google.gson.reflect.TypeToken
import klib.annotations.Experimental
import klib.kLibInf
import org.bukkit.Bukkit
@Experimental
object UserAPI {
var remote = "https://aaab-online.xyz"
fun isBanned(uuid: String): Boolean {
val f = Fuel.get("$remote/i/$uuid")
.setDefaultHeaders()
.responseObject<UserResponse>()
Console.log("Checking: $remote/i/$uuid")
......@@ -20,8 +26,15 @@ object UserAPI {
return res?.ok ?: false
}
fun sendToken(token: String) {
val f = Fuel.get("$remote/t/$token")
.setDefaultHeaders()
.responseString()
}
fun getAfter(num: Int): List<Profile> {
val f = Fuel.get("$remote/a/$num")
.setDefaultHeaders()
.responseString()
println("Syncing with $remote on $num")
......@@ -39,6 +52,7 @@ object UserAPI {
fun getAll(): List<Profile> {
val f = Fuel.get("$remote/a")
.setDefaultHeaders()
.responseString()
Console.log("Syncing with $remote")
......
package com.atvgstudios.aaab.extensions
import com.atvgstudios.aaab.Plugin
import com.github.kittinunf.fuel.core.Request
import klib.extensions.asSha256
import org.bukkit.Bukkit
fun Request.setDefaultHeaders(): Request {
return this
.header("X-Client-Type", "Plugin")
.header("X-Client-Version", Plugin.version)
}
\ No newline at end of file
......@@ -2,17 +2,20 @@ main: com.atvgstudios.aaab.Plugin
name: AAAB-v3
description: This is the third generation of AAAB that uses a completly new online API and is more performant.
author: Thomas Obernosterer <thomas.obernosterer@atvg-studios.com>
version: 3.3.0
version: 3.4.0
website: https://aaab-online.xyz
commands:
aaab:
description: Plugin commands
usage: /<command> [settings]
usage: /aaab [settings, token]
settings:
description: Get information about the AAAB Plugin Configs
usage: /aaab <command>
usage: /aaab settings
permission: aaab.see_settings
token:
description: Send a token to the Plugin's Server
usage: /aaab token <token>
permissions:
aaab.*:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment