I tried to use this. For example:
Timer timer=new Timer(1000,new ActionListener(){
public void actionPerformed(ActionEvent ev) {
if(Minecraft.getMinecraft().getIntegratedServer() != null){
System.out.println("123");
}else{
System.out.println("321");
}
}
});
Timer timer=new Timer(1000,new ActionListener(){
public void actionPerformed(ActionEvent ev) {
if(Minecraft.getMinecraft().isSingleplayer()){
System.out.println("123");
}else{
System.out.println("321");
}
}
});
Timer timer=new Timer(1000,new ActionListener(){
public void actionPerformed(ActionEvent ev) {
if((Minecraft.getMinecraft().isIntegratedServerRunning()){
System.out.println("123");
}else{
System.out.println("321");
}
}
});
Always output is "321". When Im playing on server, or in singleplayer or just looking on Menu)
I call timer in public void load(FMLInitializationEvent event).