Skip to content

Commit

Permalink
Test modifications, and patches.
Browse files Browse the repository at this point in the history
Signed-off-by: creatorfromhell <[email protected]>
  • Loading branch information
creatorfromhell committed Aug 24, 2023
1 parent 743e6e6 commit d2adf18
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -158,9 +159,11 @@ public boolean loadCurrency(final File directory, File curDirectory) {
uuidAsId = cur.getBoolean("Info.UUIDAsId");
}


final UUID check = UUID.nameUUIDFromBytes(identifier.getBytes(StandardCharsets.UTF_8));
if(cur.contains("Info.UUID")) {

final UUID check = UUID.fromString(identifier);
System.out.println("UUIDASID: " + uuidAsId);

final UUID id = (uuidAsId && !cur.getString("Info.UUID").equalsIgnoreCase(check.toString()))? check : UUID.fromString(cur.getString("Info.UUID"));

Expand All @@ -170,7 +173,9 @@ public boolean loadCurrency(final File directory, File curDirectory) {
currency.setUid(UUID.fromString(cur.getString("Info.UUID")));
}
} else {
currency.setUid(UUID.fromString(identifier));
if(uuidAsId) {
currency.setUid(check);
}
}

currency.setIdentifier(identifier);
Expand Down
24 changes: 21 additions & 3 deletions Core/src/net/tnemc/core/handlers/player/PlayerJoinHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,23 @@ public HandlerResponse handle(PlayerProvider provider) {
if(acc.isPresent()) {

if(firstJoin) {
final String region = TNECore.eco().region().getMode().region(provider);
for(Currency currency : TNECore.eco().currency().currencies()) {
acc.get().setHoldings(new HoldingsEntry(TNECore.eco().region().getMode().region(provider),

if(currency.type().supportsItems() && MainConfig.yaml().getBoolean("Core.Server.ImportItems", true)) {

TNECore.eco().account().getImporting().add(id);

for(HoldingsEntry entry : acc.get().getHoldings(region, currency.getUid())) {

acc.get().setHoldings(entry, entry.getHandler());
}

TNECore.eco().account().getImporting().remove(id);
continue;
}

acc.get().setHoldings(new HoldingsEntry(region,
currency.getUid(),
currency.getStartingHoldings(),
EconomyManager.NORMAL
Expand All @@ -93,11 +108,14 @@ public HandlerResponse handle(PlayerProvider provider) {

if(currency.type().supportsItems()) {

/*System.out.println("Region: " + acc.get().getWallet().getHoldings(region).isEmpty());
System.out.println("Currency: " + !acc.get().getWallet().getHoldings(region).get().getHoldings().containsKey(currency.getUid()));
if(MainConfig.yaml().getBoolean("Core.Server.ImportItems", true)
&& acc.get().getWallet().getHoldings(region).isEmpty()
|| MainConfig.yaml().getBoolean("Core.Server.ImportItems", true)
&& acc.get().getWallet().getHoldings(region).get().getHoldingsEntry(currency.getUid()).isEmpty()) {
&& !acc.get().getWallet().getHoldings(region).get().getHoldings().containsKey(currency.getUid())) {
System.out.println("Importing Item Currency.");
TNECore.eco().account().getImporting().add(id);
for(HoldingsEntry entry : acc.get().getHoldings(region, currency.getUid())) {
Expand All @@ -107,7 +125,7 @@ public HandlerResponse handle(PlayerProvider provider) {
TNECore.eco().account().getImporting().remove(id);
continue;
}
}*/

for(HoldingsEntry entry : acc.get().getHoldings(region, currency.getUid())) {

Expand Down

0 comments on commit d2adf18

Please sign in to comment.