Skip to content

Commit

Permalink
Adjust codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakubk15 committed Jul 7, 2024
1 parent f4832c0 commit e67506f
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ protected <T> CompletableFuture<T> supplyExecute(String sql, ThrowingFunction<Pr
PreparedStatement statement = connection.prepareStatement(sql)
) {
return function.apply(statement);
} catch (SQLException e) {
}
catch (SQLException e) {
throw new ParcelLockersException(e);
}
}, this.executorService).orTimeout(5, TimeUnit.SECONDS);
Expand All @@ -58,7 +59,8 @@ protected <T> T executeSync(String sql, ThrowingFunction<PreparedStatement, T, S
PreparedStatement statement = connection.prepareStatement(sql)
) {
return function.apply(statement);
} catch (SQLException e) {
}
catch (SQLException e) {
throw new ParcelLockersException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,15 @@ public void show(Player player) {
int slotsSize = result.get().items().size();
if (slotsSize <= 9) {
this.scheduler.runTask(this.plugin, () -> storageGUI.show(player, this.size));
} else if (slotsSize <= 18 && this.size == ParcelSize.SMALL) {
}
else if (slotsSize <= 18 && this.size == ParcelSize.SMALL) {
this.scheduler.runTask(this.plugin, () -> storageGUI.show(player, ParcelSize.MEDIUM));
} else {
}
else {
this.scheduler.runTask(this.plugin, () -> storageGUI.show(player, ParcelSize.LARGE));
}
} else {
}
else {
this.scheduler.runTask(this.plugin, () -> storageGUI.show(player, this.size));
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ private void show(Player player, Page page) {
Sentry.captureException(throwable);
throwable.printStackTrace();
}
});
}
);

}

Expand Down Expand Up @@ -160,7 +161,8 @@ private List<String> replaceParcelPlaceholders(Parcel parcel, List<String> lore)
formatter.register("{POSITION_X}", locker.position().x())
.register("{POSITION_Y}", locker.position().y())
.register("{POSITION_Z}", locker.position().z());
} else {
}
else {
formatter.register("{POSITION_X}", "-")
.register("{POSITION_Y}", "-")
.register("{POSITION_Z}", "-");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ private List<String> replaceParcelPlaceholders(Parcel parcel, List<String> lore)
formatter.register("{POSITION_X}", locker.position().x())
.register("{POSITION_Y}", locker.position().y())
.register("{POSITION_Z}", locker.position().z());
} else {
}
else {
formatter.register("{POSITION_X}", "-")
.register("{POSITION_Y}", "-")
.register("{POSITION_Z}", "-");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public void onBlockPlace(BlockPlaceEvent event) {
}
this.announcer.sendMessage(player, this.config.messages.parcelLockerSuccessfullyCreated);
});
} else {
}
else {
event.setCancelled(true);
}
this.lockerCreators.remove(player.getUniqueId());
Expand All @@ -106,5 +107,4 @@ public void onBlockPlace(BlockPlaceEvent event) {

player.beginConversation(conversationFactory.buildConversation(player));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public static Position parse(String parse) {
/**
* Returns the distance between two positions.
*
* @param a
* @param b
* @return the distance between two positions
* @param a the first position
* @param b the second position
* @return the distance between two positions
*/

public static int distance(Position a, Position b) {
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/com/eternalcode/parcellockers/util/ItemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ private ItemUtil() {
public static String serialize(ItemStack stack) {
try {
return JSON.writeValueAsString(stack);
} catch (JsonProcessingException e) {
}
catch (JsonProcessingException e) {
Sentry.captureException(e);
throw new ParcelLockersException("Failed to serialize itemstack", e);
}
Expand All @@ -48,7 +49,8 @@ public static String serialize(ItemStack stack) {
public static String serializeItems(List<ItemStack> stack) {
try {
return JSON.writeValueAsString(stack);
} catch (JsonProcessingException e) {
}
catch (JsonProcessingException e) {
Sentry.captureException(e);
throw new ParcelLockersException("Failed to serialize itemstack", e);
}
Expand All @@ -57,7 +59,8 @@ public static String serializeItems(List<ItemStack> stack) {
public static ItemStack deserialize(String string) {
try {
return JSON.readValue(string, ItemStack.class);
} catch (JsonProcessingException e) {
}
catch (JsonProcessingException e) {
Sentry.captureException(e);
throw new ParcelLockersException("Failed to deserialize itemstack", e);
}
Expand All @@ -66,7 +69,8 @@ public static ItemStack deserialize(String string) {
public static List<ItemStack> deserializeItems(String string) {
try {
return JSON.readValue(string, JSON.getTypeFactory().constructCollectionType(List.class, ItemStack.class));
} catch (JsonProcessingException e) {
}
catch (JsonProcessingException e) {
Sentry.captureException(e);
throw new ParcelLockersException("Failed to deserialize itemstack", e);
}
Expand Down Expand Up @@ -103,7 +107,8 @@ public static List<String> replaceParcelPlaceholders(Parcel parcel, List<String>
formatter.register("{POSITION_X}", locker.position().x())
.register("{POSITION_Y}", locker.position().y())
.register("{POSITION_Z}", locker.position().z());
} else {
}
else {
formatter.register("{POSITION_X}", "-")
.register("{POSITION_Y}", "-")
.register("{POSITION_Z}", "-");
Expand Down

0 comments on commit e67506f

Please sign in to comment.