예제 #1
0
  public boolean intersects(int x, int y, Rectangle rectangle) {
    try {
      Rectangle up = new Rectangle(rectangle.getX(), rectangle.getY() - 2, rectangle.getWidth(), 1);
      Rectangle right =
          new Rectangle(
              rectangle.getX() + rectangle.getWidth() + 1,
              rectangle.getY(),
              1,
              rectangle.getHeight());
      Rectangle down =
          new Rectangle(
              rectangle.getX(),
              rectangle.getY() + rectangle.getHeight() + 1,
              rectangle.getWidth(),
              1);
      Rectangle left =
          new Rectangle(rectangle.getX() - 2, rectangle.getY(), 1, rectangle.getHeight());
      Rectangle rect = blocks[x][y].getRect();

      return (rect.intersects(up)
          || rect.intersects(right)
          || rect.intersects(down)
          || rect.intersects(left));
    } catch (NullPointerException e) {
      logger.log("NullPointerException in World.intersects(int, int, Rectangle)", Level.DEBUG);
      logger.log("Stack:", Level.DEBUG);
      logger.log(e.getMessage(), Level.DEBUG);
    }
    return false;
  }
예제 #2
0
  public InstanceBlock[] intersects(Rectangle rectangle) {
    InstanceBlock[] ret = new InstanceBlock[4];
    try {
      for (int x = 0; x < BWIDTH; x++) {
        for (int y = 0; y < BHEIGHT; y++) {
          Block block = blocks[x][y].getBlock();
          Rectangle rect = blocks[x][y].getRect();
          if (block.isCollidable()) {

            Rectangle up =
                new Rectangle(rectangle.getX(), rectangle.getY() - 2, rectangle.getWidth(), 1);
            Rectangle right =
                new Rectangle(
                    rectangle.getX() + rectangle.getWidth() + 1,
                    rectangle.getY(),
                    1,
                    rectangle.getHeight());
            Rectangle down =
                new Rectangle(
                    rectangle.getX(),
                    rectangle.getY() + rectangle.getHeight() + 1,
                    rectangle.getWidth(),
                    1);
            Rectangle left =
                new Rectangle(rectangle.getX() - 2, rectangle.getY(), 1, rectangle.getHeight());

            if (rect.intersects(up)) {
              ret[Player.UP] = blocks[x][y];
            }
            if (rect.intersects(right)) {
              ret[Player.RIGHT] = blocks[x][y];
            }
            if (rect.intersects(down)) {
              ret[Player.DOWN] = blocks[x][y];
            }
            if (rect.intersects(left)) {
              ret[Player.LEFT] = blocks[x][y];
            }
          }
        }
      }
    } catch (NullPointerException e) {
      logger.log("NullPointerException in World.intersects(Rectangle)", Level.DEBUG);
      logger.log("Stack:", Level.DEBUG);
      logger.log(e.getMessage(), Level.DEBUG);
    }
    return ret;
  }
예제 #3
0
  public void draw() {
    try {
      for (int x = 0; x < BWIDTH; x++)
        for (int y = 0; y < BHEIGHT; y++) {
          if (!(blocks[x][y].getBlock() == Block.air)) blocks[x][y].draw();
        }

      if (player != null) {
        player.draw();
      }
    } catch (NullPointerException e) {
      logger.log("NullPointerException in World.intersects(Rectangle)", Level.DEBUG);
      logger.log("Stack:", Level.DEBUG);
      logger.log(e.getMessage(), Level.DEBUG);
    }
  }
