-
Notifications
You must be signed in to change notification settings - Fork 20
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
How to extend PluginBase? #39
Comments
if you don't need a specific plugin you can just use core.plugin, but if you want to make your own instance of PluginBase you can use Java.extend Example: const PluginBase = Java.type("org.bukkit.plugin.PluginBase")
const TestPlugin = Java.extend(PluginBase, {
onEnable: ()=>{
console.log("New Plugin enabled")
},
isEnabled:()=>{
return true
}
})
const plugin = new TestPlugin()
const player = core.type("org.bukkit.Bukkit").getPlayerExact("Losin6450_2nd")
player.hidePlayer(plugin, player) But i wouldn't recommend using Java.extend to make an instance of PluginBase as you could just use core.plugin |
Hey, thank you for your help. I have figured out some similar solution. I just noticed two issues:
This is the code I used:
But yeah, Notes for other people who might stumble across this: |
The reason why |
Player.hidePlayer()
expects aPlugin
as it's first argument, the other version without is deprecated.I would like to follow the best practice of course. How am I supposed to extend PluginBase from Javascript?
I tried doing the following:
But this seems to cause the following error:
[19:12:21 WARN]: TypeError: protoParent is neither Object nor Null
The text was updated successfully, but these errors were encountered: