removed fallback game, webserver update(...someone rewrite this please im begging)
This commit is contained in:
@ -342,6 +342,8 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||||
|
|
||||||
|
System.out.println(response);
|
||||||
|
|
||||||
if (client.getAccountId() > 0)
|
if (client.getAccountId() > 0)
|
||||||
{
|
{
|
||||||
PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid);
|
PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid);
|
||||||
@ -422,6 +424,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
// JSON sql response
|
// JSON sql response
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||||
|
System.out.println(response);
|
||||||
|
|
||||||
if (client.getAccountId() > 0)
|
if (client.getAccountId() > 0)
|
||||||
{
|
{
|
||||||
@ -502,6 +505,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
// JSON sql response
|
// JSON sql response
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||||
|
System.out.println(response);
|
||||||
|
|
||||||
if (client.getAccountId() > 0)
|
if (client.getAccountId() > 0)
|
||||||
{
|
{
|
||||||
@ -595,6 +599,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
TimingManager.start(client.getName() + " Event.");
|
TimingManager.start(client.getName() + " Event.");
|
||||||
// JSON sql response
|
// JSON sql response
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||||
|
System.out.println(response);
|
||||||
TimingManager.stop(client.getName() + " Event.");
|
TimingManager.stop(client.getName() + " Event.");
|
||||||
|
|
||||||
TimingManager.stop(client.getName() + " LoadClient Total.");
|
TimingManager.stop(client.getName() + " LoadClient Total.");
|
||||||
|
@ -8,7 +8,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
|
|
||||||
public class ServerGroup
|
public class ServerGroup
|
||||||
{
|
{
|
||||||
private HashMap<String, String> _dataMap = null;
|
private HashMap<String, String> _dataMap = null;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public class ServerGroup
|
|||||||
_tournament = Boolean.valueOf(data.get("tournament"));
|
_tournament = Boolean.valueOf(data.get("tournament"));
|
||||||
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
|
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
|
||||||
_hardMaxPlayerCap = Boolean.valueOf(data.get("hardMaxPlayerCap"));
|
_hardMaxPlayerCap = Boolean.valueOf(data.get("hardMaxPlayerCap"));
|
||||||
_games = data.getOrDefault("games", "Smash");
|
_games = data.get("games");
|
||||||
_modes = data.get("modes");
|
_modes = data.get("modes");
|
||||||
_boosterGroup = data.get("boosterGroup");
|
_boosterGroup = data.get("boosterGroup");
|
||||||
_serverType = data.getOrDefault("serverType", "dedicated");
|
_serverType = data.getOrDefault("serverType", "dedicated");
|
||||||
|
@ -8,24 +8,14 @@ fastify.register(require('fastify-mysql'), {
|
|||||||
connectionString: 'mysql://root:root@localhost/account'
|
connectionString: 'mysql://root:root@localhost/account'
|
||||||
})
|
})
|
||||||
|
|
||||||
fastify.post('/PlayerAccount/GetAccountByUUID', {
|
async function loginByName(name) {
|
||||||
schema: {
|
console.log(`Geting info: ${name}`)
|
||||||
body: {
|
|
||||||
type: 'string',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, async (request, reply) => {
|
|
||||||
const connection = await fastify.mysql.getConnection()
|
const connection = await fastify.mysql.getConnection()
|
||||||
const accountResult = await connection.query(
|
const accountResult = await connection.query(
|
||||||
'SELECT * FROM accounts WHERE uuid=?', [request.body],
|
'SELECT * FROM accounts WHERE name=?', [name],
|
||||||
);
|
);
|
||||||
|
|
||||||
const account = accountResult[0][0];
|
const account = accountResult[0][0];
|
||||||
const accountRankResult = await connection.query(
|
|
||||||
'SELECT * FROM accountranks WHERE accountId=?', [account.id],
|
|
||||||
);
|
|
||||||
|
|
||||||
const accountRank = accountRankResult[0][0];
|
|
||||||
|
|
||||||
const accountDonor = {
|
const accountDonor = {
|
||||||
Gems: account.gems,
|
Gems: account.gems,
|
||||||
@ -55,17 +45,89 @@ fastify.post('/PlayerAccount/GetAccountByUUID', {
|
|||||||
});
|
});
|
||||||
connection.release();
|
connection.release();
|
||||||
console.log(`Logging in: ${account.id} | ${account.name}`)
|
console.log(`Logging in: ${account.id} | ${account.name}`)
|
||||||
//Punishment
|
|
||||||
return {
|
const accountRankResult = await connection.query(
|
||||||
|
'SELECT * FROM accountranks WHERE accountId=?', [account.id],
|
||||||
|
);
|
||||||
|
|
||||||
|
const rsp = {
|
||||||
AccountId: account.id,
|
AccountId: account.id,
|
||||||
LastLogin: new Date().getTime(),
|
LastLogin: new Date().getTime(),
|
||||||
Name: account.name,
|
Name: account.name,
|
||||||
Rank: accountRank.rankIdentifier,
|
Rank: "all",
|
||||||
DonorToken: accountDonor,
|
DonorToken: accountDonor,
|
||||||
Time: 0,
|
Time: 0,
|
||||||
Punishments: accountPunishments
|
Punishments: accountPunishments
|
||||||
|
}
|
||||||
|
const accountRank = accountRankResult[0][0];
|
||||||
|
if(accountRank) rsp.Rank = accountRank.rankIdentifier;
|
||||||
|
return rsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function loginByUuid(uuid) {
|
||||||
|
console.log(`Geting info: ${uuid}`)
|
||||||
|
const connection = await fastify.mysql.getConnection()
|
||||||
|
const accountResult = await connection.query(
|
||||||
|
'SELECT * FROM accounts WHERE uuid=?', [uuid],
|
||||||
|
);
|
||||||
|
|
||||||
|
const account = accountResult[0][0];
|
||||||
|
|
||||||
|
const accountDonor = {
|
||||||
|
Gems: account.gems,
|
||||||
|
Coins: account.coins,
|
||||||
|
SalesPackages: [],
|
||||||
|
UnknownSalesPackages: [],
|
||||||
|
Transactions: [],
|
||||||
|
CoinRewards: []
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
const accountPunishmentsResult = await connection.query(
|
||||||
|
'SELECT * FROM accountpunishments WHERE target=?', [account.name],
|
||||||
|
);
|
||||||
|
|
||||||
|
const accountPunishments = [];
|
||||||
|
|
||||||
|
accountPunishmentsResult[0].forEach(punishment => {
|
||||||
|
accountPunishments.push({
|
||||||
|
PunishmentId: punishment.id,
|
||||||
|
Admin: punishment.admin,
|
||||||
|
Sentence: punishment.sentence,
|
||||||
|
Reason: punishment.reason,
|
||||||
|
Duration: punishment.duration,
|
||||||
|
Admin: punishment.admin,
|
||||||
|
Severity: punishment.severity
|
||||||
|
});
|
||||||
|
});
|
||||||
|
connection.release();
|
||||||
|
console.log(`Logging in: ${account.id} | ${account.name}`)
|
||||||
|
|
||||||
|
const accountRankResult = await connection.query(
|
||||||
|
'SELECT * FROM accountranks WHERE accountId=?', [account.id],
|
||||||
|
);
|
||||||
|
|
||||||
|
const rsp = {
|
||||||
|
AccountId: account.id,
|
||||||
|
LastLogin: new Date().getTime(),
|
||||||
|
Name: account.name,
|
||||||
|
Rank: "all",
|
||||||
|
DonorToken: accountDonor,
|
||||||
|
Time: 0,
|
||||||
|
Punishments: accountPunishments
|
||||||
|
}
|
||||||
|
const accountRank = accountRankResult[0][0];
|
||||||
|
if(accountRank) rsp.Rank = accountRank.rankIdentifier;
|
||||||
|
return rsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
fastify.post('/PlayerAccount/GetAccountByUUID', {
|
||||||
|
schema: {
|
||||||
|
body: {
|
||||||
|
type: 'string',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, async (request, reply) => await loginByUuid(request.body));
|
||||||
|
|
||||||
fastify.post('/PlayerAccount/GetAccount', {
|
fastify.post('/PlayerAccount/GetAccount', {
|
||||||
schema: {
|
schema: {
|
||||||
@ -73,8 +135,7 @@ fastify.post('/PlayerAccount/GetAccount', {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, async (request, reply) => {
|
}, async (request, reply) => await loginByName(request.body));
|
||||||
});
|
|
||||||
|
|
||||||
fastify.post('/PlayerAccount/Login', {
|
fastify.post('/PlayerAccount/Login', {
|
||||||
schema: {
|
schema: {
|
||||||
@ -89,60 +150,7 @@ fastify.post('/PlayerAccount/Login', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async (request, reply) => {
|
async (request, reply) => await loginByUuid(request.body.Uuid));
|
||||||
const connection = await fastify.mysql.getConnection()
|
|
||||||
|
|
||||||
const loginToken = request.body;
|
|
||||||
const accountResult = await connection.query(
|
|
||||||
'SELECT * FROM accounts WHERE uuid=?', [loginToken.Uuid],
|
|
||||||
);
|
|
||||||
|
|
||||||
const account = accountResult[0][0];
|
|
||||||
const accountRankResult = await connection.query(
|
|
||||||
'SELECT * FROM accountranks WHERE accountId=?', [account.id],
|
|
||||||
);
|
|
||||||
|
|
||||||
const accountRank = accountRankResult[0][0];
|
|
||||||
|
|
||||||
const accountDonor = {
|
|
||||||
Gems: account.gems,
|
|
||||||
Coins: account.coins,
|
|
||||||
SalesPackages: [],
|
|
||||||
UnknownSalesPackages: [],
|
|
||||||
Transactions: [],
|
|
||||||
CoinRewards: []
|
|
||||||
};
|
|
||||||
|
|
||||||
const accountPunishmentsResult = await connection.query(
|
|
||||||
'SELECT * FROM accountpunishments WHERE target=?', [account.name],
|
|
||||||
);
|
|
||||||
|
|
||||||
const accountPunishments = [];
|
|
||||||
|
|
||||||
accountPunishmentsResult[0].forEach(punishment => {
|
|
||||||
accountPunishments.push({
|
|
||||||
PunishmentId: punishment.id,
|
|
||||||
Admin: punishment.admin,
|
|
||||||
Sentence: punishment.sentence,
|
|
||||||
Reason: punishment.reason,
|
|
||||||
Duration: punishment.duration,
|
|
||||||
Admin: punishment.admin,
|
|
||||||
Severity: punishment.severity
|
|
||||||
});
|
|
||||||
});
|
|
||||||
connection.release();
|
|
||||||
console.log(`Logging in: ${account.id} | ${account.name}`)
|
|
||||||
//Punishment
|
|
||||||
return {
|
|
||||||
AccountId: account.id,
|
|
||||||
LastLogin: new Date().getTime(),
|
|
||||||
Name: account.name,
|
|
||||||
Rank: accountRank.rankIdentifier,
|
|
||||||
DonorToken: accountDonor,
|
|
||||||
Time: 0,
|
|
||||||
Punishments: accountPunishments
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
fastify.post('/PlayerAccount/Punish', {
|
fastify.post('/PlayerAccount/Punish', {
|
||||||
schema: {
|
schema: {
|
||||||
|
Reference in New Issue
Block a user