[issue/chat-system] **UNRELATED** Commit with necessary changes to the banking system for it to be robust enough on release of the server. ONLY banking system changes in here! COMMAND ONLY. NOTHING HOOKED UP YET IN BANK MANAGER!
Some checks failed
build / build (21) (push) Has been cancelled

This commit is contained in:
Jkibbels 2024-11-02 04:25:37 -04:00
parent 95c68935f3
commit 5cae7ec313

View File

@ -4,6 +4,10 @@ import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.LongArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import static java.util.Map.entry;
import jesse.keeblarcraft.BankMgr.BankManager; import jesse.keeblarcraft.BankMgr.BankManager;
import jesse.keeblarcraft.ConfigMgr.ConfigManager; import jesse.keeblarcraft.ConfigMgr.ConfigManager;
@ -14,142 +18,568 @@ import net.minecraft.text.Text;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
public class BankCommands { public class BankCommands {
private static List<String> FILLER_WORDS = new ArrayList<String>(List.of("of", "from", "as", "with", "name", "dubbed", "coined", "note"));
private static Map<String, String> HELP_COMMANDS = Map.ofEntries(
entry
("help", "This is the general help message for the bank system. For detailed help messages, please run /bank help <command OR subcommand>. List of possible " +
"commands are: CREATE, SELECT, CLOSE, REPORT, BALANCE, EXAMPLES, WIRE, MOVE, SYNTAX, ALIAS"
),
entry
(
"create", "The create command is used for creating an account type with the bank system! You can also alias your bank account names for easier access. Example: " +
"\"/bank create checking primary\" will create an account with a unique identifier (the checking #). HOWEVER, you can use the alias 'primary' to also refer to it in other commands!"
),
entry
("select", "The SELECT command provides a powerful tool for selecting a default account that the bank system automagically does transactions out of. Whether it be wires from you " +
"to someone else - it will use this as a default. Example usage: \"/bank select primary\" will make your account that is aliased as 'primary' your primary bank account. You can also " +
"use the accounts unique number too. In addition to just normal usage, you can set backup accounts too that transactions will come out of should your primary account (or another backup) " +
"reach a 0 balance. Just use \"/bank select 3181-31-3354 as backup\"."
),
entry
("close", "The CLOSE command provides the ability to close an account PROVIDING that there is a 0-balance inside that account. It is your responsibility to ensure all debts are paid " +
"and any remaining money in the account is moved to another account. To avoid magic money vanishing, closing accounts with balances of negative or positive amounts is impossible. " +
"Example usage: \"/bank close 3181-31-3354\""
),
entry
("report", "The report command provides a powerful ability of generating reports of all bank transactions and activities on one or multiple accounts at a single command-call. Example " +
"usage: \"/bank report 3181-31-3354\" will generate a bank report of all transactions to and from this account from its creation. If you wanted to generate reports on all your accounts " +
"at once, you would run \"/bank report all\" instead."
),
entry
("balance", "The balance command is the primary way to get your bank accounts balance. If no account is specified, it will use your default account (if not set, then default is first created). " +
"Example usages: \"/balance 3181-31-3354\". \"/balance aliased-name\"."
),
entry
("examples", "Random example commands. \"/wire Notch 900 from primary-checking\". \"/balance on secondary-savings\". \"/bank report all\". \"/bank create savings-account MyFirstSavings\". " +
"\"/wire 3181-31-3354 8767.43 with note \"Dinner payment\"\""
),
entry
("move", "Move provides the ability to transfer money from one account to another without the double withdraw-then-deposit dilemma. Additionally, move lets a player move an account to a SEPARATE " +
"bank or faction (providing these are in the game and supported). Example usage: \"/bank move 900 from savings to checking\". Or, \"/bank move 3181-31-3354 to {/FACTION_OR_BANK_IDENTIFIER}\""
),
entry
("syntax", "This banking system was written to be human readable in command-form and often operates like a database. You can put certain filler-words inside your commands that are " +
"parsed out at runtime if it helps with reading. Example command: \"/bank select 942-3449-42\" will work just fine to select a bank account as a primary account. HOWEVER, you can also " +
"type \"/bank select for-bills as default\" so long as you aliased the account identifier as 'for-bills'. Much nicer to read and work with. [Related: /bank help aliases]"
),
entry
("alias", "Alias provides a way for the player to alias an existing account (or re-alias) if they did not do that at the account creation (tip, you can! run /bank help create). NOTE: Aliases " +
"MUST be unique across ALL bank accounts a player possesses. This means even bank accounts across banks/factions. Additionally, a re-alias to an alias that already exists will fail. " +
"Example usage: \"/bank alias 3181-31-3354 to \"for-bills\"\". More usage: \"/bank alias 'for-bills' to 'for-all-outgoing-transactions'\""
),
entry
("wire", "The wire command allows a player to wire money from account to account. You can use /wire like /move ('/bank help move' for more) or more primarily for wiring to any other account. " +
"Example usage: \"/wire Notch 500 from 3181-31-3354\". Additional usage: \"/wire 9384-493-2912 400,000 from 3181-31-3354 with reason \"Groceries\"\". CRITICAL NOTE: Because of the way the banking " +
"system has its command structure setup - you **CANNOT** use aliases in wire commands! This is because aliases are only unique per PLAYER, not across the entire server."
)
);
ConfigManager config = new ConfigManager(); ConfigManager config = new ConfigManager();
public void RegisterCommands(){ public void RegisterCommands() {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
// This is basically a small re-created SQL language but for bank commands. I recommend asking me for the drawn
// image to better understand what this is accomplishing if it is confusing. Essentially it is easy though, as it
// is just /bank ACTION-WORD [arguments...] [optionals]
var bankRoot = CommandManager.literal("bank").build();
var actionWord = CommandManager.argument("ACTION_WORD", StringArgumentType.greedyString()).build();
var argList = CommandManager.argument("ARG_LIST", StringArgumentType.greedyString())
.executes(context -> ParseBankCommand
(
context,
StringArgumentType.getString(context, "ACTION_WORD"),
StringArgumentType.getString(context, "ARG_LIST"))
)
.build();
// Building the argument tree here
dispatcher.getRoot().addChild(bankRoot);
bankRoot.addChild(actionWord);
bankRoot.addChild(argList);
// Aliases
dispatcher.register(CommandManager.literal("wire").redirect(actionWord));
dispatcher.register(CommandManager.literal("balance").redirect(actionWord));
});
// Command: "/getbalance" // Command: "/getbalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { // CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("getbalance") // dispatcher.register(CommandManager.literal("getbalance")
.executes(context -> GetBalance(context))); // .executes(context -> GetBalance(context)));
}); // });
// Command: "/setbalance || rootSetBalance" // // Command: "/setbalance || rootSetBalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { // CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var rootSetBalance = dispatcher.register(CommandManager.literal("setbalance") // final var rootSetBalance = dispatcher.register(CommandManager.literal("setbalance")
.then(CommandManager.argument("newBalance", IntegerArgumentType.integer()) // .then(CommandManager.argument("newBalance", IntegerArgumentType.integer())
.then(CommandManager.argument("reason", StringArgumentType.string()) // .then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("otherParty", StringArgumentType.string()) // .then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> SetBalance( // .executes(context -> SetBalance(
IntegerArgumentType.getInteger(context, "newBalance"), // IntegerArgumentType.getInteger(context, "newBalance"),
StringArgumentType.getString(context, "reason"), // StringArgumentType.getString(context, "reason"),
StringArgumentType.getString(context, "otherParty"), // StringArgumentType.getString(context, "otherParty"),
context)))))); // context))))));
dispatcher.register(CommandManager.literal("setbalance").redirect(rootSetBalance)); // dispatcher.register(CommandManager.literal("setbalance").redirect(rootSetBalance));
}); // });
// Command: "/AddMoney" // // Command: "/AddMoney"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { // CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("AddMoney") // dispatcher.register(CommandManager.literal("AddMoney")
.then(CommandManager.argument("reason", StringArgumentType.string()) // .then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg()) // .then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string()) // .then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> AddMoney( // .executes(context -> AddMoney(
StringArgumentType.getString(context, "reason"), // StringArgumentType.getString(context, "reason"),
LongArgumentType.getLong(context, "payment"), // LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "otherParty"), // StringArgumentType.getString(context, "otherParty"),
context)))))); // context))))));
}); // });
// Command: "/subtractbalance || /SubtractBalance" // // Command: "/subtractbalance || /SubtractBalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { // CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var SubtractBalance = dispatcher.register(CommandManager.literal("subtractbalance") // final var SubtractBalance = dispatcher.register(CommandManager.literal("subtractbalance")
.then(CommandManager.argument("reason", StringArgumentType.string()) // .then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg()) // .then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string()) // .then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> SubtractBalance( // .executes(context -> SubtractBalance(
StringArgumentType.getString(context, "reason"), // StringArgumentType.getString(context, "reason"),
LongArgumentType.getLong(context, "payment"), // LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "otherParty"), // StringArgumentType.getString(context, "otherParty"),
context)))))); // context))))));
dispatcher.register(CommandManager.literal("subtractbalance").redirect(SubtractBalance)); // dispatcher.register(CommandManager.literal("subtractbalance").redirect(SubtractBalance));
}); // });
// Command: "/wire || /sendmoney" // // Command: "/wire || /sendmoney"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { // CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var sendmoney = dispatcher.register(CommandManager.literal("wire") // final var sendmoney = dispatcher.register(CommandManager.literal("wire")
.then(CommandManager.argument("reason", StringArgumentType.string()) // .then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg()) // .then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string()) // .then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> Wire( // .executes(context -> Wire(
StringArgumentType.getString(context, "reason"), // StringArgumentType.getString(context, "reason"),
LongArgumentType.getLong(context, "payment"), // LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "otherParty"), // StringArgumentType.getString(context, "otherParty"),
context)))))); // context))))));
dispatcher.register(CommandManager.literal("wire").redirect(sendmoney)); // dispatcher.register(CommandManager.literal("wire").redirect(sendmoney));
}); // });
} }
public Integer GetBalance(CommandContext<ServerCommandSource> context) { // Remove filler words which only exist for human readability
Integer ret = -1; public List<String> RemoveFillerWords(List<String> argList) {
int index = 0;
for (String str : argList) {
if (FILLER_WORDS.contains(str)) {
argList.remove(index);
}
index++;
}
return argList;
}
if (context.getSource().isExecutedByPlayer()) { public int ParseBankCommand(CommandContext<ServerCommandSource> context, String actionWord, String unformattedArgList) {
ServerPlayerEntity player = context.getSource().getPlayer(); // String[] formattedArgList = unformattedArgList.split("\\s+"); // REGEX is matching 1+ whitespace characters
BankManager playerBank = new BankManager(player.getUuidAsString()); List<String> formattedArgList = List.of(unformattedArgList.split("\\s+"));
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance()))); formattedArgList = RemoveFillerWords(formattedArgList);
return 0; actionWord = actionWord.toLowerCase();
switch(actionWord)
{
case "create":
CreateCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "close":
CloseCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "select":
SelectCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "wire":
WireCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "balance":
BalanceCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "help":
HelpCommand(context.getSource().getPlayer(), "help");
break;
case "move":
MoveCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "alias":
AliasCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "report":
ReportCommand(context.getSource().getPlayer(), formattedArgList);
break;
case "examples":
HelpCommand(context.getSource().getPlayer(), "examples");
break;
case "syntax":
HelpCommand(context.getSource().getPlayer(), "syntax");
break;
default:
if (context.getSource().isExecutedByPlayer()) {
context.getSource().getPlayer().sendMessage(Text.of("You have entered an improperly formatted message. Please reference the bank manual if you are confused how to form a command!"));
}
break;
}
return 0;
}
// Possible code paths:
// REQUIRED (path 1) = {AMOUNT} [FROM:{INTERNAL ACCOUNT #|ALIAS}] TO:{INTERNAL ACCOUNT #|ALIAS} ***Note: TO{} can be assumed to be SELECTED default if not specified
// REQUIRED (path 2) = {INTERNAL ACCOUNT #|ALIAS} {EXTERNAL BANK/FACTION ID}
// OPTIONAL = []
public void MoveCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() >= 2) {
String possibleExternalIdentifier = argList.get(1);
boolean isExternalTransfer = false;
/*
* CALL TO BANKMGR TO VERIFY IF ABOVE IS VALID BANK ID. IF NOT; THIS IS INTERNAL TRANSFER
*/
if (isExternalTransfer) {
// External move to another bank or faction
String targetMoveAccount = argList.get(0);
String destBankId = argList.get(1);
/*
* CALL TO BANKMGR TO MOVE ACCOUNTS HERE
*/
} else {
// Internal transfer to this players accounts within system
String optionalFromAccount = ""; /* CALL TO BANKMGR TO GET DEFAULT SELECTED ACCOUNT FOR `FROM` FIELD */
if (argList.size() == 3) {
optionalFromAccount = argList.get(1);
}
String transferAmount = argList.get(0);
String destinationTransfer = argList.get(2);
/*
* BANK MGR CALL HERE
*/
}
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized move command. Please use \"/bank help MOVE\" for more information."));
}
}
// Posible code paths:
// REQUIRED = {ACCOUNT-ID|ALIAS} {ALIAS}
// OPTIONAL = []
public void AliasCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() > 0) {
String newAlias = argList.get(0);
/*
* CALL TO BANKMGR TO SEE IF ALIAS ARG ALREADY EXISTS
*/
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized alias command. Please run \"/bank help ALIAS\" for more information."));
}
}
// Possible code paths:
// REQUIRED = {...} valid argList required
// OPTIONAL = []
// NOTE: This is just a shorthand to get to `/bank create report`
public void ReportCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() > 0) {
argList.add(0, "report"); // Since we lose 'report' when we pass it as an alias/passthrough; we just shim it into the first spot
CreateCommand(sourcePlayer, argList);
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized report command. Please run \"/bank help REPORT\" for more information."));
}
}
// Possible code paths:
// REQUIRED = {}
// OPTIONAL = [identifier|alias]
public int BalanceCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
String accountToBalance = "default";
/*
*
* Code here to get default account from player
*
*/
if (argList.size() == 1) {
/*
* Set accountToBalance here
*/
} }
return ret; /*
* Return to player balance here in new chatutil function not yet made
*/
return 0;
} }
//SetBalance will be a ServerCommand only Perm level Op // Create command - valid arg list types:
public Integer SetBalance(Integer newBalance, String reason, String otherParty, CommandContext<ServerCommandSource> context) { // /... CREATE {CA/checking/savings/checking-account/savings-account/report}
Integer ret = -1; public int CreateCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() > 0) {
String action = argList.get(0).toLowerCase();
if (context.getSource().hasPermissionLevel(1)) { switch (action) {
ServerPlayerEntity player = context.getSource().getPlayer(); // Checking & Savings are handled in the same function so we can just "alias" all of these to the same call!
BankManager playerBank = new BankManager(player.getUuidAsString()); case "ca":
playerBank.SetBalance(newBalance, reason, otherParty); case "checking":
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance()))); case "checking-account":
case "sa":
case "savings":
case "savings-account":
argList.remove(0); // Remove action word (all the above aliases)
CreateAccount(sourcePlayer, argList);
break;
case "rep":
case "report":
argList.remove(0); // Remove action word (all the above aliases)
GenerateAccountReport(sourcePlayer, argList);
break;
}
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized create command formed on bank. Please run \"/bank help CREATE\" for more information"));
} }
return 0;
return ret;
} }
//AddMoney will be a ServerCommand Only Perm level Op // Possible code paths:
public Integer AddMoney(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) { // REQUIRED = {ACCOUNT ID|ALIAS}
Integer ret = -1; // OPTIONAL = []
public int CloseCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (context.getSource().hasPermissionLevel(1)) { if (argList.size() > 0) {
ret = 0; String accountToClose = argList.get(0);
ServerPlayerEntity player = context.getSource().getPlayer(); /*
BankManager playerBank = new BankManager(player.getUuidAsString()); * CALL TO BANKMGR TO DO STUFF
playerBank.AddMoney(reason, payment, otherParty); */
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance()))); } else {
sourcePlayer.sendMessage(Text.of("Unrecognized close command. Please see \"/bank help CLOSE\" for more information."));
} }
return 0;
return ret;
} }
//SubtractBalance will be a ServerCommand Perm leve Op // Possible code paths:
public Integer SubtractBalance(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) { // required = {account id | alias}
Integer ret = -1; // optional = [default|secondary|backup]
public int SelectCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() > 0) {
String requiredArg = argList.get(0).toLowerCase();
if (context.getSource().hasPermissionLevel(1)) { // If the optional args exist; fetch them
ret = 0; String optionalArg = "";
ServerPlayerEntity player = context.getSource().getPlayer(); if (argList.size() == 2) {
BankManager playerBank = new BankManager(player.getUuidAsString()); optionalArg = argList.get(1).toLowerCase();
playerBank.SubtractBalance(reason, payment, otherParty); }
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
/*
*
*
* BANKMANAGER CALL-THROUGHS HERE
*
*/
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized select command. Please run /bank help select for more information."));
} }
return 0;
return ret;
} }
public Integer Wire(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) { // Possible code paths:
Integer ret = -1; // REQUIRED = {account id | player} {amount} [optional] NOTE: A wire CANNOT be performed on an alias; as a possible conflict can happen between player accounts since aliases are ONLY unique PER player
// OPTIONAL = [account id | alias] [reason] NOTE: This is the account the wire comes from. If none selected, DEFAULT is chosen (if exists)
public int WireCommand(ServerPlayerEntity sourcePlayer, List<String> argList) {
if (argList.size() >= 2) {
String destAccount = argList.get(0).toLowerCase();
String amountToWire = argList.get(1).toLowerCase();
if (context.getSource().isExecutedByPlayer()) { String optionalNonDefaultAccount = "";
ret = 0; if (argList.size() >= 3) {
ServerPlayerEntity player = context.getSource().getPlayer(); optionalNonDefaultAccount = argList.get(2).toLowerCase();
BankManager playerBank = new BankManager(player.getUuidAsString()); }
playerBank.Wire(reason, payment, otherParty);
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance()))); String optionalReason = "";
if (argList.size() >= 4) {
optionalReason = argList.get(3);
}
/*
*
*
* CALL THROUGHS TO BANK MGR HERE
* CALL THROUGHS TO BANK MGR HERE
*
*/
} else {
sourcePlayer.sendMessage(Text.of("Unrecognized wire command. Please run /bank help wire for more information."));
} }
return 0;
return ret;
} }
// Possible code paths:
// REQUIRED = {}
// OPTIONAL = [command|subcommand]
public int HelpCommand(ServerPlayerEntity sourcePlayer, String helpCommand) {
if (helpCommand.length() > 0) {
// Specific command help message
/*
*
* A ChatUtil message needs to be created to better display messages to players. Once that is created; forward this string to that
*
*/
} else {
// General help message
/*
*
* A ChatUtil message needs to be created to better display messages to players. Once that is created; forward this string to that
*
*/
}
return 0;
}
// Possible args:
// /bank create {SAVINGS/CHECKING} [optional: alias]
public void CreateAccount(ServerPlayerEntity player, List<String> accountArgs) {
if (accountArgs.size() > 0) {
String accountType = accountArgs.get(0);
String accountAlias = "NO_ALIAS";
// Set the optional account alias for ease-of-reference
if (accountArgs.size() >= 2) {
accountAlias = accountArgs.get(1).toLowerCase();
}
/*
*
* Finally - calls to BankManager here for more
*
*/
} else {
player.sendMessage(Text.of("Unrecognized create account command. Please run /bank help create for more information"));
}
}
// Possible code paths for /bank create report
// required = {ACCOUNT ID / ALIAS} or {ALL}
public void GenerateAccountReport(ServerPlayerEntity player, List<String> reportArgs) {
if (reportArgs.size() > 0) {
String reportIdentifier = reportArgs.get(0).toLowerCase();
// First path is just to run a report on all accounts this player is attached to:
if (reportIdentifier == "all") {
/* BANKMANAGER CALL HERE. LOOP LIKELY NEEDED */
} else {
/* BANKMANAGER CALL HERE */
}
} else {
player.sendMessage(Text.of("Unrecognized report field data. Please run /bank help report for more information"));
}
}
// public Integer GetBalance(CommandContext<ServerCommandSource> context) {
// Integer ret = -1;
// if (context.getSource().isExecutedByPlayer()) {
// ServerPlayerEntity player = context.getSource().getPlayer();
// BankManager playerBank = new BankManager(player.getUuidAsString());
// player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
// return 0;
// }
// return ret;
// }
// //SetBalance will be a ServerCommand only Perm level Op
// public Integer SetBalance(Integer newBalance, String reason, String otherParty, CommandContext<ServerCommandSource> context) {
// Integer ret = -1;
// if (context.getSource().hasPermissionLevel(1)) {
// ServerPlayerEntity player = context.getSource().getPlayer();
// BankManager playerBank = new BankManager(player.getUuidAsString());
// playerBank.SetBalance(newBalance, reason, otherParty);
// player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
// }
// return ret;
// }
// //AddMoney will be a ServerCommand Only Perm level Op
// public Integer AddMoney(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
// Integer ret = -1;
// if (context.getSource().hasPermissionLevel(1)) {
// ret = 0;
// ServerPlayerEntity player = context.getSource().getPlayer();
// BankManager playerBank = new BankManager(player.getUuidAsString());
// playerBank.AddMoney(reason, payment, otherParty);
// player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
// }
// return ret;
// }
// //SubtractBalance will be a ServerCommand Perm leve Op
// public Integer SubtractBalance(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
// Integer ret = -1;
// if (context.getSource().hasPermissionLevel(1)) {
// ret = 0;
// ServerPlayerEntity player = context.getSource().getPlayer();
// BankManager playerBank = new BankManager(player.getUuidAsString());
// playerBank.SubtractBalance(reason, payment, otherParty);
// player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
// }
// return ret;
// }
// public Integer Wire(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
// Integer ret = -1;
// if (context.getSource().isExecutedByPlayer()) {
// ret = 0;
// ServerPlayerEntity player = context.getSource().getPlayer();
// BankManager playerBank = new BankManager(player.getUuidAsString());
// playerBank.Wire(reason, payment, otherParty);
// player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
// }
// return ret;
// }
} }