SkyBlock Minecraft Addon #25 - Parkour top lists & permanent storage for custom armor stands

in utopian-io •  6 years ago 
Now, players can compete against each other on any parkour in SKYBLOCK.SK and look up a top list to view the fastest competitors.

Hello everyone,

I have new features and changes from SKYBLOCK.SK to show off for you guys today. This time, smaller changes have been added, but also a bigger one, which allows saving the parkour top list also, permanent custom armor stands have been added, about which I'm very excited.

1. Repository

https://github.com/Abwasserrohr/SKYBLOCK.SK

2. Index

  1. Repository
  2. Index
  3. New Features and changes
    3.1 parkour.sk: Added top lists for parkour timings and also store it
    3.2 Added serialize functions
    3.3 customarmorstsands.sk: Store armor stand data within the copy tool
    3.4 Added drop flag
    3.5 storage.sk: Added storageitemcheck function & on dispense event
    3.6 storage.sk: Storage units now use formatted numbers
    3.7 Added new challenges to default config
    3.8 Added ChatComponent messages to challenge chat feedback
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features and changes

3.1 parkour.sk: Added top lists for parkour timings and also store it

Parkour is an add-on to SkyBlock which allows the players to set up parkours on their island which other players can play. Some are difficult to solve and some easy and there are people who want to compete with others. I added top lists for that reason, which are all stored directly as nbt data of the parkour block.

Storing data within the parkour block directly instead of a separate database has multiple advantages:

+ The nbt data is only loaded if it is really needed
+ If the parkour gets removed for some reason, there is no leftover data by default
+ Accessing the nbt data is fast and easy
+ If the server world gets backed up, the nbt data is safe

But there also disadvantages:

- Getting the nbt data from somewhere else needs to load a chunk
- Loading much nbt data from multiple locations which have to be loaded first isn't instantly

That sums up the nbt data. Usually, players are next to the parkour block if they're doing the parkour. That way, the nbt data of the block already is loaded and fast to get. Which is one reason why I decided to store the parkour speedrun top list using nbt.

Instead of using the in Skript included now effect to get the current timestamp, I need to get the java.util.Date, which allows for more precise timings and calculation.

Here is an example of how the parkour add-on now stores new parkour entries, if a player finishes the parkour.

This is how it works step by step:

  1. If the parkourtoplist function has been called with the {_action} parameter set to "newentry", the function knows that a new entry should be made.
  2. {_times} is a HashMap("uuid of player", time difference), if the uuid key doesn't exist, it is automatically a new personal best and needs to be stored.
  3. If the uuid key of the HashMap above already exists, check if the new difference ({_diff}) is faster (lower) than the current one.
  4. Save the old personal best for later.
  5. Overwrite the old personal best time with the new one, if it is better (faster).
  6. Serialize the HashMap and save it to the nbt data of the parkour block.

That's how the parkour saves the times. It also has an option which allows the server operator to decide how many speed run top list times should be stored per parkour. By default, 100 times are stored in each parkour. If the amount is exceeded, the slowest times are deleted out of the parkour block.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/240

3.2 Added serialize functions

I don't need to explain much what these functions are going to do. They can serialize any object which can be serialized into a string. That's pretty much all they do. Very useful to store data within items as nbt.

On some systems, these functions might fail because I have not used a specific character set. On my test environment, everything worked fine but on production, it didn't. The reason has been that the server might encode it different than it decoded the information. To solve this issue, I decided to use a predefined character set, Cp1047, which solved the problem.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/241
Character set fix: https://github.com/Abwasserrohr/SKYBLOCK.SK/commit/f49412b4cbb355106e2801a71d3751b6f7bfaa87

3.3 customarmorstsands.sk: Store armor stand data within the copy tool

The new serialize functions come handy here to store copied armor stands for a longer period of time.
Previously, the armor stands have been copied directly by storing a copy of the entity within the temporary metadata of the server, which meant that the copy tool is only working for one server session.

Thanks to the new serialize functions and nbt, all the armor stand data can be saved within the copy tool's nbt data.
This means that the copy tool will never lose any data, the only way that the data of the tool could get lost is by losing the copy tool itself in the game.

Since entities can't be simply serialized, I had to get all the necessary data, save it in a HashMap, serialize the HashMap and store it to the copy tool as nbt.

There is much more about a single armor stand than you might imagine, here is how I stored the data of the armor stand into the HashMap, just to show how much data they have.

I want to mention that ItemStacks have a serialize method included in bukkit, which I use here. I created a function which serializes and de-serializes EulerAngles, they're called pose2text and text2pose. This makes it easy for me to use them in one line to have it less messy.

Here is a video that shows off the new copy tool with a customized armor stand.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/242

3.4 Added drop flag

