Esempio n. 1
0
 public boolean attachPopupScreen(PopupScreen screen) {
   if (getActivePopup() == null) {
     ScreenOpenEvent event = new ScreenOpenEvent(SpoutManager.getPlayerFromId(playerId), screen);
     Bukkit.getServer().getPluginManager().callEvent(event);
     if (event.isCancelled()) {
       return false;
     }
     activePopup = screen;
     screen.setScreen(this);
     ((GenericPopup) screen).playerId = this.playerId;
     return true;
   }
   return false;
 }
Esempio n. 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);
   }
 }