Example #1
0
 private void addEffectLoopButton() {
   GenericButton effectLoopButton = new GenericButton("Manage EffectLoops");
   effectLoopButton.setAnchor(WidgetAnchor.BOTTOM_LEFT);
   effectLoopButton.setWidth(120).setHeight(20);
   effectLoopButton.shiftXPos(10).shiftYPos(-nextSongButton.getHeight() - 10);
   this.attachWidget(AmbientSpout.callback, effectLoopButton);
 }
Example #2
0
  public MainGUI(Player p) {
    this.p = p;
    nextSongButton = new GenericButton("Music On"); // The first button.
    nextSongButton.setAnchor(
        WidgetAnchor
            .CENTER_CENTER); // We are "sticking" it from the center_center, from there we will be
                             // shifting.
    nextSongButton.setWidth(90).setHeight(20); // Setting the width and height of the button.
    nextSongButton.shiftXPos(-90 / 2).shiftYPos(-nextSongButton.getHeight() / 2 + 5);

    stopMusicButton = new GenericButton("Music Off"); // The second button.
    stopMusicButton.setAnchor(WidgetAnchor.CENTER_CENTER);
    stopMusicButton.setWidth(90).setHeight(20);
    // stopMusicButton.shiftXPos(0).shiftYPos(stopMusicButton.getHeight()/2);
    stopMusicButton.shiftXPos(-90 / 2).shiftYPos((int) (stopMusicButton.getHeight() * 1.1));

    if (Settings.useBackgroundImage) addBackground();

    currentSongLabel = new GenericLabel("");
    currentSongLabel.setAnchor(WidgetAnchor.CENTER_CENTER);
    currentSongLabel.setWidth(200).setHeight(10);
    currentSongLabel.shiftXPos(-50).shiftYPos(50);
    currentSongLabel.setTextColor(new Color(200, 200, 200));
    if (Settings.showCurrentSong) this.attachWidget(AmbientSpout.callback, currentSongLabel);

    if (!AmbientSpout.callback.getConfig().getBoolean("Settings.Donation", false)) addCredit();

    if (Model.playerMusicEnabled.containsKey(p.getName())) {
      if (Model.playerMusicEnabled.get(p.getName())) {
        nextSongButton.setText("Next Song");
        updateCurrentSong();
      } else {
        stopMusicButton.setVisible(false);
      }
    }

    if (p.hasPermission("ambientspout.admin") || p.isOp()) {
      // System.out.println("Adding EffectLoopButton"); //TODO DebugOnly

      addEffectLoopButton();
    }

    this.attachWidget(AmbientSpout.callback, nextSongButton);
    this.attachWidget(AmbientSpout.callback, stopMusicButton);
  }
  public ItemSoundManager(ItemSound plugin, InGameHUD hud) {
    super();
    this.plugin = plugin;
    GenericTextField textField = new GenericTextField();
    int w = hud.getWidth();
    int h = hud.getHeight();
    textField.setWidth(w - 40);
    textField.setHeight(h - 100);
    textField.setText(plugin.config.toString());
    textField.setY(20);
    textField.setX(20);

    GenericButton updateButton = new GenericButton();
    updateButton.setText("Update");
    updateButton.setY(h - 80);
    updateButton.setCentered(true);
    this.attachWidget(textField);
    this.attachWidget(updateButton);
  }
