SHARE
TWEET

Untitled

a guest Apr 19th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.   public final boolean isOnSurface()
  4.   {
  5.     return isOnSurface;
  6.   }
  7.  
  8.   public final void addVillage(Village village)
  9.   {
  10.     if (villages == null)
  11.       villages = new HashSet();
  12.     if (!villages.contains(village))
  13.     {
  14.       villages.add(village);
  15.       if (tiles != null)
  16.       {
  17.         for (VolaTile tile : tiles.values())
  18.         {
  19.           if (village.covers(tile.getTileX(), tile.getTileY())) {
  20.             tile.setVillage(village);
  21.           }
  22.         }
  23.       }
  24.       addMineDoors(village);
  25.     }
  26.   }
  27.  
  28.   public final void removeVillage(Village village)
  29.   {
  30.     if (villages == null)
  31.       villages = new HashSet();
  32.     if (villages.contains(village))
  33.     {
  34.       villages.remove(village);
  35.       if (tiles != null)
  36.       {
  37.  
  38.  
  39.  
  40.         for (VolaTile tile : tiles.values())
  41.         {
  42.           if (village.covers(tile.getTileX(), tile.getTileY())) {
  43.             tile.setVillage(null);
  44.           }
  45.         }
  46.       }
  47.      
  48.  
  49.  
  50.  
  51.       for (int x = startX; x < endX; x++)
  52.       {
  53.         for (int y = startY; y < endY; y++)
  54.         {
  55.           MineDoorPermission md = MineDoorPermission.getPermission(x, y);
  56.           if (md != null)
  57.           {
  58.             if (village.covers(x, y)) {
  59.               village.removeMineDoor(md);
  60.             }
  61.           }
  62.         }
  63.       }
  64.     }
  65.   }
  66.  
  67.   public final void updateVillage(Village village, boolean shouldStay) {
  68.     if (villages == null)
  69.       villages = new HashSet();
  70.     if (villages.contains(village))
  71.     {
  72.       if (!shouldStay)
  73.         villages.remove(village);
  74.       if (tiles != null)
  75.       {
  76.         for (VolaTile tile : tiles.values())
  77.         {
  78.           if ((!village.covers(tile.getTileX(), tile.getTileY())) && (tile.getVillage() == village)) {
  79.             tile.setVillage(null);
  80.           }
  81.         }
  82.         for (VolaTile tile : tiles.values())
  83.         {
  84.           if (village.covers(tile.getTileX(), tile.getTileY()))
  85.             tile.setVillage(village);
  86.         }
  87.       }
  88.       for (int x = startX; x < endX; x++)
  89.       {
  90.         for (int y = startY; y < endY; y++)
  91.         {
  92.           MineDoorPermission md = MineDoorPermission.getPermission(x, y);
  93.           if (md != null)
  94.           {
  95.             if ((!village.covers(x, y)) && (md.getVillage() == village))
  96.               village.removeMineDoor(md);
  97.             if (village.covers(x, y)) {
  98.               village.addMineDoor(md);
  99.             }
  100.           }
  101.         }
  102.       }
  103.       addMineDoors(village);
  104.     }
  105.     else if (shouldStay) {
  106.       addVillage(village);
  107.     }
  108.   }
  109.  
  110.   final boolean containsVillage(int x, int y) {
  111.     if (villages != null)
  112.     {
  113.       for (Village village : villages)
  114.       {
  115.         if (village.covers(x, y))
  116.           return true;
  117.       }
  118.     }
  119.     return false;
  120.   }
  121.  
  122.   final Village getVillage(int x, int y)
  123.   {
  124.     if (villages != null)
  125.     {
  126.       for (Village village : villages)
  127.       {
  128.         if (village.covers(x, y))
  129.           return village;
  130.       }
  131.     }
  132.     return null;
  133.   }
  134.  
  135.  
  136.  
  137.  
  138.  
  139.   public final Village[] getVillages()
  140.   {
  141.     if (villages != null) {
  142.       return (Village[])villages.toArray(new Village[villages.size()]);
  143.     }
  144.     return new Village[0];
  145.   }
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.   public final void poll(int nums)
  174.   {
  175.     VolaTile[] lTileArray = getTiles();
  176.    
  177.  
  178.  
  179.     pollTicker = ((short)(pollTicker + 1));
  180.     boolean lPollStuff = pollTicker >= maxZonesPolled;
  181.    
  182.     boolean spawnCreatures = (lPollStuff) || (Creatures.getInstance().getNumberOfCreatures() < localServermaxCreatures - 1000);
  183.    
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.     boolean checkAreaEffect = Server.rand.nextInt(5) == 0;
  192.     long now = System.nanoTime();
  193.     for (VolaTile lElement : lTileArray)
  194.     {
  195.       lElement.poll(lPollStuff, pollTicker, checkAreaEffect);
  196.     }
  197.    
  198.  
  199.  
  200.  
  201.     float lElapsedTime = (float)(System.nanoTime() - now) / 1000000.0F;
  202.     if ((logger.isLoggable(Level.FINE)) && (lElapsedTime > 200.0F))
  203.     {
  204.       logger.fine("Zone at " + startX + ", " + startY + " polled " + lTileArray.length + " tiles. That took " + lElapsedTime + " millis.");
  205.  
  206.     }
  207.     else if ((!localServertestServer) && (lElapsedTime > 300.0F))
  208.       logger.log(Level.INFO, "Zone at " + startX + ", " + startY + " polled " + lTileArray.length + " tiles. That took " + lElapsedTime + " millis.");
  209.     Object t;
  210.     Creature cret;
  211.     if (isOnSurface())
  212.     {
  213.       if ((Server.getWeather().getFog() > 0.5F) && (fogSpiders.size() < Zones.worldTileSizeX / 10))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top