SHARE
TWEET

Untitled

a guest Apr 1st, 2019 57 in 96 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class TextCreator
  2. {
  3.     private TextComponent txt;
  4.  
  5.     public TextCreator(String text)
  6.     {
  7.         txt = new TextComponent(text);
  8.     }
  9.  
  10.     public TextCreator setColor(ChatColor color)
  11.     {
  12.         txt.setColor(color);
  13.         return this;
  14.     }
  15.  
  16.     public TextCreator setBold(boolean bold)
  17.     {
  18.         txt.setBold(bold);
  19.         return this;
  20.     }
  21.  
  22.     public TextCreator setItalic(boolean italic)
  23.     {
  24.         txt.setItalic(italic);
  25.         return this;
  26.     }
  27.  
  28.     public TextCreator setUnderlined(boolean underlined)
  29.     {
  30.         txt.setUnderlined(underlined);
  31.         return this;
  32.     }
  33.  
  34.     public TextCreator setObfuscated(boolean obfuscated)
  35.     {
  36.         txt.setObfuscated(obfuscated);
  37.         return this;
  38.     }
  39.  
  40.     public TextCreator setStrikethrough(boolean strikethrough)
  41.     {
  42.         txt.setStrikethrough(strikethrough);
  43.         return this;
  44.     }
  45.  
  46.     public TextCreator setExtra(List<BaseComponent> extra)
  47.     {
  48.         txt.setExtra(extra);
  49.         return this;
  50.     }
  51.  
  52.     public TextComponent getText()
  53.     {
  54.         return txt;
  55.     }
  56.  
  57.     public TextCreator setClickEvent(ClickEvent.Action action, String value)
  58.     {
  59.         txt.setClickEvent(new ClickEvent(action, value));;
  60.         return this;
  61.     }
  62.  
  63.     public TextCreator setHoverEvent(HoverEvent.Action action, BaseComponent value)
  64.     {
  65.         txt.setHoverEvent(new HoverEvent(action, new ComponentBuilder(value).create()));
  66.         return this;
  67.     }
  68. }
  69. [/code]
  70.  
  71. This for the page:
  72. [code=Java]package com.kyuukun.KyuuKun.Core.Util;
  73.  
  74. import net.md_5.bungee.api.chat.BaseComponent;
  75. import net.md_5.bungee.api.chat.HoverEvent;
  76. import net.md_5.bungee.api.chat.TextComponent;
  77.  
  78. import java.util.ArrayList;
  79. import java.util.List;
  80.  
  81. public class PageCreator
  82. {
  83.     private List<BaseComponent> text = new ArrayList<>();
  84.  
  85.     public PageCreator add(String txt)
  86.     {
  87.         this.text.add(new TextComponent(txt));
  88.         return this;
  89.     }
  90.  
  91.     public PageCreator newLine() {
  92.         this.text.add(new TextComponent("\n"));
  93.         return this;
  94.     }
  95.  
  96.     public PageCreator add(BaseComponent component) {
  97.         this.text.add(component);
  98.         return this;
  99.     }
  100.  
  101.     public BaseComponent[] create()
  102.     {
  103.         return text.toArray(new BaseComponent[text.size()]);
  104.     }
  105.  
  106. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top