Skip to content

Commit f841adb

Browse files
authored
Merge branch 'master' into 65-add-the-ability-to-transfer-ownership-of-a-bank-account
2 parents 37cecdb + dc36e46 commit f841adb

File tree

7 files changed

+79
-40
lines changed

7 files changed

+79
-40
lines changed

.github/dependabot.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ updates:
66
interval: weekly
77
day: monday
88
time: "06:00"
9-
reviewers:
10-
- cloudnode-pro/smp
119
- package-ecosystem: github-actions
1210
directory: /
1311
schedule:
1412
interval: weekly
1513
day: monday
1614
time: "06:00"
17-
reviewers:
18-
- cloudnode-pro/smp

.github/workflows/codeql.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ jobs:
5757
uses: actions/checkout@v4
5858

5959

60-
- uses: actions/setup-java@v4
60+
- uses: actions/setup-java@v5
6161
with:
6262
distribution: 'temurin'
6363
java-version: 17
6464

6565
# Initializes the CodeQL tools for scanning.
6666
- name: Initialize CodeQL
67-
uses: github/codeql-action/init@v3
67+
uses: github/codeql-action/init@v4
6868
with:
6969
languages: ${{ matrix.language }}
7070
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -78,7 +78,7 @@ jobs:
7878
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
7979
# If this step fails, then you should remove it and run the build manually (see below)
8080
- name: Autobuild
81-
uses: github/codeql-action/autobuild@v3
81+
uses: github/codeql-action/autobuild@v4
8282

8383
# ℹ️ Command-line programs to run using the OS shell.
8484
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -91,6 +91,6 @@ jobs:
9191
# ./location_of_script_within_repo/buildscript.sh
9292

9393
- name: Perform CodeQL Analysis
94-
uses: github/codeql-action/analyze@v3
94+
uses: github/codeql-action/analyze@v4
9595
with:
9696
category: "/language:${{matrix.language}}"

.github/workflows/maven.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727
- name: Set up JDK 17
28-
uses: actions/setup-java@v4
28+
uses: actions/setup-java@v5
2929
with:
3030
java-version: '17'
3131
distribution: 'temurin'
@@ -35,4 +35,4 @@ jobs:
3535

3636
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
3737
- name: Submit Dependency Snapshot
38-
uses: advanced-security/maven-dependency-submission-action@v4
38+
uses: advanced-security/maven-dependency-submission-action@v5

