Exemplo n.º 1
0
  @EventHandler(priority = EventPriority.LOW)
  public void onBlockPlace(BlockPlaceEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);

    if (client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
      event.setCancelled(true);
      return;
    }

    if (event.getBlockPlaced().getType() == Material.TNT
        && Rixor.getRotation().getSlot().getMap().getTntsettings().isInstantIgnite()) {
      event.getBlockPlaced().setType(Material.AIR);
      TNTPrimed tnt =
          event
              .getBlockPlaced()
              .getWorld()
              .spawn(event.getBlockPlaced().getLocation(), TNTPrimed.class);
    }

    if (!client.isObserver()) {
      Map map = Rixor.getRotation().getSlot().getMap();
      BlockChangeEvent change =
          new BlockChangeEvent(
              event, map, client, event.getBlockReplacedState(), event.getBlockPlaced().getState());
      Rixor.callEvent(change);
    }
  }
Exemplo n.º 2
0
  @EventHandler(priority = EventPriority.LOW)
  public void onPlayerDropItems(PlayerDropItemEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);

    if (client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
      event.setCancelled(true);
      return;
    }

    if (!client.isObserver()) {
      /*Map map = Rixor.getRotation().getSlot().getMap();
       */
    }
  }
Exemplo n.º 3
0
  @EventHandler(priority = EventPriority.LOW)
  public void onInventoryClick(InventoryClickEvent event) {
    if (event.getWhoClicked() instanceof Player == false) {
      event.setCancelled(true);
      return;
    }

    Player player = (Player) event.getWhoClicked();
    Client client = Client.getClient(player);

    if ((client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning())
        && event.getInventory().getType() != InventoryType.PLAYER) {
      event.setCancelled(true);
      return;
    }

    if (!client.isObserver()) {
      /*Map map = Rixor.getRotation().getSlot().getMap();
       */
    }
  }
Exemplo n.º 4
0
  @SuppressWarnings("deprecation")
  @EventHandler(priority = EventPriority.LOW)
  public void onBlockBreak(BlockBreakEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);

    if (client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
      event.setCancelled(true);
      return;
    }

    if (!client.isObserver()) {
      Map map = Rixor.getRotation().getSlot().getMap();

      BlockState newState = event.getBlock().getState();
      newState.setData(new MaterialData(Material.AIR, (byte) 0));

      BlockChangeEvent change =
          new BlockChangeEvent(event, map, client, event.getBlock().getState(), newState);
      Rixor.callEvent(change);
    }
  }
Exemplo n.º 5
0
  @EventHandler(priority = EventPriority.LOW)
  public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);

    if (client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
      event.setCancelled(true);
      if (event.getClickedBlock() != null
          && event.getClickedBlock().getType() == Material.CHEST
          && event.getAction() == Action.RIGHT_CLICK_BLOCK)
        player.openInventory(((Chest) event.getClickedBlock().getState()).getBlockInventory());
      return;
    }
    /*	if(client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
    	event.setCancelled(true);
    	if(event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST && event.getAction() == Action.RIGHT_CLICK_BLOCK)
    		player.openInventory(((Chest) event.getClickedBlock().getState()).getBlockInventory());
    	return;
    }*/
  }