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);
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.
boolean showtext = true; while(showtext) { addText(blah); } Im not too good at enabling/disabling things via commands.