[Open Source] SkyBlock Minecraft Addon [New features & changes #9]steemCreated with Sketch.

in #utopian-io5 years ago (edited)

Hello everyone,

I have added new functions, changed some code and solved some issues the last couple of days on SKYBLOCK.SK, a Minecraft game, where players have to play on an island flying in the air. SKYBLOCK.SK is licenced under the MIT licence and free to use as wanted.

1. Repository

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

2. Index

  1. Repository
  2. Index
  3. New Features and changes
    3.1. Allow damage by bows for people who have access to the island
    3.2. Removed elevator.sk bug and renewed the process
    3.3. The island top list now deletes duplicate entries
    3.4. /island info now uses checkislandaccess function
    3.5. Explosion flags are now working for everyone.
    3.6. Added flag check for Redstone
    3.7. The lava bucket within a new island chest is now bound to the island
    3.8. Added selectlanguage & changelanguage function
    3.9. Changed tabs to spaces
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features

3.1. Allow damage by bows for people who have access to the island

Players can now deal damage with bows and snowballs, if they have access to the island.

Before this change, it was not possible to attack mobs or anybody because every damage event has been cancelled before.
This is how it looked before:

  if "%{_player}%" is "arrow" or "snowball":
    cancel event

And it has been changed to now check the shooter of the snowfall, if there are rights to throw the snowball or shoot the arrow:


  if "%{_player}%" is "arrow" or "snowball":
    if {_player}.getShooter() is a player:
      if event.getEntity() is a animal:
        set {_type} to "animal"
      else if event.getEntity() is a player:
        if {SB::config::pvp} is false:
          cancel event
          stop
      else if event.getEntity() is a monster:
        set {_type} to "monster"
      else:
        set {_type} to "entity"
      set {_allowed} to checkislandaccess({_player}.getShooter(),location of event.getEntity(),"EntityDamageByEntityEvent-%{_type}%")
      if {_allowed} is false:
        cancel event
        stop

This is not only checking if the shooter is allowed to shoot, but also sets the entity which has been hit by the projectile to check if there is a flag set, which disallows this kind of action. If the action is allowed, it is not cancelled.

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


3.2. Removed elevator.sk bug and renewed the process

An example of an elevator death trap.

The elevator had a dangerous bug, which likely killed players who have set up multiple elevators at the same x- and z-coordinate on the teleportation downwards. This happened, since it didn't stop at the first elevator sign but calculated the distance between all elevators together and teleported the player to the incorrect distance, which in this case, was below y-coordinate 0. I have changed the elevator.sk. It now loops through the blocks below or above one by one until it finds the right and matching elevator sign and then stops searching and teleports to there.

This is the example how it searches for matching elevator signs:

on rightclick on sign:
  if line 1 of event-block is {@sign_lift}:
    set {_clift} to location of event-block
    if line 2 of event-block is {@sign_down}:
      loop 255 times:
        remove 1 from y-coordinate of {_clift}
        if line 2 of block at {_clift} is {@sign_up}:
          set {_liftdest} to {_clift}
          stop loop

If a player clicks on a lift sign and it contains on the second line the same text as the option {@sign_down}, then loops 255 blocks downwards until it hits a block with the text like option {@sign_up}on the second line. It then sets this sign to the {_liftdest} variable.

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


3.3. The island top list now deletes duplicate entries

In some cases, the server crashes or something else happens. In that case, some variable lists might get duplicated or left over. The array, where this happened multiple times for me has been the {SB::islvl::*} array. To prevent this, it is now checking for any duplicates and deletes them to prevent any errors, which could occur due to duplicates.

This might get included into the start-up process. But right now, it is working while rearranging and sorting the top list for /island top.

          if {_duplicationcheck::%loop-index%} is set:
            delete {SB::islvl::%loop-index%}
          set {_duplicationcheck::%loop-index%} to loop-value
          if {_Level::%{_uuid}%} is set:
            delete {SB::islvl::%loop-index%}
          set {_Level::%{_uuid}%} to {_level}

To determine, if a duplicate has been detected, it watches out for a duplicate index in the array and also for duplicate player uuids in the array. If it finds anything, it deletes the duplicate.

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


3.4. /island info now uses checkislandaccess function

The searchisland function has been used before to get the island bedrock. While the searchisland function is great to find non-existent islands, where no bedrock is set, it is not as efficient as the checkislandaccess to detect an already existing island and taking the temporary created location as bedrock.
This increases the speed of the /island info command. I also changed the tabs to spaces, I'm sorry for that but I linked directly to the new lines.
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/82/commits/d46b9c79b44f966fc8e2b4a9ec8855d921f100e9#diff-bb659113c6eddd1f292786cc198fce1eR667


3.5. Explosion flags are now working for everyone.

Before, the checkislandaccess function automatically returned true for admins.

Before, explosion flags have not worked correctly, they did explode if an admin where near the place, since the checkislandaccess function always returned true for admins. But explosions are now handled correctly. Creepers now do not longer explode in front of admins.

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


3.6. Added flag check for Redstone

Thank you for testing the new flags out, @mcsiempre! =)

