use of org.dragonet.common.gui.DropDownComponent in project DragonProxy by DragonetMC.
the class TestCommand method testForm.
public static void testForm(UpstreamSession player) {
ModalFormRequestPacket p = new ModalFormRequestPacket();
CustomFormComponent form = new CustomFormComponent("\u00a7dTest Form");
form.addComponent(new LabelComponent("\u00a71Text \u00a7ki"));
form.addComponent(new LabelComponent("LABEL 2"));
form.addComponent(new DropDownComponent("DROP DOWN", Arrays.asList("option 1", "option 2")));
System.out.println(form.serializeToJson().toString());
p.formId = 1;
p.formData = form.serializeToJson().toString();
player.sendPacket(p);
}
use of org.dragonet.common.gui.DropDownComponent in project DragonProxy by DragonetMC.
the class DragonProxyFormCommand method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("form")) {
if ((sender instanceof Player)) {
Player player = (Player) sender;
if (this.plugin.isBedrockPlayer(player.getUniqueId())) {
CustomFormComponent form = new CustomFormComponent("This is a test form");
form.addComponent(new LabelComponent("Test label"));
form.addComponent(new InputComponent("Test input").setPlaceholder("placeholder"));
List<String> dropDown = new ArrayList();
dropDown.add("Choice 1");
dropDown.add("Choice 2");
dropDown.add("Choice 3");
form.addComponent(new DropDownComponent("Test dropdown", dropDown));
BedrockPlayer.getForPlayer(player).sendForm(0, form);
}
// do something
}
return true;
}
return false;
}
Aggregations