Showing 213 of 213 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
package noahnok.dbdl.files.utils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
- Read upRead up
- Create a ticketCreate a ticket
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 147.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
package noahnok.dbdl.files.utils.pagenation;
import noahnok.dbdl.files.utils.pagenation.buttons.PageItem;
import noahnok.dbdl.files.utils.pagenation.interfaces.GeneralClick;
import org.bukkit.Material;
- Read upRead up
- Create a ticketCreate a ticket
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 147.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
}
- Read upRead up
- Create a ticketCreate a ticket
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) {
- Create a ticketCreate a ticket
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 + ".";
- Create a ticketCreate a ticket
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());
- Create a ticketCreate a ticket
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 {
- Create a ticketCreate a ticket
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()) {
- Read upRead up
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public void announceJoin(Player p) {
for (DPlayer player : players) {
Player reciever = main.getServer().getPlayer(player.getId());
reciever.spigot().sendMessage(ChatMessageType.ACTION_BAR,
TextComponent.fromLegacyText(ChatColor.GOLD + p.getName() + ChatColor.GRAY + " joined the game!"));
- Read upRead up
- Create a ticketCreate a ticket
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 112.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public void announceLeave(Player p) {
for (DPlayer player : players) {
Player reciever = main.getServer().getPlayer(player.getId());
reciever.spigot().sendMessage(ChatMessageType.ACTION_BAR,
TextComponent.fromLegacyText(ChatColor.GOLD + p.getName() + ChatColor.GRAY + " left the game!"));
- Read upRead up
- Create a ticketCreate a ticket
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 112.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Create a ticketCreate a ticket
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);
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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);
}
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
i = invBuilder.createIcon(itemBuilder.getNewBuilder(Material.WOOL)
.setByte((short) 14).build(), ChatColor.GOLD + "✕ " + mode.getId());
i.addLore(ChatColor.translateAlternateColorCodes('&', "&aClick to &a&lENABLE &a this mode!"));
i.addLore("");
- Read upRead up
- Create a ticketCreate a ticket
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 102.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (Boolean.TRUE.equals(a.getUsableModes().get(mode))) {
i = invBuilder.createIcon(itemBuilder.getNewBuilder(Material.WOOL)
.setByte((short) 5).build(), ChatColor.GREEN + "✔ " + mode.getId());
i.addLore(ChatColor.translateAlternateColorCodes('&', "&4Click to &4&lDISABLE &4 this mode!"));
i.addLore("");
- Read upRead up
- Create a ticketCreate a ticket
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 102.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method getInventory
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Inventory getInventory() {
Inventory inv;
if (pageSize == -1) {
- Read upRead up
- Create a ticketCreate a ticket
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);
}
- Read upRead up
- Create a ticketCreate a ticket
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++) {
- Read upRead up
- Create a ticketCreate a ticket
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"