Skip to content

Commit

Permalink
Merge branch 'pr/138'
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Jun 12, 2024
2 parents 6e69e20 + ab14d7f commit d7441f2
Show file tree
Hide file tree
Showing 10 changed files with 2,205 additions and 17 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ How to include the API with Maven:
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultUnlockedAPI</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
Expand Down Expand Up @@ -79,10 +80,12 @@ Implementing VaultUnlocked is quite simple. It requires getting the Economy, Per
```java
package com.example.plugin;

import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.permission.Permission;
import java.util.logging.Logger;

import net.milkbowl.vault2.chat.Chat;
import net.milkbowl.vault2.economy.Economy;
import net.milkbowl.vault2.economy.EconomyResponse;
import net.milkbowl.vault2.permission.Permission;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand All @@ -103,7 +106,7 @@ public class ExamplePlugin extends JavaPlugin {

@Override
public void onEnable() {
if (!setupEconomy() ) {
if (!setupEconomy()) {
getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
Expand Down Expand Up @@ -146,8 +149,8 @@ public class ExamplePlugin extends JavaPlugin {

if(command.getLabel().equals("test-economy")) {
// Lets give the player 1.05 currency (note that SOME economic plugins require rounding!)
sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName()))));
EconomyResponse r = econ.depositPlayer(player, 1.05);
sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getUniqueId()))));
EconomyResponse r = econ.depositPlayer(player.getUniqueId(), new BigDecimal("1.05"));
if(r.transactionSuccess()) {
sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance)));
} else {
Expand Down
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
<artifactId>VaultUnlockedAPI</artifactId>
<version>2.0</version>

<name>VaultUnlockedAPI</name>
<description>VaultUnlocked is a Permissions &amp; Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.

VaultUnlocked supports all plugins that support Vault
</description>
<name>VaultUnlockedAPI</name>
<description>VaultUnlocked is a Permissions &amp; Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves. VaultUnlocked supports all plugins that support Vault
</description>
<url>http://dev.bukkit.org/server-mods/vault/</url>

<properties>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/milkbowl/vault/chat/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/**
* The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them
*
* @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.chat.
*/
public abstract class Chat {

Expand Down
13 changes: 7 additions & 6 deletions src/main/java/net/milkbowl/vault/economy/Economy.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/**
* The main economy API
*
* @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.economy and update to use the new UUID-based methods where available.
*/
public interface Economy {

Expand Down Expand Up @@ -157,7 +158,7 @@ public interface Economy {
boolean has(OfflinePlayer player, double amount);

/**
* @deprecated As of VaultAPI 1.4 use @{link {@link #has(OfflinePlayer, String, double)} instead.
* @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, String, double)} instead.
*/
@Deprecated
boolean has(String playerName, String worldName, double amount);
Expand All @@ -169,7 +170,7 @@ public interface Economy {
* @param player to check
* @param worldName to check with
* @param amount to check for
* @return True if <b>player</b> has <b>amount</b>, False else wise
* @return True if <b>player</b> has <b>amount</b> in the given <b>world</b>, False else wise
*/
boolean has(OfflinePlayer player, String worldName, double amount);

Expand Down Expand Up @@ -226,7 +227,7 @@ public interface Economy {
EconomyResponse depositPlayer(String playerName, String worldName, double amount);

/**
* Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS
* Deposit an amount to a player on a given world - DO NOT USE NEGATIVE AMOUNTS
* IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.
*
* @param player to deposit to
Expand Down Expand Up @@ -307,7 +308,7 @@ public interface Economy {
EconomyResponse isBankOwner(String name, OfflinePlayer player);

/**
* @deprecated As of VaultAPI 1.4 use {{@link #isBankMember(String, OfflinePlayer)} instead.
* @deprecated As of VaultAPI 1.4 use {@link #isBankMember(String, OfflinePlayer)} instead.
*/
@Deprecated
EconomyResponse isBankMember(String name, String playerName);
Expand All @@ -328,7 +329,7 @@ public interface Economy {
List<String> getBanks();

/**
* @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer)} instead.
* @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer)} instead.
*/
@Deprecated
boolean createPlayerAccount(String playerName);
Expand All @@ -341,7 +342,7 @@ public interface Economy {
boolean createPlayerAccount(OfflinePlayer player);

/**
* @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer, String)} instead.
* @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer, String)} instead.
*/
@Deprecated
boolean createPlayerAccount(String playerName, String worldName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows
* the method, or if the operation was a success or failure.
*
* @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.economy.
*/
public class EconomyResponse {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/**
* The main Permission API - allows for group and player based permission tests
*
* @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.permission.
*/
public abstract class Permission {

Expand Down
Loading

0 comments on commit d7441f2

Please sign in to comment.