Removed all the UUIDFetcher calls.
This commit is contained in:
parent
00e372820b
commit
62a172e01b
@ -1,7 +1,5 @@
|
|||||||
package mineplex.core.account;
|
package mineplex.core.account;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -174,7 +172,6 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
public void loadClientByName(final String playerName, final Runnable runnable)
|
public void loadClientByName(final String playerName, final Runnable runnable)
|
||||||
{
|
{
|
||||||
final CoreClient client = Add(playerName);
|
final CoreClient client = Add(playerName);
|
||||||
final UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
@ -183,6 +180,12 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
ClientToken token = null;
|
ClientToken token = null;
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
// Fails if not in DB and if duplicate.
|
||||||
|
UUID uuid = loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
String response = _repository.getClientByUUID(uuid);
|
String response = _repository.getClientByUUID(uuid);
|
||||||
token = gson.fromJson(response, ClientToken.class);
|
token = gson.fromJson(response, ClientToken.class);
|
||||||
|
|
||||||
@ -330,9 +333,28 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
}, name, rank, perm);
|
}, name, rank, perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkPlayerNameExact(final Callback<Boolean> callback, final String playerName)
|
||||||
|
{
|
||||||
|
_repository.matchPlayerName(new Callback<List<String>>()
|
||||||
|
{
|
||||||
|
public void run(List<String> matches)
|
||||||
|
{
|
||||||
|
for (String match : matches)
|
||||||
|
{
|
||||||
|
if (match.equalsIgnoreCase(playerName))
|
||||||
|
{
|
||||||
|
callback.run(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
callback.run(false);
|
||||||
|
}
|
||||||
|
}, playerName);
|
||||||
|
}
|
||||||
|
|
||||||
public void checkPlayerName(final Player caller, final String playerName, final Callback<Boolean> callback)
|
public void checkPlayerName(final Player caller, final String playerName, final Callback<Boolean> callback)
|
||||||
{
|
{
|
||||||
_repository.MatchPlayerName(new Callback<List<String>>()
|
_repository.matchPlayerName(new Callback<List<String>>()
|
||||||
{
|
{
|
||||||
public void run(List<String> matches)
|
public void run(List<String> matches)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
|||||||
|
|
||||||
if ((rank == Rank.YOUTUBE && Plugin.Get(caller).GetRank().Has(Rank.OWNER)) || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
if ((rank == Rank.YOUTUBE && Plugin.Get(caller).GetRank().Has(Rank.OWNER)) || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||||
{
|
{
|
||||||
Plugin.getRepository().MatchPlayerName(new Callback<List<String>>()
|
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||||
{
|
{
|
||||||
public void run(List<String> matches)
|
public void run(List<String> matches)
|
||||||
{
|
{
|
||||||
|
@ -264,7 +264,7 @@ public class AccountRepository extends RepositoryBase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MatchPlayerName(final Callback<List<String>> callback, final String userName)
|
public void matchPlayerName(final Callback<List<String>> callback, final String userName)
|
||||||
{
|
{
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
Thread asyncThread = new Thread(new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,7 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
protected List<String> getMatches(String start, Enum[] numerators)
|
protected List<String> getMatches(String start, Enum[] numerators)
|
||||||
{
|
{
|
||||||
List<String> matches = new ArrayList<String>();
|
List<String> matches = new ArrayList<String>();
|
||||||
|
@ -27,7 +27,10 @@ public class BoosterCommand extends CommandBase<SalesPackageManager>
|
|||||||
final String playerName = args[0];
|
final String playerName = args[0];
|
||||||
final int amount = Integer.parseInt(args[1]);
|
final int amount = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false);
|
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false);
|
||||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||||
|
@ -26,7 +26,10 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
|
|||||||
String playerName = args[0];
|
String playerName = args[0];
|
||||||
int amount = Integer.parseInt(args[1]);
|
int amount = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
Plugin.getDonationManager().RewardCoins(null, caller.getName(), playerName, uuid, amount);
|
Plugin.getDonationManager().RewardCoins(null, caller.getName(), playerName, uuid, amount);
|
||||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!"));
|
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!"));
|
||||||
|
@ -26,7 +26,10 @@ public class GemHunterCommand extends CommandBase<SalesPackageManager>
|
|||||||
String playerName = args[0];
|
String playerName = args[0];
|
||||||
int amount = Integer.parseInt(args[1]);
|
int amount = Integer.parseInt(args[1]);
|
||||||
int experience = 0;
|
int experience = 0;
|
||||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
if (amount == 4)
|
if (amount == 4)
|
||||||
experience = 70000;
|
experience = 70000;
|
||||||
|
@ -27,7 +27,10 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
|||||||
final String playerName = args[0];
|
final String playerName = args[0];
|
||||||
final int amount = Integer.parseInt(args[1]);
|
final int amount = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false);
|
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false);
|
||||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||||
|
@ -27,7 +27,10 @@ public class TreasureKeyCommand extends CommandBase<SalesPackageManager>
|
|||||||
final String playerName = args[0];
|
final String playerName = args[0];
|
||||||
final int amount = Integer.parseInt(args[1]);
|
final int amount = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName);
|
||||||
|
|
||||||
|
if (uuid == null)
|
||||||
|
UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
|
||||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false);
|
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false);
|
||||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||||
|
Loading…
Reference in New Issue
Block a user