add notify + reject now throws

This commit is contained in:
Ceikry 2021-03-26 01:02:39 -05:00
parent 7f91f7c410
commit 4ffa4301ec
3 changed files with 17 additions and 7 deletions

View file

@ -1,16 +1,16 @@
package core.game.interaction.player; package core.game.interaction.player;
import java.util.concurrent.TimeUnit;
import core.game.content.activity.ActivityManager; import core.game.content.activity.ActivityManager;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.game.node.item.Item; import core.game.node.item.Item;
import core.game.system.SystemManager; import core.game.system.SystemManager;
import rs09.game.world.GameWorld; import core.plugin.Initializable;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.PluginManifest; import core.plugin.PluginManifest;
import core.plugin.Initializable;
import core.plugin.PluginType; import core.plugin.PluginType;
import rs09.game.world.GameWorld;
import java.util.concurrent.TimeUnit;
/** /**
* Validates a player login. * Validates a player login.
@ -59,7 +59,6 @@ public final class LoginValidationPlugin implements Plugin<Player> {
if (player.getAttribute("falconry", false)) { if (player.getAttribute("falconry", false)) {
ActivityManager.start(player, "falconry", true); ActivityManager.start(player, "falconry", true);
} }
player.getConfigManager().set(678, 5);// RFD
if (player.getSavedData().getQuestData().getDragonSlayerAttribute("repaired")) { if (player.getSavedData().getQuestData().getDragonSlayerAttribute("repaired")) {
player.getConfigManager().set(177, 1967876); player.getConfigManager().set(177, 1967876);
} }

View file

@ -25,7 +25,9 @@ class CommandSystem {
} }
} }
} else { } else {
try {
command.attemptHandling(player, arguments) command.attemptHandling(player, arguments)
} catch (e: IllegalStateException){return true}
} }
return false return false
} }

View file

@ -28,10 +28,19 @@ abstract class CommandSet(val defaultPrivilege: Command.Privilege) : Plugin<Any?
/** /**
* Glorified player.sendMessage with red text coloring. Please use this * Glorified player.sendMessage with red text coloring. Please use this
* rather than just player.sendMessage for anything that involves informing the player * rather than just player.sendMessage for anything that involves informing the player
* of proper usage or invalid syntax. * of proper usage or invalid syntax. Throws an IllegalStateException and ends command execution immediately.
*/ */
fun reject(player: Player, message: String){ fun reject(player: Player, message: String){
player.sendMessage(colorize("%R$message")) player.sendMessage(colorize("%R$message"))
throw IllegalStateException()
}
/**
* Glorified player.sendMessage with green text coloring and an arrow. Use this when you need to
* notify/inform a player of some information from within the command without ending execution.
*/
fun notify(player: Player, message: String){
player.sendMessage(colorize("%G-->$message"))
} }
/** /**