Advertisement
james1bow

Untitled

Mar 28th, 2024
962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. package InvSubPanel;
  2.  
  3. import net.risingworld.api.Plugin;
  4. import net.risingworld.api.events.EventMethod;
  5. import net.risingworld.api.events.Listener;
  6. import net.risingworld.api.events.player.PlayerConnectEvent;
  7. import net.risingworld.api.objects.Player;
  8. import net.risingworld.api.ui.UIElement;
  9. import net.risingworld.api.ui.UITarget;
  10. import net.risingworld.api.ui.style.Pivot;
  11.  
  12.  
  13. public class InvSubPanel extends Plugin implements Listener{
  14.    
  15.    
  16.    
  17.    
  18.     @Override
  19.     public void onEnable() {
  20.         this.registerEventListener(this);
  21.        
  22.     }
  23.  
  24.     @Override
  25.     public void onDisable() {
  26.        
  27.     }
  28.    
  29.    
  30.     @EventMethod
  31.     public void playerConnect(PlayerConnectEvent evt){
  32.         Player player = evt.getPlayer();
  33.         addElement(player);
  34.        
  35.     }
  36.  
  37.     public void addElement(Player player){
  38.         UIElement invSubPanel = new UIElement();
  39.         invSubPanel.setPivot(Pivot.MiddleLeft);
  40.         invSubPanel.setSize(15, 45, true);
  41.         invSubPanel.setPosition(78f, 43f, true);
  42.         invSubPanel.setBackgroundColor(0, 0, 0, 0.75f);
  43.         invSubPanel.setVisible(true);
  44.         player.setAttribute("Inventory_Sub_Panel", invSubPanel);
  45.         player.addUIElement(invSubPanel, UITarget.Inventory);
  46.     }  
  47.    
  48.    
  49.    
  50.    
  51.    
  52.    
  53.    
  54.    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement