Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting remaining time of command cooldown overridden by setLastUsage() #5862

Closed
1 task done
sovdeeth opened this issue Jul 27, 2023 · 0 comments
Closed
1 task done
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. good first issue An issue that would be good for a first-time contributor to make a PR for priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@sovdeeth
Copy link
Member

Skript/Server Version

[01:12:12 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[01:12:12 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[01:12:12 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[01:12:12 INFO]: [Skript] Server Version: git-Paper-550 (MC: 1.19.4)
[01:12:12 INFO]: [Skript] Skript Version: 2.7.0-beta3 (skriptlang-github)
[01:12:12 INFO]: [Skript] Installed Skript Addons:
[01:12:12 INFO]: [Skript]  - skript-particle v1.0.2-beta (https://github.com/sovdeeth/skript-particle)
[01:12:12 INFO]: [Skript]  - skript-reflect v2.3.1-for-skript-beta (https://github.com/TPGamesNL/skript-reflect)
[01:12:12 INFO]: [Skript]  - SkBee v2.14.1 (https://github.com/ShaneBeee/SkBee)
[01:12:12 INFO]: [Skript]  - Skript-Packet v2.1.2 (www.github.com/Anarchick/skript-packet)
[01:12:12 INFO]: [Skript] Installed dependencies:
[01:12:12 INFO]: [Skript]  - WorldGuard v7.0.8-beta-01+cbb2ba7

Bug Description

When immediately setting the remaining time of a command, the change is overridden due to the setLastUsage call of the command being after the command is executed. The usage call should be before the execution of the code in the command. See line 277 of ch/njol/skript/command/ScriptCommand.java.

Expected Behavior

The change to remaining time should persist, and not be overwritten after the command's execute2 method returns.

Steps to Reproduce

Does not work (always 20 seconds)

command /tank:
    permission: sk.tank
    cooldown: 20 seconds
    cooldown message: You still have to wait %remaining time%
    trigger:
        set remaining time of cooldown to 10 seconds

Works:

command /tank:
    permission: sk.tank
    cooldown: 20 seconds
    cooldown message: You still have to wait %remaining time%
    trigger:
        wait 1 tick
        set remaining time of cooldown to 10 seconds

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@sovdeeth sovdeeth changed the title Setting remaining time be overridden by setLastUsage(). Setting remaining time overridden by setLastUsage() Jul 27, 2023
@sovdeeth sovdeeth changed the title Setting remaining time overridden by setLastUsage() Setting remaining time of command cooldown overridden by setLastUsage() Jul 27, 2023
@AyhamAl-Ali AyhamAl-Ali added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Jul 27, 2023
@sovdeeth sovdeeth added the good first issue An issue that would be good for a first-time contributor to make a PR for label Aug 26, 2023
@AyhamAl-Ali AyhamAl-Ali added the PR available Issues which have a yet-to-be merged PR resolving it label Sep 17, 2023
@sovdeeth sovdeeth added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Sep 18, 2023
@sovdeeth sovdeeth reopened this Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. good first issue An issue that would be good for a first-time contributor to make a PR for priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

3 participants