Package org.getspout.spout.player

Examples of org.getspout.spout.player.SpoutCraftPlayer


  }

  @Override
  public void a(Packet18ArmAnimation packet) {
    if (packet.a == -42) {
      SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(getPlayer());
      player.setBuildVersion(1); // Don't know yet, just set above zero
      try {
        Spout.getInstance().playerListener.manager.onSpoutcraftEnable((SpoutPlayer) getPlayer());
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here


    }
  }

  @Override
  public void a(Packet14BlockDig packet) {
    SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(getPlayer());
    boolean inAir = false;
    if (player.canFly() && !player.getHandle().onGround) {
      inAir = true;
      player.getHandle().onGround = true;
    }
    super.a(packet);
    if (inAir) {
      player.getHandle().onGround = false;
    }
  }
View Full Code Here

    if (!event.getPlayer().getClass().equals(SpoutCraftPlayer.class)) {
      SpoutCraftPlayer.updatePlayerConnection(event.getPlayer());
      SpoutCraftPlayer.updateBukkitEntity(event.getPlayer());
      updatePlayerEvent(event);
      Spout.getInstance().authenticate(event.getPlayer());
      SpoutCraftPlayer player = (SpoutCraftPlayer)SpoutCraftPlayer.getPlayer(event.getPlayer());
    }
    ((SimplePlayerChunkMap)SpoutManager.getPlayerChunkMap()).onPlayerJoin(event.getPlayer());
    manager.onPlayerJoin(event.getPlayer());
    synchronized(Spout.getInstance().getOnlinePlayers()) {
      Spout.getInstance().getOnlinePlayers().add((SpoutPlayer) event.getPlayer());
View Full Code Here

  }

  @EventHandler
  public void onPlayerKick(PlayerKickEvent event) {
    if (event.getPlayer() instanceof SpoutCraftPlayer) {
      SpoutCraftPlayer player = (SpoutCraftPlayer)event.getPlayer();
      if (event.getReason().equals("You moved too quickly :( (Hacking?)")) {
        if (player.canFly()) {
          event.setCancelled(true);
        }
        if (System.currentTimeMillis() < player.velocityAdjustmentTime) {
          event.setCancelled(true);
        }
View Full Code Here

    if (event.isCancelled()) {
      return;
    }

    Runnable update = null;
    final SpoutCraftPlayer scp = (SpoutCraftPlayer)SpoutCraftPlayer.getPlayer(event.getPlayer());

    if (event.getFrom().getWorld().equals(event.getTo().getWorld())) {
      update = new PostTeleport(scp);
    } else {
      update = new PostWorldTeleport(scp);
    }
    if (update != null) {
      Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Spout.getInstance(), update, 2);
    }
    if (event.getPlayer() instanceof SpoutPlayer) {
      scp.sendPacket(new PacketAllowVisualCheats(PermHandler.allowSkyCheat(scp),PermHandler.forceSkyCheat(scp),PermHandler.showSkyCheat(scp),PermHandler.allowClearWaterCheat(scp),PermHandler.forceClearWaterCheat(scp),PermHandler.showClearWaterCheat(scp),PermHandler.allowStarsCheat(scp),PermHandler.forceStarsCheat(scp),PermHandler.showStarsCheat(scp),PermHandler.allowWeatherCheat(scp),PermHandler.forceWeatherCheat(scp),PermHandler.showWeatherCheat(scp),PermHandler.allowTimeCheat(scp),PermHandler.allowCoordsCheat(scp),PermHandler.allowEntityLabelCheat(scp),PermHandler.allowVoidFogCheat(scp),PermHandler.forceVoidFogCheat(scp),PermHandler.showVoidFogCheat(scp),PermHandler.allowFlightSpeedCheat(scp)));
    }
  }
View Full Code Here

    }
    if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
      return;
    }

    SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(event.getPlayer());

    if (event.getClickedBlock() != null) {
      boolean action = false;

      switch (event.getClickedBlock().getType()) {
      case BREWING_STAND:
      case CHEST:
      case DISPENSER:
      case ENCHANTMENT_TABLE:
      case FURNACE:
      case WORKBENCH:
      case BED_BLOCK:
      case CAKE_BLOCK:
      case CAULDRON:
      case DIODE_BLOCK_OFF:
      case DIODE_BLOCK_ON:
      case FENCE_GATE:
      case IRON_DOOR_BLOCK:
      case LEVER:
      case NOTE_BLOCK:
      case STONE_BUTTON:
      case TRAP_DOOR:
      case WOODEN_DOOR:
        action = true;
        break;
      }

      if (event.hasItem() && !action) {
        SpoutBlock block = (SpoutBlock)event.getClickedBlock().getRelative(event.getBlockFace());

        if (event.getClickedBlock().getType() == Material.SNOW) {
          block = block.getRelative(0, -1, 0);
        }

        ItemStack item = event.getItem();
        int damage = item.getDurability();
        if (item.getType() == Material.FLINT && damage != 0) {
          SimpleMaterialManager mm = (SimpleMaterialManager)SpoutManager.getMaterialManager();

          if (!player.getEyeLocation().getBlock().equals(block) && !player.getLocation().getBlock().equals(block)) {
            CustomBlock cb = MaterialData.getCustomBlock(damage);

            if (cb != null && isReplaceable(block.getType())) {
              BlockState oldState = block.getState();
              block.setTypeIdAndData(cb.getBlockId(), (byte)(cb.getBlockData()), true);
              cb.onBlockPlace(block.getWorld(), block.getX(), block.getY(), block.getZ(), player);

              int rot = Math.round(player.getLocation().getYaw() + 45 % 360);
              boolean mirrored = player.getLocation().getPitch() < -45;
              if (rot < 0 ) {
                rot += 360;
              }
              rot = (2 - (rot/90)) % 4;
              if (rot < 0) {
                rot += 4;
              }
              byte rotation;
              if (cb.canMirroredRotate() && mirrored) {
                rotation = cb.canRotate() ? (byte) (rot + 4) : 4;
              } else {
                rotation = cb.canRotate() ? (byte) rot : 0;
              }
              mm.overrideBlock(block, cb, rotation);

              if (canPlaceAt(block, oldState, (SpoutBlock)event.getClickedBlock(), item, player)) {
                // Yay, take the item from inventory
                if (player.getGameMode() == GameMode.SURVIVAL) {
                  if (item.getAmount() == 1) {
                  // Remove this for Stuff 
                  event.getPlayer().setItemInHand(null);
                  } else {
                    item.setAmount(item.getAmount() - 1);
                  }
                }
                player.playSound(player.getLocation(), Sound.DIG_STONE, 1.0F, 0.7936508F);
                player.updateInventory();
                // Now we have placed a nice custom block! We should check its rotation and rotate the base block!
                if (cb.canRotate()) {
                  if (cb.canMirroredRotate() && mirrored) {
                    if (block.getType() == Material.LEVER || block.getType() == Material.TORCH || block.getType() == Material.STONE_BUTTON || block.getType() == Material.WOOD_BUTTON) {
                      // The below Types need a slightly different data value to assign correct positioning.
View Full Code Here

        sender.sendMessage("[SpoutPlugin] Client version: no client");
      }
      if (!(target instanceof SpoutPlayer)) {
        sender.sendMessage("[SpoutPlugin] Client version: standard client");
      } else {
        SpoutCraftPlayer sp = (SpoutCraftPlayer) target;
        if (!sp.isSpoutCraftEnabled()) {
          sender.sendMessage("[SpoutPlugin] Client version: standard client");
        } else {
          sender.sendMessage("[SpoutPlugin] Client version: " + sp.getVersionString());
        }
      }
      return true;
    }
View Full Code Here

          packet = new PacketCustomMultiBlockOverride(xCoords, yCoords, zCoords, typeIds, data);
        }

        for (Player player : players) {
          if (player instanceof SpoutCraftPlayer) {
            SpoutCraftPlayer spc = (SpoutCraftPlayer) player;
            if (spc.isSpoutCraftEnabled()) {
              spc.sendPacket(packet);
            }
          }
        }
      } else {
        for (int i = 0; i < xCoords.size(); i++) {
          SpoutPacket packet = new PacketCustomBlockOverride(xCoords.get(i), yCoords.get(i), zCoords.get(i), typeIds.get(i), data.get(i));
          for (Player player : players) {
            if (player instanceof SpoutCraftPlayer) {
              SpoutCraftPlayer spc = (SpoutCraftPlayer) player;
              if (spc.isSpoutCraftEnabled()) {
                spc.sendPacket(packet);
              }
            }
          }
        }
      }
View Full Code Here

  }

  @Override
  public void playSoundEffect(SpoutPlayer target, SoundEffect effect, Location location, int distance, int volumePercent) {
    if (target.isSpoutCraftEnabled()) {
      SpoutCraftPlayer ccp = (SpoutCraftPlayer) target;
      if (location == null || ccp.getWorld().equals(location.getWorld())) {
        if (location == null) {
          ccp.sendPacket(new PacketPlaySound(effect, distance, volumePercent));
        } else {
          ccp.sendPacket(new PacketPlaySound(effect, location, distance, volumePercent));
        }
      }
    }
  }
View Full Code Here

            if (event.isCancelled()) {
              return;
            }
            volumePercent = event.getVolumePercent();
          }
          SpoutCraftPlayer ccp = (SpoutCraftPlayer) target;
          ccp.sendPacket(new PacketDownloadMusic(plugin != null ? plugin.getDescription().getName() : "temp", Url, location, distance, volumePercent, soundEffect, notify));
        }
      } else {
        throw new UnsupportedOperationException("All audio files must be ogg vorbis, wav, or midi type");
      }
    }
View Full Code Here

TOP

Related Classes of org.getspout.spout.player.SpoutCraftPlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.