Пример #1
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onScreenClose(final ScreenCloseEvent event) {
   if (!event.isCancelled() && event.getScreenType() == ScreenType.CHAT_SCREEN) {
     Widget bar = chatbar.remove(event.getPlayer());
     if (bar != null) {
       bar.setVisible(false);
     }
   }
 }
Пример #2
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onScreenOpen(final ScreenOpenEvent event) {
   if (!event.isCancelled() && event.getScreenType() == ScreenType.CHAT_SCREEN) {
     Color black = new Color(0f, 0f, 0f, 0.5f), white = new Color(1f, 1f, 1f, 0.5f);
     SpoutPlayer player = event.getPlayer();
     Widget label, bar = chatbar.get(player);
     if (bar == null) {
       bar =
           new GenericContainer(
                   label =
                       new GenericLabel(
                               ChatColor.GRAY
                                   + Herochat.getChatterManager()
                                       .getChatter(player)
                                       .getActiveChannel()
                                       .getName())
                           .setResize(true)
                           .setFixed(true)
                           .setMargin(3, 3, 0, 3),
                   new GenericGradient(black).setPriority(RenderPriority.Highest),
                   new GenericGradient(white)
                       .setMaxWidth(1)
                       .setPriority(RenderPriority.High)
                       .setVisible(false),
                   new GenericGradient(white)
                       .setMaxWidth(1)
                       .setMarginLeft(label.getWidth() + 5)
                       .setPriority(RenderPriority.High),
                   new GenericGradient(white).setMaxHeight(1).setPriority(RenderPriority.High))
               .setLayout(ContainerType.OVERLAY)
               .setAnchor(WidgetAnchor.BOTTOM_LEFT)
               .setY(-27)
               .setX(4)
               .setHeight(13)
               .setWidth(label.getWidth() + 6);
       chatbar.put(player, bar);
       player.getMainScreen().attachWidget(this, bar);
     }
     bar.setVisible(true);
   }
 }
Пример #3
0
 private void setXToMid(Widget w) {
   w.setX((maxWidth - w.getWidth()) / 2);
 }
Пример #4
0
 public void redrawAll(Player player) {
   SpoutPlayer splayer = SpoutManager.getPlayer(player);
   if (splayer.isSpoutCraftEnabled())
     for (Widget widget : splayer.getMainScreen().getAttachedWidgets())
       if ((widget.getPlugin() instanceof Features)) widget.setDirty(true);
 }