[Open Source] SkyBlock Minecraft Addon - First island abuse prevention [New features #6]
Hello steemians and also minecrafters,
the last couple of days, I have made changes for SKYBLOCK.SK, which aren't visible for the players directly, but for me and (maybe) others who want to contribute to SKYBLOCK.SK. In this contribution, I successfully removed 4 variables per player which are no longer needed, thanks to changes in the code. This reduces the size of the database with increasing player amounts. Also I finally added some sort of "first island creation abuse" prevention. This was required, since people could create islands, take the dirt and sell it and then create another island. Now, the dirt blocks, which are very valuable in SkyBlock, are now bound to the island until a specified island level, which makes them useless on other islands.
1. Repository
https://github.com/Abwasserrohr/SKYBLOCK.SK
2. Index
- Repository
- Index
- New Features
3.1. New functiongetleader
3.2. Added island warps
3.2. Added island creation abuse prevention - Other changes
4.1. Reduced the amount of needed variables assigned to the uuid of players
4.2. Split Functions.sk into multiple small files named after the functions - Pull requests
- GitHub Account
- How to contribute
3. New Features
The last two days, I added three features which improve the code readability and fun for players playing SKYBLOCK.SK, also some other changes happened, which were very needed in my opinion. I go more into detail below.
3.1. New function getleader
The new getleader
function replaces many places in the code where the leader of an island was needed. Before, I was able to use {SB::player:%uuid of player%::island::leader}
, but since this is one of the variables which are going to get removed within the next day, I needed something to replace this variable.
This function does one thing, if I call getleader
with the parameter player, it takes the bedrock location of the player, gets the x, y and z coordinates of the bedrock location and looks into the island variable named after the bedrock location, which holds the leader. If there is a leader, it returns the uuid of it to identify the leader. This is used many times in the future to check if the player is the leader of the island or not.
This is how it looks like:
function getleader(p:offline player) :: text:
set {_uuid} to uuid of {_p}
set {_bedrock} to {SB::player::%{_uuid}%::island::bedrock}
set {_x} to x-coord of {_bedrock}
set {_y} to y-coord of {_bedrock}
set {_z} to z-coord of {_bedrock}
return {SB::island::%{_x}%_%{_y}%_%{_z}%::leader}
It is very short, but reduces the size everywhere it is needed and makes it easier to read trough.
If I want to use the getleader
function, there is nothing easier than this:
command /getmyleader:
trigger:
set {_leader} to getleader(player)
set {_leader} to {_leader} parsed as offline player
message "Your island leader is: %{_leader}%"
This prints out: "Your island leader is: yournamehere". This function can also be used global on the whole server, server operators can also use it for whatever reason they need it.
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/52
3.2. Added island warps
Many players have special places which they want to share with others, warps are a great way to make this possible.
Players have now already all kinds of teleportation options. They can go to the bedrock (middle) of the island using /island go
, use /island sethome <name>
and /island <home>
to teleport to multiple places on their island. But there are players who want to setup shops or other attractions on their islands.
For this reason, warps have been added. If a player wants to let people on his island at a specific place, the /island setwarp
is the kind of thing they have been waiting for. It works similar like the homehandler
, but it can only be set to one location.
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/53
3.3. Added island creation abuse prevention
An example of a player using the new created islands to avoid playing the normal way and rather use the "dirt faucet" to get as much dirt as possible. In SkyBlock, dirt is more valuable than diamonds.
As already mentioned above, island creation abuse is a serious problem for SkyBlock servers, since dirt is very valuable and islands have with much of dirt at the start. There are some possibilities to make this happen. I already tried out like 5 different options on my test server for the last week and nothing seemed to work perfectly like I wanted it. This on the other hand works like I wanted.
The new prevention is very simple:
- If a player is below a specific island level, his dirt is bound to the island by changing the lore (the text below the item title) of the dirt.
- This lore is not changeable.
- Once someone places a island bound dirt, grass or farmland, the lore (text below item title) is checked, if the island location saved in the lore matches with the island, it is placed, if it doesn't match, the event is cancelled.
Even by trading, the lore doesn't disappear and makes it useless to buy once it is bound to a specific island. The server operator can configure until which island level the dirt should be island bound.
Here, I want to show how the bindcheck
function detects if the island is the origin of the item or not:
function bindcheck(i:item, p:player) :: boolean:
This function can be called everywhere we need. I use it at the on place
event in “SkyBlock/SKYBLOCK.SK/Events.sk”.
If the player is allowed to place blocks and the block is a dirt, grass or farmland block, I call this function to get then in return if it is either true or false to place the block. If the return is false, the event gets cancelled.
set {_bedrock} to {SB::TEMPLOC::%{_p}%}
We need to know the current bedrock location where the player wanted to set the block, since we already have a variable which is always up to date. ({SB::TEMPLOC::%{_p}%}
)
if lore of {_i} is not "":
We only check for the locations, if the dirt block has a custom lore (text below the title).
set {_x} to x-coord of {_bedrock}
set {_z} to z-coord of {_bedrock}
if lore of {_i} contains "%{_x}%_%{_z}%":
return true
If the lore matches with the coordinates of the island bedrock (island middle), the function returns true and allows the player to place it.
else:
set {_uuid} to uuid of {_p}
message "%{SB::lang::prefix::%{SK::lang::%{_uuid}%}%}% %{SB::lang::boundtoanotherisland::%{SK::lang::%{_uuid}%}%}%" to {_p}
return false
If the lore does not contain the coordinates, an error is printed into the chat of the player and returned false to cancel the event.
This is one of two parts, the other one is setting the lore to the item, and this one above reads it.
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/58
If a player breaks a block like dirt, grass or farmland and the island is not over a specified level, the player now gets a block which has a custom lore like in the picture.
4. Other changes
This time, I also changed other things that don't directly add new features for players.
4.1. Reduced the amount of needed variables assigned to the uuid of players
To not save the same data at multiple places, I wanted to remove some, old, no longer needed variables out of SKYBLOCK.SK. There were 4 variables, which have been used to either know who the leader of an island is, where the island begins and ends and also the homes of the player.
Now, since the homes, leaders, locations are saved and named after the island location, we no longer need the player based variables. Also the border variables were removed, since the new protection function created temporary variables for each player if needed.
There were many places where i had to remove old variables and add new in. Also the new getleader
function was quite useful, since I needed it many times to know if the player is the leader or not.
This change is in the same pull request as the split of the Functions.sk, since I made some mistakes while changing everything. Debugging the Functions.sk was very painful, since there were no errors which gave me a hint where it could be and the file loaded without errors. I also decided to split the Functions.sk directly in this pull request.
The following variables are now no longer used:
{SB::player::%{_uuid}%::island::border1}
{SB::player::%{_uuid}%::island::border2}
{SB::player::%{_uuid}%::island::home::*}
{SB::player::%{_uuid}%::island::leader}
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/56/
4.2. Split Functions.sk into multiple small files named after the functions
One of these things is the size of the Functions.sk, which i have split into multiple smaller files, which can be found easily in the "SkyBlock/SKYBLOCK.SK/Functions/" folder, where they are named after their function names. This way, it is easier to detect which function created an error and also makes easier to read changes in the code and understand what happened later. This also explains why there where so many changes in this pull request. =)
Commits:
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/56/commits/a43e01a0ceb68f3769b8de0d6ef44d03a235ad20
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/56/commits/14aad6773a1122e01e96907e00ad688be601b193
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/56/
5. Pull requests
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/52
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/53
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/55
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/56
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/58
6. GitHub Account
https://github.com/Abwasserrohr
7. How to contribute
Skript is a great way to make very customizable additions to the Minecraft game for server operators. If you're interested in contributing to SKYBLOCK.SK or want to learn how Skript works, feel free to join the Discord server I linked below. If you already know how Skript works, you can also open a pull request right away. =)
Discord: https://discord.gg/FRuK5BC
Thank you for reading my contribution post. I'm really happy that the island creation abuse prevention is finally done, since it was very painful to think through ideas, since there were always some loopholes where players could have cheated the system. Preventing players to abuse the island creation system is now working good. =D
If you have feedback of any kind, I would like to hear about it. I'll try to give everyone an upvote if it is about the topic. Also suggestions for SKYBLOCK.SK are very appreciated. :3
Keep on steeming and I wish you guys great Christmas holidays,
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. =)
Thank you for your review, @helo! Keep up the good work!
Auch wenn man schon lange MC spielt ist es was ganz anders in luftiger Höhe zu bauen und fast jeden Tag gibt es etwas Neues, z.B. Warps und in der Lobby v.m.
Ja, jetzt befinden wir uns noch in der Entwicklungsphase und regelmäßig kommen neue Sachen dazu.^^
Sobald mal alles etwas gebalanced ist, wird es dann auch besser mit den Preisen für die ganzen Funktionen und Gegenstände im Spiel. =)
ich finde es cool das man nicht mehr erde durch die insel bekommen kann, die warps sind auch nice gemacht worden vlt sollte es noch eine info geben wie das funktioniert und einen draufhinweisen das es sowas gibt
Freut mich, dass dir die neuen Funktionen gefallen. Ja, die Funktionen werden später besser präsentiert und die /island help Hilfeseite auch nochmal verbessert. =)
Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 2 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.
I upvoted your contribution because to my mind your post is at least 8 SBD worth and should receive 152 votes. It's now up to the lovely Steemit community to make this come true.
I am
TrufflePig
, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!Have a nice day and sincerely yours,
TrufflePig
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!