Search in sources :

Example 6 with MapleNPC

use of server.life.MapleNPC in project HeavenMS by ronancpl.

the class MapleMap method toggleHiddenNPC.

public void toggleHiddenNPC(int id) {
    chrRLock.lock();
    objectRLock.lock();
    try {
        for (MapleMapObject obj : mapobjects.values()) {
            if (obj.getType() == MapleMapObjectType.NPC) {
                MapleNPC npc = (MapleNPC) obj;
                if (npc.getId() == id) {
                    npc.setHide(!npc.isHidden());
                    if (// Should only be hidden upon changing maps
                    !npc.isHidden()) {
                        broadcastMessage(MaplePacketCreator.spawnNPC(npc));
                    }
                }
            }
        }
    } finally {
        objectRLock.unlock();
        chrRLock.unlock();
    }
}
Also used : MapleNPC(server.life.MapleNPC)

Aggregations

MapleNPC (server.life.MapleNPC)6 MapleMapObject (server.maps.MapleMapObject)3 MapleCharacter (client.MapleCharacter)2 Item (client.inventory.Item)2 MapleMonster (server.life.MapleMonster)2 MapleMap (server.maps.MapleMap)2 MapleMapItem (server.maps.MapleMapItem)2 Point (java.awt.Point)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 MaplePacketHandler (net.MaplePacketHandler)1