Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<version>1.8</version>

<name>VaultAPI</name>
<description>Vault is a Permissions &amp; Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.
Expand Down
85 changes: 83 additions & 2 deletions src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package net.milkbowl.vault.economy;

import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;

@SuppressWarnings("deprecation")
Expand All @@ -16,15 +19,37 @@ public boolean hasAccount(OfflinePlayer player, String worldName) {
if (player.getName() == null) return false;
return hasAccount(player.getName(), worldName);
}

@Override
public boolean hasAccount(UUID uuid) {
if (uuid == null) return false;
return hasAccount(Bukkit.getOfflinePlayer(uuid));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be player-only? Same goes with methods beneath this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the way I remember this class working, is that most economy plugins will end up replacing all of these methods, the economy plugins that will actually run these methods are the ones which are still in included in the Vault source:
Capture

Of these plugins the only one I see being used is EssentialsEconomy, which afaik, has already internalized their Vault implementation in their 2.19 version. The economy plugin I maintain (ico5) was dropped from Vault long-ago. Gringott's is the only other one that I see people wanting to use (but it is not maintained any longer.)

Before this PR is ever accepted something has to be done to avoid calling Bukkit.getOfflinePlayer(), as this should never be used for cost/time/lag reasons. One way to go about this might be to drop all Economy plugins from Vault.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah for this PR to get accepted I basically would need to remove all the implementations from Vault. At least we are on the same page as far as that's concerned.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its about time. Further down you can see my comment where I went and dug up when those plugins were last updated. Did you want some help/a pull request made up for Vault?

Further, when they are removed that means the entire AbstractEconomy class can be removed from VaultAPI, correct?


@Override
public boolean hasAccount(UUID uuid, String worldName) {
if (uuid == null) return false;
return hasAccount(Bukkit.getOfflinePlayer(uuid), worldName);
}

@Override
public double getBalance(OfflinePlayer player) {
return getBalance(player.getName());
Comment thread
LlmDl marked this conversation as resolved.
Outdated
}

@Override
public double getBalance(OfflinePlayer player, String world) {
return getBalance(player.getName(), world);
public double getBalance(OfflinePlayer player, String worldName) {
return getBalance(player.getName(), worldName);
}

@Override
public double getBalance(UUID uuid) {
return getBalance(Bukkit.getOfflinePlayer(uuid));
}

@Override
public double getBalance(UUID uuid, String worldName) {
return getBalance(Bukkit.getOfflinePlayer(uuid), worldName);
}

@Override
Expand All @@ -38,6 +63,18 @@ public boolean has(OfflinePlayer player, String worldName, double amount) {
if (player.getName() == null) return false;
return has(player.getName(), worldName, amount);
}

@Override
public boolean has(UUID uuid, double amount) {
if (uuid == null) return false;
return has(Bukkit.getOfflinePlayer(uuid), amount);
}

@Override
public boolean has(UUID uuid, String worldName, double amount) {
if (uuid == null) return false;
return has(Bukkit.getOfflinePlayer(uuid), worldName, amount);
}

@Override
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) {
Expand All @@ -49,6 +86,16 @@ public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, do
return withdrawPlayer(player.getName(), worldName, amount);
}

@Override
public EconomyResponse withdrawPlayer(UUID uuid, double amount) {
return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), amount);
}

@Override
public EconomyResponse withdrawPlayer(UUID uuid, String worldName, double amount) {
return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount);
}

@Override
public EconomyResponse depositPlayer(OfflinePlayer player, double amount) {
return depositPlayer(player.getName(), amount);
Expand All @@ -59,20 +106,45 @@ public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, dou
return depositPlayer(player.getName(), worldName, amount);
}

@Override
public EconomyResponse depositPlayer(UUID uuid, double amount) {
Comment thread
LlmDl marked this conversation as resolved.
Outdated
return depositPlayer(Bukkit.getOfflinePlayer(uuid), amount);
}

@Override
public EconomyResponse depositPlayer(UUID uuid, String worldName, double amount) {
return depositPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount);
}

@Override
public EconomyResponse createBank(String name, OfflinePlayer player) {
return createBank(name, player.getName());
}

@Override
public EconomyResponse createBank(String name, UUID uuid) {
return createBank(name, Bukkit.getOfflinePlayer(uuid));
}

@Override
public EconomyResponse isBankOwner(String name, OfflinePlayer player) {
return isBankOwner(name, player.getName());
}

@Override
public EconomyResponse isBankOwner(String name, UUID uuid) {
return isBankOwner(name, Bukkit.getOfflinePlayer(uuid));
}

@Override
public EconomyResponse isBankMember(String name, OfflinePlayer player) {
return isBankMember(name, player.getName());
}

@Override
public EconomyResponse isBankMember(String name, UUID uuid ) {
return isBankMember(name, Bukkit.getOfflinePlayer(uuid));
}

@Override
public boolean createPlayerAccount(OfflinePlayer player) {
Expand All @@ -84,4 +156,13 @@ public boolean createPlayerAccount(OfflinePlayer player, String worldName) {
return createPlayerAccount(player.getName(), worldName);
}

@Override
public boolean createPlayerAccount(UUID uuid) {
return createPlayerAccount(Bukkit.getOfflinePlayer(uuid));
}

@Override
public boolean createPlayerAccount(UUID uuid, String worldName) {
return createPlayerAccount(Bukkit.getOfflinePlayer(uuid), worldName);
}
}
Loading