Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.20.1/dev' into 1.20.1/salepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
techno-sam committed Aug 8, 2024
2 parents 9985089 + e6c8edc commit 0ee6549
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 168 deletions.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: I found a bug!
description: "Report some other kind of issue. You should ask in the Discord first to make sure it's actually a bug with Numismatics."
labels: [ "type: bug" ]
body:
- type: textarea
attributes:
label: Description
description: "
Please describe the issue with as much detail as possible.
Explain what happened, and what should have happened instead.
Add images, screenshots, or videos if they could be useful."
validations:
required: true

- type: input
attributes:
label: Game Log
description: "
We need the game log for additional information about the bug.
This file can be found in the \"logs\" folder of your Minecraft folder as \"latest.log\".
Please upload the file to https://mclo.gs/ and put the link here.
Do **not** paste the *contents* of the file here, because that will make this issue very hard to read.
"
validations:
required: true

- type: textarea
attributes:
label: Debug Information
description: "
Please run the \"/create debuginfo\" command in-game.
This will copy useful information to your clipboard that will greatly help with debugging.
Please paste this information here.
If this command does not exist, you can skip this part.
"
validations:
required: false

- type: markdown
attributes:
value: "Thank you for taking the time to make a report and help improve Numismatics!"
97 changes: 0 additions & 97 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: I have a question!
url: https://discord.gg/create-steam-n-rails-706277846389227612
about: Join us on Discord and ask the community.
- name: I have a suggestion or idea!
url: https://discord.gg/create-steam-n-rails-706277846389227612
about: These are best discussed with the community and submitted on Discord.
- name: Talk to us on Discord.
url: https://discord.gg/create-steam-n-rails-706277846389227612
about: Ask questions and get help from the community.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/crash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: My game crashed!
description: Report an issue that crashes the game.
labels: [ "type: crash" ]
body:
- type: textarea
attributes:
label: Context
description: What were you doing when the game crashed? Add images, screenshots, or videos if they could be useful.
validations:
required: true

- type: input
attributes:
label: Crash Report
description: "
We need the crash report to figure out why the crash happened.
This file can be found in the \"crash-reports\" folder of your Minecraft folder.
It will be the newest file there.
Please upload the file to https://mclo.gs/ and put the link here.
Do **not** paste the *contents* of the file here, because that will make this issue very hard to read.
"
validations:
required: true

- type: markdown
attributes:
value: "Thank you for taking the time to make a report and help improve Numismatics!"
25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/suggestion.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import dev.ithundxr.createnumismatics.Numismatics;
import dev.ithundxr.createnumismatics.config.NumismaticsConfig;
import dev.ithundxr.createnumismatics.content.backend.BankAccount;
import dev.ithundxr.createnumismatics.content.backend.IDeductable;
import dev.ithundxr.createnumismatics.content.backend.ReasonHolder;
Expand All @@ -32,12 +33,55 @@
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;
import java.util.*;