예제 #4
0
  // Process the request
  private String processRequest(HttpServletRequest request, HttpServletResponse response) {
    HttpSession session = request.getSession();
    String userIDs = (String) session.getAttribute("user.id");
    userIDs = (userIDs != null && userIDs.compareTo(" ") > 0) ? userIDs : "0";
    long userID = Long.parseLong(userIDs);
    String command = request.getParameter("command");
    String template = request.getParameter("template");
    String pageHash = request.getParameter("pagehash");
    String pageTitle = request.getParameter("pagetitle");
    String pageDescription = request.getParameter("pagedescription");

    String outLine = "";
    String nextScript = request.getParameter("nextscript");
    OutputStream toClient;
    boolean success = false;

    // System.out.println("userid=" + userID + ", id=" + id + ", command=" + command);

    command = (command != null && command.compareTo(" ") > 0) ? command : "form";
    nextScript = (nextScript != null && nextScript.compareTo(" ") > 0) ? nextScript : "simple1.jsp";

    //    inputstring = (inputstring != null && inputstring.compareTo(" ") > 0) ? inputstring : "";

    DbConn myConn = null;
    try {

      Context initCtx = new InitialContext();
      // String csiSchema = (String) initCtx.lookup("java:comp/env/csi-schema-path");
      // String acronym = (String) initCtx.lookup("java:comp/env/SystemAcronym");
      myConn = new DbConn();
      String csiSchema = myConn.getSchemaPath();
      if (userID != 0) {
        if (command.equals("add")) {
          outLine = "";
        } else if (command.equals("update")) {
          outLine = "";
        } else if (command.equals("updatepage")) {
          UHash uPage = new UHash(pageHash, myConn);
          // System.out.println("Got Here 1");
          if (template.equals("simple1")) {
            TextItem title = new TextItem(uPage.get("title"), myConn);
            title.setText(pageTitle);
            title.save(myConn);
            TextItem description = new TextItem(uPage.get("description"), myConn);
            description.setText(pageDescription);
            description.save(myConn);
          } else if (template.equals("simple2")) {
          }

        } else if (command.equals("test")) {
          outLine = "test";
        }
        success = true;
      }

    } catch (IllegalArgumentException e) {
      outLine = outLine + "IllegalArgumentException caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'");
      // log(outLine);
    } catch (NullPointerException e) {
      outLine = outLine + "NullPointerException caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'");
      // log(outLine);
    }

    // catch (IOException e) {
    //    outLine = outLine + "IOException caught: " + e.getMessage();
    //    ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'");
    //    //log(outLine);
    // }

    catch (Exception e) {
      outLine = outLine + "Exception caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'");
      // log(outLine);
    } finally {
      try {
        generateResponse(outLine, command, nextScript, success, response);
      } catch (Exception i) {
      }

      myConn.release();
      // log("Test log message\n");
    }

    return outLine;
  }
  /**
   * Create a multicast socket and join the multicast group. This method creates a multicast socket
   * that is used to broadcast The <CODE>DiscoveryResponder</CODE> will then join the multicast
   * group and send a join message. This method has no effect if the <CODE>DiscoveryResponder</CODE>
   * is <CODE>ONLINE</CODE> or <CODE>STOPPING</CODE> or <CODE>STARTING</CODE>.
   *
   * @exception IOException The creation of the Multicast socket failed.
   */
  public void start() throws IOException {
    if (state == OFFLINE) {
      changeState(STARTING);
      if (cmf == null) {
        if (logger.finerOn()) {
          logger.finer("start ", "Can't start discoveryResponder: JDMK MBeanServer is not set");
        }
        return;
      }

      // ----------------
      // Create a new obj to receive multicast msg ;
      // ----------------
      try {
        if (logger.finerOn()) {
          logger.finer("start ", "Create a new responder");
        }
        responder =
            new ActualResponder(multicastGroup, multicastPort, getTimeToLive(), cmf, spy, this);

        if (local != null) {
          responder.setLocalHost(local);
        }

        // NPCTE fix for bugId 4499338, esc 0, 04 Sept 2001
        if (usrInet != null) {
          responder.setInterface(usrInet);

          if (logger.finerOn()) {
            logger.finer("start ", "set interface to " + usrInet);
          }
        }
        // end of NPCTE fix for bugId 4499338

        if (noEvent != null) responder.noEvent();

        if (logger.finerOn()) {
          logger.finer("start ", "call responder connect");
        }
        responder.connectToGroup();

        // ----------------
        // Create a new thread to receive multicast msg ;
        // ----------------
        // responderThread = cmf.getThreadAllocatorSrvIf().obtainThread(responderObjectName,
        // responder);
        responderThread = new Thread(responder);
        responderThread.setName("Multicast responder");

        // ----------------
        // Start thread
        // ----------------
        responderThread.start();

        // ----------------
        // Update state
        // ----------------
        // changeState(ONLINE) ;
      } catch (SocketException e) {
        if (logger.finestOn()) {
          logger.finest("start", e);
        }
        throw new IOException(e.getMessage());

      } catch (IOException e) {
        // ------------------------
        // Keep exception for us
        // ------------------------
        if (logger.finestOn()) {
          logger.finest("start ", e);
        }
        throw e;
      } catch (NullPointerException e) {
        // ------------------------
        // the set group did not worked
        // ------------------------
        if (logger.finestOn()) {
          logger.finest("start ", e);
        }
        throw new IOException(e.getMessage());
      }
    } else {
      if (logger.finerOn()) {
        logger.finer("start ", "Responder is not OFFLINE");
      }
    }
  }
