-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This can be applied to other things too, of course, but didn't want to de-length-prefix everything at once.
- Loading branch information
Showing
6 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
mod/common/src/main/java/gjum/minecraft/mapsync/common/utils/Arguments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gjum.minecraft.mapsync.common.utils; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public final class Arguments { | ||
public static void checkNotNull( | ||
final @NotNull String name, | ||
final Object value | ||
) { | ||
if (value == null) { | ||
throw new IllegalArgumentException("'" + name + "' is null!"); | ||
} | ||
} | ||
|
||
public static void checkLength( | ||
final @NotNull String name, | ||
final int currentLength, | ||
final int requiredLength | ||
) { | ||
if (currentLength != requiredLength) { | ||
throw new IllegalArgumentException("'" + name + "' has length " + currentLength + " when it must be " + requiredLength); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
mod/common/src/main/java/gjum/minecraft/mapsync/common/utils/MagicValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package gjum.minecraft.mapsync.common.utils; | ||
|
||
public final class MagicValues { | ||
// SHA1 produces 160-bit (20-byte) hashes | ||
// https://en.wikipedia.org/wiki/SHA-1 | ||
public static final int SHA1_HASH_LENGTH = 20; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters