1package com.runehive.game.service;
3import com.runehive.content.achievement.AchievementHandler;
4import com.runehive.content.achievement.AchievementKey;
5import com.runehive.game.world.World;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.items.Item;
8import org.apache.logging.log4j.LogManager;
9import org.apache.logging.log4j.Logger;
12import java.util.concurrent.TimeUnit;
17 private static final String
CONNECTION_STRING =
"jdbc:mysql://173.82.152.23:3306/osroyjs_vote";
18 private static final String
USER =
"osroyjs_exo1";
19 private static final String
PASS =
"3AXbU=W7IfzX";
33 boolean found =
false;
38 PreparedStatement sta = connection.prepareStatement(
"SELECT * FROM fx_votes WHERE username = ? AND claimed=0 AND callback_date IS NOT NULL", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)) {
40 sta.setString(1, player.
getName().replace(
" ",
"_"));
42 try (ResultSet rs = sta.executeQuery()) {
44 String timestamp = rs.getTimestamp(
"callback_date").toString();
45 String ipAddress = rs.getString(
"ip_address");
46 int siteId = rs.getInt(
"site_id");
50 player.totalVotes += 1;
51 logger.info(String.format(
"[Vote] Vote claimed by %s. (sid: %d, ip: %s, time: %s)", player.
getName(), siteId, ipAddress, timestamp));
52 rs.updateInt(
"claimed", 1);
64 }
catch (SQLException ex) {
65 logger.error(String.format(
"Error claiming vote for player=%s", player.
getName()), ex);
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
final DialogueFactory execute()
Retrieves the next dialogue in the chain and executes it.
final DialogueFactory sendStatement(String... lines)
Appends a StatementDialogue to the current dialogue chain.
static final String CONNECTION_STRING
static final Logger logger
static void claimReward(Player player)
Represents the game world.
static void sendMessage(String... messages)
Sends a global message.
This class represents a character controlled by a player.
final Inventory inventory
String getName()
Gets the name of this entity.
Stopwatch databaseRequest
DialogueFactory dialogueFactory
The container class that represents an item that can be interacted with.
boolean add(Item item)
Attempts to deposit item into this container.
final boolean hasCapacityFor(Item... item)
Determines if this container has the capacity for item.
boolean elapsed(long time, TimeUnit unit)
static String getColor(PlayerRight right)