Unlockables

Some easy achievement-like things that perist across reboots.

/goop unlockables unlock <player> <goal> [x] [reset] [time]

Makes a player unlock a simple text value called 'goal.' Will succeed only if the player had not already unlocked it.


/goop unlockables lock <player> <goal>

Locks this goal of the player Will succeed only if the player already unlocked it.


/goop unlockables lockstate <player> <goal> <x> [objective] [score]

Will test that a player has unlocked such goal.

Ran the command twice. The first time it will succeed and commands will chain with oS:, the second time it wont.

Locked vs Unlocked

Internally, these unlockables are saved as a number:

  • If a player doesnt have a saved number, or this number is zero: LOCKED

  • Anything else: UNLOCKED


By default, unlocking just sets this value to 1. But you may use any value you want with that [x] parameter.

Args Breakdown (What everything does)

<Player>


<Goal>

  • Literally any text value (with no spaces).

  • Caps sensitive.


<x>

  • Unlocking has technically two states: Locked and Unlocked, 0.0 and 1.0 respectively.

    • You may write true or false also.

  • However, actually, you may use any number, if so you choose.

    • Locked means that this is exactly 0.0

    • When using command lockstate, it accepts ranges in the form of those of vanilla minecraft ( -1.2..34.5 means -1.2 through 34.5 ), inclusive.

    • When using command unlock, it accepts Plus Minus Percent operations.

      • When using these operations, the command will succeed if the value of x changes.


[Reset Timer]

  • If the player already has the goal unlocked, and it has a timer going on, and this is set to true

    • If you are not specifying a time, the older timer will be removed (so that the player will now have it unlocked forever).

    • If you are specifying a time, the old timer will be forgotten and this one will replace it.

    • If either of these happens, the command will succeed and chain commands.


  • If the player had not unlocked the goal, and this is set to true

    • If no new timer was specified, the command will fail and not unlock nothing.

    • If a new timer was specified, the goal will unlock with that new timer.


  • If the the goal didnt have a timer, but the player had unlocked it, this value is completely ignored.


[Time]

  • How long will this last unlocked.

    • Default is 'forever'

    • You must specify an integer number and a time unit:

      • s (seconds), m (minutes), h (hours), d (days), y (years)

      • Example: 20s, 5m, 72h, 180d, 1y

      • Absolutely reliable. No server crash can threaten this number.


[Objective]

  • Scoreboard objective that will be targetted


[Score]

  • If the player had permission, their score will be set to this value.

  • Supports PlusMinusPercent operations.

Tips

  • This command can be used to make some easy quest-like completion commands, that will run only once per player.

    • Or more if you choose to unlock them.


  • You could add two-step timed goals, where the first one activates with a timer, and the second time it runs resetting that timer (but with no new timer).

    • 1: /unlockables unlock %player% SpeedrunTest 1.0 true 1m oS: goop tell @s &cQuick, you have 1 minute!

    • 2: /unlockables unlock %player% SpeedrunTest 1.0 true oS: goop tell @s &6&lContratulations!!

    • If the player runs the second one in time, the timer will be removed and they will have forever unlocked this.

    • If the player runs the second step first, it will fail and not do anything.

    • If the player runs the second step too late, it will also fail and not do anything.


  • Because if the goal score thing equals zero for a player it means that it is locked, attempting to unlock a goal to a score of 0 will set it to a value of 0.001 instead.

Simple Examples:

/unlockables unlock atuosto FoundLoot oS: goop tell @s &2You pickup something shiny oS: mmoitems give SWORD LUSTRUOUS_SWORD @s

Unlocks 'FoundLoot' for player atuosto. The message will only run the very first time the command runs, as well as the item give command.


/unlockables unlock atuosto FoundLoot +1

Because either 'yes' or 'no' is too simple, of course atuosto can have this unlocked with a value of 2 or 3, which can be detected somehow....


/unlockables lockstate atuosto FoundLoot 2 oS: goop tell @s This is a secret message

The GooP Tell command will only run if atuosto has exactly 2 as his 'unlock' score thing.


/unlockables lockstate atuosto FoundLoot true oS: goop tell @s So you've found that shiny sword ey?

The GooP Tell command will only run if atuosto has unlocked the FoundLoot goal, regardless of what score he has.


/unlockables lock cocopad IsRogue oS: &cYou are no longer rogue.

If cocopad had unlocked 'IsRogue' in the past, he will no longer have it unlocked. Will only run the one time it locks it, subsequent repeated calls wont have any effect, and wont display the message.


/unlockables unlock gunging TerspassingPerms false

/unlockables unlock gunging TerspassingPerms 0

Because you are using the unlock command, and zero is actually locking the goal, it will be set to 0.001 instead - still unlocked.

Comment from the Dev:

I had to break the format of the entire manual for this one. That insert 'Locked vs Unlocked' up there looks dirty asf and bugs me much, but it had to be clear how this all works. Otherwise its just straight up confusing.