Making a simple effect
Effects inherit the CustomEffect
interface. They work in a similar way as CustomItem
. You only need to overwrite one method that tells the plugin what you are doing.
Of course it uses a date class called CustomEffectData
. It contains the name of the effect, its id, its maximum amplifier (The maximum level can be obtained via getMaxLevel()
) and whether the effect can be cleared by milk or player death.
public class TestEffectThatDoNothing implements CustomEffect {
@Override
public @NotNull CustomEffectData effectData() {
/*
1. Is ID for our custom effect
2. Is the name for our custom effect (Used in PAPi and etc.)
3. Max amplifier of our effect
4. Can be cleared with milk?
5. Can be cleared after death?
*/
return new CustomEffectData("testeffectthatdonothing",
"Nothing test effect", 0, false, false);
}
}
And we need to register it.
public MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Getting the manager.
CustomEffectManager.register(new MyEffect()); // lets register our effect.
}
}
And you are good to go! Use /customitem
command to give your self a effect.
Last updated
Was this helpful?