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;
}
- 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
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
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"
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))));
- Create a ticketCreate a ticket
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) {
- Create a ticketCreate a ticket
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();
}
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
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);
}
- Create a ticketCreate a ticket
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();
- Create a ticketCreate a ticket