Fixes to Vault integration and improvements to IdUtil

This commit is contained in:
Magnus Ulf 2019-01-04 14:55:22 +01:00
parent 4374add2cd
commit a5179b514a
2 changed files with 21 additions and 3 deletions

View File

@ -151,9 +151,6 @@ public class MoneyMixinVault extends MoneyMixinAbstract
{
Economy economy = this.getEconomy();
OfflinePlayer offlinePlayerFrom = IdUtil.getOfflinePlayer(fromId);
OfflinePlayer offlinePlayerTo = IdUtil.getOfflinePlayer(toId);
// Ensure positive direction
if (amount < 0)
{
@ -163,6 +160,9 @@ public class MoneyMixinVault extends MoneyMixinAbstract
toId = temp;
}
OfflinePlayer offlinePlayerFrom = IdUtil.getOfflinePlayer(fromId);
OfflinePlayer offlinePlayerTo = IdUtil.getOfflinePlayer(toId);
// Ensure the accounts exist
if (fromId != null) this.ensureExists(fromId);
if (toId != null) this.ensureExists(toId);

View File

@ -482,6 +482,12 @@ public class IdUtil implements Listener, Runnable
return getIdToData().get(id);
}
// OfflinePlayer (UUID recurse)
if (senderObject instanceof OfflinePlayer)
{
return getData(((OfflinePlayer) senderObject).getUniqueId());
}
// UUID
if (senderObject instanceof UUID)
{
@ -538,6 +544,12 @@ public class IdUtil implements Listener, Runnable
// CommandSender
// Handled at "Already Done"
// OfflinePlayer
if (senderObject instanceof OfflinePlayer)
{
return getSender(((OfflinePlayer) senderObject).getUniqueId());
}
// UUID
if (senderObject instanceof UUID)
{
@ -602,6 +614,9 @@ public class IdUtil implements Listener, Runnable
return MUtil.asUuid(id);
}
// OfflinePlayer
if (senderObject instanceof OfflinePlayer) return ((OfflinePlayer) senderObject).getUniqueId();
// UUID
// Handled at "Already Done"
@ -659,6 +674,9 @@ public class IdUtil implements Listener, Runnable
// Command Sender
if (senderObject instanceof CommandSender) return getIdFromSender((CommandSender) senderObject);
// OfflinePlayer
// Handled at "Data"
// UUID
if (senderObject instanceof UUID) return getIdFromUuid((UUID) senderObject);