Esempio n. 1
0
  public void updateOwnerList(FPlayer player) {
    SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
    if (!sPlayer.isSpoutCraftEnabled()
        || (Conf.spoutTerritoryDisplaySize <= 0 && !Conf.spoutTerritoryNoticeShow)) return;

    FLocation here = player.getLastStoodAt();
    Faction factionHere = Board.getFactionAt(here);

    doOwnerList(player, sPlayer, here, factionHere);

    return;
  }
  public void setPlayerChunk(int cx, int cz) {
    ChunkCoordIntPair cur = currentChunk.get();
    if (cur.x != cx || cur.z != cz) {
      currentChunk.set(new ChunkCoordIntPair(cx, cz));
      updateCounter.incrementAndGet();

      SpoutPlayer player = (SpoutPlayer) getPlayer();
      if (player != null && player.isSpoutCraftEnabled()) {
        Spout.getInstance().getPlayerTrackingManager().onMoveChunk((SpoutPlayer) getPlayer());
      }
    }
  }
Esempio n. 3
0
  public boolean updateTerritoryDisplay(FPlayer player, boolean notify) {
    Player p = player.getPlayer();
    if (p == null) return false;

    SpoutPlayer sPlayer = SpoutManager.getPlayer(p);
    if (!sPlayer.isSpoutCraftEnabled()
        || (Conf.spoutTerritoryDisplaySize <= 0 && !Conf.spoutTerritoryNoticeShow)) return false;

    doLabels(player, sPlayer, notify);

    return true;
  }
 private void updateBlockAttributes(int id, short data) {
   org.getspout.spoutapi.material.Block block = MaterialData.getBlock(id, data);
   if (block != null) {
     cachedBlockData = null;
     HashSet<org.getspout.spoutapi.material.Block> toUpdate =
         new HashSet<org.getspout.spoutapi.material.Block>(1);
     toUpdate.add(block);
     SpoutPacket updatePacket = new PacketBlockData(toUpdate);
     for (SpoutPlayer player : SpoutManager.getOnlinePlayers()) {
       if (player.isSpoutCraftEnabled()) player.sendPacket(updatePacket);
     }
   }
 }
Esempio n. 5
0
 @Override
 public void stopMusic(Location location) {
   /** get players in radius of the jukebox and start it for only those players * */
   for (Player p : location.getWorld().getPlayers()) {
     double distance = location.toVector().distance(p.getLocation().toVector());
     if (distance <= (double) range) {
       SpoutPlayer sp = SpoutManager.getPlayer(p);
       if (sp.isSpoutCraftEnabled()) {
         SpoutManager.getSoundManager().stopMusic(sp);
       }
     }
   }
 }
 @Override
 public void onTick() {
   SpoutPlayer player = (SpoutPlayer) SpoutManager.getPlayerFromId(playerId);
   if (player != null && player.isSpoutCraftEnabled()) {
     if (getActivePopup() != null) {
       if (getActivePopup().isDirty()) {
         if (!getActivePopup().getType().isServerOnly()) {
           player.sendPacket(new PacketWidget(getActivePopup(), getId()));
         }
         getActivePopup().setDirty(false);
       }
       getActivePopup().onTick();
     }
   }
   super.onTick();
 }
Esempio n. 7
0
 @Override
 public void playMusic(String url, Location location) {
   /** get players in radius of the jukebox and start it for only those players * */
   for (Player p : location.getWorld().getPlayers()) {
     double distance = location.toVector().distance(p.getLocation().toVector());
     if (distance <= (double) range) {
       SpoutPlayer sp = SpoutManager.getPlayer(p);
       if (sp.isSpoutCraftEnabled()) {
         try {
           SpoutManager.getSoundManager().playCustomMusic(plugin, sp, url, true, location, range);
         } catch (Exception e) {
           // the disc has an error.
           // player.sendMessage(e.getMessage());
           SpoutManager.getSoundManager()
               .playGlobalCustomSoundEffect(
                   plugin, CustomsManager.SF_JUKEBOX_ERROR, false, location, 3);
         }
       }
     }
   }
 }
 @Override
 public boolean x() {
   if (clazz == null || a == null) {
     return false;
   }
   Thread t = Thread.currentThread();
   if (!clazz.isInstance(t)) {
     return false;
   }
   NetworkManager nm = null;
   try {
     nm = (NetworkManager) a.get(t);
   } catch (Exception e) {
   }
   if (nm == null) {
     return false;
   }
   SpoutPlayer player = lookupPlayer(nm);
   if (player == null) {
     return false;
   }
   return player.isSpoutCraftEnabled();
 }
Esempio n. 9
0
 public void redrawAll(Player player) {
   SpoutPlayer splayer = SpoutManager.getPlayer(player);
   if (splayer.isSpoutCraftEnabled())
     for (Widget widget : splayer.getMainScreen().getAttachedWidgets())
       if ((widget.getPlugin() instanceof Features)) widget.setDirty(true);
 }
Esempio n. 10
0
 /**
  * Spawns this particle - making it visible to the given player
  *
  * @param player to spawn the particle for
  */
 public void spawn(SpoutPlayer player) {
   if (player.isSpoutCraftEnabled() && player.getLocation().distance(location) <= range) {
     player.sendPacket(new PacketParticle(this));
   }
 }