add ZXMushroom63's "ez fix"

This commit is contained in:
radmanplays 2024-09-12 12:07:04 +03:30 committed by GitHub
parent 7615fb213f
commit c3cc12c2ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,6 +32,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
PluginAPI.dedicatedServer.appendCode(function () {
PluginAPI.addEventListener("processcommand", (event) => {
if (event.command.toLowerCase().startsWith("//wand")) {
if (ModAPI.reflect.getClassById("net.minecraft.entity.player.EntityPlayerMP").instanceOf(event.sender.getRef())) {
// Create a new ItemStack for the custom item
const ItemStackClass = ModAPI.reflect.getClassById("net.minecraft.item.ItemStack");
const itemStack = ItemStackClass.constructors[4](
@ -63,6 +64,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
event.preventDefault = true;
}
}
});
});
})();