Some people had fun to clog the hopper systems from other people. Thanks to this new flag, it will be no longer possible to clog hoppers, since it can be disabled by the island owner through the /island flagmenu.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/243

3.5 storage.sk: Added storageitemcheck function & on dispense event

The storage units had a little security hole which allowed to place them over hoppers even if it is disabled because this can currently break the storage unit. As the default block for storage units is a shulker box, they can also be broken by pistons and then replaced everywhere the player wants, also on hoppers. This now has been fixed. It is now checked if the inventory of the shulker box is like a storage unit and prevents it from being placed on top of a hopper.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/252

3.6 storage.sk: Storage units now use formatted numbers

As some players have some heavy big farms running, the storage unit sign displayed some pretty big numbers which are hard to read. The numbers are now formatted to be easier readable.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/253

3.7 Added new challenges to default config

Two new challenges have been added, which allow players to exchange strings from spiders and spider eyes into cobwebs and rotten flesh. This might be useful for people who have many spiders to kill.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/260

3.8 Added ChatComponent messages to challenge chat feedback

The challenge feedback messages now use the ChatComponent. This is very useful if I have to tell the user which items are still needed if the player clicks on a challenge where not all items are available in the inventory. I can simply send for example minecraft.item.stone and it automatically gets translated into the language of the client.

To show off that it actually works: Here is a video where I change my client language between English and German, you can see that the item names change:

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/261


4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/240
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/241
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/242
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/243
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/252
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/253
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/260
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/261


5. GitHub Account

https://github.com/Abwasserrohr


6. How to contribute

If you want to contribute to SKYBLOCK.SK, contact me here in the comments or on Discord. Please contact me directly, I'm the sewage pipe on Discord. I look forward to meeting people who want to get in touch with Skript and Minecraft.
If you never had anything to do with programming, SKYBLOCK.SK could be a great way to start. Skript is easy to learn and gives you the opportunity to understand how things work and also get the idea behind object-oriented languages, like Java while playing a game.

Discord: https://discord.gg/FRuK5BC


Thank you for reading my contribution post.

There have been some really interesting changes for SKYBLOCK.SK this time and I'm really excited about the permanent storage of the custom armor stands and the top lists of the parkour, which finally allow players to compete against each other.

I added some smaller features or changes but these were important for SKYBLOCK.SK to improve it further. Most of the times, the little details are very important for players, which I have to understand and hopefully integrate the right way.

If you have feedback about this contribution post, the new features, and changes or SKYBLOCK.SK as a whole, just comment below this post, I appreciate your feedback.

Have a nice day,

@immanuel94

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  • Congratulations on this great article, the two videos, multiple images and code samples give it a lot of value for the community.
  • Top notch commit comments as well as code comments throughout.
  • It would be cool to have on boarding live parties scheduled to encourage people to try Skyblock.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for reviewing my contribution post. =) 👍

Maybe I'll do a on boarding in the future... I actually do sometimes contests where people can win SBI by playing on a production version of SkyBlock. :3 There are still people that have to buy Minecraft, which is often a hurdle to get in touch with SkyBlock.

Thank you for your review, @helo! Keep up the good work!

Hey @Immanuel94,
ich habe eine Flag Idee für den Skyblock.
Und zwar das man einstellen kann ob Schnee/ Eis schmilzt

Hallo @jongartv! =)

Ja, das ist eine gute Idee!^^ Jenachdem, wieviel Eis auf einer Insel ist, würde das aber auch sehr oft getriggert werden.

Wird sicher in der folgenden Zeit hinzugefügt: https://github.com/Abwasserrohr/SKYBLOCK.SK/issues/289.

Wie gewohnt ein Top Post!

Vielen Dank für dein Feedback. =) 👌

Kein Thema.^^

ich finde die neuen Features echt cool, vorallem das man keine Items droppen kann ist nice

Freut mich, dass dir der neue Flag und die Features gefallen! ;) Wenn du Ideen hast, melde dich gerne.^^

Tolle neue Funktionen die du eingebaut hast. JnR betrifft mich zwar weniger aber alles andere hört sich sehr gut an.

Super, dass dir die anderen Sachen soweit gefallen. :3 Ja, Parkour ist nicht für jeden was...

Nice

Gute Arbeit! ^^

Just amazing how much time you put into this

ich finde Skybloch toll aber es ist blöd das mann die Versioon ändern muss

Ja, der Sv wird Bald auch in der 1.13 Laufen.^^

Sogar auf 1.14! =)

Oh, ups da habe ich mich verschreiben.^^

Da kann man ja schon gespannt sein, was du dir als nächstes noch alles einfallen lässt =)

Naja, meistens sind es die Ideen von den Spielern, die ich einbaue. =) Aber da kommen noch ein paar Interessante Ideen, in der Zukunft. =)

ich mag den SB inzwischen echt ^^

Hi @immanuel94!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @immanuel94!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!