ursinn/DeadByDaylightMC

View on GitHub
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java

Summary

Maintainability
F
3 days
Test Coverage

File ArenaEditor.java has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package noahnok.dbdl.files.utils;

import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import noahnok.dbdl.files.DeadByDaylight;
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 4 hrs to fix

Method setUpItems has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void setUpItems() {
        generator = new EditorItem(new ItemStack(Material.FURNACE, 1), "&bGenerator")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Generator placed!");
                    editing.get(p.getUniqueId()).getPossibleGeneratorLocations().add(bloc);
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 3 hrs to fix

Method hideArenaBlocks has a Cognitive Complexity of 18 (exceeds 5 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 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 toggleEditing has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public void toggleEditing(Player p, String arena) {
        DArena a = main.getArenaManager().isArena(arena);
        if (a == null) {
            p.sendMessage("Not a valid arena!");
            return;
Severity: Minor
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.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 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 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 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

Avoid deeply nested control flow statements.
Open

                        if (editing.containsKey(key)) {
                            p.sendMessage(main.getServer().getPlayer(key).getName() +
                                    " is currently editing this arena!");
                            return;
                        }
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java - About 45 mins to fix

Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.
Open

    public void toggleEditing(Player p, String arena) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.
Open

    private void hideArenaBlocks(final DArena a) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Define a constant instead of duplicating this literal "DBDL-SHULKER-" 3 times.
Open

        shulker.setCustomName("DBDL-SHULKER-" + a.getId());

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "DBDL-SH-" 4 times.
Open

        main.sbrd.registerNewTeam("DBDL-SH-" + color);

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

TODO found
Open

            // TODO

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        hunter = new EditorItem(new ItemStack(Material.WOOL, 1, (short) 15), "&0Hunter")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Hunter Spawn Placed");
                    editing.get(p.getUniqueId()).getPossibleHunterSpawns().add(bloc);
                    addShulker(bloc, BLACK, Material.WOOL, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 1 other location - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 297..302

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        hunted = new EditorItem(new ItemStack(Material.WOOL, 1, (short) 0), "&fHunted")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Hunted Spawn Placed");
                    editing.get(p.getUniqueId()).getPossibleHuntedSpawns().add(bloc);
                    addShulker(bloc, WHITE, Material.WOOL, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 1 other location - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 306..311

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        generator = new EditorItem(new ItemStack(Material.FURNACE, 1), "&bGenerator")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Generator placed!");
                    editing.get(p.getUniqueId()).getPossibleGeneratorLocations().add(bloc);
                    addShulker(bloc, BLUE, Material.FURNACE, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        hatch = new EditorItem(new ItemStack(Material.TRAP_DOOR, 1), "&5Hatch")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Hatch Location Placed");
                    editing.get(p.getUniqueId()).getPossibleHatchLocations().add(bloc);
                    addShulker(bloc, PURPLE, Material.TRAP_DOOR, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        chest = new EditorItem(new ItemStack(Material.CHEST, 1), "&1Chest")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Chest placed!");
                    editing.get(p.getUniqueId()).getPossibleChestSpawns().add(bloc);
                    addShulker(bloc, D_BLUE, Material.CHEST, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        trap = new EditorItem(new ItemStack(Material.PISTON_BASE, 1), "&dTrap")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Trap Location Placed");
                    editing.get(p.getUniqueId()).getTrapLocations().add(bloc);
                    addShulker(bloc, PINK, Material.PISTON_BASE, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        exitArea = new EditorItem(new ItemStack(Material.BARRIER, 1), "&8Exit Area")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("ExitArea Location Placed");
                    editing.get(p.getUniqueId()).getExitArea().add(bloc);
                    addShulker(bloc, PINK, Material.BARRIER, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        cabinet = new EditorItem(new ItemStack(Material.BOOKSHELF, 1), "&cCabinet")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Cabinet Placed");
                    editing.get(p.getUniqueId()).getCabinetLocations().add(bloc);
                    addShulker(bloc, L_RED, Material.BOOKSHELF, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 270..275
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        hook = new EditorItem(new ItemStack(Material.IRON_BLOCK, 1), "&4Hook")
                .addExecutor((Player p, Location bloc) -> {
                    p.sendMessage("Hook placed!");
                    editing.get(p.getUniqueId()).getPossibleHookLocations().add(bloc);
                    addShulker(bloc, RED, Material.IRON_BLOCK, editing.get(p.getUniqueId()));
Severity: Major
Found in src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java and 6 other locations - About 1 hr to fix
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 261..266
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 279..284
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 288..293
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 337..342
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 346..351
src/main/java/noahnok/dbdl/files/utils/ArenaEditor.java on lines 355..360

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status