How do you specify certain parameters in JAVA (Minecraft plugin development)?
package de.mateo161013.menuAPI; import de.mateo161013.menuAPI.listeners.InventoryListener; import org.bukkit.plugin.java.JavaPlugin; public final class MenuAPI extends JavaPlugin { @Override public void onEnable() { // Plugin startup logic getServer().getPluginManager().registerEvent(new InventoryListener(), ); } @Override public void onDisable() { // Plugin shutdown logic } }
This was my code & after InventoryListener(), I want to specify this as parameter for plugin, but the listener becomes this if I type this like this.
How do I solve it?
this would refer the current object of the class. Since the class has no constructor, there can never be objects from it.
OK.
I found my mistake
Each class has a constructor. If no explicit constructor is defined, a standard constructor is created.