ursinn/DeadByDaylightMC

View on GitHub

Showing 103 of 213 total issues

Method onCommand has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
        if (!(commandSender instanceof Player)) {
            commandSender.sendMessage(main.prefix + "Only players can use this command!");
            return true;
        }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/commands/MainCommands.java - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method showGamemodesPage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public Inventory showGamemodesPage(final DArena a) {
        main.getArenaManager().setUsableGamemodes(a);
        int rows = ((a.getUsableModes().size() / 9) + 1) * 9;

        if (a.getUsableModes().size() == rows) {
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaManagmentInvs.java - About 2 hrs to fix

Method loadGamemodesFromFile has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void loadGamemodesFromFile() {
        int count = 0;

        for (String key : main.getGamemodesConfig().getConfig().getConfigurationSection("gamemodes").getKeys(false)) {
            String path = "gamemodes." + key + ".";
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DGamemodeManager.java - About 1 hr to fix

Method sneakMenu has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @EventHandler
    public void sneakMenu(PlayerToggleSneakEvent e) {

        if (!e.isSneaking()) {
            DGame game = main.getGameManager().getGamePlayerIsIn(e.getPlayer());
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 1 hr to fix

Method editorBlockBreakEntity has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @EventHandler
    public void editorBlockBreakEntity(PlayerInteractAtEntityEvent e) {
        if (!main.getArenaEditor().editing.containsKey(e.getPlayer().getUniqueId())) {
            Shulker shulker;
            try {

Method getRandomArena has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public DArena getRandomArena() {
        List<DArena> tempArenaList = new ArrayList<>();
        for (DArena arena : arenas) {
            boolean hasDefault = false;
            for (DGamemode mode : arena.getUsableModes().keySet()) {
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DArenaManager.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method setUsableGamemodes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public void setUsableGamemodes(DArena a) {
        for (DGamemode mode : a.getUsableModes().keySet()) {
            if (a.getPossibleGeneratorLocations().size() < mode.getMaxgenerators()) {
                a.getUsableModes().put(mode, false);
                continue;
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DArenaManager.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method huntedDies has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @EventHandler
    public void huntedDies(EntityDamageByEntityEvent e) {
        if (e.getEntity() instanceof Player && e.getDamager() instanceof Firework) {
            if (e.getDamager().getCustomName().equals("DBDL-FIREWORK")) {
                e.setCancelled(true);
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 1 hr to fix

Method onClick has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    @EventHandler
    public void onClick(InventoryClickEvent e) {
        if (e.getView().getTopInventory().getHolder() instanceof Page) {
            e.setCancelled(true);

Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/pagenation/PageEvent.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method onClick has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    @EventHandler
    public void onClick(InventoryClickEvent event) {
        //Check if the inventory is custom
        if (event.getView().getTopInventory().getHolder() instanceof CustomHolder) {
            //Cancel the event
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/InventoryEvents.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method hideArenaBlocks has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void hideArenaBlocks(final DArena a) {
        for (Location loc : a.getPossibleGeneratorLocations()) {
            removeShulker(loc, a);
        }

Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 1 hr to fix

Method getInventory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Inventory getInventory() {
        Inventory inv;

        if (pageSize == -1) {
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/pagenation/Page.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method showArenaBlocks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private void showArenaBlocks(final DArena a) {
        for (Location loc : a.getPossibleGeneratorLocations()) {
            addShulker(loc, BLUE, Material.FURNACE, a);
        }

Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method getExitGateLocation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private List<Location> getExitGateLocation(Location loc, String dir) {
        List<Location> locs = new ArrayList<>();
        if (dir.equalsIgnoreCase("EAST")) {
            for (int i = -1; i < 2; i++) {
                for (int y = 0; y < 3; y++) {
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method showArenaPage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public Inventory showArenaPage(final DArena arena) {
        CustomHolder arenaInv = invBuilder.createNew(arena.getId(), 9);
        arenaInv.setIcon(8, closeMenu);
        Icon del = deleteItem.getCopy().clearLore();
        arenaInv.setIcon(7, del.addClickAction(p -> p.openInventory(confirmDelete(arena))));
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaManagmentInvs.java - About 1 hr to fix

Method blockInteract has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @EventHandler
    public void blockInteract(PlayerInteractEvent e) {

        DGame game = main.getGameManager().getGamePlayerIsIn(e.getPlayer());
        if (game != null && game.getStatus() == STATUS.INGAME) {
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 1 hr to fix

Method endCountdown has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void endCountdown(boolean toPlay) {
        DSign sign = main.getSignManager().getSign(ref);
        if (sign != null) {
            sign.removeGame();
        }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/Countdown.java - About 1 hr to fix

Method addPlayerToMatchMakingLoop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void addPlayerToMatchMakingLoop(final Player p, final String playType) {
        BukkitTask tryMatchMake = new BukkitRunnable() {
            public void run() {
                if (addToMatchmaking(p, playType)) {
                    removePlayerFromMatchMakingLoop(p);
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 1 hr to fix

Method showArenaBlocks has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void showArenaBlocks(final DArena a) {
        for (Location loc : a.getPossibleGeneratorLocations()) {
            addShulker(loc, BLUE, Material.FURNACE, a);
        }

Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 1 hr to fix

Method addToMatchmaking has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public boolean addToMatchmaking(Player p, String playType) {
        //Check if there are any available games
        if (waitingGames.isEmpty()) {
            //Try and create a new game
            DGame game = main.getGameManager().createNewGame();
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/MatchMaking.java - About 1 hr to fix
Severity
Category
Status
Source
Language