Adds some minor style improvements

This commit is contained in:
Kristian Knarvik 2021-10-29 01:46:15 +02:00
parent 487cb3ad9e
commit f0e5cd45a4
5 changed files with 17 additions and 17 deletions

View File

@ -124,7 +124,7 @@ public final class StargateConfig {
public void reload(CommandSender sender) {
//Unload all saved data
unload();
//Perform all block change requests to prevent mismatch if a gate's open-material changes. Changing the
// closed-material still requires a restart.
BlockChangeRequest firstElement = Stargate.blockChangeRequestQueue.peek();
@ -132,7 +132,7 @@ public final class StargateConfig {
BlockChangeThread.pollQueue();
firstElement = Stargate.blockChangeRequestQueue.peek();
}
//Store the old enable bungee state in case it changes
boolean oldEnableBungee = stargateGateConfig.enableBungee();
@ -158,7 +158,7 @@ public final class StargateConfig {
//Force all portals to close
closeAllOpenPortals();
PortalHandler.closeAllPortals();
//Clear queues and lists
activePortalsQueue.clear();
openPortalsQueue.clear();

View File

@ -15,7 +15,7 @@ public final class EntityHelper {
* Gets the max size of an entity along its x and z axis
*
* <p>This function gets the ceiling of the max size of an entity, thus calculating the smallest box, using whole
* blocks as unit, needed to contain the entity. Assuming n is returned, an (n x n) box is needed to contain the
* blocks as unit, needed to contain the entity. Assuming n is returned, an (n x n) box is needed to contain the
* entity.</p>
*
* @param entity <p>The entity to get max size for</p>

View File

@ -26,7 +26,7 @@ public final class FileHelper {
/**
* Gets an input stream from a string pointing to an internal file
*
*
* <p>This is used for getting an input stream for reading a file contained within the compiled .jar file. The file
* should be in the resources directory, and the file path should start with a forward slash ("/") character.</p>
*

View File

@ -47,7 +47,7 @@ public final class PermissionHelper {
}
//Deny access if another player has activated the portal, and it's still in use
if (!portal.getOptions().isFixed() && portal.getPortalActivator().isActive() &&
if (!portal.getOptions().isFixed() && portal.getPortalActivator().isActive() &&
portal.getActivePlayer() != player) {
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("denyMsg"));
return;
@ -95,7 +95,7 @@ public final class PermissionHelper {
*/
public static boolean cannotAccessPortal(Player player, Portal entrancePortal, Portal destination) {
boolean deny = false;
if (entrancePortal.getOptions().isBungee()) {
if (!PermissionHelper.canAccessServer(player, entrancePortal.getNetwork())) {
//If the portal is a bungee portal, and the player cannot access the server, deny
@ -135,7 +135,7 @@ public final class PermissionHelper {
/**
* Check if a player has been given a permission implicitly
*
* <p>This should be run if a player has a parent permission to check for the child permission. It is assumed the
* <p>This should be run if a player has a parent permission to check for the child permission. It is assumed the
* player has the child permission unless it's explicitly set to false.</p>
*
* @param player <p>The player to check</p>
@ -150,7 +150,7 @@ public final class PermissionHelper {
return true;
}
if (Stargate.getStargateConfig().isPermissionDebuggingEnabled()) {
Stargate.debug("hasPermissionImplicit::Permission", permission + " => " +
Stargate.debug("hasPermissionImplicit::Permission", permission + " => " +
player.hasPermission(permission));
}
return player.hasPermission(permission);
@ -338,12 +338,12 @@ public final class PermissionHelper {
*/
public static boolean canDestroyPortal(Player player, Portal portal) {
String network = portal.getNetwork();
//Use a special check for bungee portals
if (portal.getOptions().isBungee()) {
return hasPermission(player, "stargate.admin.bungee");
}
//Check if the player is allowed to destroy on all networks
if (hasPermission(player, "stargate.destroy.network")) {
//Check if the network has been explicitly denied

View File

@ -13,12 +13,12 @@ public class MaterialHelperTest {
public static void setUp() {
MockBukkit.mock();
}
@AfterAll
public static void tearDown() {
MockBukkit.unmock();
}
@Test
public void isWallCoralTest() {
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.DEAD_BRAIN_CORAL_WALL_FAN));
@ -31,12 +31,12 @@ public class MaterialHelperTest {
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.HORN_CORAL_WALL_FAN));
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.DEAD_TUBE_CORAL_WALL_FAN));
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.TUBE_CORAL_WALL_FAN));
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.DEAD_TUBE_CORAL));
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL));
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL_BLOCK));
}
@Test
public void isButtonCompatibleTest() {
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.DEAD_BRAIN_CORAL_WALL_FAN));
@ -82,9 +82,9 @@ public class MaterialHelperTest {
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.CHEST));
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.ENDER_CHEST));
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.TRAPPED_CHEST));
//Chek something random to make sure isButtonCompatible is not just "return true;"
Assertions.assertFalse(MaterialHelper.isButtonCompatible(Material.OAK_LOG));
}
}