[help] GMS events in v142.2

Results 1 to 10 of 10
  1. #1
    Beep Boop Rampenbram is offline
    MemberRank
    Feb 2009 Join Date
    The NetherlandsLocation
    341Posts

    [help] GMS events in v142.2

    Hello Ragezone,

    I'm having this strange issue when i try to launch a GMS event in v142.2. When I use !event coconut it calls back : The event must not have been already scheduled. I didn't launched a event before, it looks like i'm missing something....

    The Command:
    PHP Code:
    public static class Event extends CommandExecute {

             [
    MENTION=2000004426]Override[/MENTION]
            public 
    int execute(MapleClient cString[] splitted) {
                final 
    MapleEventType type MapleEventType.getByString(splitted[1]);
                if (
    type == null) {
                    final 
    StringBuilder sb = new StringBuilder("Wrong syntax: ");
                    for (
    MapleEventType t MapleEventType.values()) {
                        
    sb.append(t.name()).append(",");
                    }
                    
    c.getPlayer().dropMessage(5sb.toString().substring(0sb.toString().length() - 1));
                    return 
    0;
                }
                final 
    String msg MapleEvent.scheduleEvent(typec.getChannelServer());
                if (
    msg.length() > 0) {
                    
    c.getPlayer().dropMessage(5msg);
                    return 
    0;
                }
                return 
    1;
            }
        } 
    The MapleEvent.java
    PHP Code:
    /*
     This file is part of the ZeroFusion MapleStory Server
     Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> 
     Matthias Butz <matze@odinms.de>
     Jan Christian Meyer <vimes@odinms.de>
     ZeroFusion organized by "RMZero213" <RMZero213@hotmail.com>

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License version 3
     as published by the Free Software Foundation. You may not use, modify
     or distribute this program under any other version of the
     GNU Affero General Public License.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU Affero General Public License for more details.

     You should have received a copy of the GNU Affero General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
    package server.events;

    import clientside.MapleCharacter;
    import constants.GameConstants;
    import handling.channel.ChannelServer;
    import handling.world.World;
    import server.MapleInventoryManipulator;
    import server.RandomRewards;
    import server.Randomizer;
    import server.Timer.EventTimer;
    import server.maps.FieldLimitType;
    import server.maps.MapleMap;
    import server.maps.SavedLocationType;
    import tools.FileoutputUtil;
    import tools.StringUtil;
    import tools.packet.CField;
    import tools.packet.CWvsContext;

    public abstract class 
    MapleEvent {

        protected 
    MapleEventType type;
        protected 
    int channelplayerCount 0;
        protected 
    boolean isRunning false;

        public 
    MapleEvent(final int channel, final MapleEventType type) {
            
    this.channel channel;
            
    this.type type;
        }

        public 
    void incrementPlayerCount() {
            
    playerCount++;
            if (
    playerCount == 250) {
                
    setEvent(ChannelServer.getInstance(channel), true);
            }
        }

        public 
    MapleEventType getType() {
            return 
    type;
        }

        public 
    boolean isRunning() {
            return 
    isRunning;
        }

        public 
    MapleMap getMap(final int i) {
            return 
    getChannelServer().getMapFactory().getMap(type.mapids[i]);
        }

        public 
    ChannelServer getChannelServer() {
            return 
    ChannelServer.getInstance(channel);
        }

        public 
    void broadcast(final byte[] packet) {
            for (
    int i 0type.mapids.lengthi++) {
                
    getMap(i).broadcastMessage(packet);
            }
        }

        public static 
    void givePrize(final MapleCharacter chr) {
            final 
    int reward RandomRewards.getEventReward();
            if (
    reward == 0) {
                final 
    int mes Randomizer.nextInt(9000000) + 1000000;
                
    chr.gainMeso(mestruefalse);
                
    chr.dropMessage(5"You gained " mes " Mesos.");
            } else if (
    reward == 1) {
                final 
    int cs Randomizer.nextInt(4000) + 1000;
                
    chr.modifyCSPoints(1cstrue);
                
    chr.dropMessage(5"You gained " + (GameConstants.GMS ? (cs 2) : cs) + " cash.");
            } else if (
    reward == 2) {
                
    chr.setVPoints(chr.getVPoints() + 1);
                
    chr.dropMessage(5"You gained 1 Vote Point.");
            } else if (
    reward == 3) {
                
    chr.addFame(10);
                
    chr.dropMessage(5"You gained 10 Fame.");
            } else if (
    reward == 4) {
                
    chr.dropMessage(5"There was no reward.");
            } else {
                
    int max_quantity 1;
                switch (
    reward) {
                    case 
    5062000:
                        
    max_quantity 3;
                        break;
                    case 
    5220000:
                        
    max_quantity 25;
                        break;
                    case 
    4031307:
                    case 
    5050000:
                        
    max_quantity 5;
                        break;
                    case 
    2022121:
                        
    max_quantity 10;
                        break;
                }
                final 
    int quantity = (max_quantity Randomizer.nextInt(max_quantity) : 0) + 1;
                if (
    MapleInventoryManipulator.checkSpace(chr.getClient(), rewardquantity"")) {
                    
    MapleInventoryManipulator.addById(chr.getClient(), reward, (shortquantity"Event prize on " FileoutputUtil.CurrentReadable_Date());
                } else {
                    
    givePrize(chr); //do again until they get
                
    }
                
    //5062000 = 1-3
                //5220000 = 1-25
                //5050000 = 1-5
                //2022121 = 1-10
                //4031307 = 1-5
            
    }
        }

        public abstract 
    void finished(MapleCharacter chr); //most dont do shit here

        
    public abstract void startEvent();

        public 
    void onMapLoad(MapleCharacter chr) { //most dont do shit here
            
    if (GameConstants.isEventMap(chr.getMapId()) && FieldLimitType.Event.check(chr.getMap().getFieldLimit()) && FieldLimitType.Event2.check(chr.getMap().getFieldLimit())) {
                
    chr.getClient().getSession().write(CField.showEventInstructions());
            }
        }

        public 
    void warpBack(MapleCharacter chr) {
            
    int map chr.getSavedLocation(SavedLocationType.EVENT);
            if (
    map <= -1) {
                
    map 104000000;
            }
            final 
    MapleMap mapp chr.getClient().getChannelServer().getMapFactory().getMap(map);
            
    chr.changeMap(mappmapp.getPortal(0));
        }

        public 
    void reset() {
            
    isRunning true;
            
    playerCount 0;
        }

        public 
    void unreset() {
            
    isRunning false;
            
    playerCount 0;
        }

        public static 
    void setEvent(final ChannelServer cserv, final boolean auto) {
            if (
    auto && cserv.getEvent() > -1) {
                for (
    MapleEventType t MapleEventType.values()) {
                    final 
    MapleEvent e cserv.getEvent(t);
                    if (
    e.isRunning) {
                        for (
    int i e.type.mapids) {
                            if (
    cserv.getEvent() == i) {
                                
    World.Broadcast.broadcastMessage(CWvsContext.serverNotice(0"Entries for the event are now closed!"));
                                
    e.broadcast(CWvsContext.serverNotice(0"The event will start in 30 seconds!"));
                                
    e.broadcast(CField.getClock(30));
                                
    EventTimer.getInstance().schedule(new Runnable() {

                                     [
    MENTION=2000004426]Override[/MENTION]
                                    public 
    void run() {
                                        
    e.startEvent();
                                    }
                                }, 
    30000);
                                break;
                            }
                        }
                    }
                }
            }
            
    cserv.setEvent(-1);
        }

        public static 
    void mapLoad(final MapleCharacter chr, final int channel) {
            if (
    chr == null) {
                return;
            } 
    //o_o
            
    for (MapleEventType t MapleEventType.values()) {
                final 
    MapleEvent e ChannelServer.getInstance(channel).getEvent(t);
                if (
    e.isRunning) {
                    if (
    chr.getMapId() == 109050000) { //finished map
                        
    e.finished(chr);
                    }
                    for (
    int i 0e.type.mapids.lengthi++) {
                        if (
    chr.getMapId() == e.type.mapids[i]) {
                            
    e.onMapLoad(chr);
                            if (
    == 0) { //first map
                                
    e.incrementPlayerCount();
                            }
                        }
                    }
                }
            }
        }

        public static 
    void onStartEvent(final MapleCharacter chr) {
            for (
    MapleEventType t MapleEventType.values()) {
                final 
    MapleEvent e chr.getClient().getChannelServer().getEvent(t);
                if (
    e.isRunning) {
                    for (
    int i e.type.mapids) {
                        if (
    chr.getMapId() == i) {
                            
    e.startEvent();
                            
    setEvent(chr.getClient().getChannelServer(), false);
                            
    chr.dropMessage(5String.valueOf(t) + " has been started.");
                        }
                    }
                }
            }
        }

        public static 
    String scheduleEvent(final MapleEventType event, final ChannelServer cserv) {
            if (
    cserv.getEvent() != -|| cserv.getEvent(event) == null) {
                return 
    "The event must not have been already scheduled.";
            }
            for (
    int i cserv.getEvent(event).type.mapids) {
                if (
    cserv.getMapFactory().getMap(i).getCharactersSize() > 0) {
                    return 
    "The event is already running.";
                }
            }
            
    cserv.setEvent(cserv.getEvent(event).type.mapids[0]);
            
    cserv.getEvent(event).reset();
            
    World.Broadcast.broadcastMessage(CWvsContext.serverNotice(0"Hello " cserv.getServerName() + "! Let's play a " StringUtil.makeEnumHumanReadable(event.name()) + " event in channel " cserv.getChannel() + "! Change to channel " cserv.getChannel() + " and use  [MENTION=1333420483]event[/MENTION] command!"));
            return 
    "";
        }

        public 
    void test(String test) {
            
    System.out.println(test);
        }

    ChannelServer.java > LoadEvents
    PHP Code:
    public final void loadEvents() {
            if (
    events.size() != 0) {
                return;
            }
            
    this.events.put(MapleEventType.Coconut, new MapleCoconut(channelMapleEventType.Coconut));
            
    this.events.put(MapleEventType.Fitness, new MapleFitness(channelMapleEventType.Fitness));
            
    this.events.put(MapleEventType.OlaOla, new MapleOla(channelMapleEventType.OlaOla));
            
    this.events.put(MapleEventType.OxQuiz, new MapleOxQuiz(channelMapleEventType.OxQuiz));
            
    this.events.put(MapleEventType.Snowball, new MapleSnowball(channelMapleEventType.Snowball));
            
    this.events.put(MapleEventType.Survival, new MapleSurvival(channelMapleEventType.Survival));
        }
        public 
    byte eventChannel
    plugins*
    PHP Code:
        private int eventmap = -1;
        private final 
    Map<MapleEventTypeMapleEventevents = new EnumMap<MapleEventTypeMapleEvent>(MapleEventType.class);
        public 
    boolean eventOn false;
        public 
    int eventMap 0;
        private 
    boolean eventWarp;
        private 
    String eventHost;
        private 
    String eventName
    - - - Updated - - -

    even if i try coconut, olaola, snowball, it says they are all have already scheduled. could someone help me with this?

    Thanks~!


  2. #2
    Beep Boop Rampenbram is offline
    MemberRank
    Feb 2009 Join Date
    The NetherlandsLocation
    341Posts

    Re: [help] GMS events in v142.2

    Bump~ :|

  3. #3
    Member Drum is offline
    MemberRank
    Jul 2013 Join Date
    80Posts

    Re: [help] GMS events in v142.2

    PHP Code:
    if (cserv.getEvent() != -|| cserv.getEvent(event) == null) {     
        return 
    "The event must not have been already scheduled."

    I think this is what you are referring to? We need to find out what these expressions are returning to see why this condition is evaluating to true. Could you please post your getEvent() method from ChannelServer.java?

  4. #4
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: [help] GMS events in v142.2

    Quote Originally Posted by Drum View Post
    PHP Code:
    if (cserv.getEvent() != -|| cserv.getEvent(event) == null) {     
        return 
    "The event must not have been already scheduled."

    I think this is what you are referring to? We need to find out what these expressions are returning to see why this condition is evaluating to true. Could you please post your getEvent() method from ChannelServer.java?
    I'm pretty sure getEvent returns the Map of events.

    Code:
    private int eventmap = -1; 
        private final Map<MapleEventType, MapleEvent> events = new EnumMap<MapleEventType, MapleEvent>(MapleEventType.class); 
    Also, your loadEvents methods already schedules them - so you obviously can't schedule a new one.

    Code:
    public final void loadEvents() { 
            if (events.size() != 0) { 
                return; 
            } 
            this.events.put(MapleEventType.Coconut, new MapleCoconut(channel, MapleEventType.Coconut)); 
            this.events.put(MapleEventType.Fitness, new MapleFitness(channel, MapleEventType.Fitness)); 
            this.events.put(MapleEventType.OlaOla, new MapleOla(channel, MapleEventType.OlaOla)); 
            this.events.put(MapleEventType.OxQuiz, new MapleOxQuiz(channel, MapleEventType.OxQuiz)); 
            this.events.put(MapleEventType.Snowball, new MapleSnowball(channel, MapleEventType.Snowball)); 
            this.events.put(MapleEventType.Survival, new MapleSurvival(channel, MapleEventType.Survival)); 
        }
    I don't see a problem.. they're already scheduled.

  5. #5
    Beep Boop Rampenbram is offline
    MemberRank
    Feb 2009 Join Date
    The NetherlandsLocation
    341Posts

    Re: [help] GMS events in v142.2

    weird thing is, i just copied stuff from v117.2 source and made the scripts without red signs. i'm sure those are not causing the issue.

    ChannelServer.java > the event functions...
    PHP Code:
    public int getEvent() {
            return 
    eventmap;
        }

        public final 
    void setEvent(final int ze) {
            
    this.eventmap ze;
        }

        public 
    MapleEvent getEvent(final MapleEventType t) {
            return 
    events.get(t);
        } 
    - - - Updated - - -

    Quote Originally Posted by Fraysa View Post
    I don't see a problem.. they're already scheduled.
    Do you have any idea how to fix this silly issue 0.o it will be appreciated.

  6. #6
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: [help] GMS events in v142.2

    Quote Originally Posted by Rampenbram View Post
    weird thing is, i just copied stuff from v117.2 source and made the scripts without red signs. i'm sure those are not causing the issue.

    ChannelServer.java > the event functions...
    PHP Code:
    public int getEvent() {
            return 
    eventmap;
        }

        public final 
    void setEvent(final int ze) {
            
    this.eventmap ze;
        }

        public 
    MapleEvent getEvent(final MapleEventType t) {
            return 
    events.get(t);
        } 
    - - - Updated - - -



    Do you have any idea how to fix this silly issue 0.o it will be appreciated.
    What issue? loadEvents method loads them, they're already initiated. It tells you exactly that: "The event is already running." - because you're automatically running it using the loadEvents method.

  7. #7
    Beep Boop Rampenbram is offline
    MemberRank
    Feb 2009 Join Date
    The NetherlandsLocation
    341Posts

    Re: [help] GMS events in v142.2

    i'm not understanding it i guess... :/ When you use !event or !scheduleevent it should open one of the GMS events, however you say they are ALL scheduled already? for me it doesn't make much sense since it's same coding as in my v117.2 which worked fine.

    Isn't loadevent the function to 'load in' the event list to get scheduled when you doing that by using the command?

  8. #8
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: [help] GMS events in v142.2

    Quote Originally Posted by Rampenbram View Post
    i'm not understanding it i guess... :/ When you use !event or !scheduleevent it should open one of the GMS events, however you say they are ALL scheduled already? for me it doesn't make much sense since it's same coding as in my v117.2 which worked fine.

    Isn't loadevent the function to 'load in' the event list to get scheduled when you doing that by using the command?
    the loadEvent method simply starts all of the events and schedules them automatically. Then, your players can join (as far as I'm aware of). If you post the constructor of one of the events, maybe I can see if it's really scheduling it. (Or just post the whole class of a certain event).

  9. #9
    Beep Boop Rampenbram is offline
    MemberRank
    Feb 2009 Join Date
    The NetherlandsLocation
    341Posts

    Re: [help] GMS events in v142.2

    MapleEvent.java
    PHP Code:
    /*
    This file is part of the ZeroFusion MapleStory Server
    Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> 
    Matthias Butz <matze@odinms.de>
    Jan Christian Meyer <vimes@odinms.de>
    ZeroFusion organized by "RMZero213" <RMZero213@hotmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
    package server.events;

    import clientside.MapleCharacter;
    import constants.GameConstants;

    import handling.channel.ChannelServer;
    import handling.world.World;
    import server.MapleInventoryManipulator;
    import server.RandomRewards;
    import server.Randomizer;
    import server.Timer.EventTimer;
    import server.maps.FieldLimitType;
    import server.maps.MapleMap;
    import server.maps.SavedLocationType;
    import tools.FileoutputUtil;
    import tools.packet.CField;
    import tools.StringUtil;
    import tools.packet.CWvsContext;

    public abstract class 
    MapleEvent {
        protected 
    MapleEventType type;
        protected 
    int channelplayerCount 0;
        protected 
    boolean isRunning false;

        public 
    MapleEvent(final int channel, final MapleEventType type) {
            
    this.channel channel;
            
    this.type type;
        }

        public 
    void incrementPlayerCount() {
        
    playerCount++;
        if (
    playerCount == 250) {
            
    setEvent(ChannelServer.getInstance(channel), true);
        }
        }

        public 
    MapleEventType getType() {
        return 
    type;
        }

        public 
    boolean isRunning() {
            return 
    isRunning;
        }

        public 
    MapleMap getMap(final int i) {
            return 
    getChannelServer().getMapFactory().getMap(type.mapids[i]);
        }

        public 
    ChannelServer getChannelServer() {
            return 
    ChannelServer.getInstance(channel);
        }

        public 
    void broadcast(final byte[] packet) {
            for (
    int i 0type.mapids.lengthi++) {
                
    getMap(i).broadcastMessage(packet);
            }
        }

        public static 
    void givePrize(final MapleCharacter chr) {
            final 
    int reward RandomRewards.getEventReward();
            if (
    reward == 0) {
                final 
    int mes Randomizer.nextInt(9000000) + 1000000;
                
    chr.gainMeso(mestruefalse);
                
    chr.dropMessage(5"You gained " mes " Mesos.");
            } else if (
    reward == 1) {
                final 
    int cs Randomizer.nextInt(4000) + 1000;
                
    chr.modifyCSPoints(1cstrue);
                
    chr.dropMessage(5"You gained " + (GameConstants.GMS ? (cs 2) : cs) + " cash.");
            } else if (
    reward == 2) {
                
    chr.setVPoints(chr.getVPoints() + 1);
                
    chr.dropMessage(5"You gained 1 Vote Point.");
            } else if (
    reward == 3) {
                
    chr.addFame(10);
                
    chr.dropMessage(5"You gained 10 Fame.");
        } else if (
    reward == 4) {
            
    chr.dropMessage(5"There was no reward.");
            } else {
                
    int max_quantity 1;
                switch (
    reward) {
                    case 
    5062000:
                        
    max_quantity 3;
                        break;
                    case 
    5220000:
                        
    max_quantity 25;
                        break;
                    case 
    4031307:
                    case 
    5050000:
                        
    max_quantity 5;
                        break;
                    case 
    2022121:
                        
    max_quantity 10;
                        break;
                }
                final 
    int quantity = (max_quantity Randomizer.nextInt(max_quantity) : 0) + 1;
                if (
    MapleInventoryManipulator.checkSpace(chr.getClient(), rewardquantity"")) {
                    
    MapleInventoryManipulator.addById(chr.getClient(), reward, (shortquantity"Event prize on " FileoutputUtil.CurrentReadable_Date());
                } else {
                    
    givePrize(chr); //do again until they get
                
    }
                
    //5062000 = 1-3
                //5220000 = 1-25
                //5050000 = 1-5
                //2022121 = 1-10
                //4031307 = 1-5
            
    }
        }

        public abstract 
    void finished(MapleCharacter chr); //most dont do shit here

        
    public abstract void startEvent();

        public 
    void onMapLoad(MapleCharacter chr) { //most dont do shit here
        
    if (GameConstants.isEventMap(chr.getMapId()) && FieldLimitType.Event.check(chr.getMap().getFieldLimit()) && FieldLimitType.Event2.check(chr.getMap().getFieldLimit())) {
            
    chr.getClient().getSession().write(CField.showEventInstructions());
        }
        }

        public 
    void warpBack(MapleCharacter chr) {
            
    int map chr.getSavedLocation(SavedLocationType.EVENT);
            if (
    map <= -1) {
                
    map 104000000;
            }
            final 
    MapleMap mapp chr.getClient().getChannelServer().getMapFactory().getMap(map);
            
    chr.changeMap(mappmapp.getPortal(0));
        }

        public 
    void reset() {
            
    isRunning true;
        
    playerCount 0;
        }

        public 
    void unreset() {
            
    isRunning false;
        
    playerCount 0;
        }

        public static final 
    void setEvent(final ChannelServer cserv, final boolean auto) {
            if (
    auto && cserv.getEvent() > -1) {
                for (
    MapleEventType t MapleEventType.values()) {
                    final 
    MapleEvent e cserv.getEvent(t);
                    if (
    e.isRunning) {
                        for (
    int i e.type.mapids) {
                            if (
    cserv.getEvent() == i) {
                    
    World.Broadcast.broadcastMessage(CWvsContext.serverNotice(0"Entries for the event are now closed!"));
                                
    e.broadcast(CWvsContext.serverNotice(0"The event will start in 30 seconds!"));
                                
    e.broadcast(CField.getClock(30));
                                
    EventTimer.getInstance().schedule(new Runnable() {

                                    public 
    void run() {
                                        
    e.startEvent();
                                    }
                                }, 
    30000);
                                break;
                            }
                        }
                    }
                }
            }
            
    cserv.setEvent(-1);
        }

        public static final 
    void mapLoad(final MapleCharacter chr, final int channel) {
        if (
    chr == null) {
            return;
        } 
    //o_o
            
    for (MapleEventType t MapleEventType.values()) {
                final 
    MapleEvent e ChannelServer.getInstance(channel).getEvent(t);
                if (
    e.isRunning) {
                    if (
    chr.getMapId() == 109050000) { //finished map
                        
    e.finished(chr);
                    }
                    for (
    int i 0e.type.mapids.lengthi++) {
                        if (
    chr.getMapId() == e.type.mapids[i]) {
                            
    e.onMapLoad(chr);
                if (
    == 0) { //first map
                    
    e.incrementPlayerCount();
                }
                        }
                    }
                }
            }
        }

        public static final 
    void onStartEvent(final MapleCharacter chr) {
            for (
    MapleEventType t MapleEventType.values()) {
                final 
    MapleEvent e chr.getClient().getChannelServer().getEvent(t);
                if (
    e.isRunning) {
                    for (
    int i e.type.mapids) {
                        if (
    chr.getMapId() == i) {
                            
    e.startEvent();
                
    setEvent(chr.getClient().getChannelServer(), false);
                            
    chr.dropMessage(5String.valueOf(t) + " has been started.");
                        }
                    }
                }
            }
        }

        public static final 
    String scheduleEvent(final MapleEventType event, final ChannelServer cserv) {
            if (
    cserv.getEvent() != || cserv.getEvent(event) == null) { // 0 = -1
                
    return "The event must not have been already scheduled.";
            }
            for (
    int i cserv.getEvent(event).type.mapids) {
                if (
    cserv.getMapFactory().getMap(i).getCharactersSize() > 0) {
                    return 
    "The event is already running.";
                }
            }
            
    cserv.setEvent(cserv.getEvent(event).type.mapids[0]);
            
    cserv.getEvent(event).reset();
            
    World.Broadcast.broadcastMessage(CWvsContext.serverNotice(0"Hello " cserv.getServerName() + "! Let's play a " StringUtil.makeEnumHumanReadable(event.name()) + " event in channel " cserv.getChannel() + "! Change to channel " cserv.getChannel() + " and use [MENTION=1333420483]event[/MENTION] command!"));
            return 
    "";
        }

    MapleCoconut.java
    PHP Code:
    /*
     This file is part of the ZeroFusion MapleStory Server
     Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> 
     Matthias Butz <mat@odinms.de>
     Jan Christian Meyer <vimes@odinms.de>
     ZeroFusion organized by "RMZero213" <RMZero213@hotmail.com>

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License version 3
     as published by the Free Software Foundation. You may not use, modify
     or distribute this program under any other version of the
     GNU Affero General Public License.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU Affero General Public License for more details.

     You should have received a copy of the GNU Affero General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
    package server.events;

    import clientside.MapleCharacter;
    import java.util.LinkedList;
    import java.util.List;
    import server.Timer.EventTimer;
    import tools.packet.CField;
    import tools.packet.CWvsContext;

    public class 
    MapleCoconut extends MapleEvent {

        private final List<
    MapleCoconutscoconuts = new LinkedList<>();
        private final 
    int[] coconutscore = new int[2];
        private 
    int countBombing 0;
        private 
    int countFalling 0;
        private 
    int countStopped 0;

        public 
    MapleCoconut(final int channel, final MapleEventType type) {
            
    super(channeltype);
        }

        [
    MENTION=2000004426]Override[/MENTION]
        public 
    void finished(MapleCharacter chr) { //do nothing.
        
    }

        [
    MENTION=2000004426]Override[/MENTION]
        public 
    void reset() {
            
    super.reset();
            
    resetCoconutScore();
        }

        [
    MENTION=2000004426]Override[/MENTION]
        public 
    void unreset() {
            
    super.unreset();
            
    resetCoconutScore();
            
    setHittable(false);
        }

        [
    MENTION=2000004426]Override[/MENTION]
        public 
    void onMapLoad(MapleCharacter chr) {
            
    super.onMapLoad(chr);
            
    chr.getClient().getSession().write(CField.coconutScore(getCoconutScore()));
        }

        public 
    MapleCoconuts getCoconut(int id) {
            if (
    id >= coconuts.size()) {
                return 
    null;
            }
            return 
    coconuts.get(id);
        }

        public List<
    MapleCoconutsgetAllCoconuts() {
            return 
    coconuts;
        }

        public 
    void setHittable(boolean hittable) {
            for (
    MapleCoconuts nut coconuts) {
                
    nut.setHittable(hittable);
            }
        }

        public 
    int getBombings() {
            return 
    countBombing;
        }

        public 
    void bombCoconut() {
            
    countBombing--;
        }

        public 
    int getFalling() {
            return 
    countFalling;
        }

        public 
    void fallCoconut() {
            
    countFalling--;
        }

        public 
    int getStopped() {
            return 
    countStopped;
        }

        public 
    void stopCoconut() {
            
    countStopped--;
        }

        public 
    int[] getCoconutScore() { // coconut event
            
    return coconutscore;
        }

        public 
    int getMapleScore() { // Team Maple, coconut event
            
    return coconutscore[0];
        }

        public 
    int getStoryScore() { // Team Story, coconut event
            
    return coconutscore[1];
        }

        public 
    void addMapleScore() { // Team Maple, coconut event
            
    coconutscore[0]++;
        }

        public 
    void addStoryScore() { // Team Story, coconut event
            
    coconutscore[1]++;
        }

        public 
    void resetCoconutScore() {
            
    coconutscore[0] = 0;
            
    coconutscore[1] = 0;
            
    countBombing 80;
            
    countFalling 401;
            
    countStopped 20;
            
    coconuts.clear();
            for (
    int i 0506i++) {
                
    coconuts.add(new MapleCoconuts());
            }
        }

        [
    MENTION=2000004426]Override[/MENTION]
        public 
    void startEvent() {
            
    reset();
            
    setHittable(true);
            
    getMap(0).broadcastMessage(CWvsContext.serverNotice(5"The event has started!!"));
            
    getMap(0).broadcastMessage(CField.hitCoconut(true00));
            
    getMap(0).broadcastMessage(CField.getClock(300));

            
    EventTimer.getInstance().schedule(new Runnable() {

                [
    MENTION=2000004426]Override[/MENTION]
                public 
    void run() {
                    if (
    getMapleScore() == getStoryScore()) {
                        
    bonusTime();
                    } else {
                        for (
    MapleCharacter chr getMap(0).getCharactersThreadsafe()) {
                            if (
    chr.getTeam() == (getMapleScore() > getStoryScore() ? 1)) {
                                
    chr.getClient().getSession().write(CField.showEffect("event/coconut/victory"));
                                
    chr.getClient().getSession().write(CField.playSound("Coconut/Victory"));
                            } else {
                                
    chr.getClient().getSession().write(CField.showEffect("event/coconut/lose"));
                                
    chr.getClient().getSession().write(CField.playSound("Coconut/Failed"));
                            }
                        }
                        
    warpOut();
                    }
                }
            }, 
    300000);
        }

        public 
    void bonusTime() {
            
    getMap(0).broadcastMessage(CField.getClock(60));
            
    EventTimer.getInstance().schedule(new Runnable() {

                [
    MENTION=2000004426]Override[/MENTION]
                public 
    void run() {
                    if (
    getMapleScore() == getStoryScore()) {
                        for (
    MapleCharacter chr getMap(0).getCharactersThreadsafe()) {
                            
    chr.getClient().getSession().write(CField.showEffect("event/coconut/lose"));
                            
    chr.getClient().getSession().write(CField.playSound("Coconut/Failed"));
                        }
                        
    warpOut();
                    } else {
                        for (
    MapleCharacter chr getMap(0).getCharactersThreadsafe()) {
                            if (
    chr.getTeam() == (getMapleScore() > getStoryScore() ? 1)) {
                                
    chr.getClient().getSession().write(CField.showEffect("event/coconut/victory"));
                                
    chr.getClient().getSession().write(CField.playSound("Coconut/Victory"));
                            } else {
                                
    chr.getClient().getSession().write(CField.showEffect("event/coconut/lose"));
                                
    chr.getClient().getSession().write(CField.playSound("Coconut/Failed"));
                            }
                        }
                        
    warpOut();
                    }
                }
            }, 
    60000);

        }

        public 
    void warpOut() {
            
    setHittable(false);
            
    EventTimer.getInstance().schedule(new Runnable() {

                [
    MENTION=2000004426]Override[/MENTION]
                public 
    void run() {
                    for (
    MapleCharacter chr getMap(0).getCharactersThreadsafe()) {
                        if ((
    getMapleScore() > getStoryScore() && chr.getTeam() == 0) || (getStoryScore() > getMapleScore() && chr.getTeam() == 1)) {
                            
    givePrize(chr);
                        }
                        
    warpBack(chr);
                    }
                    
    unreset();
                }
            }, 
    10000);
        }

        public static class 
    MapleCoconuts {

            private 
    int hits 0;
            private 
    boolean hittable false;
            private 
    boolean stopped false;
            private 
    long hittime System.currentTimeMillis();

            public 
    void hit() {
                
    this.hittime System.currentTimeMillis() + 1000// test
                
    hits++;
            }

            public 
    int getHits() {
                return 
    hits;
            }

            public 
    void resetHits() {
                
    hits 0;
            }

            public 
    boolean isHittable() {
                return 
    hittable;
            }

            public 
    void setHittable(boolean hittable) {
                
    this.hittable hittable;
            }

            public 
    boolean isStopped() {
                return 
    stopped;
            }

            public 
    void setStopped(boolean stopped) {
                
    this.stopped stopped;
            }

            public 
    long getHitTime() {
                return 
    hittime;
            }
        }

    ChannelServer.java
    PHP Code:
    package handling.channel;

    import clientside.MapleCharacter;
    import constants.GameConstants;
    import handling.MapleServerHandler;
    import handling.cashshop.CashShopServer;
    import handling.login.LoginServer;
    import handling.mina.MapleCodecFactory;
    import handling.world.CheaterData;
    import handling.world.MaplePartyCharacter;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.EnumMap;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    import java.util.concurrent.locks.ReentrantReadWriteLock;
    import org.apache.mina.core.buffer.IoBuffer;
    import org.apache.mina.core.buffer.SimpleBufferAllocator;
    import org.apache.mina.core.filterchain.IoFilter;
    import org.apache.mina.core.service.IoAcceptor;
    import org.apache.mina.core.session.IoSession;
    import org.apache.mina.filter.codec.ProtocolCodecFilter;
    import org.apache.mina.transport.socket.SocketSessionConfig;
    import org.apache.mina.transport.socket.nio.NioSocketAcceptor;

    import scripting.EventScriptManager;
    import server.MapleSquad;
    import server.ServerProperties;
    import server.Start;
    import server.events.MapleCoconut;
    import server.events.MapleEvent;
    import server.events.MapleEventType;
    import server.events.MapleFitness;
    import server.events.MapleOla;
    import server.events.MapleOxQuiz;
    import server.events.MapleSnowball;
    import server.events.MapleSurvival;
    import server.life.PlayerNPC;
    import server.maps.AramiaFireWorks;
    import server.maps.MapleMapFactory;
    import server.maps.MapleMapObject;
    import server.shops.HiredMerchant;
    import tools.ConcurrentEnumMap;
    import tools.packet.CWvsContext;

    public class 
    ChannelServer {

        public static 
    long serverStartTime;
        private 
    int expRate;
        private 
    int mesoRate;
        private 
    int dropRate 3;
        private 
    int cashRate 1;
        private 
    int traitRate 10;
        private 
    int BossDropRate 3;
        private 
    short port 8585;
        private static final 
    short DEFAULT_PORT 8585;
        private 
    int channel;
        private 
    int running_MerchantID 0;
        private 
    int flags 0;
        private 
    String serverMessage;
        private 
    String ip;
        private 
    String serverName;
        private 
    boolean shutdown false;
        private 
    boolean finishedShutdown false;
        private 
    boolean MegaphoneMuteState false;
        private 
    boolean adminOnly false;
        private 
    PlayerStorage players;
        private 
    IoAcceptor acceptor;
        private final 
    MapleMapFactory mapFactory;
        private 
    EventScriptManager eventSM;
        private 
    AramiaFireWorks works = new AramiaFireWorks();
        private static final 
    Map<IntegerChannelServerinstances = new HashMap();
        private final 
    Map<MapleSquad.MapleSquadTypeMapleSquadmapleSquads = new ConcurrentEnumMap(MapleSquad.MapleSquadType.class);
        private final 
    Map<IntegerHiredMerchantmerchants = new HashMap();
        private final List<
    PlayerNPCplayerNPCs = new LinkedList();
        private final 
    ReentrantReadWriteLock merchLock = new ReentrantReadWriteLock();
        private 
    int eventmap = -1;
        private final 
    Map<MapleEventTypeMapleEventevents = new EnumMap<MapleEventTypeMapleEvent>(MapleEventType.class);
        public 
    boolean eventOn false;
        public 
    int eventMap 0;
        private 
    boolean eventWarp;
        private 
    String eventHost;
        private 
    String eventName;



        private 
    ChannelServer(int channel) {
            
    this.channel channel;
            
    this.mapFactory = new MapleMapFactory(channel);
        }

        public static 
    Set<IntegergetAllInstance() {
            return new 
    HashSet(instances.keySet());
        }
        
        public final 
    void loadEvents() {
            if (!
    events.isEmpty()) {
               return;
            }
            
    events.put(MapleEventType.CokePlay, new MapleCoconut(channelMapleEventType.CokePlay)); //yep, coconut. same shit
            
    events.put(MapleEventType.Coconut, new MapleCoconut(channelMapleEventType.Coconut));
            
    events.put(MapleEventType.Fitness, new MapleFitness(channelMapleEventType.Fitness));
            
    events.put(MapleEventType.OlaOla, new MapleOla(channelMapleEventType.OlaOla));
            
    events.put(MapleEventType.OxQuiz, new MapleOxQuiz(channelMapleEventType.OxQuiz));
            
    events.put(MapleEventType.Snowball, new MapleSnowball(channelMapleEventType.Snowball));
            
    events.put(MapleEventType.Survival, new MapleSurvival(channelMapleEventType.Survival));   
        }
        
        public 
    byte eventChannel;


        public final 
    void run_startup_configurations() {
            
    setChannel(this.channel);
            try {
                
    this.expRate Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.exp"));
                
    this.mesoRate Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.meso"));
                
    this.serverMessage ServerProperties.getProperty("net.sf.odinms.world.serverMessage");
                
    this.serverName ServerProperties.getProperty("net.sf.odinms.login.serverName");
                
    this.flags Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.world.flags""0"));
                
    this.eventSM = new EventScriptManager(thisServerProperties.getProperty("net.sf.odinms.channel.events").split(","));
                
    this.port Short.parseShort(ServerProperties.getProperty("net.sf.odinms.channel.net.port" this.channelString.valueOf(8585 this.channel)));
            } catch (
    Exception e) {
                throw new 
    RuntimeException(e);
            }
            
    this.ip = (Start.nexonip ":" this.port);

            
    IoBuffer.setUseDirectBuffer(false);
            
    IoBuffer.setAllocator(new SimpleBufferAllocator());
            
    acceptor = new NioSocketAcceptor();
            
    acceptor.getFilterChain().addLast("codec", (IoFilter) new ProtocolCodecFilter(new MapleCodecFactory()));
            
    players = new PlayerStorage(channel);
            try {
                
    acceptor.setHandler(new MapleServerHandler(channelfalsefalse));
                
    acceptor.bind(new InetSocketAddress(port));
                ((
    SocketSessionConfigacceptor.getSessionConfig()).setTcpNoDelay(true);
                
    System.out.println("Channel " this.channel ": Listening on port " this.port "");
                
    this.eventSM.init();
            } catch (
    IOException e) {
                
    System.out.println("Binding to port " this.port " failed (ch: " getChannel() + ")" e);
            }

        }

        public final 
    void shutdown() {
            if (
    this.finishedShutdown) {
                return;
            }
            
    broadcastPacket(CWvsContext.serverNotice(0"This channel will now shut down."));

            
    this.shutdown true;

            
    System.out.println("Channel " this.channel ", Saving characters...");

            
    getPlayerStorage().disconnectAll();
            
    acceptor.setCloseOnDeactivation(true);
            for (
    IoSession ss acceptor.getManagedSessions().values()) {
                
    ss.close(true);
            }
            
    acceptor.unbind();
            
    acceptor.dispose();
            
    System.out.println("Channel " this.channel ", Unbinding...");

            
    instances.remove(Integer.valueOf(this.channel));
            
    setFinishShutdown();
        }

        public final 
    MapleCharacter getPlayer() {
            return 
    getPlayer();
        }

        public final List<
    MapleCharactergetPartyMembers(MapleCharacter party) {
            List 
    chars = new LinkedList();
            for (
    MaplePartyCharacter partychar getPlayer().getParty().getMembers()) {
                if (
    partychar.getChannel() == getChannel()) {
                    
    MapleCharacter chr getPlayerStorage().getCharacterByName(partychar.getName());
                    if (
    chr != null) {
                        
    chars.add(chr);
                    }
                }
            }
            return 
    chars;
        }

        public final 
    boolean hasFinishedShutdown() {
            return 
    this.finishedShutdown;
        }

        public final 
    MapleMapFactory getMapFactory() {
            return 
    this.mapFactory;
        }

        public static final 
    ChannelServer newInstance(int channel) {
            return new 
    ChannelServer(channel);
        }

        public static final 
    ChannelServer getInstance(int channel) {
            return (
    ChannelServerinstances.get(Integer.valueOf(channel));
        }

        public final 
    void addPlayer(MapleCharacter chr) {
            
    getPlayerStorage().registerPlayer(chr);
        }

        public 
    PlayerStorage getPlayerStorage() {
            if (
    players == null) { //wth
                
    players = new PlayerStorage(channel); //wthhhh
            
    }
            return 
    players;
        }

        public final 
    void removePlayer(MapleCharacter chr) {
            
    getPlayerStorage().deregisterPlayer(chr);
        }

        public final 
    void removePlayer(int idzString namez) {
            
    getPlayerStorage().deregisterPlayer(idznamez);
        }

        public final 
    String getServerMessage() {
            return 
    this.serverMessage;
        }

        public final 
    void setServerMessage(String newMessage) {
            
    this.serverMessage newMessage;
            
    broadcastPacket(CWvsContext.serverMessage(this.serverMessage));
        }

        public final 
    void broadcastPacket(byte[] data) {
            
    getPlayerStorage().broadcastPacket(data);
        }

        public final 
    void broadcastSmegaPacket(byte[] data) {
            
    getPlayerStorage().broadcastSmegaPacket(data);
        }

        public final 
    void broadcastGMPacket(byte[] data) {
            
    getPlayerStorage().broadcastGMPacket(data);
        }

        public final 
    int getExpRate() {
            return 
    this.expRate;
        }

        public final 
    void setExpRate(int expRate) {
            
    this.expRate expRate;
        }

        public final 
    int getCashRate() {
            return 
    this.cashRate;
        }

        public final 
    int getChannel() {
            return 
    this.channel;
        }

        public final 
    void setChannel(int channel) {
            
    instances.put(Integer.valueOf(channel), this);
            
    LoginServer.addChannel(channel);
        }

        public static final 
    ArrayList<ChannelServergetAllInstances() {
            return new 
    ArrayList(instances.values());
        }

        public final 
    String getIP() {
            return 
    this.ip;
        }

        public 
    String getIP(int channel) {
            try {
                return 
    getIP(channel);
            } catch (
    Exception e) {
                
    System.out.println("Lost connection to world server " e);
            }
            throw new 
    RuntimeException("Lost connection to world server");
        }

        public final 
    boolean isShutdown() {
            return 
    this.shutdown;
        }

        public final 
    int getLoadedMaps() {
            return 
    this.mapFactory.getLoadedMaps();
        }

        public final 
    EventScriptManager getEventSM() {
            return 
    this.eventSM;
        }

        public final 
    void reloadEvents() {
            
    this.eventSM.cancel();
            
    this.eventSM = new EventScriptManager(thisServerProperties.getProperty("net.sf.odinms.channel.events").split(","));
            
    this.eventSM.init();
        }

        public final 
    int getMesoRate() {
            return 
    this.mesoRate;
        }

        public final 
    void setMesoRate(int mesoRate) {
            
    this.mesoRate mesoRate;
        }
        
        public final 
    void setDropRate(int dropRate) {
            
    this.dropRate dropRate;
        }

        public final 
    int getDropRate() {
            return 
    this.dropRate;
        }
        

        public final 
    int getBossDropRate() {
            return 
    this.BossDropRate;
        }

        public static final 
    void startChannel_Main() {
            
    serverStartTime System.currentTimeMillis();

            for (
    int i 0Integer.parseInt(ServerProperties.getProperty("net.sf.odinms.channel.count""0")); i++) {
                
    newInstance(1).run_startup_configurations();
            }

        }

        public 
    Map<MapleSquad.MapleSquadTypeMapleSquadgetAllSquads() {
            return 
    Collections.unmodifiableMap(this.mapleSquads);
        }

        public final 
    MapleSquad getMapleSquad(String type) {
            return 
    getMapleSquad(MapleSquad.MapleSquadType.valueOf(type.toLowerCase()));
        }

        public final 
    MapleSquad getMapleSquad(MapleSquad.MapleSquadType type) {
            return (
    MapleSquadthis.mapleSquads.get(type);
        }

        public final 
    boolean addMapleSquad(MapleSquad squadString type) {
            
    MapleSquad.MapleSquadType types MapleSquad.MapleSquadType.valueOf(type.toLowerCase());
            if ((
    types != null) && (!this.mapleSquads.containsKey(types))) {
                
    this.mapleSquads.put(typessquad);
                
    squad.scheduleRemoval();
                return 
    true;
            }
            return 
    false;
        }

        public final 
    boolean removeMapleSquad(MapleSquad.MapleSquadType types) {
            if ((
    types != null) && (this.mapleSquads.containsKey(types))) {
                
    this.mapleSquads.remove(types);
                return 
    true;
            }
            return 
    false;
        }

        public final 
    int closeAllMerchant() {
            
    int ret 0;
            
    this.merchLock.writeLock().lock();
            try {
                
    Iterator merchants_ this.merchants.entrySet().iterator();
                while (
    merchants_.hasNext()) {
                    
    HiredMerchant hm = (HiredMerchant) ((Map.Entrymerchants_.next()).getValue();
                    
    hm.closeShop(truefalse);

                    
    hm.getMap().removeMapObject(hm);
                    
    merchants_.remove();
                    
    ret++;
                }
            } finally {
                
    this.merchLock.writeLock().unlock();
            }

            for (
    int i 910000001<= 910000022i++) {
                for (
    MapleMapObject mmo this.mapFactory.getMap(i).getAllHiredMerchantsThreadsafe()) {
                    ((
    HiredMerchantmmo).closeShop(truefalse);

                    
    ret++;
                }
            }
            return 
    ret;
        }

        public final 
    int addMerchant(HiredMerchant hMerchant) {
            
    this.merchLock.writeLock().lock();
            try {
                
    this.running_MerchantID += 1;
                
    this.merchants.put(Integer.valueOf(this.running_MerchantID), hMerchant);
                return 
    this.running_MerchantID;
            } finally {
                
    this.merchLock.writeLock().unlock();
            }
        }

        public final 
    void removeMerchant(HiredMerchant hMerchant) {
            
    this.merchLock.writeLock().lock();
            try {
                
    this.merchants.remove(Integer.valueOf(hMerchant.getStoreId()));
            } finally {
                
    this.merchLock.writeLock().unlock();
            }
        }

        public final 
    boolean containsMerchant(int accidint cid) {
            
    boolean contains false;

            
    this.merchLock.readLock().lock();
            try {
                
    Iterator itr this.merchants.values().iterator();

                while (
    itr.hasNext()) {
                    
    HiredMerchant hm = (HiredMerchantitr.next();
                    if ((
    hm.getOwnerAccId() == accid) || (hm.getOwnerId() == cid)) {
                        
    contains true;
                        break;
                    }
                }
            } finally {
                
    this.merchLock.readLock().unlock();
            }
            return 
    contains;
        }

        public final List<
    HiredMerchantsearchMerchant(int itemSearch) {
            List list = new 
    LinkedList();
            
    this.merchLock.readLock().lock();
            try {
                
    Iterator itr this.merchants.values().iterator();

                while (
    itr.hasNext()) {
                    
    HiredMerchant hm = (HiredMerchantitr.next();
                    if (
    hm.searchItem(itemSearch).size() > 0) {
                        list.
    add(hm);
                    }
                }
            } finally {
                
    this.merchLock.readLock().unlock();
            }
            return list;
        }

        public final 
    void toggleMegaphoneMuteState() {
            
    this.MegaphoneMuteState = (!this.MegaphoneMuteState);
        }

        public final 
    boolean getMegaphoneMuteState() {
            return 
    this.MegaphoneMuteState;
        }

        public 
    int getEvent() {
            return 
    eventmap;
        }

        public final 
    void setEvent(final int ze) {
            
    eventmap ze;
        }

        public 
    MapleEvent getEvent(final MapleEventType t) {
            return 
    events.get(t);
        }

        public final 
    Collection<PlayerNPCgetAllPlayerNPC() {
            return 
    this.playerNPCs;
        }

        public final 
    void addPlayerNPC(PlayerNPC npc) {
            if (
    this.playerNPCs.contains(npc)) {
                return;
            }
            
    this.playerNPCs.add(npc);
            
    getMapFactory().getMap(npc.getMapId()).addMapObject(npc);
        }

        public final 
    void removePlayerNPC(PlayerNPC npc) {
            if (
    this.playerNPCs.contains(npc)) {
                
    this.playerNPCs.remove(npc);
                
    getMapFactory().getMap(npc.getMapId()).removeMapObject(npc);
            }
        }

        public final 
    String getServerName() {
            return 
    this.serverName;
        }

        public final 
    void setServerName(String sn) {
            
    this.serverName sn;
        }

        public final 
    String getTrueServerName() {
            return 
    this.serverName.substring(0this.serverName.length() - (GameConstants.GMS 3));
        }

        public final 
    int getPort() {
            return 
    this.port;
        }

        public static final 
    Set<IntegergetChannelServer() {
            return new 
    HashSet(instances.keySet());
        }

        public final 
    void setShutdown() {
            
    this.shutdown true;
            
    System.out.println("Channel " this.channel " has set to shutdown and is closing Hired Merchants...");
        }

        public final 
    void setFinishShutdown() {
            
    this.finishedShutdown true;
            
    System.out.println("Channel " this.channel " has finished shutdown.");
        }

        public final 
    boolean isAdminOnly() {
            return 
    this.adminOnly;
        }

        public static final 
    int getChannelCount() {
            return 
    instances.size();
        }

        public final 
    int getTempFlag() {
            return 
    this.flags;
        }

        public static 
    Map<IntegerIntegergetChannelLoad() {
            
    Map ret = new HashMap();
            for (
    ChannelServer cs instances.values()) {
                
    ret.put(Integer.valueOf(cs.getChannel()), Integer.valueOf(cs.getConnectedClients()));
            }
            return 
    ret;
        }

        public 
    int getConnectedClients() {
            return 
    getPlayerStorage().getConnectedClients();
        }

        public 
    void broadcastMessage(byte[] message) {
            
    broadcastPacket(message);
        }

        public 
    void broadcastSmega(byte[] message) {
            
    broadcastSmegaPacket(message);
        }

        public 
    void broadcastGMMessage(byte[] message) {
            
    broadcastGMPacket(message);
        }

        public 
    AramiaFireWorks getFireWorks() {
            return 
    this.works;
        }

        public 
    int getTraitRate() {
            return 
    this.traitRate;
        }


  10. #10
    Member Drum is offline
    MemberRank
    Jul 2013 Join Date
    80Posts

    Re: [help] GMS events in v142.2

    Yeah I agree with Fraysa. It definitely looks like it's been scheduled so

    cserv.getEvent(event) == null

    So I don't think this would be returning null. Check the other condition then. eventmap is initialized to -1, and the condition checks for this. So where is this changed? Do a bit of debugging :P



Advertisement