cn.nukkit.dialog.response.FormResponseDialog Maven / Gradle / Ivy
package cn.nukkit.dialog.response;
import cn.nukkit.api.PowerNukkitXOnly;
import cn.nukkit.api.Since;
import cn.nukkit.dialog.element.ElementDialogButton;
import cn.nukkit.dialog.window.FormWindowDialog;
import cn.nukkit.network.protocol.NPCRequestPacket;
import lombok.Getter;
@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
@Getter
public class FormResponseDialog {
private long entityRuntimeId;
private String data;
private ElementDialogButton clickedButton;//can be null
private String sceneName;
private NPCRequestPacket.RequestType requestType;
private int skinType;
public FormResponseDialog(NPCRequestPacket packet, FormWindowDialog dialog) {
this.entityRuntimeId = packet.getRequestedEntityRuntimeId();
this.data = packet.getData();
try {
this.clickedButton = dialog.getButtons().get(packet.getSkinType());
}catch (IndexOutOfBoundsException e){
this.clickedButton = null;
}
this.sceneName = packet.getSceneName();
this.requestType = packet.getRequestType();
this.skinType = packet.getSkinType();
}
}