예제 #6
0
  // Process the request
  private String processRequest(HttpServletRequest request, HttpServletResponse response) {
    String command = request.getParameter("command");
    String id = request.getParameter("id");
    String description = request.getParameter("description");
    String status = request.getParameter("rstatus");
    status = (status != null && status.compareTo(" ") > 0) ? status : null;
    String outLine = "";
    // String nextScript = "home.jsp";
    String nextScript = request.getParameter("nextscript");
    OutputStream toClient;
    HttpSession session = request.getSession();
    boolean success = false;
    String userIDs = (String) session.getAttribute("user.id");
    long userID = Long.parseLong(userIDs);

    command = (command != null && command.compareTo(" ") > 0) ? command : "form";
    nextScript = (nextScript != null && nextScript.compareTo(" ") > 0) ? nextScript : "roles.jsp";

    //    inputstring = (inputstring != null && inputstring.compareTo(" ") > 0) ? inputstring : "";

    DbConn myConn = null;
    try {

      Context initCtx = new InitialContext();
      // String csiSchema = (String) initCtx.lookup("java:comp/env/csi-schema-path");
      String acronym = (String) initCtx.lookup("java:comp/env/SystemAcronym");
      myConn = new DbConn();
      String csiSchema = myConn.getSchemaPath();
      if (command.equals("add")) {
        Role item = new Role();
        item.setDescription(description);
        item.setStatus(status);
        getPermissions(request, item);
        getPositions(request, item);
        item.add(myConn, userID);
        GlobalMembership.refresh(myConn);
        success = true;
        outLine = "";

      } else if (command.equals("update")) {
        Role item = new Role(myConn, Long.parseLong(id));
        item.setDescription(description);
        item.setStatus(status);
        getPermissions(request, item);
        getPositions(request, item);
        item.save(myConn, userID);
        GlobalMembership.refresh(myConn);
        success = true;
        outLine = "";
      } else if (command.equals("drop")) {
        Role item = new Role(myConn, Long.parseLong(id));
        item.drop(myConn, userID);
        success = true;
        outLine = "Role " + item.getDescription() + " Removed";
      } else if (command.equals("test")) {
        outLine = "test";
      }

    } catch (IllegalArgumentException e) {
      outLine = outLine + "IllegalArgumentException caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'");
      // log(outLine);
    } catch (NullPointerException e) {
      outLine = outLine + "NullPointerException caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'");
      // log(outLine);
    }

    // catch (IOException e) {
    //    outLine = outLine + "IOException caught: " + e.getMessage();
    //    ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'");
    //    //log(outLine);
    // }

    catch (Exception e) {
      outLine = outLine + "Exception caught: " + e.getMessage();
      ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'");
      // log(outLine);
    } finally {
      try {
        generateResponse(outLine, command, nextScript, success, response);
      } catch (Exception i) {
      }

      myConn.release();
      // log("Test log message\n");
    }

    return outLine;
  }
  public void bad() throws Throwable {
    if (private_t) {
      java.util.logging.Logger log2 = java.util.logging.Logger.getLogger("local-logger");
      /* This code could be a part of a user questionnaire */
      String address = null;
      BufferedReader bufread2 = null;
      InputStreamReader inread2 = null;
      try {
        IO.writeLine("Do you know your forwarding address (y/n)? ");
        inread2 = new InputStreamReader(System.in);
        bufread2 = new BufferedReader(inread2);
        if (bufread2.readLine().equalsIgnoreCase("y")) {
          IO.writeLine("Enter your forwarding address: ");
          inread2 = new InputStreamReader(System.in);
          bufread2 = new BufferedReader(inread2);
          address = bufread2.readLine();
        }
        IO.writeLine(
            "bad() - address length = "
                + address.length()); /* INCIDENTAL: CWE476 Null Pointer Dereference */
      } catch (
          NullPointerException npe) /* FLAW: Use of catch block to detect null dereferences */ {
        IO.writeLine(npe.getMessage());
      } catch (Exception e) {
        log2.warning("Error!");
      } finally {
        try {
          if (bufread2 != null) {
            bufread2.close();
          }
        } catch (IOException e) {
          log2.warning("Error closing bufread2");
        } finally {
          try {
            if (inread2 != null) {
              inread2.close();
            }
          } catch (IOException e) {
            log2.warning("Error closing inread2");
          }
        }
      }
    } else {
      /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */

      java.util.logging.Logger log2 = java.util.logging.Logger.getLogger("local-logger");

      /* This code could be a part of a user questionnaire */
      String address = null;
      BufferedReader bufread2 = null;
      InputStreamReader inread2 = null;

      try {
        IO.writeLine("Do you know your forwarding address (y/n)? ");
        inread2 = new InputStreamReader(System.in);
        bufread2 = new BufferedReader(inread2);

        if (bufread2.readLine().equalsIgnoreCase("y")) {
          IO.writeLine("Enter your forwarding address: ");
          inread2 = new InputStreamReader(System.in);
          bufread2 = new BufferedReader(inread2);
          address = bufread2.readLine();
        }
      } catch (Exception e) {
        log2.warning("Error!");
      } finally {
        try {
          if (bufread2 != null) {
            bufread2.close();
          }
        } catch (IOException e) {
          log2.warning("Error closing bufread2");
        } finally {
          try {
            if (inread2 != null) {
              inread2.close();
            }
          } catch (IOException e) {
            log2.warning("Error closing inread2");
          }
        }
      }

      if (address != null) /* FIX: Check for null value before calling a method */ {
        IO.writeLine("good() - address length = " + address.length());
      }
    }
  }
