-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Unable to forcefully unregister commands in bukkit namespace #210
Comments
Yup. Can confirm that the CommandAPI doesn't unregister stuff from the Bukkit namespace, because the code literally doesn't do that - it only unregisters Minecraft commands from the Minecraft namespace because it was designed to unregister Vanilla commands because the CommandAPI registers Vanilla commands. I will look into trying to improving the unregistration system at a later date after 6.0.0's release. |
@Reminant So it turns out, Bukkit commands are fairly complicated! You can't unregister I think the best way to implement this is to use a separate method (e.g. I have two questions: Command prefixes
Say I have my own plugin CommandAPI.unregisterBukkit("plugins"); Should it unregister the following:
Or should it unregister the following:
Alternatively, should the CommandAPI enforce that a prefix is present? If so, what about unprefixed commands? (Both Aliases
Say I have this method: CommandAPI.unregisterBukkit("version"); Should it unregister the following:
Or should it unregister the following:
|
@JorelAli
|
For this issue, I noticed something surprising, but it is totally possible I messed something up. Bukkit.getScheduler().runTaskLater(this, () -> {
CommandAPIBukkit.unregister("help", true, true);
CommandAPI.unregister("me", true);
}, 0); As expected, |
@DerEchtePilz Hm, for me it does work. All of the commands in question do not show up for tab-complete, and they can not be run. Specifically, I have this: @Override
public void onEnable() {
CommandAPI.onEnable();
Bukkit.getScheduler().runTaskLater(this, () -> {
CommandAPIBukkit.unregister("help", true, true);
CommandAPI.unregister("me", true);
}, 0);
} Do you call Also, are you able to run the |
Yeah, I am calling As for the |
I think the placement of Lines 198 to 217 in e48dc6d
Note that the CommandAPI schedules its own task to take care of a couple of things after the server is loaded. One of those is calling CommandAPI/commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPI.java Lines 44 to 59 in c78c686
This is important because Lines 562 to 609 in e48dc6d
If Have you tried calling |
I mean, yeah, it does work when calling According to the order of operations you could probably argue that this is correct this way. |
Oh, got it. I think I see what you're saying. It is not obvious that this would be a problem just looking at it from the outside, so yeah, something needs to be improved. Note, however, that in most cases, unregistration does work. You can usually unregister commands before and after the server has started (see the docs; all of those cases are valid and tested). The bug here is that command unregistration does not work after the server has started, but before the CommandAPI's delayed initialization task has run. I see 3 ways to fix this:
I rank these ideas 3 best, then 1, with 2 worst. Other parts of the CommandAPI depend on the value of |
Ah, I found exactly what I was looking for to implement idea 3. The I implemented this (ee9077a), and tested it for this application. It looks like it works. With this code: @Override
public void onEnable() {
Bukkit.getScheduler().runTaskLater(this, () -> {
CommandAPIBukkit.unregister("help", true, true);
CommandAPI.unregister("me", true);
}, 0);
CommandAPI.onEnable();
}
|
I also did my own testing and I am also able to confirm that this seems to work great! |
it's been 3 years mate.
…On Sun, 8 Oct 2023 at 02:34, DerEchtePilz ***@***.***> wrote:
I also did my own testing and I am also able to confirm that this seems to
work great!
—
Reply to this email directly, view it on GitHub
<#210 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY4FFEB7FD62JCYENMZXILX6FK4RAVCNFSM46IWNS5KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZVGE3TCNBVGMYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Implemented in CommandAPI 9.3.0. |
CommandAPI version: 5.12
Server version: Paper version git-Paper-762 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
What I did:
CommandAPI running as plugin on the server.
Actual result:
Relevant console output:
The text was updated successfully, but these errors were encountered: