From c430566c6dc8ecb4f4ac525af3eb7c0cd4cc0780 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 24 Jun 2016 16:59:27 -0500 Subject: [PATCH] Never reset a player's YouTube click time locally --- .../src/mineplex/core/bonuses/gui/BonusGui.java | 12 +++--------- .../src/mineplex/core/youtube/YoutubeManager.java | 11 +---------- .../mineplex/core/youtube/YoutubeRepository.java | 13 ++----------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 7eba1b985..a8fef8c82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -1,13 +1,7 @@ package mineplex.core.bonuses.gui; import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.gui.buttons.CarlSpinButton; -import mineplex.core.bonuses.gui.buttons.ClaimTipsButton; -import mineplex.core.bonuses.gui.buttons.DailyBonusButton; -import mineplex.core.bonuses.gui.buttons.FacebookButton; -import mineplex.core.bonuses.gui.buttons.PollButton; -import mineplex.core.bonuses.gui.buttons.RankBonusButton; -import mineplex.core.bonuses.gui.buttons.VoteButton; +import mineplex.core.bonuses.gui.buttons.*; import mineplex.core.boosters.BoosterManager; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; @@ -37,9 +31,9 @@ public class BonusGui extends SimpleGui setItem(19, new FacebookButton(player, facebookManager)); - //setItem(21, new YoutubeButton(player, youtubeManager)); + setItem(21, new YoutubeButton(player, youtubeManager)); - //setItem(23, new TwitterButton(player)); + setItem(23, new TwitterButton(player)); setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java index 808087c36..45963b9b8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -48,16 +48,7 @@ public class YoutubeManager extends MiniDbClientPlugin } YoutubeClient client = Get(player); client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); - _repository.attemptYoutube(player, client, success -> - { - if (success) - { - _donationManager.RewardCoinsLater("YouTube", player, 250); - } else - { - client.setClickDate(null); - } - }); + _repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java index a108a0b3b..7e437d0cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java @@ -1,6 +1,5 @@ package mineplex.core.youtube; -import mineplex.core.common.util.Callback; import mineplex.serverdata.database.DBPool; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -19,7 +18,7 @@ public class YoutubeRepository _manager = manager; } - public void attemptYoutube(Player player, YoutubeClient client, Callback callback) + public void attemptYoutube(Player player, YoutubeClient client, Runnable runnable) { int accountId = _manager.getClientManager().Get(player).getAccountId(); @@ -32,20 +31,12 @@ public class YoutubeRepository statement.setDate(2, Date.valueOf(client.getClickDate())); statement.executeUpdate(); - if (callback != null) - { - callback.run(true); - } + runnable.run(); } catch (SQLException e) { e.printStackTrace(); } - - if (callback != null) - { - callback.run(false); - } }); }