예제 #8
0
  public void collect(Player player, List<ItemStack> itemDrops, EntityDeathEvent event) {
    if (itemDrops.isEmpty() && !levelAllow(player) && !expAllow(player)) {
      return;
    }

    if (plugin.config.dropOnPVPDeath() && player.getKiller() instanceof Player) {
      plugin.message(player, plugin.config.msgPVPDeath());
      return;
    }

    if (plugin.config.residence()) {
      ClaimedResidence res = Residence.getResidenceManager().getByLoc(player.getLocation());
      if (res != null) {
        ResidencePermissions perms = res.getPermissions();
        if (perms.playerHas(player.getName(), plugin.config.resFlag(), true)) {
          plugin.logDebug(
              "Player '"
                  + player.getName()
                  + "' is not allowed to use Scavenger in this residence. Items will be dropped.");
          plugin.message(player, plugin.config.msgInsideRes());
          return;
        } else {
          plugin.logDebug(
              "Player '" + player.getName() + "' is allowed to use Scavenger in this residence.");
        }
      }
    }

    if (plugin.config.factionEnemyDrops() && plugin.factionHook != null) {
      if (plugin.factionHook.isPlayerInEnemyFaction(player)) {
        return;
      }
    }

    if (plugin.config.dungeonMazeDrops() && plugin.dmHook != null) {
      plugin.logDebug("Checking if '" + player.getName() + "' is in DungeonMaze.");
      if (plugin.dmHook.isPlayerInDungeon(player)) {
        plugin.logDebug("Player '" + player.getName() + "' is in DungeonMaze.");
        plugin.message(player, plugin.config.msgInsideDungeonMaze());
        return;
      }
    }

    if (plugin.getWorldGuard() != null) {
      plugin.logDebug("Checking region support for '" + player.getWorld().getName() + "'");
      if (plugin.getWorldGuard().getRegionManager(player.getWorld()) != null) {
        try {
          RegionManager regionManager = plugin.getWorldGuard().getRegionManager(player.getWorld());
          ApplicableRegionSet set = regionManager.getApplicableRegions(player.getLocation());
          if (set.allows(DefaultFlag.PVP) && plugin.config.wgPVPIgnore()) {
            plugin.logDebug(
                "This is a WorldGuard PVP zone and WorldGuardPVPIgnore is "
                    + plugin.config.wgPVPIgnore());
            if (!plugin.config.msgInsideWGPVP().isEmpty()) {
              plugin.message(player, plugin.config.msgInsideWGPVP());
            }
            return;
          }
          if (!set.allows(DefaultFlag.PVP) && plugin.config.wgGuardPVPOnly()) {
            plugin.logDebug(
                "This is NOT a WorldGuard PVP zone and WorldGuardPVPOnly is "
                    + plugin.config.wgGuardPVPOnly());
            if (!plugin.config.msgInsideWGPVP().isEmpty()) {
              plugin.message(player, plugin.config.msgInsideWGPVPOnly());
            }
            return;
          }
        } catch (NullPointerException ex) {
          plugin.logDebug(ex.getMessage());
        }
      } else {
        plugin.logDebug("Region support disabled for '" + player.getWorld().getName() + "'");
      }
    }

    if (plugin.getUltimateArena() != null) {
      if (UltimateArenaAPI.hookIntoUA(plugin).isInArena(player)) {
        if (!plugin.config.msgInsideUA().isEmpty()) {
          plugin.message(player, plugin.config.msgInsideUA());
        }
        return;
      }
    }

    if (plugin.maHandler != null && plugin.maHandler.isPlayerInArena(player)) {
      if (!plugin.config.msgInsideMA().isEmpty()) {
        plugin.message(player, plugin.config.msgInsideMA());
      }
      return;
    }

    if (plugin.pvpHandler != null && !PVPArenaAPI.getArenaName(player).equals("")) {
      String x = plugin.config.msgInsidePA();
      if (!x.isEmpty()) {
        x = x.replace("%ARENA%", PVPArenaAPI.getArenaName(player));
        plugin.message(player, x);
      }
      return;
    }

    if (plugin.battleArena) {
      mc.alk.arena.objects.ArenaPlayer ap = mc.alk.arena.BattleArena.toArenaPlayer(player);
      if (ap != null) {
        Match match = BattleArena.getBAController().getMatch(ap);
        if (match != null) {
          if (match.isInMatch(ap)) {
            String x = plugin.config.msgInsideBA();
            if (!x.isEmpty()) {
              plugin.message(player, x);
            }
            return;
          }
        }
      }
    }

    if (plugin.minigames != null) {
      if (plugin.minigames.playerInMinigame(player)) {
        plugin.logDebug(
            "Player '" + player.getName() + "' is in a Minigame. Not recovering items.");
        return;
      }
    }

    if (hasRestoration(player)) {
      plugin.error(player, "Restoration already exists, ignoring.");
      return;
    }

    if (plugin.getEconomy() != null
        && !(player.hasPermission(PERM_FREE) || (player.isOp() && plugin.config.opsAllPerms()))
        && plugin.config.economyEnabled()) {
      NumberFormat formatter = NumberFormat.getInstance(new Locale(plugin.config.countryCode()));
      formatter.setMaximumFractionDigits(plugin.config.decimalPlaces());
      double restoreCost = plugin.config.restoreCost();
      double withdrawAmount;
      double playerBalance = plugin.getEconomy().getBalance(player);
      double percentCost = plugin.config.percentCost();
      double minCost = plugin.config.minCost();
      double maxCost = plugin.config.maxCost();
      EconomyResponse er;
      String currency;
      if (plugin.config.percent()) {
        if (playerBalance < 0) {
          withdrawAmount = 0;
        } else {
          withdrawAmount = playerBalance * (percentCost / 100.0);
        }
        plugin.logDebug("withdrawAmount: " + withdrawAmount);
        plugin.logDebug("playeBalance: " + playerBalance);
        plugin.logDebug("percentCost: " + percentCost + "(" + (percentCost / 100.0) + ")");
        if (plugin.config.addMin()) {
          withdrawAmount = withdrawAmount + minCost;
          plugin.logDebug("withdrawAmount (addMin): " + withdrawAmount);
        } else if (withdrawAmount < minCost) {
          withdrawAmount = minCost;
        }
        if (withdrawAmount > maxCost && maxCost > 0) {
          withdrawAmount = maxCost;
        }
      } else {
        withdrawAmount = restoreCost;
      }
      er = plugin.getEconomy().withdrawPlayer(player, withdrawAmount);
      if (er.transactionSuccess()) {
        plugin.logDebug("Withdraw success!");
        if (withdrawAmount == 1) {
          currency = plugin.getEconomy().currencyNameSingular();
        } else {
          currency = plugin.getEconomy().currencyNamePlural();
        }
        String x = plugin.config.msgSaveForFee();
        if (!x.isEmpty()) {
          x = x.replace("%COST%", formatter.format(withdrawAmount));
          x = x.replace("%CURRENCY%", currency);
          plugin.message(player, x);
        }
        if (!plugin.config.depositDestination().isEmpty()) {
          plugin.logDebug("DepositDesination: " + plugin.config.depositDestination());
          if (plugin.config.depositType().equalsIgnoreCase("bank")) {
            plugin.logDebug("DepositType: BANK");
            if (plugin.getEconomy().hasBankSupport()) {
              plugin.logDebug("Bank support is enabled");
              plugin.getEconomy().bankDeposit(plugin.config.depositDestination(), withdrawAmount);
            } else {
              plugin.logDebug("Bank support is NOT enabled");
            }
          } else if (plugin.config.depositType().equalsIgnoreCase("player")) {
            plugin.logDebug("DepositType: PLAYER");
            plugin.logDebug("DepositDestination: " + plugin.config.depositDestination());
            if (plugin.getEconomy().hasAccount(plugin.config.depositDestination())) {
              plugin.logDebug("DepositDestination: VALID");
              plugin.getEconomy().depositPlayer(plugin.config.depositDestination(), withdrawAmount);
            } else {
              plugin.logDebug("DepositDestination: INVALID");
            }
          } else {
            plugin.logDebug("DepositType: INVALID");
          }
        } else {
          plugin.logDebug("No deposit destination!");
        }
      } else {
        plugin.logDebug("Withdraw fail! " + er.errorMessage);
        if (playerBalance == 1) {
          currency = plugin.getEconomy().currencyNameSingular();
        } else {
          currency = plugin.getEconomy().currencyNamePlural();
        }
        String x = plugin.config.msgNotEnoughMoney();
        if (!x.isEmpty()) {
          x = x.replace("%BALANCE%", formatter.format(playerBalance));
          x = x.replace("%COST%", formatter.format(withdrawAmount));
          x = x.replace("%CURRENCY%", currency);
          x = x.replace("%ERRORMESSAGE%", er.errorMessage);
          plugin.message(player, x);
        }
        return;
      }
    } else {
      plugin.message(player, plugin.config.msgSaving());
    }

    Restoration restoration = new Restoration();
    restoration.enabled = false;

    // temporary fix for 1.9
    restoration.inventory = Arrays.copyOfRange(player.getInventory().getContents(), 0, 36);
    restoration.armour = player.getInventory().getArmorContents();
    if (plugin.isMc19or110()) {
      restoration.offHand = player.getInventory().getItemInOffHand();
    }
    restoration.playerName = player.getDisplayName();
    itemDrops.clear();

    if (levelAllow(player)) {
      plugin.logDebug("Collecting level " + player.getLevel() + " for " + player.getName());
      restoration.level = player.getLevel();
    }
    if (expAllow(player)) {
      plugin.logDebug("Collecting exp " + player.getExp() + " for " + player.getName());
      restoration.exp = player.getExp();
      event.setDroppedExp(0);
    }

    String deathCause = "NULL";
    if (player.getLastDamageCause() != null) {
      if (player.getLastDamageCause().getCause() != null) {
        deathCause = player.getLastDamageCause().getCause().toString();
      }
    }
    String deathCausePermission = PERM_SCAVENGE_PREFIX + deathCause;
    plugin.logDebug(
        "[p:"
            + player.getName()
            + "] ["
            + PERM_SCAVENGE
            + ":"
            + player.hasPermission(PERM_SCAVENGE)
            + "]"
            + " ["
            + deathCausePermission
            + ":"
            + player.hasPermission(deathCausePermission)
            + "]");
    if (player.hasPermission(PERM_SCAVENGE) || player.hasPermission(deathCausePermission)) {
      plugin.logDebug("Permissions are okay. Time to scavenge...");
      if (plugin.config.chanceToDrop() > 0 && !player.hasPermission(PERM_NO_CHANCE)) {
        checkChanceToDropItems(restoration.armour, itemDrops);
        checkChanceToDropItems(restoration.inventory, itemDrops);
        if (plugin.isMc19or110()) {
          checkChanceToDropItems(restoration.offHand, itemDrops);
        }
      }
      if (plugin.config.singleItemDrops()) {
        checkSingleItemDrops(player, restoration.armour, itemDrops);
        checkSingleItemDrops(player, restoration.inventory, itemDrops);
        checkSingleItemDrops(player, restoration.offHand, itemDrops);
      } else if (plugin.config.singleItemKeeps()) {
        checkSingleItemKeeps(player, "armour", restoration.armour, itemDrops);
        checkSingleItemKeeps(player, "inv", restoration.inventory, itemDrops);
        if (plugin.isMc19or110()) {
          checkSingleItemKeeps(player, "offhand", restoration.offHand, itemDrops, 1);
        }
      } else if (plugin.config.slotBasedRecovery()) {
        checkSlots(player, "armour", restoration.armour, itemDrops);
        checkSlots(player, "inv", restoration.inventory, itemDrops);
        if (plugin.isMc19or110()) {
          checkSlots(player, "offhand", restoration.offHand, itemDrops, 1);
        }
      }
    } else {
      plugin.logDebug("Permissions are NOT okay. Dropping items...");
      dropItems(restoration.armour, itemDrops);
      dropItems(restoration.inventory, itemDrops);
      dropItem(restoration.offHand, itemDrops);
    }
    addRestoration(player, restoration);
  }