public enum BankTerminalPeripheral implements IPeripheral {
INSTANCE
;

@LuaFunction
public final List<String> getAccounts() throws LuaException {
List<String> output = new ArrayList<String>();
for (UUID uuid : Numismatics.BANK.accounts.keySet()) {
output.add(uuid.toString());
}
return output;
}

@LuaFunction
public final String getAccountLabel(String accountID) throws LuaException {
UUID account$;
try {
account$ = UUID.fromString(accountID);
} catch (IllegalArgumentException e) {
throw new LuaException("Invalid UUID");
}

BankAccount bankAccount = Numismatics.BANK.getAccount(account$);
if (bankAccount == null) {
throw new LuaException("Account not found");
}

return bankAccount.getDisplayName().getString();
}

@LuaFunction
public final boolean isPlayerOwned(String accountID) throws LuaException {
UUID account$;
try {
account$ = UUID.fromString(accountID);
} catch (IllegalArgumentException e) {
throw new LuaException("Invalid UUID");
}

BankAccount bankAccount = Numismatics.BANK.getAccount(account$);
if (bankAccount == null) {
throw new LuaException("Account not found");
}

return (bankAccount.type == BankAccount.Type.PLAYER);
}

@LuaFunction
public final int getBalance(String accountID) throws LuaException {
UUID account$;
Expand All @@ -55,6 +99,64 @@ public final int getBalance(String accountID) throws LuaException {
return bankAccount.getBalance();
}

@LuaFunction
public final List<String> getSubAccounts(String accountID) throws LuaException {
if (NumismaticsConfig.server().getSubAccountsCommand.get()) {
UUID account$;
try {
account$ = UUID.fromString(accountID);
} catch (IllegalArgumentException e) {
throw new LuaException("Invalid UUID");
}

BankAccount bankAccount = Numismatics.BANK.getAccount(account$);
if (bankAccount == null) {
throw new LuaException("Account not found");
}

List<String> output = new ArrayList<String>();
bankAccount.getSubAccounts().forEach((temp) -> {
output.add(temp.getAuthorizationID().toString());
});

if (output.isEmpty()) {
throw new LuaException("No sub accounts");
}
return output;
} else {
throw new LuaException("Function disabled by config");
}
}

@LuaFunction
public final String getSubAccountLabel(String accountID, String authorizationID) throws LuaException {
UUID account$, authorization$;
try {
account$ = UUID.fromString(accountID);
authorization$ = UUID.fromString(authorizationID);
} catch (IllegalArgumentException e) {
throw new LuaException("Invalid UUID");
}

Authorization authorization = new Authorization.Anonymous(authorization$);

BankAccount bankAccount = Numismatics.BANK.getAccount(account$);
if (bankAccount == null) {
throw new LuaException("Account not found");
}

ReasonHolder reasonHolder = new ReasonHolder();
SubAccount subAccount = bankAccount.getSubAccount(authorization, reasonHolder);

if (subAccount == null) {
Component errorMessage = reasonHolder.getMessageOrDefault(Components.translatable("error.numismatics.authorized_card.account_not_found"));
throw new LuaException(errorMessage.getString());
}


return subAccount.getLabel();
}

@LuaFunction
public final int getMaxAvailableWithdrawal(String accountID, String authorizationID) throws LuaException {
UUID account$, authorization$;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class CServer extends ConfigBase {
public final ConfigInt starterCogs = i(0, 0, "starter_cogs");
public final ConfigInt starterCrowns = i(0, 0, "starter_crowns");
public final ConfigInt starterSuns = i(0, 0, "starter_suns");

public final ConfigGroup computerCraft = group(0, "computerCraft", Comments.computerCraft);

public final ConfigBool getSubAccountsCommand = b(false, "get_sub_accounts_command", Comments.getSubAccountsCommand);


//public final ConfigGroup misc = group(0, "misc", Comments.misc);
Expand All @@ -46,9 +50,13 @@ public String getName() {

private static class Comments {
static final String coins = "Coin settings";

static final String starterCurrency = "How much of this coin type should players receive in their bank account on first join";;


static final String computerCraft = "Settings relating to ComputerCraft compatibility";

static final String getSubAccountsCommand = "Enables the getSubAccounts function. Disabled by default due to security concerns.";

static final String misc = "Miscellaneous settings";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"gui.numismatics.vendor.generic_named": "Kontakt %s",
"gui.numismatics.vendor.incorrect_item": "Falscher Gegenstand",
"gui.numismatics.vendor.insufficient_funds": "Unzureichendes Guthaben",
"gui.numismatics.vendor.insufficient_funds.named": "Unzureichenden Kontostand, kontaktiere %s für eine Nachfüllung",
"gui.numismatics.vendor.mode.buy": "Kaufen",
"gui.numismatics.vendor.mode.buy.action": "Zum Kauf verwenden",
"gui.numismatics.vendor.mode.sell": "Verkaufen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"gui.numismatics.vendor.generic_named": "Kontakt %s",
"gui.numismatics.vendor.incorrect_item": "Falscher Gegenstand",
"gui.numismatics.vendor.insufficient_funds": "Unzureichendes Guthaben",
"gui.numismatics.vendor.insufficient_funds.named": "Unzureichenden Kontostand, kontaktiere %s für eine Nachfüllung",
"gui.numismatics.vendor.mode.buy": "Kaufen",
"gui.numismatics.vendor.mode.buy.action": "Zum Kauf verwenden",
"gui.numismatics.vendor.mode.sell": "Verkaufen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"gui.numismatics.vendor.generic_named": "Contacter %s",
"gui.numismatics.vendor.incorrect_item": "Item incorrect",
"gui.numismatics.vendor.insufficient_funds": "Fonds insuffisants",
"gui.numismatics.vendor.insufficient_funds.named": "Fonds insuffisants, contactez %s pour un réapprovisionnement",
"gui.numismatics.vendor.mode.buy": "Acheter",
"gui.numismatics.vendor.mode.buy.action": "Utiliser pour acheter",
"gui.numismatics.vendor.mode.sell": "Vendre",
Expand Down
Loading

0 comments on commit 0ee6549

Please sign in to comment.