ursinn/DeadByDaylightMC

View on GitHub

Showing 103 of 213 total issues

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

    private boolean removeArenaBlock(DArena a, Location bloc) {
        if (a.getPossibleChestSpawns().remove(bloc)) {
            return true;
        }

Method canMove has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @EventHandler
    public void canMove(PlayerMoveEvent e) {
        DPlayer dPlayer = main.getDPlayerManager().getPlayer(e.getPlayer().getUniqueId());
        if (dPlayer == null) {
            return;
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 1 hr to fix

Method initConnection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void initConnection() {
        loadValues();
        if (!main.getToggles().usingSQL) {
            return;
        }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/mysql/MySQL_Connect.java - About 1 hr to fix

Method reInitConnection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public boolean reInitConnection() {
        loadValues();

        try {
            if (connection != null && !connection.isClosed()) {
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/mysql/MySQL_Connect.java - About 1 hr to fix

Method checkTableExists has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void checkTableExists() {
        new BukkitRunnable() {
            @Override
            public void run() {

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

Method saveArenasToFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void saveArenasToFile() {
        for (DArena arena : arenas) {
            String path = "arenas." + arena.getId() + ".";
            FileConfiguration config = main.getArenasConfig().getConfig();
            List<String> gamemodeStrings = new ArrayList<>();
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DArenaManager.java - About 1 hr to fix

Method isArenaBlock has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private boolean isArenaBlock(DArena a, Location bloc) {
        if (a.getPossibleChestSpawns().contains(bloc)) {
            return true;
        }

Method uploadUserStats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void uploadUserStats(final DPlayer p) {
        if (!main.getToggles().usingSQL) {
            return;
        }

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

Method spawnExitGates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private void spawnExitGates(DGame game) {
        for (ExitGate gate : game.getArena().getExitGateLocations()) {
            for (Location loc : gate.getLocs()) {
                loc.getBlock().setType(Material.IRON_FENCE);
            }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DGameManager.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 removeArenaBlock has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean removeArenaBlock(DArena a, Location bloc) {
        if (a.getPossibleChestSpawns().remove(bloc)) {
            return true;
        }

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 27 lines of code (exceeds 25 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

Method spawnExitGates has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void spawnExitGates(DGame game) {
        for (ExitGate gate : game.getArena().getExitGateLocations()) {
            for (Location loc : gate.getLocs()) {
                loc.getBlock().setType(Material.IRON_FENCE);
            }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/DGameManager.java - About 1 hr to fix

Method getRows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private List<List<Location>> getRows() {
        int lowestY = 400;
        for (Location loc : this.locs) {
            if (loc.getY() <= lowestY) {
                lowestY = loc.getBlockY();
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/game/ExitGate.java - About 55 mins 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 isArenaBlock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean isArenaBlock(DArena a, Location bloc) {
        if (a.getPossibleChestSpawns().contains(bloc)) {
            return true;
        }

Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/editor/item/EditorEvents.java - About 55 mins 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

Avoid deeply nested control flow statements.
Open

                        if (game.getStatus() == STATUS.INGAME) {
                            dPlayer.startSpectating(game);
                        }
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if (!lever.isFinished()) {
                            lever.increment(player);

                            e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR,
                                    TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&',
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if (eItem.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(meta.getDisplayName())) {
                            item = eItem;
                        }
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/editor/item/EditorEvents.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if (!gen.isFinished()) {
                            gen.increment(player);
                        }
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if (player.isDead()) {
                            pageItem.addLore("&4&lDead/Escaped");
                        } else {
                            pageItem.addClickAction(p -> {
                                p.closeInventory();
Severity: Major
Found in src/main/java/noahnok/dbdl/files/game/events/MainEvents.java - About 45 mins to fix

Method initConnection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public void initConnection() {
        loadValues();
        if (!main.getToggles().usingSQL) {
            return;
        }
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/mysql/MySQL_Connect.java - About 45 mins 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

Severity
Category
Status
Source
Language