SamB440 / Tale-of-Kingdoms

An adventure of glory in the world of Minecraft - Revival of Tale of Kingdoms mod
GNU General Public License v3.0
16 stars 2 forks source link

Implemented json to ShopItem conversion, Fixes #56 - [merged] #107

Closed SamB440 closed 2 years ago

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 24:24

Merges master -> master

This pr fixes #56 as said in the title, for information on the changes, check the commit message and/or changes.

SamB440 commented 3 years ago

I believe StringBuilder should be use for this type of thing

SamB440 commented 3 years ago

I think we should not have this static and instead have one instance of ShopParser and access it through ShopParser#getShopItems

SamB440 commented 3 years ago

Use throws ReflectiveOperationException

SamB440 commented 3 years ago

No star imports

SamB440 commented 3 years ago

Cache the new ShopParser and use that instance everywhere

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:25

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopItem.java line 42

Why do you think a StringBuilder is necessary? Doesn't seem like it's needed imo (and the ide recommended making the toString method that way)

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:26

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 4

Sorry, The ide keeps doing that

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:30

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 31

Well I thought it would make sense for it to be static as there should only ever be one instance of ShopParser (in use) and the shop parser should always return the most up to date values (and the Sell, Blacksmith, and Food Shops should always get the most updated values as well, makes it helpful and easy for implementing the /taleofkingdoms reload command) but if you think it should be instance based then I will change it.

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:31

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 89

Fixed, will be pushing commit soon.

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:32

Commented on src/main/java/com/convallyria/taleofkingdoms/TaleOfKingdoms.java line 159

Check my reasoning for the static map to understand why I did that, if you think my reasoning is not good enough then I will do your requested change.

SamB440 commented 3 years ago

Don't think it is necessary, it's just a general pattern that I usually see in Minecraft/Minecraft server code.

SamB440 commented 3 years ago

This should be ok for now then, might need changing in the future though

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:36

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 31

Alright!

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:39

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopItem.java line 42

Oh, I think it would just make it more messy to have a bunch of appends and I don't feel our needs fits the purpose of StringBuilder, not sure why the Minecraft/Minecraft server code would use StringBuilder but I definitely wouldn't use their code as a good example given how bad minecraft server performance has gotten (since 1.13), but nevertheless, that is interesting.

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 89

changed this line in version 2 of the diff

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 4

changed this line in version 2 of the diff

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

added 1 commit

Compare with previous version

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 89

Added in pushed commit.

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

Commented on src/main/java/com/convallyria/taleofkingdoms/common/shop/ShopParser.java line 4

Fixed in pushed commit.

SamB440 commented 3 years ago

In GitLab by @jordanplayz158 on Jun 6, 2021, 15:46

resolved all threads

SamB440 commented 3 years ago

approved this merge request

SamB440 commented 3 years ago

mentioned in commit bed17c3225e51e13eed9cb0d60315199b8475dcb

SamB440 commented 3 years ago

requested review from @SamB440