Fixes for Codacy;

These fixes are designed to satisfy codacy.

However, codacy reports a NPath Complexity of 649, whereas the current, recommended, and standardized threshold is 200.

This is caused by FreedomCommand#execute(CommandSender, String, String[]);
This commit is contained in:
Paldiu 2020-12-25 15:35:33 -05:00
parent 361aa4ee04
commit 97edce0a67
7 changed files with 22 additions and 27 deletions

View File

@ -182,22 +182,22 @@ public class Pterodactyl extends FreedomService
return URL;
}
public String getSERVER_KEY()
public String getServerKey()
{
return SERVER_KEY;
}
public String getADMIN_KEY()
public String getAdminKey()
{
return ADMIN_KEY;
}
public List<String> getSERVER_HEADERS()
public List<String> getServerHeaders()
{
return SERVER_HEADERS;
}
public List<String> getADMIN_HEADERS()
public List<String> getAdminHeaders()
{
return ADMIN_HEADERS;
}

View File

@ -134,13 +134,11 @@ public class EventBlocker extends FreedomService
@EventHandler(priority = EventPriority.HIGH)
public void onEntityDamage(EntityDamageEvent event)
{
if (event.getCause() == EntityDamageEvent.DamageCause.LAVA)
if ((event.getCause() == EntityDamageEvent.DamageCause.LAVA)
&& !ConfigEntry.ALLOW_LAVA_DAMAGE.getBoolean())
{
if (!ConfigEntry.ALLOW_LAVA_DAMAGE.getBoolean())
{
event.setCancelled(true);
return;
}
event.setCancelled(true);
return;
}
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())

View File

@ -126,7 +126,7 @@ public class CageData
this.innerMaterial = inner;
input = null;
buildHistory(location, fPlayer);
buildHistory(location);
regenerate();
}
@ -143,7 +143,7 @@ public class CageData
this.innerMaterial = inner;
CageData.input = input;
buildHistory(location, fPlayer);
buildHistory(location);
regenerate();
}
@ -197,7 +197,7 @@ public class CageData
}
}
private void buildHistory(Location location, FPlayer playerdata)
private void buildHistory(Location location)
{
final Block center = location.getBlock();
for (int xOffset = -2; xOffset <= 2; xOffset++)

View File

@ -187,7 +187,7 @@ public class Discord extends FreedomService
@Override
public void onReady(@NotNull ReadyEvent event)
{
new StartEvent(event.getJDA()).start();
new StartEvent().start();
}
})
.setAutoReconnect(true)
@ -503,7 +503,7 @@ public class Discord extends FreedomService
// Do no ask why this is here. I spent two hours trying to make a simple thing work
public class StartEvent
{
public StartEvent(JDA api)
public StartEvent()
{
}

View File

@ -324,14 +324,13 @@ public class ItemFun extends FreedomService
{
arrow = (Arrow)entity;
}
if (arrow != null && (arrow.getShooter() instanceof Player))
//Redundant Player cast is required to avoid suspicious method calls.
if (arrow != null
&& (arrow.getShooter() instanceof Player)
&& explosivePlayers.contains((Player)arrow.getShooter()))
{
//Redundant Player cast is required to avoid suspicious method calls.
if (explosivePlayers.contains(arrow.getShooter()))
{
Objects.requireNonNull(arrow.getLocation().getWorld()).createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean());
arrow.remove();
}
Objects.requireNonNull(arrow.getLocation().getWorld()).createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean());
arrow.remove();
}
if (entity instanceof Fireball)

View File

@ -23,7 +23,7 @@ public class PermissionConfig extends FreedomService
{
entries = new EnumMap<>(PermissionEntry.class);
PermissionDefaults tempDefaults = null;
PermissionDefaults tempDefaults;
try
{
try
@ -50,8 +50,6 @@ public class PermissionConfig extends FreedomService
{
FLog.severe(ex);
}
PermissionDefaults defaults = tempDefaults;
}
@Override

View File

@ -133,12 +133,12 @@ public class Punishment implements IConfig
this.reason = reason;
}
public Date getIssued_on()
public Date getIssuedOn()
{
return issued_on;
}
public void setIssued_on(Date issued_on)
public void setIssuedOn(Date issued_on)
{
this.issued_on = issued_on;
}