diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit index 8b45be1ff0..6b17c8c3c5 100644 --- a/.git-hooks/pre-commit +++ b/.git-hooks/pre-commit @@ -2,18 +2,11 @@ echo "[pre-commit check]" -STAGED_FILES=$(git --no-pager diff --name-only --staged --line-prefix=$(git rev-parse --show-toplevel)/ | paste -sd ',') - -if [ ! -z "$STAGED_FILES" ] +echo -n "Checking code format with spotless: " +mvn spotless:apply > /tmp/spotless.out 2>&1 +RETURN_VALUE=$? +if [ $RETURN_VALUE -gt 0 ] then - echo -n "Checking code format with spotless: " - mvn spotless:check -DspotlessFiles=$STAGED_FILES > /tmp/spotless.out 2>&1 - RETURN_VALUE=$? - if [ $RETURN_VALUE -gt 0 ] - then - echo "Please run 'mvn spotless:check' for more details or 'mvn spotless:apply' to automatically fix the violations." - fi - exit $RETURN_VALUE + echo "Please run 'mvn spotless:check' for more details or 'mvn spotless:apply' to automatically fix the violations." fi - -exit 0 \ No newline at end of file +exit $RETURN_VALUE \ No newline at end of file diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java index a86f73a675..42b34889aa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java @@ -10,7 +10,6 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.logging.Level; @@ -130,14 +129,17 @@ private void addDirectory(@Nonnull ZipOutputStream output, @Nonnull File directo * An {@link IOException} is thrown if a {@link File} could not be deleted */ private void purgeBackups(@Nonnull List backups) throws IOException { - var matchedBackup = backups.stream().filter(f -> f.getName().matches("^\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}$")).sorted((a, b) -> { - LocalDateTime time1 = - LocalDateTime.parse(a.getName().substring(0, a.getName().length() - 4), format); - LocalDateTime time2 = - LocalDateTime.parse(b.getName().substring(0, b.getName().length() - 4), format); - - return time2.compareTo(time1); - }).toList(); + var matchedBackup = backups.stream() + .filter(f -> f.getName().matches("^\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}$")) + .sorted((a, b) -> { + LocalDateTime time1 = LocalDateTime.parse( + a.getName().substring(0, a.getName().length() - 4), format); + LocalDateTime time2 = LocalDateTime.parse( + b.getName().substring(0, b.getName().length() - 4), format); + + return time2.compareTo(time1); + }) + .toList(); for (int i = matchedBackup.size() - MAX_BACKUPS; i > 0; i--) { Files.delete(matchedBackup.get(i).toPath()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java index c846e4a8cc..4398191eee 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java @@ -98,7 +98,7 @@ public void onResult(SlimefunBlockData result) { } } - // Don't move my machine :| + // Don't move my machine :| case ENDERMAN -> e.setCancelled(true); } }