.github/workflows/release.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Set up JDK 17
17-
uses: actions/setup-java@v4
17+
uses: actions/setup-java@v5
1818
with:
1919
java-version: 17
2020
distribution: temurin
@@ -41,6 +41,11 @@ jobs:
4141
version: ${{ github.event.release.tag_name }}
4242
changelog: ${{ github.event.release.body }}
4343
loaders: paper
44+
dependencies: |-
45+
[{
46+
"project_id": "lKEzGugV",
47+
"dependency_type": "optional"
48+
}]
4449
game-versions: |-
4550
1.20.x
4651
1.21.x

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[<img src="https://wsrv.nl/?url=https://raw.githubusercontent.com/cloudnode-pro/BankAccounts/master/icon.svg&w=128&output=webp" alt="BankAccounts logo" align="left">](https://modrinth.com/plugin/Dc8RS2En)
22

33
# Bank Accounts
4-
[![Available on Modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/modrinth_vector.svg)](https://modrinth.com/plugin/Dc8RS2En) [![Available for Paper](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/paper_vector.svg)](https://papermc.io/software/paper) [![Available on GitHub](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/github_vector.svg)](https://github.com/cloudnode-pro/BankAccounts/)
4+
[![Available on Modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/modrinth_vector.svg)](https://modrinth.com/plugin/Dc8RS2En)
5+
[![Available for Paper](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/paper_vector.svg)](https://papermc.io/software/paper)
6+
[![Available on GitHub](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/github_vector.svg)](https://github.com/cloudnode-pro/BankAccounts/)
7+
[![Won’t support Spigot](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/unsupported/spigot_vector.svg)](https://github.com/cloudnode-pro/BankAccounts/issues/28)
8+
[![Chat with us on Matrix](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/social/matrix-plural_vector.svg)](https://matrix.to/#/#community:cloudnode.pro)
59

6-
[![Java CI with Maven](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/maven.yml/badge.svg)](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/maven.yml) [![CodeQL](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/codeql.yml/badge.svg)](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/codeql.yml) [![Version](https://img.shields.io/modrinth/v/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/version/latest) [![Game Versions](https://img.shields.io/modrinth/game-versions/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/) [![Downloads](https://img.shields.io/modrinth/dt/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/)
10+
[![Java CI with Maven](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/maven.yaml/badge.svg)](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/maven.yaml) [![CodeQL](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/codeql.yaml/badge.svg)](https://github.com/cloudnode-pro/BankAccounts/actions/workflows/codeql.yaml) [![Version](https://img.shields.io/modrinth/v/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/version/latest) [![Game Versions](https://img.shields.io/modrinth/game-versions/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/) [![Downloads](https://img.shields.io/modrinth/dt/Dc8RS2En)](https://modrinth.com/plugin/Dc8RS2En/)
711

812
A Minecraft economy plugin that enables players to hold multiple bank accounts.
913

@@ -33,6 +37,11 @@ enabling compatibility with third-party plugins that support Vault.
3337

3438
You can create a [Point of Sale](https://github.com/cloudnode-pro/BankAccounts/wiki/POS), which is a type of single-use chest shop. Players can pay using a bank card (`/bank card`).
3539

40+
### PlaceholderAPI Support
41+
42+
BankAccounts provides several *PlaceholderAPI* placeholders that you can use. See
43+
the [Placeholders Wiki](https://github.com/cloudnode-pro/BankAccounts/wiki/Placeholders) for an exhaustive list.
44+
3645
### Extensive Configuration
3746

3847
All functionality is fully configurable. See [default config](https://github.com/cloudnode-pro/BankAccounts/blob/master/src/main/resources/config.yml).
@@ -75,9 +84,3 @@ If you're interested in contributing, follow these steps:
7584
4. Commit your changes with clear and descriptive messages.
7685
5. Push your changes to your fork.
7786
6. Submit a pull request.
78-
79-
## Thanks To
80-
81-
[<img src="https://github.com/JetBrains/logos/raw/master/web/jetbrains/jetbrains-simple.svg" alt="JetBrains logo" height="96" align="left">](https://www.jetbrains.com)
82-
83-
[JetBrains](https://www.jetbrains.com/), creators of the IntelliJ IDEA, supports BankAccounts with one of their [Open Source Licenses](https://www.jetbrains.com/opensource/). IntelliJ IDEA is the recommended IDE for working with BankAccounts.

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<plugin>
2222
<groupId>org.apache.maven.plugins</groupId>
2323
<artifactId>maven-compiler-plugin</artifactId>
24-
<version>3.14.0</version>
24+
<version>3.14.1</version>
2525
<configuration>
2626
<source>${java.version}</source>
2727
<target>${java.version}</target>
@@ -30,7 +30,7 @@
3030
<plugin>
3131
<groupId>org.apache.maven.plugins</groupId>
3232
<artifactId>maven-shade-plugin</artifactId>
33-
<version>3.6.0</version>
33+
<version>3.6.1</version>
3434
<executions>
3535
<execution>
3636
<phase>package</phase>
@@ -81,13 +81,13 @@
8181
<dependency>
8282
<groupId>com.zaxxer</groupId>
8383
<artifactId>HikariCP</artifactId>
84-
<version>6.2.1</version>
84+
<version>7.0.2</version>
8585
<scope>provided</scope>
8686
</dependency>
8787
<dependency>
8888
<groupId>org.mariadb.jdbc</groupId>
8989
<artifactId>mariadb-java-client</artifactId>
90-
<version>3.5.2</version>
90+
<version>3.5.6</version>
9191
<scope>provided</scope>
9292
</dependency>
9393
<dependency>

src/main/java/pro/cloudnode/smp/bankaccounts/integrations/PAPIIntegration.java

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
import pro.cloudnode.smp.bankaccounts.Account;
77
import pro.cloudnode.smp.bankaccounts.BankAccounts;
88

9+
import java.math.BigDecimal;
10+
import java.util.Arrays;
11+
import java.util.stream.Collectors;
12+
913
public final class PAPIIntegration extends PlaceholderExpansion {
1014
@Override
1115
public @NotNull String getIdentifier() {
@@ -22,29 +26,60 @@ public final class PAPIIntegration extends PlaceholderExpansion {
2226
return BankAccounts.getInstance().getPluginMeta().getVersion();
2327
}
2428

25-
/**
26-
* Adds the following placeholders:
27-
* <ul>
28-
* <li>%bankaccounts_balance_&lt;accountID&gt;% - returns balance of account with specified ID</li>
29-
* <li>%bankaccounts_balance_formatted_&lt;accountID&gt;% - returns formatted balance of account with specified ID</li>
30-
* <li>%bankaccounts_owner_&lt;accountID&gt;% - returns name of the owner of account with specified ID</li>
31-
* <li>%bankaccounts_type_&lt;accountID&gt;% - returns type of account with specified ID</li>
32-
* <li>%bankaccounts_name_&lt;accountID&gt;% - returns name of account with specified ID</li>
33-
* </ul>
34-
*/
3529
@Override
3630
public String onRequest(final @NotNull OfflinePlayer player, final @NotNull String params) {
3731
final @NotNull String[] args = params.split("_");
3832

3933
if (args.length < 1) return null;
4034
return switch (args[0]) {
41-
case "balance" -> args.length < 2 ? null : switch (args[1]) {
42-
case "formatted" -> args.length != 3 ? null : Account.get(Account.Tag.from(args[2])).map(value -> BankAccounts.formatCurrency(value.balance)).orElse(null);
43-
default -> Account.get(Account.Tag.from(args[1])).map(value -> String.valueOf(value.balance)).orElse(null);
44-
};
45-
case "owner" -> args.length < 2 ? null : Account.get(Account.Tag.from(args[1])).map(value -> value.owner.getName()).orElse(null);
46-
case "type" -> args.length < 2 ? null : Account.get(Account.Tag.from(args[1])).map(value -> value.type.getName()).orElse(null);
47-
case "name" -> args.length < 2 ? null : Account.get(Account.Tag.from(args[1])).map(value -> value.name).orElse(null);
35+
case "balance" -> {
36+
if (args.length == 1)
37+
yield String.valueOf(
38+
Arrays.stream(Account.get(player))
39+
.map(account -> account.balance)
40+
.reduce(BigDecimal.ZERO, BigDecimal::add)
41+
);
42+
yield switch (args[1]) {
43+
case "formatted" -> {
44+
if (args.length == 3)
45+
yield Account.get(Account.Tag.from(args[2])).map(value -> BankAccounts.formatCurrency(value.balance)).orElse(null);
46+
if (args.length == 2)
47+
yield BankAccounts.formatCurrency(
48+
Arrays.stream(Account.get(player))
49+
.map(account -> account.balance)
50+
.reduce(BigDecimal.ZERO, BigDecimal::add)
51+
);
52+
yield null;
53+
}
54+
case "short" -> {
55+
if (args.length == 3)
56+
yield Account.get(Account.Tag.from(args[2])).map(value -> BankAccounts.formatCurrencyShort(value.balance)).orElse(null);
57+
if (args.length == 2)
58+
yield BankAccounts.formatCurrencyShort(
59+
Arrays.stream(Account.get(player))
60+
.map(account -> account.balance)
61+
.reduce(BigDecimal.ZERO, BigDecimal::add)
62+
);
63+
yield null;
64+
}
65+
default -> Account.get(Account.Tag.from(args[1])).map(value -> String.valueOf(value.balance)).orElse(null);
66+
};
67+
}
68+
case "owner" -> args.length != 2 ? null : Account.get(Account.Tag.from(args[1])).map(value -> value.owner.getName()).orElse(null);
69+
case "type" -> args.length != 2 ? null : Account.get(Account.Tag.from(args[1])).map(value -> value.type.getName()).orElse(null);
70+
case "name" -> args.length != 2 ? null : Account.get(Account.Tag.from(args[1])).map(Account::name).orElse(null);
71+
case "account" -> {
72+
if (args.length == 2) {
73+
final @NotNull Account @NotNull [] accounts = Account.get(player);
74+
yield switch (args[1]) {
75+
case "list" -> Arrays.stream(accounts).map(account -> account.id).collect(Collectors.joining(", "));
76+
case "names" -> Arrays.stream(accounts).map(Account::name).collect(Collectors.joining(", "));
77+
case "count" -> String.valueOf(accounts.length);
78+
default -> null;
79+
};
80+
}
81+
yield null;
82+
}
4883
default -> null;
4984
};
5085
}

0 commit comments

Comments
 (0)