Example #4
0
 public void openVotingScreen(String[] options) {
   GenericPopup voting = new GenericPopup();
   for (int i = 0; i < 3; i++) {
     GenericButton button = new ZVotingButton((i + 1) + ":" + options[i]);
     button.setHeight(24);
     button.setWidth(128);
     button.setAlign(WidgetAnchor.CENTER_CENTER);
     button.setAnchor(WidgetAnchor.CENTER_CENTER);
     button.shiftYPos(-24 + i * 24);
     button.shiftXPos(button.getWidth() / -2);
     voting.attachWidget(ZArena.getInstance(), button);
   }
   ((SpoutPlayer) Bukkit.getPlayer(player)).getMainScreen().attachPopupScreen(voting);
 }
  @Override
  protected void setup() {
    Map<TriggerState, ItemStack[]> inventories = facade.getInventories(player);

    GenericContainer list = new GenericContainer();
    list.setLayout(ContainerType.VERTICAL);

    for (final TriggerState triggerState : inventories.keySet()) {
      list.addChild(
          new BlockSet(triggerState.toString(), inventories.get(triggerState)) {
            @Override
            public void onSelect() {
              facade.setTriggerState(player, triggerState);
            }
          });
    }

    GenericButton toTriggerPageButton =
        new GenericButton("Trigger Overview ...") {
          @Override
          public void onButtonClick(final ButtonClickEvent event) {
            super.onButtonClick(event);
            overlay.switchToPage(overlay.getMainPage());
          }
        };

    toTriggerPageButton.setWidth(9 * 20);
    toTriggerPageButton.setHeight(20);
    toTriggerPageButton.setMarginTop(10);
    toTriggerPageButton.setFixed(true);

    list.addChild(toTriggerPageButton);

    list.setAnchor(WidgetAnchor.TOP_CENTER);
    list.shiftXPos(-9 * 20 / 2);
    list.shiftYPos(5);

    attachWidget(list);
  }
  @Override
  public void onButtonClick(ButtonClickEvent event) {
    try {
      storage.addInteger("x", Integer.parseInt(x.getText()));
      storage.addInteger("y", Integer.parseInt(y.getText()));
      storage.addInteger("z", Integer.parseInt(z.getText()));
      storage.addInteger("data", Integer.parseInt(data.getText()));

      storage.sync(p);
      event.getPlayer().sendNotification("Location set", "", Material.REDSTONE);
    } catch (Exception e) {
      event.getPlayer().sendNotification(ChatColor.RED + "Error", "", Material.REDSTONE);
    }
    super.onButtonClick(event);
  }
Example #7
0
  public void updateMusicEnabled() {
    if (Model.playerMusicEnabled.containsKey(p.getName())) {
      if (Model.playerMusicEnabled.get(p.getName())) {
        nextSongButton.setText("Next Song");
        nextSongButton.setDirty(true);
        stopMusicButton.setVisible(true);
        stopMusicButton.setDirty(true);

      } else {
        nextSongButton.setText("Music On");
        nextSongButton.setDirty(true);
        stopMusicButton.setVisible(false);
        stopMusicButton.setDirty(true);
      }
    }
    this.setDirty(true);
  }
  public void handleSpoutEditing(Player player, Sign sign) {

    if (!plugin.getSelectionHandler().checkForSelectionRights(player, sign.getBlock())) {

      QSUtil.tell(player, "You don't own this sign.");
      return;
    }

    if (!plugin.getBlackList().allows(sign, player)) {

      QSUtil.tell(player, "You cannot edit this sign: its contents are blacklisted.");
      return;
    }

    SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);

    PopupScreen popup = new GenericPopup();

    int y = 30;
    UUID[] widgets = new UUID[5];

    for (int i = 0; i < 4; i++) {

      GenericTextField textField = new GenericTextField();

      String line0 = sign.getLine(i).replaceAll("\u00A7([0-9a-fA-Fk-oK-OrR])", "&$1");
      textField
          .setText(line0)
          .setCursorPosition(line0.length() - 1)
          .setFieldColor(new Color(0, 0, 0, 1.0F));
      textField.setBorderColor(new Color(1.0F, 1.0F, 1.0F, 1.0F));
      textField.setMaximumCharacters(15).setHeight(20).setWidth(100);
      textField.setX(170).setY(y);
      textField.setAnchor(WidgetAnchor.SCALE);
      popup.attachWidget(plugin, textField);
      y += 30;
      widgets[i] = textField.getId();
    }

    GenericButton button = new GenericButton("Done");

    button.setColor(new Color(1.0F, 1.0F, 1.0F, 1.0F));
    button.setHoverColor(new Color(1.0F, 1.0F, 0, 1.0F));
    button.setX(170).setY(150);
    button.setWidth(100).setHeight(20);
    widgets[4] = button.getId();

    popup.attachWidget(plugin, button);

    attachColorLabels(popup);

    popup.setTransparent(true);

    spoutPlayer.getMainScreen().attachPopupScreen(popup);

    SpoutEditSession session = (SpoutEditSession) plugin.getSession(player);

    session.setPopup(popup);
    session.addSign(sign);
    session.setWidgets(widgets);
  }
