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;
}
- Create a ticketCreate a ticket
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;
- Create a ticketCreate a ticket
Method initConnection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void initConnection() {
loadValues();
if (!main.getToggles().usingSQL) {
return;
}
- Create a ticketCreate a ticket
Method reInitConnection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean reInitConnection() {
loadValues();
try {
if (connection != null && !connection.isClosed()) {
- Create a ticketCreate a ticket
Method checkTableExists
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void checkTableExists() {
new BukkitRunnable() {
@Override
public void run() {
- Create a ticketCreate a ticket
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<>();
- Create a ticketCreate a ticket
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;
}
- Create a ticketCreate a ticket
Method uploadUserStats
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void uploadUserStats(final DPlayer p) {
if (!main.getToggles().usingSQL) {
return;
}
- Create a ticketCreate a ticket
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);
}
- 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 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;
}
- 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 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;
- Create a ticketCreate a ticket
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);
}
- Create a ticketCreate a ticket
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();
- 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 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;
}
- 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
Avoid deeply nested control flow statements. Open
if (game.getStatus() == STATUS.INGAME) {
dPlayer.startSpectating(game);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!lever.isFinished()) {
lever.increment(player);
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR,
TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&',
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (eItem.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(meta.getDisplayName())) {
item = eItem;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!gen.isFinished()) {
gen.increment(player);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (player.isDead()) {
pageItem.addLore("&4&lDead/Escaped");
} else {
pageItem.addClickAction(p -> {
p.closeInventory();
- Create a ticketCreate a ticket
Method initConnection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public void initConnection() {
loadValues();
if (!main.getToggles().usingSQL) {
return;
}
- 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"