Zavada

playerconstants

Jan 14th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. package com.vencillio.rs2.entity.player;
  2.  
  3. import com.vencillio.core.util.Utility;
  4. import com.vencillio.rs2.content.io.PlayerSaveUtil;
  5. import com.vencillio.rs2.entity.Location;
  6.  
  7. /**
  8. * Handles player constants
  9. *
  10. * @author Daniel
  11. *
  12. */
  13. public final class PlayerConstants {
  14.  
  15. /**
  16. * Array of owner usernames
  17. */
  18. public static final String[] OWNER_USERNAME = { "unlawful", "spoofs" };
  19.  
  20. /**
  21. * Side bar interface IDs
  22. */
  23. public static final int[] SIDEBAR_INTERFACE_IDS = { 2423, 3917, 29400, 3213, 1644, 5608, 0, 18128, 5065, 5715, 2449, 904, 147, 63700, 0 };
  24.  
  25. /**
  26. * Max item count
  27. */
  28. public static final int MAX_ITEM_COUNT = 21411;
  29.  
  30. /**
  31. * Lumbridge teleport
  32. */
  33. public static Location LUMBRIDGE = new Location(3222, 3216 + Utility.randomNumber(2), 0);
  34.  
  35. /**
  36. * Home teleport
  37. */
  38. public static Location HOME = new Location(3088, 3501, 0);
  39.  
  40. /**
  41. * Edgeville teleport
  42. */
  43. public static Location EDGEVILLE = new Location(3094, 3447, 0);
  44.  
  45. public static Location VARROCK = new Location(3214, 3424, 0);
  46.  
  47. public static Location FALADOR = new Location(2966, 3379, 0);
  48.  
  49. public static Location CAMELOT = new Location(2758, 3479, 0);
  50.  
  51. public static Location ARDOUGNE = new Location(2661, 3310, 0);
  52.  
  53. public static Location WATCHTOWER = new Location(2931, 4711, 0);
  54.  
  55. public static Location TROLLHEIM = new Location(2910, 3612, 0);
  56.  
  57. public static Location APE_ATOLL = new Location(2801, 2704, 1);
  58. /**
  59. * Jailed area
  60. */
  61. public static Location JAILED_AREA = new Location(2774, 2794, 0);
  62.  
  63. /**
  64. * Staff area
  65. */
  66. public static Location STAFF_AREA = new Location(2758, 3507, 2);
  67.  
  68. /**
  69. * Member zone
  70. */
  71. public static Location MEMEBER_AREA = new Location(2827, 3344, 0);
  72.  
  73. /**
  74. * Handles starters
  75. *
  76. * @param player
  77. */
  78. public static void doStarter(Player player) {
  79. player.setAppearanceUpdateRequired(true);
  80. player.getEquipment().onLogin();
  81. PlayerSaveUtil.setReceivedStarter(player);
  82. player.getRunEnergy().setRunning(true);
  83. player.setProfilePrivacy(false);
  84. }
  85.  
  86. /**
  87. * Overrides object existance
  88. *
  89. * @param p
  90. * @param objectId
  91. * @param x
  92. * @param y
  93. * @param z
  94. * @return
  95. */
  96. public static boolean isOverrideObjectExistance(Player p, int objectId, int x, int y, int z) {
  97. if ((x == 2851) && (y == 5333)) {
  98. return true;
  99. }
  100.  
  101. if (objectId == 26342 && p.getX() >= 2916 && p.getY() >= 3744 && p.getX() <= 2921 && p.getY() <= 3749) {
  102. return true;
  103. }
  104.  
  105. if (objectId == 2072) {
  106. return true;
  107. }
  108.  
  109. return false;
  110. }
  111.  
  112. public static boolean isHighClass(Player player) {
  113. final int[] ranks = { 2, 3, 4 };
  114. for (int i = 0; i < ranks.length; i++) {
  115. if (player.getRights() == ranks[i]) {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121.  
  122. public static boolean isPlayer(Player player) {
  123. if (player.getRights() == 0) {
  124. return true;
  125. }
  126. if (player.getRights() == 11 && !player.isMember()) {
  127. return true;
  128. }
  129. if (player.getRights() == 12 && !player.isMember()) {
  130. return true;
  131. }
  132. return false;
  133. }
  134.  
  135. public static boolean isStaff(Player player) {
  136. if (player.getRights() == 1 || player.getRights() == 2 || player.getRights() == 3 || player.getRights() == 4) {
  137. return true;
  138. }
  139.  
  140. return false;
  141. }
  142.  
  143. public static boolean isModerator(Player player) {
  144. if (player.getRights() == 1) {
  145. return true;
  146. }
  147. return false;
  148. }
  149.  
  150. public static boolean isAdministrator(Player player) {
  151. if (player.getRights() == 2) {
  152. return true;
  153. }
  154. return false;
  155. }
  156.  
  157. /**
  158. * Checks if player is Owner
  159. *
  160. * @param p
  161. * @return
  162. */
  163. public static boolean isOwner(Player p) {
  164. return p.getAttributes().get("ownerkey") != null || p.getUsername().equalsIgnoreCase("unlawful") || p.getUsername().equalsIgnoreCase("spoofs");
  165. }
  166.  
  167. /**
  168. * Checks if player is Developer
  169. *
  170. * @param p
  171. * @return
  172. */
  173. public static boolean isDeveloper(Player p) {
  174. return p.getAttributes().get("developerkey") != null || p.getUsername().equalsIgnoreCase("unlawful") || p.getUsername().equalsIgnoreCase("spoofs");
  175. }
  176.  
  177. /**
  178. * Checks if player is setting appearance
  179. *
  180. * @param player
  181. * @return
  182. */
  183. public static final boolean isSettingAppearance(Player player) {
  184. return player.getAttributes().get("setapp") != null;
  185. }
  186.  
  187. }
Add Comment
Please, Sign In to add comment