-
Notifications
You must be signed in to change notification settings - Fork 24
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
style fix #30
style fix #30
Conversation
You are subscribing to the function but not passing the object to the function as a parameter. |
that also does work |
Before: msg would return undefined in function prefixcommand(msg) {
const player = msg.sender;
commandHandler(player, msg);
} |
how would it be undefined? didnt get it |
they do the same thing |
import { world } from "mojang-minecraft";
import { commandHandler } from "../../../commands/handler.js";
const World = world;
function prefixcommand(msg) {
const player = msg.sender;
commandHandler(player, msg);
}
const PrefixCommand = () => {
World.events.beforeChat.subscribe(prefixcommand);
};
export { PrefixCommand }; You are subscribing to a function which expects a parameter to be defined. It's not being defined so when the parameter is later used in the function to define the player object it would essentially error.
It's the same scenario with the other files as well. |
wdym by expects a parameter to be defined? params are passed to the prefixcommand function |
Yes, but you removed msg from the subscription. msg is the object which triggers the event. The object defines the properties for the message and the entity, specifically the player class, that sent the message. Without the object you cannot call its properties. |
the object is passed to |
it does not expects a parameter to be defined, but pass that param and do the cb, so doing prefixcommand, msg is passed to prefixcommand |
I just verified. It works. Though I can't say when this was allowed with Gametest because this wasn't the case for me in the past when I first began working on this project. |
it always works for me since i started doing gametest ¯\(ツ)/¯. anyways |
I find that odd. Nonetheless, you still have a lot of other files that would need similar changes made to them for this patch to be complete. |
ight |
ok i think its done |
I'll check it out when I get a chance. Just now following up on your last reply. |
w