-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replaced inaccurate chat colorizing - Added XYZCommandActor#wrap(...) methods - Exposed CommandActor to CommandExceptionHandler#handleException - Removed #getActor() from exceptions - Added support for Sponge's TextMessageException. - Created a default exception handler for Velocity - SendableExceptions no longer require a CommandActor to be supplied. - Bump versions
- Loading branch information
Showing
71 changed files
with
398 additions
and
538 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
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
31 changes: 16 additions & 15 deletions
31
bukkit/src/main/java/revxrsal/commands/bukkit/exception/BukkitExceptionAdapter.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,42 +1,43 @@ | ||
package revxrsal.commands.bukkit.exception; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import revxrsal.commands.command.CommandActor; | ||
import revxrsal.commands.exception.DefaultExceptionHandler; | ||
|
||
public /*final*/ class BukkitExceptionAdapter extends DefaultExceptionHandler { | ||
|
||
public static final BukkitExceptionAdapter INSTANCE = new BukkitExceptionAdapter(); | ||
|
||
@Override protected final void handleUnknown(@NotNull Throwable throwable) { | ||
@Override protected final void handleUnknown(@NotNull CommandActor actor, @NotNull Throwable throwable) { | ||
if (throwable instanceof SenderNotPlayerException) | ||
senderNotPlayer((SenderNotPlayerException) throwable); | ||
senderNotPlayer(actor, (SenderNotPlayerException) throwable); | ||
else if (throwable instanceof SenderNotConsoleException) | ||
senderNotConsole((SenderNotConsoleException) throwable); | ||
senderNotConsole(actor, (SenderNotConsoleException) throwable); | ||
else if (throwable instanceof InvalidPlayerException) | ||
invalidPlayer((InvalidPlayerException) throwable); | ||
invalidPlayer(actor, (InvalidPlayerException) throwable); | ||
else if (throwable instanceof InvalidWorldException) | ||
invalidWorld((InvalidWorldException) throwable); | ||
invalidWorld(actor, (InvalidWorldException) throwable); | ||
else | ||
handleUnknownThrowable(throwable); | ||
handleUnknownThrowable(actor, throwable); | ||
} | ||
|
||
protected void senderNotPlayer(@NotNull SenderNotPlayerException exception) { | ||
exception.getActor().error("You must be a player to use this command!"); | ||
protected void senderNotPlayer(@NotNull CommandActor actor, @NotNull SenderNotPlayerException exception) { | ||
actor.error("You must be a player to use this command!"); | ||
} | ||
|
||
protected void senderNotConsole(@NotNull SenderNotConsoleException exception) { | ||
exception.getActor().error("This command can only be used on console!"); | ||
protected void senderNotConsole(@NotNull CommandActor actor, @NotNull SenderNotConsoleException exception) { | ||
actor.error("This command can only be used on console!"); | ||
} | ||
|
||
protected void invalidPlayer(@NotNull InvalidPlayerException exception) { | ||
exception.getActor().error("Invalid player: &e" + exception.getInput()); | ||
protected void invalidPlayer(@NotNull CommandActor actor, @NotNull InvalidPlayerException exception) { | ||
actor.error("Invalid player: &e" + exception.getInput()); | ||
} | ||
|
||
protected void invalidWorld(@NotNull InvalidWorldException exception) { | ||
exception.getActor().error("Invalid world: &e" + exception.getInput()); | ||
protected void invalidWorld(@NotNull CommandActor actor, @NotNull InvalidWorldException exception) { | ||
actor.error("Invalid world: &e" + exception.getInput()); | ||
} | ||
|
||
protected void handleUnknownThrowable(@NotNull Throwable throwable) { | ||
protected void handleUnknownThrowable(@NotNull CommandActor actor, @NotNull Throwable throwable) { | ||
throwable.printStackTrace(); | ||
} | ||
} |
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
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
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
25 changes: 13 additions & 12 deletions
25
bungee/src/main/java/revxrsal/commands/bungee/exception/BungeeExceptionAdapter.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,36 +1,37 @@ | ||
package revxrsal.commands.bungee.exception; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import revxrsal.commands.command.CommandActor; | ||
import revxrsal.commands.exception.DefaultExceptionHandler; | ||
|
||
public /*final*/ class BungeeExceptionAdapter extends DefaultExceptionHandler { | ||
|
||
public static final BungeeExceptionAdapter INSTANCE = new BungeeExceptionAdapter(); | ||
|
||
@Override protected final void handleUnknown(@NotNull Throwable throwable) { | ||
@Override protected final void handleUnknown(@NotNull CommandActor actor, @NotNull Throwable throwable) { | ||
if (throwable instanceof SenderNotPlayerException) | ||
senderNotPlayer((SenderNotPlayerException) throwable); | ||
senderNotPlayer(actor, (SenderNotPlayerException) throwable); | ||
else if (throwable instanceof SenderNotConsoleException) | ||
senderNotConsole((SenderNotConsoleException) throwable); | ||
senderNotConsole(actor, (SenderNotConsoleException) throwable); | ||
else if (throwable instanceof InvalidPlayerException) | ||
invalidPlayer((InvalidPlayerException) throwable); | ||
invalidPlayer(actor, (InvalidPlayerException) throwable); | ||
else | ||
handleUnknownThrowable(throwable); | ||
handleUnknownThrowable(actor, throwable); | ||
} | ||
|
||
protected void senderNotPlayer(@NotNull SenderNotPlayerException exception) { | ||
exception.getActor().error("You must be a player to use this command!"); | ||
protected void senderNotPlayer(@NotNull CommandActor actor, @NotNull SenderNotPlayerException exception) { | ||
actor.error("You must be a player to use this command!"); | ||
} | ||
|
||
protected void senderNotConsole(@NotNull SenderNotConsoleException exception) { | ||
exception.getActor().error("This command can only be used on console!"); | ||
protected void senderNotConsole(@NotNull CommandActor actor, @NotNull SenderNotConsoleException exception) { | ||
actor.error("This command can only be used on console!"); | ||
} | ||
|
||
protected void invalidPlayer(@NotNull InvalidPlayerException exception) { | ||
exception.getActor().error("Invalid player: &e" + exception.getInput()); | ||
protected void invalidPlayer(@NotNull CommandActor actor, @NotNull InvalidPlayerException exception) { | ||
actor.error("Invalid player: &e" + exception.getInput()); | ||
} | ||
|
||
protected void handleUnknownThrowable(@NotNull Throwable throwable) { | ||
protected void handleUnknownThrowable(@NotNull CommandActor actor, @NotNull Throwable throwable) { | ||
throwable.printStackTrace(); | ||
} | ||
} |
Oops, something went wrong.