1package com.runehive.game.service;
3import com.runehive.Config;
4import com.runehive.game.world.WorldType;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.entity.mob.player.PlayerRight;
7import com.runehive.game.world.entity.skill.Skill;
8import org.apache.logging.log4j.LogManager;
9import org.apache.logging.log4j.Logger;
11import java.sql.Connection;
12import java.sql.DriverManager;
13import java.sql.PreparedStatement;
14import java.sql.SQLException;
22 private static final String
PASSWORD =
"bQ9R#UnPsW5^HLiU9$4LcJvE4%ZwJWLz";
30 PreparedStatement dsta = connection.prepareStatement(
"DELETE FROM hs_users WHERE id = ?");
31 PreparedStatement ista = connection.prepareStatement(
generateQuery())) {
37 ista.setString(2, player.
getName());
54 }
catch (SQLException ex) {
55 logger.error(String.format(
"Failed to save highscores for player=%s", player.
getName()), ex);
70 StringBuilder sb =
new StringBuilder();
71 sb.append(
"INSERT INTO hs_users (");
73 sb.append(
"username, ");
74 sb.append(
"rights, ");
76 sb.append(
"total_prestiges, ");
77 sb.append(
"attack_prestiges, ");
78 sb.append(
"defence_prestiges, ");
79 sb.append(
"strength_prestiges, ");
80 sb.append(
"hitpoints_prestiges, ");
81 sb.append(
"ranged_prestiges, ");
82 sb.append(
"prayer_prestiges, ");
83 sb.append(
"magic_prestiges, ");
84 sb.append(
"cooking_prestiges, ");
85 sb.append(
"woodcutting_prestiges, ");
86 sb.append(
"fletching_prestiges, ");
87 sb.append(
"fishing_prestiges, ");
88 sb.append(
"firemaking_prestiges, ");
89 sb.append(
"crafting_prestiges, ");
90 sb.append(
"smithing_prestiges, ");
91 sb.append(
"mining_prestiges, ");
92 sb.append(
"herblore_prestiges, ");
93 sb.append(
"agility_prestiges, ");
94 sb.append(
"thieving_prestiges, ");
95 sb.append(
"slayer_prestiges, ");
96 sb.append(
"farming_prestiges, ");
97 sb.append(
"runecrafting_prestiges, ");
98 sb.append(
"hunter_prestiges, ");
99 sb.append(
"construction_prestiges,");
100 sb.append(
"total_level, ");
101 sb.append(
"overall_xp, ");
102 sb.append(
"attack_xp, ");
103 sb.append(
"defence_xp, ");
104 sb.append(
"strength_xp, ");
105 sb.append(
"hitpoints_xp, ");
106 sb.append(
"ranged_xp, ");
107 sb.append(
"prayer_xp, ");
108 sb.append(
"magic_xp, ");
109 sb.append(
"cooking_xp, ");
110 sb.append(
"woodcutting_xp, ");
111 sb.append(
"fletching_xp, ");
112 sb.append(
"fishing_xp, ");
113 sb.append(
"firemaking_xp, ");
114 sb.append(
"crafting_xp, ");
115 sb.append(
"smithing_xp, ");
116 sb.append(
"mining_xp, ");
117 sb.append(
"herblore_xp, ");
118 sb.append(
"agility_xp, ");
119 sb.append(
"thieving_xp, ");
120 sb.append(
"slayer_xp, ");
121 sb.append(
"farming_xp, ");
122 sb.append(
"runecrafting_xp, ");
123 sb.append(
"hunter_xp, ");
124 sb.append(
"construction_xp)");
125 sb.append(
"VALUES (" +
126 "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
127 "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
128 "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
129 "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
130 "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
132 return sb.toString();
The class that contains setting-related constants for the server.
static WorldType WORLD_TYPE
int totalPrestige
The total amount of prestiges.
int[] prestige
The prestiges.
static final String PASSWORD
static int getRank(PlayerRight right)
static final Logger logger
static void saveHighscores(Player player)
static final String USERNAME
static final String CONNECTION_STRING
static String generateQuery()
final SkillManager skills
This class represents a character controlled by a player.
String getName()
Gets the name of this entity.
Represents a trainable and usable skill.
static final int SKILL_COUNT
The amount of available skills.
int getRoundedExperience()
Gets the floor experience.
Skill get(int id)
Gets the skill for an id.
int getTotalLevel()
Gets the total level of the mob.
The OS Royale world types.
Holds all the player right data.
static boolean isAdministrator(Player player)
Checks if the player is a privileged member.