Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.sadtaco.SkillTrees;
- import org.bukkit.ChatColor;
- import org.bukkit.entity.Player;
- import org.getspout.spoutapi.SpoutManager;
- import org.getspout.spoutapi.player.SpoutPlayer;
- import org.getspout.spoutapi.gui.Color;
- //import org.getspout.spoutapi.gui.GenericButton;
- import org.getspout.spoutapi.gui.GenericLabel;
- //import org.getspout.spoutapi.gui.GenericPopup;
- import org.getspout.spoutapi.gui.WidgetAnchor;
- public class SkillsGui {
- private static SkillTrees plugin;
- public SkillsGui(SkillTrees plugin, ServerChatPlayerListener serverChatPlayerListener) {
- SkillsGui.setPlugin(plugin);
- }
- public void skillHint(Player player){
- player.sendMessage(ChatColor.RED + "[Server] " + ChatColor.WHITE + "Here I would be making a button.");
- SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
- //GenericPopup popup = new GenericPopup();
- /*GenericButton button = new GenericButton("+");
- button.setColor(new Color(1.0F, 1.0F, 0, 1.0F)); //This makes the button text yellow.
- button.setHoverColor(new Color(1.0F, 0, 0, 1.0F)); //When you hover over with a mouse this makes the text red.
- button.setX(100).setY(100); //Puts the button at 100*100 on the screen
- button.setWidth(40).setHeight(40); //Makes the button 200 wide and 20 high
- popup.attachWidget(getPlugin(), button);
- sPlayer.getMainScreen().attachPopupScreen(popup);*/
- GenericLabel label = new GenericLabel("Press \"K\" to open Skills");
- label.setTextColor(new Color(1.0F, 1.0F, 1.0F, 1.0F));
- label.setAlign(WidgetAnchor.TOP_CENTER).setAnchor(WidgetAnchor.BOTTOM_RIGHT);
- sPlayer.getMainScreen().attachWidget(plugin, label);
- //label.shiftYPos(20);
- }
- public static SkillTrees getPlugin() {
- return plugin;
- }
- public static void setPlugin(SkillTrees plugin) {
- SkillsGui.plugin = plugin;
- }
- }
- package me.sadtaco.SkillTrees;
- import org.bukkit.ChatColor;
- import org.bukkit.entity.Player;
- import org.bukkit.event.player.PlayerChatEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerListener;
- public class ServerChatPlayerListener extends PlayerListener {
- public static SkillTrees plugin;
- public final SkillsGui gui = new SkillsGui(plugin, this);
- public ServerChatPlayerListener(SkillTrees instance){
- plugin = instance;
- }
- public void onPlayerChat(PlayerChatEvent event){
- Player p = event.getPlayer();
- String msg = event.getMessage().toLowerCase();
- if( msg.contains("hi") && msg.contains("server") ){
- p.sendMessage(ChatColor.RED + "[Server] " + ChatColor.WHITE + "Hi!");
- }
- }
- public void onPlayerJoin(PlayerJoinEvent event){
- Player p = event.getPlayer();
- gui.skillHint(p);
- }
- }
Add Comment
Please, Sign In to add comment