Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. package hybrid.core.events.ss;
  2.  
  3. import java.nio.ByteBuffer;
  4.  
  5. import hybrid.core.*;
  6. import hybrid.core.tools.*;
  7. import hybrid.core.consts.*;
  8.  
  9.  
  10. /**
  11. * The PowerballGoal event is fired when a player scores a goal with a powerball.
  12. * <P>
  13. * <PRE>Packet Layout
  14. * Field Length Description
  15. * 0 1 Packet ID: 0x0B
  16. * 1 2 Team number (Frequency)
  17. * 3 4 Points Awarded
  18. * </PRE>
  19. *
  20. * @author Chris "Cerium" Rog
  21. */
  22. public class PowerballGoal extends SSPacket
  23. {
  24. private int intFreq;
  25. private long lngPoints;
  26.  
  27.  
  28. // Constructor
  29. ////////////////////////////////////////////////////////////////////////////////////////////////////
  30. /**
  31. * Creates a new instance of the PowerballGoal event.
  32. *
  33. * @param objConnection The SSConnection object that generated this event.
  34. * @param objPacket The decrypted & unwrapped packet data. All core-packet headers must be
  35. * stripped.
  36. */
  37. public PowerballGoal(SSConnection objConnection, ByteBuffer objPacket)
  38. {
  39. super(SSEvents.PowerballGoal, objConnection, objPacket);
  40.  
  41.  
  42. if(objPacket.capacity() == 7)
  43. {
  44. this.intFreq = objPacket.getShort(1);
  45. this.lngPoints = objPacket.getInt(3);
  46. } else {
  47. System.out.println("Malformed 'SoccerGoal' Packet -- [Expected Size: 7] [Actual Size: " + objPacket.capacity() + "]");
  48. this.killEvent();
  49. }
  50. }
  51.  
  52.  
  53. // Public Functions
  54. ////////////////////////////////////////////////////////////////////////////////////////////////////
  55. /**
  56. * Returns the team number (frequency) that scored the goal.
  57. *
  58. * @return See above.
  59. */
  60. public int getFreq() { return this.intFreq; }
  61.  
  62. /**
  63. * Returns the amount of points awarded to each player on the team that scored the goal.
  64. *
  65. * @return See above.
  66. */
  67. public long getPoints() { return this.lngPoints; }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement