Skip to content

Instantly share code, notes, and snippets.

@ericpauley
Created August 17, 2011 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericpauley/1152476 to your computer and use it in GitHub Desktop.
Save ericpauley/1152476 to your computer and use it in GitHub Desktop.
Spout Plugin
package zonedabone.SpoutTest;
import org.getspout.spoutapi.event.inventory.InventoryCloseEvent;
import org.getspout.spoutapi.event.inventory.InventoryListener;
import org.getspout.spoutapi.event.inventory.InventoryOpenEvent;
public class IL extends InventoryListener {
SpoutTest plugin;
public IL(SpoutTest instance){
plugin = instance;
}
public void onInventoryOpen(InventoryOpenEvent e){
System.out.println("OPEN!");
}
public void onInventoryClose(InventoryCloseEvent e){
System.out.println("CLOSE!");
}
}
name: SpoutTest
version: 1.0.0
main: zonedabone.SpoutTest.SpoutTest
package zonedabone.SpoutTest;
import javax.swing.Popup;
import org.bukkit.Material;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.event.spout.SpoutListener;
import org.getspout.spoutapi.gui.Button;
import org.getspout.spoutapi.gui.GenericButton;
import org.getspout.spoutapi.gui.GenericItemWidget;
import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.GenericPopup;
import org.getspout.spoutapi.gui.GenericSlider;
import org.getspout.spoutapi.gui.ItemWidget;
import org.getspout.spoutapi.gui.Label;
import org.getspout.spoutapi.gui.PopupScreen;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Slider;
public class SL extends PlayerListener {
SpoutTest plugin;
public SL(SpoutTest instance){
plugin = instance;
}
public void onPlayerInteract(PlayerInteractEvent e){
ItemWidget button = (ItemWidget) new GenericItemWidget().setTypeId(1).setX(100).setY(100).setWidth(10).setWidth(10);
button.setTypeId(1);
button.setX(0);
button.setY(100);
button.setWidth(10);
button.setHeight(10);
ItemWidget button2 = (ItemWidget) new GenericItemWidget();
button2.setTypeId(2);
button2.setX(0);
button2.setY(150);
button2.setWidth(10);
button2.setHeight(10);
ItemWidget button3 = (ItemWidget) new GenericItemWidget();
button3.setTypeId(261);
button3.setX(0);
button3.setY(200);
button3.setWidth(10);
button3.setHeight(10);
System.out.println("TEST");
PopupScreen popup = new GenericPopup();
popup.attachWidget(plugin, button);
popup.attachWidget(plugin, button2);
popup.attachWidget(plugin, button3);
SpoutManager.getPlayer(e.getPlayer()).getMainScreen().attachPopupScreen(popup);
}
}
package zonedabone.SpoutTest;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.plugin.java.JavaPlugin;
import org.getspout.spoutapi.gui.Label;
public class SpoutTest extends JavaPlugin {
Map<String,Label> players = new HashMap<String,Label>();
@Override
public void onDisable() {
// TODO Auto-generated method stub
}
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_INTERACT, new SL(this), Event.Priority.Normal, this);
this.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, new IL(this), Event.Priority.Normal, this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment