Skip to content

Instantly share code, notes, and snippets.

@NidPlays
Last active September 22, 2017 11:59
Show Gist options
  • Save NidPlays/d57af6e1b5de781eab9e28201f59024a to your computer and use it in GitHub Desktop.
Save NidPlays/d57af6e1b5de781eab9e28201f59024a to your computer and use it in GitHub Desktop.
UH the form thingy
<?php
//This is declaration part
//
$ui = new SimpleForm('Choose The Server You want to transfer to', '');
$button1 = new Button('SkyrimButton');
$ui->addButton($button1);
$button1->addImage(Button::IMAGE_TYPE_URL, 'https://minecraft.gamepedia.com/media/minecraft.gamepedia.com/4/4b/Light_Blue_Glazed_Terracotta.png?version=9a75c5ea5247b6cec95ddf926c8fe27b');
$button2 = new Button('DiamondButton');
$button2->addImage(Button::IMAGE_TYPE_URL, 'https://minecraft.gamepedia.com/media/minecraft.gamepedia.com/4/40/Block_of_Diamond.png?version=44e4a59faca2c039eb23ef30fadb6947');
$ui->addButton($button2);
self::$uis['simpleUI'] = UIAPI::addUI($this, $ui);
//
//This is sending part
//
UIAPI::showUIbyID($this->getPlugin(), Loader::$uis['simpleUI'], $sender);
//
//This the handeling
//
case Loader::$uis['simpleUI']: {
$data = $event->getData();
$ui = UIAPI::getPluginUI($this->owner, $id);
$response = $ui->handle($data, $event->getPlayer());
var_dump($response);
switch ($response){
case 'SkyrimButton': {
//$command = "say i clicked the button 'SkyrimButton'";
//$this->owner->getServer()->getCommandMap()->dispatch($event->getPlayer(), $command);
$event->getPlayer()->sendMessage("Transferring to SkyrimServer");
break;
}
case 'DiamondButton': {
//$command = "say Im going to get tranferred to DiamondServer";
//$this->owner->getServer()->getCommandMap()->dispatch($event->getPlayer(), $command);
$event->getPlayer()->sendMessage("Transferring to DiamondServer");
break;
}
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment