}
ButtonClickEvent event = new ButtonClickEvent(player, screen, (Button) control);
((Button) control).onButtonClick(event);
Bukkit.getServer().getPluginManager().callEvent(event);
} else if (control instanceof Slider) {
SliderDragEvent event = new SliderDragEvent(player, screen, (Slider) control, state);
((Slider) control).onSliderDrag(event);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
((Slider) control).setSliderPosition(event.getOldPosition());
control.setDirty(true);
} else if (event.getNewPosition() != state) {
((Slider) control).setSliderPosition(event.getNewPosition());
control.setDirty(true);
} else {
((Slider) control).setSliderPosition(event.getNewPosition());
}
} else if (control instanceof TextField) {
TextFieldChangeEvent event = new TextFieldChangeEvent(player, screen, (TextField) control, data);
((TextField) control).onTextFieldChange(event);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
((TextField) control).setText(event.getOldText());
control.setDirty(true);
} else if (!event.getNewText().equals(data)) {
((TextField) control).setText(event.getNewText());
control.setDirty(true);
} else {
((TextField) control).setText(event.getNewText());
((TextField) control).setCursorPosition((int) state);
control.setDirty(false);
}
} else if (control instanceof Scrollable) {
if (data.equals("HORIZONTAL") || data.equals("VERTICAL")) {