Adds some minor style improvements
This commit is contained in:
parent
487cb3ad9e
commit
f0e5cd45a4
@ -124,7 +124,7 @@ public final class StargateConfig {
|
|||||||
public void reload(CommandSender sender) {
|
public void reload(CommandSender sender) {
|
||||||
//Unload all saved data
|
//Unload all saved data
|
||||||
unload();
|
unload();
|
||||||
|
|
||||||
//Perform all block change requests to prevent mismatch if a gate's open-material changes. Changing the
|
//Perform all block change requests to prevent mismatch if a gate's open-material changes. Changing the
|
||||||
// closed-material still requires a restart.
|
// closed-material still requires a restart.
|
||||||
BlockChangeRequest firstElement = Stargate.blockChangeRequestQueue.peek();
|
BlockChangeRequest firstElement = Stargate.blockChangeRequestQueue.peek();
|
||||||
@ -132,7 +132,7 @@ public final class StargateConfig {
|
|||||||
BlockChangeThread.pollQueue();
|
BlockChangeThread.pollQueue();
|
||||||
firstElement = Stargate.blockChangeRequestQueue.peek();
|
firstElement = Stargate.blockChangeRequestQueue.peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Store the old enable bungee state in case it changes
|
//Store the old enable bungee state in case it changes
|
||||||
boolean oldEnableBungee = stargateGateConfig.enableBungee();
|
boolean oldEnableBungee = stargateGateConfig.enableBungee();
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ public final class StargateConfig {
|
|||||||
//Force all portals to close
|
//Force all portals to close
|
||||||
closeAllOpenPortals();
|
closeAllOpenPortals();
|
||||||
PortalHandler.closeAllPortals();
|
PortalHandler.closeAllPortals();
|
||||||
|
|
||||||
//Clear queues and lists
|
//Clear queues and lists
|
||||||
activePortalsQueue.clear();
|
activePortalsQueue.clear();
|
||||||
openPortalsQueue.clear();
|
openPortalsQueue.clear();
|
||||||
|
@ -15,7 +15,7 @@ public final class EntityHelper {
|
|||||||
* Gets the max size of an entity along its x and z axis
|
* 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
|
* <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>
|
* entity.</p>
|
||||||
*
|
*
|
||||||
* @param entity <p>The entity to get max size for</p>
|
* @param entity <p>The entity to get max size for</p>
|
||||||
|
@ -26,7 +26,7 @@ public final class FileHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an input stream from a string pointing to an internal file
|
* 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
|
* <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>
|
* should be in the resources directory, and the file path should start with a forward slash ("/") character.</p>
|
||||||
*
|
*
|
||||||
|
@ -47,7 +47,7 @@ public final class PermissionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Deny access if another player has activated the portal, and it's still in use
|
//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) {
|
portal.getActivePlayer() != player) {
|
||||||
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("denyMsg"));
|
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("denyMsg"));
|
||||||
return;
|
return;
|
||||||
@ -95,7 +95,7 @@ public final class PermissionHelper {
|
|||||||
*/
|
*/
|
||||||
public static boolean cannotAccessPortal(Player player, Portal entrancePortal, Portal destination) {
|
public static boolean cannotAccessPortal(Player player, Portal entrancePortal, Portal destination) {
|
||||||
boolean deny = false;
|
boolean deny = false;
|
||||||
|
|
||||||
if (entrancePortal.getOptions().isBungee()) {
|
if (entrancePortal.getOptions().isBungee()) {
|
||||||
if (!PermissionHelper.canAccessServer(player, entrancePortal.getNetwork())) {
|
if (!PermissionHelper.canAccessServer(player, entrancePortal.getNetwork())) {
|
||||||
//If the portal is a bungee portal, and the player cannot access the server, deny
|
//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
|
* 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>
|
* player has the child permission unless it's explicitly set to false.</p>
|
||||||
*
|
*
|
||||||
* @param player <p>The player to check</p>
|
* @param player <p>The player to check</p>
|
||||||
@ -150,7 +150,7 @@ public final class PermissionHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Stargate.getStargateConfig().isPermissionDebuggingEnabled()) {
|
if (Stargate.getStargateConfig().isPermissionDebuggingEnabled()) {
|
||||||
Stargate.debug("hasPermissionImplicit::Permission", permission + " => " +
|
Stargate.debug("hasPermissionImplicit::Permission", permission + " => " +
|
||||||
player.hasPermission(permission));
|
player.hasPermission(permission));
|
||||||
}
|
}
|
||||||
return player.hasPermission(permission);
|
return player.hasPermission(permission);
|
||||||
@ -338,12 +338,12 @@ public final class PermissionHelper {
|
|||||||
*/
|
*/
|
||||||
public static boolean canDestroyPortal(Player player, Portal portal) {
|
public static boolean canDestroyPortal(Player player, Portal portal) {
|
||||||
String network = portal.getNetwork();
|
String network = portal.getNetwork();
|
||||||
|
|
||||||
//Use a special check for bungee portals
|
//Use a special check for bungee portals
|
||||||
if (portal.getOptions().isBungee()) {
|
if (portal.getOptions().isBungee()) {
|
||||||
return hasPermission(player, "stargate.admin.bungee");
|
return hasPermission(player, "stargate.admin.bungee");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if the player is allowed to destroy on all networks
|
//Check if the player is allowed to destroy on all networks
|
||||||
if (hasPermission(player, "stargate.destroy.network")) {
|
if (hasPermission(player, "stargate.destroy.network")) {
|
||||||
//Check if the network has been explicitly denied
|
//Check if the network has been explicitly denied
|
||||||
|
@ -13,12 +13,12 @@ public class MaterialHelperTest {
|
|||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
MockBukkit.mock();
|
MockBukkit.mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void tearDown() {
|
public static void tearDown() {
|
||||||
MockBukkit.unmock();
|
MockBukkit.unmock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isWallCoralTest() {
|
public void isWallCoralTest() {
|
||||||
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.DEAD_BRAIN_CORAL_WALL_FAN));
|
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.HORN_CORAL_WALL_FAN));
|
||||||
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.DEAD_TUBE_CORAL_WALL_FAN));
|
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.DEAD_TUBE_CORAL_WALL_FAN));
|
||||||
Assertions.assertTrue(MaterialHelper.isWallCoral(Material.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.DEAD_TUBE_CORAL));
|
||||||
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL));
|
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL));
|
||||||
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL_BLOCK));
|
Assertions.assertFalse(MaterialHelper.isWallCoral(Material.TUBE_CORAL_BLOCK));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isButtonCompatibleTest() {
|
public void isButtonCompatibleTest() {
|
||||||
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.DEAD_BRAIN_CORAL_WALL_FAN));
|
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.CHEST));
|
||||||
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.ENDER_CHEST));
|
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.ENDER_CHEST));
|
||||||
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.TRAPPED_CHEST));
|
Assertions.assertTrue(MaterialHelper.isButtonCompatible(Material.TRAPPED_CHEST));
|
||||||
|
|
||||||
//Chek something random to make sure isButtonCompatible is not just "return true;"
|
//Chek something random to make sure isButtonCompatible is not just "return true;"
|
||||||
Assertions.assertFalse(MaterialHelper.isButtonCompatible(Material.OAK_LOG));
|
Assertions.assertFalse(MaterialHelper.isButtonCompatible(Material.OAK_LOG));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user