People wanted to have the possibility to change the flags for Redstone specific stuff. Now, it is added, the players can now set the flags for foreign, trusted players and members of their island to be changed. Like repeater, comparators or daylight sensors.

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

The new Redstone flag is also available through the /island flag menu, of course. :)

3.7. The lava bucket within a new island chest is now bound to the island

The lava bucket within the new created chest of an island is now also island bound.

I'm really trying hard to remove any abuse from the island creation abuse. Since people testing everything and trying to cash out as fast as they can, it is easy to detect that there is something going wrong. The lava buckets, which spawn with the islands haven't been bound to the island. This is now changed.


               if {_titem} is a lava bucket:
                set {_x} to x-coord of {_loc}
                set {_z} to z-coord of {_loc}
                set lore of {_titem} to "&r%{SB::lang::islandbound::%{SK::lang::%uuid of player%}%}%||&7%{_x}%_%{_z}%"

If there is an item that should be placed in the chest it checks if it is a lava bucket, if it is, bind it to the island by setting the lore of the item to the x- and z-coordinate of the islands bedrock (island middle).

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


3.8. Added selectlanguage & changelanguage function

The new language menu, which displays the flag of the language. Textures can be changed in the language files.

This has been on the issue list for some time now. And it's finally here. =) With the new selectlanguage and changelanguage function, players can use /island lang or /island language to open a language menu where all languages are displayed automatically, if they are located within the "SkyBlock/lang/" folder.

This is how the new selectlanguage function is detecting the languages:


   set {_files::*} to ...new File("plugins/Skript/scripts/SkyBlock/lang").listFiles()
  loop {_files::*}:
    if loop-value.toString().endsWith(".sk") is true:
      set {_fname} to loop-value.getName()
      set {_l::*} to {_fname} split at "."

First, it loads all files into a new object list, which is stored in the {_files::*} array(list). This array is then looped trough, it checks if the file ends with ".sk".
If it ends with ".sk", it is a valid skript file and should be used. The name is taken and split at the "." into an array. The first entry of the new array is then used for the language code. Exampe: "de".

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


3.9. Changed tabs to spaces

As suggested in the last post by @helo, I changed the "tabs" to 2 spaces, which really helps a lot to make it easier to read, thank you for the suggestion. =)

I don't really know how to make multiple changes in one commit, that's why there are multiple for this one, did I miss there something in the GitHub GUI? :3 I have to ask someone..^^

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


4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/76
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/77
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/81
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/82
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/83
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/84
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/85
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/86
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/87


5. GitHub Account

https://github.com/Abwasserrohr


6. How to contribute

If you're interested in contribution to SKYBLOCK.SK, feel free to contact me on Discord or create a pull request on GitHub. I'm looking forward to see you on Discord or GitHub. =) I'm Abwasserrohr there.

Discord: https://discord.gg/FRuK5BC


Thank you for reading this contribution post. I gathered some pull requests together this time, since I split them more than before to have a better overview later, what has been changed in which pull request. =)

I made a mistake to not change all tabs to spaces within one specific pull request, since it makes it hard to review the code at 3 pull requests. I'm very sorry about that.

If you have any feedback, just let me know, I'm open to new suggestions or features.

Keep on steeming and a nice week

@immanuel94

Sort:  
  • Great article, great formatting and handling of images.
  • Lots of code sample and explanation of the improvements.
  • If you wanted to go one step above, you could improve github itself by adding skript syntax highlighting!
    https://github.com/github/linguist

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? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for reviewing my contribution post. =)

I'm looking into the linguist repository....

I looked into it and it seems they only accept pull requests for new syntax highlighting if it is used enough on github. It seems like skript is not used enough (tagged) I think. I have to tag my repository soon...^^

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

Cool das /is top jetzt richtig funktioniert. Die anderen neuen Features sind ebenfalls toll.

Freut mich, dass dir die neuen Funktionen gefallen, @flyerchen.^^
Ja, /is top sollte jetzt besser funktionieren als vorher, viele wurden nicht angezeigt. Jetzt geht das.^^

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!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63960.62
ETH 3142.95
USDT 1.00
SBD 3.95