Adding text to Spout API

Discussion in 'Resources' started by CainFoool, Aug 7, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    CainFoool

    Code:
        public void addText(String color, String text, String position, SpoutPlayer sp) {
            GenericLabel spouttext = new GenericLabel("");
            if(position.toString().equals("health")) {
            	spouttext.setHexColor(Integer.parseInt(color, 16)).setX(209).setY(211);
            }
            if(position.toString().equals("top-right")) {
            	spouttext.setHexColor(Integer.parseInt(color, 16)).setX(300).setY(5);
            }
            if(position.toString().equals("top-left")) {
            	spouttext.setHexColor(Integer.parseInt(color, 16)).setX(3).setY(5);
            }
            if(position.toString().equals("bottom-left")) {
            	spouttext.setHexColor(Integer.parseInt(color, 16)).setX(3).setY(220);
            }
            if(position.toString().equals("bottom-right")) {
            	spouttext.setHexColor(Integer.parseInt(color, 16)).setX(315).setY(230);
            }
            spouttext.setText(text);
            spouttext.setDirty(true);
            sp.getMainScreen().attachWidget(spouttext);
        }
    Just use it like
    pluginname.addText("FFFFFF", "Text here", "top-left, top-right, bottom-left, bottom,right or health", SpoutPlayer cast);

    For my ZombeBanner, I use
    addText("FFFFFF", "ZombeBanner is on!", "health", splayer);
     
  2. Offline

    skawke

    How would you remove this text?
     
  3. Offline

    CainFoool

    Just remove the addText(); line altogether.. I don't get what you mean.
     
  4. Offline

    skawke

    I was trying to use the Spout API, and i managed to add a Label Widget on. I wanted my users to type in a command to remove it from their screen if they wanted to. Tried using removeWidget() and setVisible(), both failed.
     
  5. Offline

    CainFoool

    boolean showtext = true;
    while(showtext) {
    addText(blah);
    }
    Im not too good at enabling/disabling things via commands.
     
  6. Offline

    skawke

    Darn. I'm pretty sure Spout has a way to do it, i just can't figure it out.
     
  7. Offline

    CainFoool

    Not necessarily spout, just Bukkit itself. Try asking at IRC.
     
Thread Status:
Not open for further replies.

Share This Page