Example #9
0
  public void createGUI(Player player) {

    GenericPopup pop = new GenericPopup();
    this.screenId = pop.getId();

    popcontainer.put(player, screenId);
    screencontainer.put(player, ms);

    GenericTexture label1 = new GenericTexture();
    label1.setUrl("http://dragontravel.phiwa.eu/images/DragonTravel-Banner_for_GUI.png");
    label1.setHeight(46).setWidth(230);
    label1.setPriority(RenderPriority.High);
    label1.setAnchor(WidgetAnchor.TOP_CENTER);
    label1.shiftXPos(-115);

    GenericLabel label2 = new GenericLabel();
    label2.setText(ChatColor.GOLD + "Destination");
    label2.setAnchor(WidgetAnchor.TOP_LEFT);
    label2.shiftXPos(40).shiftYPos(50);

    GenericLabel label3 = new GenericLabel();
    label3.setText(ChatColor.GOLD + "Travel to Destination");
    label3.setAnchor(WidgetAnchor.TOP_CENTER);
    label3.shiftXPos(40).shiftYPos(50);

    GenericLabel label4 = new GenericLabel();
    label4.setText(ChatColor.GOLD + "Station");
    label4.setAnchor(WidgetAnchor.TOP_LEFT);
    label4.shiftXPos(40).shiftYPos(110);

    GenericLabel label5 = new GenericLabel();
    label5.setText(ChatColor.GOLD + "Travel to Player");
    label5.setAnchor(WidgetAnchor.TOP_CENTER);
    label5.shiftXPos(40).shiftYPos(110);

    input1 = new GenericTextField();
    input1.setMaximumLines(15);
    input1.setHeight(15).setWidth(200);
    input1.setAnchor(WidgetAnchor.TOP_LEFT);
    input1.shiftXPos(40).setY(60);
    input1.setMaximumLines(1);
    input1.setFocus(false);

    input2 = new GenericTextField();
    input2.setMaximumLines(15);
    input2.setHeight(15).setWidth(200);
    input2.setAnchor(WidgetAnchor.TOP_CENTER);
    input2.shiftXPos(40).setY(60);
    input2.setMaximumLines(1);
    input2.setFocus(false);

    input3 = new GenericTextField();
    input3.setMaximumLines(15);
    input3.setHeight(15).setWidth(200);
    input3.setAnchor(WidgetAnchor.TOP_LEFT);
    input3.shiftXPos(40).setY(120);
    input3.setMaximumLines(1);
    input3.setFocus(false);

    input4 = new GenericTextField();
    input4.setMaximumLines(15);
    input4.setHeight(15).setWidth(200);
    input4.setAnchor(WidgetAnchor.TOP_CENTER);
    input4.shiftXPos(40).setY(120);
    input4.setMaximumLines(1);
    input4.setFocus(false);

    GenericButton button1 = new GenericButton("Create Destination");
    button1.setAlign(WidgetAnchor.CENTER_CENTER);
    button1.setAnchor(WidgetAnchor.TOP_LEFT);
    button1.shiftXPos(40).shiftYPos(80);
    button1.setHeight(15).setWidth(200);
    button1.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button2 = new GenericButton("Fly to Destination");
    button2.setAlign(WidgetAnchor.CENTER_CENTER);
    button2.setAnchor(WidgetAnchor.TOP_CENTER);
    button2.shiftXPos(40).shiftYPos(80);
    button2.setHeight(15).setWidth(200);
    button2.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button3 = new GenericButton("Create Station");
    button3.setAlign(WidgetAnchor.CENTER_CENTER);
    button3.setAnchor(WidgetAnchor.TOP_LEFT);
    button3.shiftXPos(40).shiftYPos(140);
    button3.setHeight(15).setWidth(200);
    button3.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button4 = new GenericButton("Fly to Player");
    button4.setAlign(WidgetAnchor.CENTER_CENTER);
    button4.setAnchor(WidgetAnchor.TOP_CENTER);
    button4.shiftXPos(40).shiftYPos(140);
    button4.setHeight(15).setWidth(200);
    button4.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    pop.attachWidget(instance, label1);
    pop.attachWidget(instance, label2);
    pop.attachWidget(instance, label3);
    pop.attachWidget(instance, label4);
    pop.attachWidget(instance, label5);

    pop.attachWidget(instance, input1);
    pop.attachWidget(instance, input2);
    pop.attachWidget(instance, input3);
    pop.attachWidget(instance, input4);

    pop.attachWidget(instance, button1);
    pop.attachWidget(instance, button2);
    pop.attachWidget(instance, button3);
    pop.attachWidget(instance, button4);

    ((SpoutPlayer) player).getMainScreen().attachPopupScreen(pop);
  }