Api and threading issue?

A new update is now available, introducing "Points of interest" and many more changes!
Latest hotfix: 0.9 (2025-11-05)
  • i have been working on a rather large plugin and i NEED to implement threading. i have been driving myself crazy with an issue tho. it seems to me that if i create a new thread the API creates hundreds of new threads. i have done some testing and i dont no think it is my code. any input would be helpful.


    Java
    // Init player method
    public void initPlayer(Player player){
    if(rpCore.getConfig().getDevConfig().getMultiThreadEnabled()){
    Thread initThread = new Thread(new InitPlayer(rpCore, player, rpCore.getConfig().getDevConfig().getMultiThreadEnabled()));
    initThread.start();
    }else{
    new InitPlayer(rpCore, player, rpCore.getConfig().getDevConfig().getMultiThreadEnabled());
    }
    }



    Java
    //ps.debug method
    println("[RPCore/PlayerSettings]" , 9);
    for (Map.Entry<String, String> entry : settings.entrySet()) {
    String key = entry.getKey();
    String value = entry.getValue();
    println("\t "+key+": -> "+value, 14);
    }


    logs to show what i think is an issue

    Threaded threaded console output.txt

    NON-Threaded non threaded consol output.txt


    Again it may be me but o do not believe it is.

  • Same thing i se on my plugin too. I use a background thread to move a vehicle along a route. First i tried with Timer and well worked well, but limited to a single vehicle. Latter i use proper thread to move many simultaneous vehicle, and when i use my thread i see a lot of messages like:



    On java side :



    And BTW when i use Custom Event



    And when i used custom event and register this event for listening i get in log for every custom event:


    Code
    [Java] -> Event: bamse.rw.ferry.events.FerryMoveToEvent
    [ERROR] [09:08:30] Java RegisterEvent - Event not found: Events.FerryMoveToEvent
    UnityEngine.Debug:LogError(Object)
    RisingWorld.PluginAPI.PluginEventHandler:OnRegisterEvent(IntPtr, JObject, JString) (at C:/GitLab-Runner/builds/jxpAq3Km/2/jiw-games/rising-world/Assets/Scripts/PluginAPI/PluginEventHandler.cs:258)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!