Command Cancel Event

This commit is contained in:
ArpyAge 2020-11-10 22:13:06 +01:00
parent d1f18a2154
commit d867160e08
2 changed files with 16 additions and 4 deletions

View File

@ -74,7 +74,12 @@ public class CommandHandler {
boolean succes = false;
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().guildRightLevel(gameClient.getHabbo()) >= 2))) {
try {
Emulator.getPluginManager().fireEvent(new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts));
UserExecuteCommandEvent userExecuteCommandEvent = new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts);
Emulator.getPluginManager().fireEvent(userExecuteCommandEvent);
if(userExecuteCommandEvent.isCancelled()) {
return userExecuteCommandEvent.isSuccess();
}
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null)
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserTypingComposer(gameClient.getHabbo().getRoomUnit(), false).compose());

View File

@ -6,15 +6,22 @@ import com.eu.habbo.habbohotel.users.Habbo;
public class UserExecuteCommandEvent extends UserEvent {
public final Command command;
public final String[] params;
private boolean success;
public UserExecuteCommandEvent(Habbo habbo, Command command, String[] params) {
super(habbo);
this.command = command;
this.params = params;
this.success = true;
}
public void setSuccess(boolean success) {
this.success = success;
}
public boolean isSuccess() {
return success;
}
}