SHOW:
|
|
- or go back to the newest paste.
1 | package me.acuddlyheadcrab.AcuddlyTrading; | |
2 | ||
3 | import java.util.logging.Logger; | |
4 | import org.bukkit.Server; | |
5 | import org.bukkit.command.Command; | |
6 | import org.bukkit.command.CommandSender; | |
7 | import org.bukkit.entity.Player; | |
8 | import org.bukkit.event.Event.Priority; | |
9 | import org.bukkit.event.Event.Type; | |
10 | import org.bukkit.plugin.PluginDescriptionFile; | |
11 | import org.bukkit.plugin.PluginManager; | |
12 | import org.bukkit.plugin.java.JavaPlugin; | |
13 | import org.getspout.spoutapi.gui.GenericLabel; | |
14 | import org.getspout.spoutapi.gui.GenericPopup; | |
15 | import org.getspout.spoutapi.gui.InGameHUD; | |
16 | import org.getspout.spoutapi.gui.Label; | |
17 | - | public class AcuddlyTrading extends JavaPlugin { |
17 | + | import org.getspout.spoutapi.gui.Widget; |
18 | - | public static AcuddlyTrading plugin; |
18 | + | |
19 | - | public final Logger log = Logger.getLogger("Minecraft"); |
19 | + | |
20 | - | public PluginManager pm; |
20 | + | public class AcuddlyTrading extends JavaPlugin |
21 | - | |
21 | + | { |
22 | - | public final AcuddlyTradingPL playerListener = new AcuddlyTradingPL(this); |
22 | + | public static AcuddlyTrading plugin; |
23 | - | |
23 | + | public final Logger log = Logger.getLogger("Minecraft"); |
24 | - | public void onDisable() { |
24 | + | public PluginManager pm; |
25 | - | PluginDescriptionFile plugdes = this.getDescription(); |
25 | + | public final AcuddlyTradingPL playerListener = new AcuddlyTradingPL(this); |
26 | - | this.log.info(plugdes.getName() + " is now disabled :("); |
26 | + | |
27 | - | } |
27 | + | public void onDisable() |
28 | - | public void onEnable() { |
28 | + | { |
29 | - | this.pm = this.getServer().getPluginManager(); |
29 | + | PluginDescriptionFile plugdes = getDescription(); |
30 | - | PluginDescriptionFile plugdes = this.getDescription(); |
30 | + | this.log.info(plugdes.getName() + " is now disabled :("); } |
31 | - | this.log.info("["+plugdes.getName()+"] "+plugdes.getVersion()+" - by acuddlyheadcrab - is enabled"); |
31 | + | |
32 | - | pm.registerEvent(Type.PLAYER_INTERACT_ENTITY, playerListener, Priority.Normal, this); |
32 | + | public void onEnable() { |
33 | - | pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Normal, this); |
33 | + | this.pm = getServer().getPluginManager(); |
34 | - | |
34 | + | PluginDescriptionFile plugdes = getDescription(); |
35 | - | |
35 | + | this.log.info("[" + plugdes.getName() + "] " + plugdes.getVersion() + " - by acuddlyheadcrab - is enabled"); |
36 | - | } |
36 | + | this.pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY, this.playerListener, Event.Priority.Normal, this); |
37 | - | |
37 | + | this.pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Event.Priority.Normal, this); |
38 | - | |
38 | + | } |
39 | - | |
39 | + | |
40 | - | public long longSeconds(int x){ |
40 | + | public long longSeconds(int x) |
41 | - | long z = (x*20); |
41 | + | { |
42 | - | return z; |
42 | + | long z = x * 20; |
43 | - | } |
43 | + | return z; |
44 | - | |
44 | + | } |
45 | - | public boolean onCommand(CommandSender cmdsndr, Command cmd, String commandLabel, String[] args){ |
45 | + | |
46 | - | Boolean one = Boolean.valueOf(cmd.getName().equalsIgnoreCase("showgui")); |
46 | + | public boolean onCommand(CommandSender cmdsndr, Command cmd, String commandLabel, String[] args) { |
47 | - | Boolean two = Boolean.valueOf(cmdsndr instanceof Player); |
47 | + | Boolean one = Boolean.valueOf(cmd.getName().equalsIgnoreCase("showgui")); |
48 | - | Boolean three = Boolean.valueOf(cmdsndr instanceof SpoutPlayer); |
48 | + | Boolean two = Boolean.valueOf(cmdsndr instanceof Player); |
49 | - | |
49 | + | Boolean three = Boolean.valueOf(cmdsndr instanceof SpoutPlayer); |
50 | - | Boolean no_args = Boolean.valueOf(args.length<1); |
50 | + | |
51 | - | if(no_args){return false;} else { |
51 | + | Boolean no_args = Boolean.valueOf(args.length < 1); |
52 | - | Boolean argsnull = Boolean.valueOf(args[0]!=null); |
52 | + | if (no_args.booleanValue()) return false; |
53 | - | Boolean cmdarg1 = Boolean.valueOf((argsnull)&&(args[0].equalsIgnoreCase("test"))); |
53 | + | Boolean argsnull = Boolean.valueOf(args[0] != null); |
54 | - | |
54 | + | Boolean cmdarg1 = Boolean.valueOf((argsnull.booleanValue()) && (args[0].equalsIgnoreCase("test"))); |
55 | - | if(one){ |
55 | + | |
56 | - | if(two){ |
56 | + | if (one.booleanValue()) { |
57 | - | if(three){ |
57 | + | if (two.booleanValue()) { |
58 | - | if(no_args){return false;} |
58 | + | if (three.booleanValue()) { |
59 | - | SpoutPlayer player = (SpoutPlayer) cmdsndr; |
59 | + | if (no_args.booleanValue()) return false; |
60 | - | |
60 | + | SpoutPlayer player = (SpoutPlayer)cmdsndr; |
61 | - | |
61 | + | |
62 | - | |
62 | + | if (cmdarg1.booleanValue()) |
63 | - | if(cmdarg1){ |
63 | + | { |
64 | - | |
64 | + | player.sendMessage("derp"); |
65 | - | player.sendMessage("derp"); |
65 | + | |
66 | - | |
66 | + | GenericPopup popup = new GenericPopup(); |
67 | - | GenericPopup popup = new GenericPopup(); |
67 | + | GenericLabel label = new GenericLabel(); |
68 | - | GenericLabel label = new GenericLabel(); |
68 | + | label.setAuto(false).setX(10).setY(10).setWidth(100).setHeight(30); |
69 | - | label.setAuto(false).setX(10).setY(10).setWidth(100).setHeight(30); |
69 | + | |
70 | - | |
70 | + | popup.attachWidget(plugin, label); |
71 | - | popup.attachWidget(plugin, label); |
71 | + | |
72 | - | |
72 | + | player.getMainScreen().attachPopupScreen(popup); |
73 | - | player.getMainScreen().attachPopupScreen(popup); |
73 | + | |
74 | - | |
74 | + | return false; |
75 | - | |
75 | + | } |
76 | - | return false; |
76 | + | |
77 | - | } else |
77 | + | return false; |
78 | - | |
78 | + | } |
79 | - | |
79 | + | cmdsndr.sendMessage("You must have Spoutcraft to do this!"); return true; } |
80 | - | |
80 | + | cmdsndr.sendMessage("You must be a player to do this!"); return true; } |
81 | - | return false; |
81 | + | return true; |
82 | } | |
83 | - | } else cmdsndr.sendMessage("You must have Spoutcraft to do this!"); return true; |
83 | + | } |
84 | - | } else cmdsndr.sendMessage("You must be a player to do this!"); return true; |
84 | + |