Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.ZockTV.AuraPVP.System;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import de.sentostv.venoriaapi.VenoriaDB;
- public class Stats_System {
- public static void createData(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (!VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- VenoriaDB.update("INSERT INTO AuraPVP (Name, UUID, Kills, Deaths, Wins, Plays) VALUES ('" + name + "', '" + uuid + "', 0, 0, 0, 0)");
- }
- }
- }
- public static int getKills(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- return VenoriaDB.Query.returnInt("Kills", "AuraPVP", uuid, "uuid");
- }
- }
- return -1;
- }
- public static int getDeaths(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- return VenoriaDB.Query.returnInt("Deaths", "AuraPVP", uuid, "uuid");
- }
- }
- return -1;
- }
- public static int getWins(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- return VenoriaDB.Query.returnInt("Wins", "AuraPVP", uuid, "uuid");
- }
- }
- return -1;
- }
- public static int getPlays(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- return VenoriaDB.Query.returnInt("Plays", "AuraPVP", uuid, "uuid");
- }
- }
- return -1;
- }
- public static void addKills(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- VenoriaDB.update("UPDATE AuraPVP SET Kills = " + (getKills(name) + 1) + " WHERE UUID = '" + uuid + "'");
- }
- }
- }
- public static void addDeaths(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- VenoriaDB.update("UPDATE AuraPVP SET Deaths = " + (getDeaths(name) + 1) + " WHERE UUID = '" + uuid + "'");
- }
- }
- }
- public static void addWins(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- VenoriaDB.update("UPDATE AuraPVP SET Wins = " + (getWins(name) + 1) + " WHERE UUID = '" + uuid + "'");
- }
- }
- }
- public static void addPlays(String name) {
- if (VenoriaDB.Query.isRegistered(name, "Name", "users")) {
- String uuid = VenoriaDB.Query.returnString("UUID", "users", "Name", name);
- if (VenoriaDB.Query.isRegistered(name, "Name", "AuraPVP")) {
- VenoriaDB.update("UPDATE AuraPVP SET Plays = " + (getPlays(name) + 1) + " WHERE UUID = '" + uuid + "'");
- }
- }
- }
- public static String getUUIDFromName(String name) {
- try {
- Statement statement = VenoriaDB.connection.createStatement();
- ResultSet resultSet = statement.executeQuery("SELECT uuid FROM users WHERE name = '" + name + "'");
- if (resultSet.next()) {
- return resultSet.getString(1);
- }
- } catch (SQLException e) {
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement