Location.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.model;
  16. import com.l2jserver.gameserver.model.actor.L2Character;
  17. public final class Location
  18. {
  19. private final int _x;
  20. private final int _y;
  21. private final int _z;
  22. private int _heading;
  23. private int _instanceId;
  24. public Location(int x, int y, int z)
  25. {
  26. _x = x;
  27. _y = y;
  28. _z = z;
  29. }
  30. public Location(L2Object obj)
  31. {
  32. _x = obj.getX();
  33. _y = obj.getY();
  34. _z = obj.getZ();
  35. _instanceId = obj.getInstanceId();
  36. }
  37. public Location(L2Character obj)
  38. {
  39. _x = obj.getX();
  40. _y = obj.getY();
  41. _z = obj.getZ();
  42. _heading = obj.getHeading();
  43. _instanceId = obj.getInstanceId();
  44. }
  45. public Location(int x, int y, int z, int heading)
  46. {
  47. _x = x;
  48. _y = y;
  49. _z = z;
  50. _heading = heading;
  51. }
  52. public Location(int x, int y, int z, int heading, int instanceId)
  53. {
  54. _x = x;
  55. _y = y;
  56. _z = z;
  57. _heading = heading;
  58. _instanceId = instanceId;
  59. }
  60. public int getX()
  61. {
  62. return _x;
  63. }
  64. public int getY()
  65. {
  66. return _y;
  67. }
  68. public int getZ()
  69. {
  70. return _z;
  71. }
  72. public int getHeading()
  73. {
  74. return _heading;
  75. }
  76. public int getInstanceId()
  77. {
  78. return _instanceId;
  79. }
  80. @Override
  81. public String toString()
  82. {
  83. return "[" + getClass().getSimpleName() + "] X: " + _x + " Y: " + _y + " Z: " + _z + " Heading: " + _heading + " InstanceId: " + _instanceId;
  84. }
  85. }