Comments (3)
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
from grakkit.
Hey, thank you for your help. I have figured out some similar solution. I just noticed two issues:
onEnable
doesn't seem to run at all. (At least console.log doesn't seem to work in that state)- You need to implement
getDescription
This is the code I used:
const PluginBase = core.type('org.bukkit.plugin.PluginBase'),
const PluginDescriptionFile = core.type('org.bukkit.plugin.PluginDescriptionFile');
const pluginDescriptionFile = new PluginDescriptionFile('Test Plugin', '1.0', 'TestPlugin');
const TestPlugin = new PluginBaseAdapter({
getDescription: () => {
return pluginDescriptionFile;
},
onEnable: () => {
console.log("Test");
},
isEnabled: () => {
return true;
}
});
But yeah, core.plugin
is prolly the better and easier solution.
Notes for other people who might stumble across this:
https://www.graalvm.org/latest/reference-manual/js/JavaInteroperability/
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/PluginBase.html
from grakkit.
The reason why onEnable
doesn't fire is probably because the plugin isn't being loaded by a plugin manager, so it just never runs
from grakkit.
Related Issues (20)
- HTTPclient Issues HOT 1
- Graal now supports nodejs natively in 21.1 HOT 1
- Grakkit and Coreprotect not working well together HOT 3
- Need to generate updated TypeScript docs for PaperMC versions past 1.16 HOT 1
- stdlib.file() doesnt supports utf-8 HOT 2
- How does `fetch` work? HOT 5
- Grakkit plugin failing in spigot/paper 1.18.1 when trying to access JavaScript HOT 10
- Minor display version mismatch HOT 3
- Grakkit failing to load on 5.0.6, Paper MC 1.18.1 HOT 2
- Add support for running with GraalVM (alternate GraalVM release) HOT 1
- Support needed for multiple config file formats! HOT 16
- Fetch is not a complete implementation HOT 1
- error with grakkit HOT 2
- Grakkit doesn't report all errors
- Grakkit's JavaScript ticker (chain) can fail and does not resume HOT 1
- Grakkit 5.0.6 introduced "java.lang.IllegalStateException: zip file closed"
- Grakkit throws "This Context is already terminated" when running contexts and using Grakkit reload
- Provide the ability to disable certain features of stdlib core
- TypeError: instantiate on org.bukkit.entity.Villager failed due to: Message not supported.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grakkit.