How to add a ControllerListener to a controller in the jinput library. I know the ControllerListener class is an interface, and that in ControllerEnvironment has a method to add the listener, but even if i do it nothing happens, how do i do it to run it?
There are simply no Plugins that fire the methods of the ControllerListener yet. There probably won't be any plugins from the creator since the project wasn't updated for a long time now and the last update was just to remove the notfication that Windows 10 is unknown.
Currently your only solutions are:
For the last solution simply calling ControllerEnvironment.getDefaultEnvironment().getControllers() is not enough. You have to call the plugin constructor again. since most of the plugin classes are on package visibility you might have to edit the original source code to make them public. The DirectAndRawEnvironmentPlugin already has a public constructor. so you could do something like this:
ControllerEnvironment env = new DirectAndRawEnvironmentPlugin();
if(!env.isSupported()) {
env = ControllerEnvironment.getDefaultEnvironment();
}