-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe818e8
commit 95b0796
Showing
10 changed files
with
119 additions
and
39 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
15 changes: 12 additions & 3 deletions
15
...in/java/com/cryptomorin/xseries/profiles/exceptions/InvalidProfileContainerException.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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
package com.cryptomorin.xseries.profiles.exceptions; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* When a provided item/block cannot contain skull textures. | ||
*/ | ||
public final class InvalidProfileContainerException extends ProfileException { | ||
public InvalidProfileContainerException(String message) { | ||
private final Object container; | ||
|
||
public InvalidProfileContainerException(Object container, String message) { | ||
super(message); | ||
this.container = container; | ||
} | ||
|
||
public InvalidProfileContainerException(String message, Throwable cause) { | ||
super(message, cause); | ||
/** | ||
* A {@link org.bukkit.inventory.ItemStack} or {@link org.bukkit.block.Block}. | ||
*/ | ||
@NotNull | ||
public Object getContainer() { | ||
return container; | ||
} | ||
} |
25 changes: 22 additions & 3 deletions
25
src/main/java/com/cryptomorin/xseries/profiles/exceptions/InvalidProfileException.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 |
---|---|---|
@@ -1,16 +1,35 @@ | ||
package com.cryptomorin.xseries.profiles.exceptions; | ||
|
||
import com.cryptomorin.xseries.profiles.objects.Profileable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* if a given {@link Profileable} has incorrect value (more general than {@link UnknownPlayerException}) | ||
* If a given {@link Profileable} has incorrect value (more general than {@link UnknownPlayerException}) | ||
* which mostly happens when a string value is passed to be handled by {@link com.cryptomorin.xseries.profiles.objects.ProfileInputType}. | ||
* E.g. invalid Base64, texture URLs, username, UUID, etc. | ||
* Though most of these invalid values are just recognized as an unknown string instead | ||
* of being invalid values of a specific input type. | ||
* <p> | ||
* Note: Unknown usernames and UUIDs are handled by {@link UnknownPlayerException} instead. | ||
*/ | ||
public class InvalidProfileException extends ProfileException { | ||
public InvalidProfileException(String message) { | ||
private final String value; | ||
|
||
public InvalidProfileException(String value, String message) { | ||
super(message); | ||
this.value = value; | ||
} | ||
|
||
public InvalidProfileException(String message, Throwable cause) { | ||
public InvalidProfileException(String value, String message, Throwable cause) { | ||
super(message, cause); | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* The invalid value. | ||
*/ | ||
@NotNull | ||
public String getValue() { | ||
return value; | ||
} | ||
} |
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
17 changes: 15 additions & 2 deletions
17
src/main/java/com/cryptomorin/xseries/profiles/exceptions/UnknownPlayerException.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 |
---|---|---|
@@ -1,12 +1,25 @@ | ||
package com.cryptomorin.xseries.profiles.exceptions; | ||
|
||
import com.cryptomorin.xseries.profiles.objects.Profileable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* If a specific player-identifying {@link Profileable} is not found. | ||
* This can be an unknown username or UUID. (Invalid usernames and UUIDs are handled by {@link InvalidProfileException}). | ||
*/ | ||
public final class UnknownPlayerException extends InvalidProfileException { | ||
public UnknownPlayerException(String message) { | ||
super(message); | ||
private final Object unknownObject; | ||
|
||
public UnknownPlayerException(Object unknownObject, String message) { | ||
super(unknownObject.toString(), message); | ||
this.unknownObject = unknownObject; | ||
} | ||
|
||
/** | ||
* An invalid or unknown username ({@link String}) or an unknown {@link java.util.UUID}. | ||
*/ | ||
@NotNull | ||
public Object getUnknownObject() { | ||
return unknownObject; | ||
} | ||
} |
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
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
Oops, something went wrong.