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

View File

@ -481,6 +481,12 @@ public class IdUtil implements Listener, Runnable
String id = getIdFromSender((CommandSender) senderObject); String id = getIdFromSender((CommandSender) senderObject);
return getIdToData().get(id); return getIdToData().get(id);
} }
// OfflinePlayer (UUID recurse)
if (senderObject instanceof OfflinePlayer)
{
return getData(((OfflinePlayer) senderObject).getUniqueId());
}
// UUID // UUID
if (senderObject instanceof UUID) if (senderObject instanceof UUID)
@ -537,6 +543,12 @@ public class IdUtil implements Listener, Runnable
// CommandSender // CommandSender
// Handled at "Already Done" // Handled at "Already Done"
// OfflinePlayer
if (senderObject instanceof OfflinePlayer)
{
return getSender(((OfflinePlayer) senderObject).getUniqueId());
}
// UUID // UUID
if (senderObject instanceof UUID) if (senderObject instanceof UUID)
@ -601,6 +613,9 @@ public class IdUtil implements Listener, Runnable
String id = sender.getName(); String id = sender.getName();
return MUtil.asUuid(id); return MUtil.asUuid(id);
} }
// OfflinePlayer
if (senderObject instanceof OfflinePlayer) return ((OfflinePlayer) senderObject).getUniqueId();
// UUID // UUID
// Handled at "Already Done" // Handled at "Already Done"
@ -658,6 +673,9 @@ public class IdUtil implements Listener, Runnable
// Command Sender // Command Sender
if (senderObject instanceof CommandSender) return getIdFromSender((CommandSender) senderObject); if (senderObject instanceof CommandSender) return getIdFromSender((CommandSender) senderObject);
// OfflinePlayer
// Handled at "Data"
// UUID // UUID
if (senderObject instanceof UUID) return getIdFromUuid((UUID) senderObject); if (senderObject instanceof UUID) return getIdFromUuid((UUID) senderObject);