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

native_minecraft_version and supported_minecraft_versions return null. #53

Open
itaquito opened this issue Jun 21, 2021 · 6 comments · May be fixed by #50
Open

native_minecraft_version and supported_minecraft_versions return null. #53

itaquito opened this issue Jun 21, 2021 · 6 comments · May be fixed by #50

Comments

@itaquito
Copy link

itaquito commented Jun 21, 2021

Hey! While experimenting more with the API (and using it in something I'm developing) I realised that some resources return null on native_minecraft_version and supported_minecraft_versions while others return an empty string on native_minecraft_version and an empty array on supported_minecraft_versions (expected behaviour).
Of course, this only happens on resources that don't have this information.

Such as these 2 resources:
Error: https://www.spigotmc.org/resources/269/ (https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id=269)

{
  "id": "269",
  "title": "BungeePlayerCounter",
  "tag": "Show player's count of each server in a scoreboard",
  "current_version": "1.5.2 beta",
  "native_minecraft_version": null,
  "supported_minecraft_versions": null,
  "icon_link": "https://www.spigotmc.org/styles/default/xenresource/resource_icon.png",
  "author": {
    "id": "7517",
    "username": "AlphartDev"
  },
  "premium": {
    "price": "0.00",
    "currency": ""
  },
  "stats": {
    "downloads": "22408",
    "updates": "11",
    "reviews": {
      "unique": "42",
      "total": "43"
    },
    "rating": "4.45238"
  },
  "description": "(...)"
}

Expected behaviour: https://www.spigotmc.org/resources/313/ (https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id=313)

{
  "id": "313",
  "title": "BungeeTabListPlus",
  "tag": "Customize your tab list",
  "current_version": "3.4.4",
  "native_minecraft_version": "",
  "supported_minecraft_versions": [],
  "icon_link": "https://www.spigotmc.org/data/resource_icons/0/313.jpg?1455645578",
  "author": {
    "id": "9041",
    "username": "CodeCrafter47"
  },
  "premium": {
    "price": "0.00",
    "currency": ""
  },
  "stats": {
    "downloads": "106209",
    "updates": "114",
    "reviews": {
      "unique": "311",
      "total": "356"
    },
    "rating": "4.63987"
  },
  "description": "(...)"
}

I'm not sure what is the cause.

@jacobsandersen
Copy link
Collaborator

They're null if never set before, and empty string/array if set before and then unset.

Working on documentation.

@itaquito
Copy link
Author

Ohhhh, okey! Thanks for the clarification.

@jacobsandersen
Copy link
Collaborator

This could be improved to be made more consistent, I will look into it.

@MrIvanPlays
Copy link

@simpleauthority you may want to always return empty string and empty array (or null) if they're not set and add a property "set_before_versions" of some kind or sth.

@jacobsandersen jacobsandersen linked a pull request Jun 24, 2021 that will close this issue
@Andre601
Copy link

I feel like that returning an empty String is.... bad.

The native_minecraft_version should imo always return null when never set or unset and supported_minecraft_versions should always return an array, either empty or filled.

This inconsistent behaviour with null and non-null values is only confusing and causes us to have extra work.

@jacobsandersen
Copy link
Collaborator

Sorry it took so long. When #50 is merged, this will be fixed.

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

Successfully merging a pull request may close this issue.

5 participants
@Andre601 @jacobsandersen @itaquito @MrIvanPlays and others