Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Get Any Resources #21

Open
demengc opened this issue Jun 26, 2020 · 0 comments
Open

Cannot Get Any Resources #21

demengc opened this issue Jun 26, 2020 · 0 comments

Comments

@demengc
Copy link

demengc commented Jun 26, 2020

I've tried getting resources by ID and getting all of a user's created resource but nothing seems to work. The API always returns null or an empty list.

public static List<PremiumResource> getPurchasedResources(User user)
      throws ConnectionFailedException {

    final List<PremiumResource> purchased = new ArrayList<>();

    for (Resource r :
        Main.getResourceManager().getResourcesByUser(Main.getUser(), Main.getUser())) {

      System.out.println(r.getResourceName());

      if (r instanceof PremiumResource) {

        System.out.println("Premium");

        final PremiumResource resource = (PremiumResource) r;

        for (Buyer buyer :
            Main.getResourceManager().getPremiumResourceBuyers(resource, Main.getUser())) {

          System.out.println(buyer.getUsername());

          if (buyer.getUserId() == user.getUserId()) {
            purchased.add(resource);
          }
        }
      }
    }

    return purchased;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant