diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java index f786f34f9..b2d97095c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java @@ -6,6 +6,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import mineplex.core.MiniPlugin; @@ -13,9 +14,11 @@ import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.InventoryManager; import mineplex.core.titles.commands.GiveTrackCommand; import mineplex.core.titles.tracks.award.Bridges2017Track; @@ -121,7 +124,7 @@ public class TrackManager extends MiniPlugin runAsync(() -> { - _inventoryManager.addItemToInventoryForOffline(success -> + Callback successCallback = success -> { if (success) { @@ -131,7 +134,18 @@ public class TrackManager extends MiniPlugin { UtilPlayer.message(caller, F.main(getName(), "Oops. Something has gone wrong while giving " + F.elem(player) + " the track " + F.elem(track) + "!")); } - }, client.getAccountId(), "track." + track, 1); + }; + + Player playerObj = Bukkit.getPlayer(client.getUniqueId()); + + if (playerObj != null) + { + _inventoryManager.addItemToInventory(successCallback, playerObj, "track." + track, 1); + } + else + { + _inventoryManager.addItemToInventoryForOffline(successCallback, client.getAccountId(), "track." + track, 1); + } }); }); }