diff --git a/src/main/java/io/minimum/minecraft/superbvote/configuration/SuperbVoteConfiguration.java b/src/main/java/io/minimum/minecraft/superbvote/configuration/SuperbVoteConfiguration.java index 3951fa4..54e6c80 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/configuration/SuperbVoteConfiguration.java +++ b/src/main/java/io/minimum/minecraft/superbvote/configuration/SuperbVoteConfiguration.java @@ -182,9 +182,10 @@ public VoteStorage initializeVoteStorage() throws IOException { String database = configuration.getString("storage.mysql.database", "superbvote"); String table = configuration.getString("storage.mysql.table", "superbvote"); boolean readOnly = configuration.getBoolean("storage.mysql.read-only"); + boolean ssl = configuration.getBoolean("storage.mysql.ssl"); HikariConfig config = new HikariConfig(); - config.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database); + config.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=" + ssl); config.setUsername(username); config.setPassword(password); config.setMinimumIdle(2); diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/SuperbVoteListener.java b/src/main/java/io/minimum/minecraft/superbvote/votes/SuperbVoteListener.java index c2c61bb..fa22ac9 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/SuperbVoteListener.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/SuperbVoteListener.java @@ -96,7 +96,9 @@ public void onPlayerJoin(PlayerJoinEvent event) { return; } - Bukkit.getScheduler().runTaskAsynchronously(SuperbVote.getPlugin(), () -> { + long delay = 100L; // 100 ticks = 5 seconds to delay + + Bukkit.getScheduler().runTaskLaterAsynchronously(SuperbVote.getPlugin(), () -> { // Update names in MySQL, if it is being used. if (SuperbVote.getPlugin().getVoteStorage() instanceof MysqlVoteStorage) { ((MysqlVoteStorage) SuperbVote.getPlugin().getVoteStorage()).updateName(event.getPlayer()); @@ -106,6 +108,10 @@ public void onPlayerJoin(PlayerJoinEvent event) { PlayerVotes pv = SuperbVote.getPlugin().getVoteStorage().getVotes(event.getPlayer().getUniqueId()); List votes = SuperbVote.getPlugin().getQueuedVotes().getAndRemoveVotes(event.getPlayer().getUniqueId()); if (!votes.isEmpty()) { + // Send message to player letting them know why they're receiving a bunch of random gifts + String queueMessage = ChatColor.translateAlternateColorCodes('&', SuperbVote.getPlugin().getConfig().getString("queue-message")); + event.getPlayer().sendMessage(queueMessage); + for (Vote vote : votes) { processVote(pv, vote, false, false, true); pv = new PlayerVotes(pv.getUuid(), event.getPlayer().getName(),pv.getVotes() + 1, PlayerVotes.Type.CURRENT); @@ -120,7 +126,7 @@ public void onPlayerJoin(PlayerJoinEvent event) { MessageContext context = new MessageContext(null, pv, event.getPlayer()); SuperbVote.getPlugin().getConfiguration().getReminderMessage().sendAsReminder(event.getPlayer(), context); } - }); + }, delay); } private void afterVoteProcessing() { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0b420bc..034c7de 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -15,6 +15,7 @@ storage: database: superbvote table: votes read-only: false + ssl: true # General vote configuration. votes: @@ -49,6 +50,7 @@ rewards: # Whether or not players need to be online to vote. If set, offline player votes are queued for when the player next logs in. require-online: true +queue-message: "&aThanks for voting recently! You will now receive your prizes." # Broadcast settings: broadcast: