SkyBlock Minecraft Addon #24 - New flag category, voting rewards add-on & improved performancesteemCreated with Sketch.

in utopian-io •  6 years ago 
Thanks to a new flag, it is now possible to set the island on fire, which also spreads everywhere. I accidentally set myself on fire while trying to get a selfie.

Hello everyone,

I have new features and changes from SKYBLOCK.SK to show off. This time, a voting reward add-on, a new flag category, new flags, and an improved island center detection are the main parts of this contribution post. Also, some other smaller changes have it made into SKYBLOCK.SK, which are useful for some players.

1. Repository

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

2. Index

  1. Repository
  2. Index
  3. New Features and changes
    3.1 Added voting reward system
    3.2 Introduced new flag category & new flags
    3.3 Books are now used for the /island help command
    3.4 Added the "publicchest" add-on
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features and changes

3.1 Added voting reward add-on

This is an exciting new add-on which can hook directly into SKYBLOCK.SK, it allows the server operators to give the players a better opportunity and reasons to vote for the server on server lists.

There are some very good visited server lists on the internet on which the server operators may want to get listed with a high rank, which means they get placed at a good spot. The easiest way of getting many votes is by giving the players a little reward for voting as an incentive.

This is where the new add-on comes in and (hopefully) saves the day. It allows a loyalty bonus for each day the player is voting for the server. What do I mean with loyalty bonus? If a player votes every day, the rewards can be changed by the server operator. For example, the rewards could increase by 20% or even double each day until it hits 700% bonus at the last 7th day, where it would keep it and no longer increase.

The loyalty bonus could be an opportunity for more votes since the counter resets once the player misses a day out.

This add-on is disabled by default because it needs a proper setup before it can be used. It depends on the well known Votifier plugin, which is used by most server operators.

I added this add-on to SKYBLOCK.SK, because I want to give the server operators ways of giving an increased reward to players if they're voting every day. There are the already existing loot boxes in SKYBLOCK.SK, which can also be used by the new add-on.

One thing that bothered me has been the amount of data which has to be saved to know when the player voted the last time, I'm using an ArrayList to store the rewards for each day and also the last voting time for each vote.

Once a player votes on a server list, the server list then sends an encrypted signal to the server, which triggers the com.vexsoftware.votifier.model.VotifierEvent event of Votifier.

The first important step in my opinion is to log the incoming votes, here is how I did that:

You may have seen that this add-on allows disabling the logging of the IP addresses, this is important for servers located in Europe to follow the GDPR easier. It seems that most server plugins do not care about the privacy of the player and just save everything forever, I wouldn't like the idea of storing private data of the player on my server, which is also why IP address logging is disabled by default.

Then, it is checked if the player has voted within the time where the loyalty bonus is given. The server operator can change the timeframes for how many hours the player has to wait for the next loyalty bonus day and also how long it takes until the bonus expires and resets to the first day.

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


3.2 Introduced new flag category & new flags

SKYBLOCK.SK users already asked for this quite some times now and it now has been added. Thank you for your feedback, guys! Also a special thanks to @kavaeron for feedback about new flags like the "fire spread" flag, which now allows players to enable fire spreading on the island.

While the old island center search has worked, It wasn't as fast as I needed it to be for the new flags. There is a reason why it has to be faster: The old island center search took around 0.2 seconds, while this ok if it is cached, I really had no idea how to cache it for fire or mob spawning since there is no player involved to which I could save the cached data.

Because there was no place to save the data, it had to call the function to search the island center every time there is a fire spread or a mob spawned and if someone decides to burn his entire island, it would lag. I tested it and it has been very laggy. Now that has been a problem which needed to be solved before the new flags could get added to SKYBLOCK.SK.

I'm really not a very mathematical guy, which is kinda bad since it would be amazing to have math skills for this. There might be a better way of doing this but this way worked.

Here is how it looked before. It is always good to see how you can do it, but better not do it and a better example. =)

This is the old version, which looped all blocks around the location on the y-coordinate of the predefined bedrock height and then returned the first bedrock it found. It worked but as you can imagine, there is quite much space for improvement there. Since big islands have 40 000 blocks only on the predefined bedrock height, you can imagine these get looped through every mob spawning event. Really not a good idea! =D

So I needed to improve this and this is what I've come up with and it also works.

As this worked well for me, I hope there is no flaw in it.

First of all, the goal was to reduce the calculation as much as possible to make it very fast to calculate the island center location from any point of the island without looping around any blocks.

Now here is the math:

  1. Set the predefined distance between all islands and multiply it by 2 as {_d2}.
  2. Set the x-coordinate of the event-location and divide it by {_d2} as {_x}
  3. Round {_x} to an integer
  4. Multiply {_x} by {_d2}
  5. Repeat Step 2 to 4 with the z-coordinate of the event.

Now, we have two coordinates, the x- and z-coordinate of the island center, on where the event happened. These two then get parsed as a location with the predefined bedrock height and returned to be used. This is a very big performance increase since the function no longer has to loop through thousands of blocks.

Here you can see me trying the new fire spread flag out, it only spreads if enabled. (Blocks which are already burning will still be destroyed.)

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


3.3 Books are now used for the /island help command

The SKYBLOCK.SK help command were displayed in the chat, like the /island top or the /island info command, with all the improvements on other commands, it is needed to add /island help to the books to make SKYBLOCK.SK more consistent. Also, books can have multiple sites, hover effects and click events, which really helps when making a book which should contain important information about the commands of SKYBLOCK.SK.

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


3.4 Added the "publicchest" add-on

There has been a request by @altonos to give special people access to one specific chest. It can be very useful if friends get a special chest with some stuff without opening the whole island using a flag for the trusted friend. This new and small add-on allows exactly this little thing. The island owner can place the "publicchest" sign and grant access to the chest to up to 3 people, even if they have no access to the island.

Here is how it works if a player who has access is trying to open the chest using the sign:

I always try to have as few variables as possible stored anywhere, since this is what increases loading times on startup. Instead, I try to use data which has to be loaded anyways by Minecraft. In this case, it is the sign, which can hold 4 lines of text. The first line is the identifier for the add-on and the three lines below it are there to define the players.

It is pretty straight forward, if the player clicks on such a sign and the player is also on the sign as a text, the add-on opens the chest for the player.

The server operator can change the add-on identifier in the options to fit the language and the look of the server.

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


4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/231
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/236
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/237
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/238


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.

I'm glad that the new island center calculation seems to work flawlessly and fast, also the newly introduced flags are nice to have. These new general flags allow some impressive new flags which could get added in the future, including toggling slime mob spawning and player vs player changeable (optional) by the island owner and of course by the server operator.

I also not talked about it, but the new flags have been improved for server operators: The server operator can now decide, which flags can be changed by the island owners and which have to be on the default setting. That way, the server operator can, for example, disable fire spread on the entire server and not allowing to toggle it on.

That's all I have to share for this post, it has been some time since my last development post but I've been really busy the last couple of days. :3

The week is almost done, have a great Friday and then a nice weekend! =)

@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:  

Thank you for your contribution. As usual, the post is of very high quality, commit messages are great as well as the comments in the code are proper. A significant update to the project as well as a lot of research is done.


If you would like further explanation of the given score, please ask.

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. :)

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

Die neuen Features hören sich echt gut an, Muss ich dann später gleich mal testen.

Ja, da sind schon ein paar Sachen dabei, die einem gut helfen können, gerade, wenn man z. B. nicht ganz abgebaute Bäume hat, die in der Luft herumschweben und endlich abgebrannt werden können... =D

Ich finde es cool das es jetzt viele neue Features gibt. Vorallem die neuen Flags sind cool

Hallo @jongartv! =)

Freut mich, dass dir die neuen Flags gefallen. Da kommen bald auch noch mehr praktische Flagss.^^

Geil wie schnell sich der SB entwickelt. Immer weiter so!

Super, dass dir die Richtung gefällt, in die sich SKYBLOCK.SK entwickelt. :3

Ich hoffe das jetzt mehr Leute Motiviert werden zu Voten.^^

Mal schauen, dauert noch etwas, bis es auf dem Server fertig eingerichtet ist.. =)

nice^^ Freue mich auf deinen nächsten Post schon

Diese Features sind schon durchaus Nice. Endlich kann ich meinen Wald abbrennen lassen!

Ja, endlich nerven diese großen Bäume nicht mehr so sehr. XD

ich finde die neuen featcher sehr toll

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

Congratulations @immanuel94! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 2000 comments. Your next target is to reach 2500 comments.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

The Steem blockchain survived its first virus plague!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

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!