[Development v117] Multi-World Fix

Results 1 to 2 of 2
  1. #1
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    [Development v117] Multi-World Fix

    While helping out someone through PM, I decided to look into it myself in which why Development v117 has issues for people using only 1 World. I knew I began implementing everything to be designed for multiple worlds, so never thought about just having one..

    Turns out, it's actually a simple fix. While everyone here keeps pointing out the loop, the loop was never the problem. The real problem is that I was too stupid to fix my loops for Lithium's terrible Respawn system.

    Anyways, to fix the IndexOutOfBounds issue (which is rather a simple fix if looking at bat tbh), the issue lies in src/handling/World/World.java.

    Find the Respawn constructor:
    PHP Code:
    public Respawn(Integer[] chsint c) {
                
    StringBuilder s = new StringBuilder("[Respawn Worker] Registered for channels ");
                for (
    int i 1<= CHANNELS_PER_THREAD && chs.length >= (i); i++) {
                    for (
    int z 0< (WorldConstants.Worlds WorldConstants.Channels) + 2z++) {
                        switch(
    z) {
                            case 
    1:// do channels start from 0?
                            
    case 2:
                            case 
    3:
                            case 
    4:
                            case 
    5:
                                
    cservs.add(ChannelServer.getInstance(0i));
                                break;
                            case 
    6:
                            case 
    7:
                            case 
    8:
                            case 
    9:
                            case 
    10:
                                
    cservs.add(ChannelServer.getInstance(1i));
                                break;
                        }
                    }
                    
    s.append(i).append(" ");
                }
                
    System.out.println(s.toString());
            } 
    and replace it with this one:
    PHP Code:
    public Respawn(Integer[] chsint c) {
                
    StringBuilder s = new StringBuilder("[Respawn Worker] Registered for channels ");
                for (
    int i 1<= CHANNELS_PER_THREAD && chs.length >= (i); i++) {
                    
    cservs.add(ChannelServer.getInstance(0i));
                    
    s.append(i).append(" ");
                }
                
    System.out.println(s.toString());
            } 
    I never actually finished coding the support for Multi-world here as you can see. Feel free to just re-write the loop and function in general yourself if you wish. This is just so people who only want one world can just run 1 world, as it will register only channels to hard-coded world 0.


  2. #2
    Enthusiast MrYz is offline
    MemberRank
    Aug 2011 Join Date
    MalaysiaLocation
    46Posts

    Re: [Development v117] Multi-World Fix

    Haha, thanks for it! Good night tho! :P



Advertisement