Advertisement
Cool_boy21

2

Jan 28th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.52 KB | None | 0 0
  1. /*
  2. * Decompiled with CFR 0_118.
  3. *
  4. * Could not load the following classes:
  5. * net.md_5.bungee.api.ChatColor
  6. * org.bukkit.Bukkit
  7. * org.bukkit.Location
  8. * org.bukkit.Material
  9. * org.bukkit.World
  10. * org.bukkit.block.Block
  11. * org.bukkit.block.BlockFace
  12. * org.bukkit.block.BlockState
  13. * org.bukkit.block.Sign
  14. * org.bukkit.block.Skull
  15. * org.bukkit.configuration.file.FileConfiguration
  16. * org.bukkit.event.EventHandler
  17. * org.bukkit.event.Listener
  18. * org.bukkit.material.MaterialData
  19. * org.bukkit.material.Sign
  20. * pl.islandworld.api.events.IslandRankUpdateEvent
  21. */
  22. package pl.iwhr.listeners;
  23.  
  24. import java.util.List;
  25. import java.util.Map;
  26. import java.util.Set;
  27. import java.util.logging.Logger;
  28. import net.md_5.bungee.api.ChatColor;
  29. import org.bukkit.Bukkit;
  30. import org.bukkit.Location;
  31. import org.bukkit.Material;
  32. import org.bukkit.World;
  33. import org.bukkit.block.Block;
  34. import org.bukkit.block.BlockFace;
  35. import org.bukkit.block.BlockState;
  36. import org.bukkit.block.Sign;
  37. import org.bukkit.block.Skull;
  38. import org.bukkit.configuration.file.FileConfiguration;
  39. import org.bukkit.event.EventHandler;
  40. import org.bukkit.event.Listener;
  41. import org.bukkit.material.MaterialData;
  42. import pl.islandworld.api.events.IslandRankUpdateEvent;
  43. import pl.iwhr.IWHeadRank;
  44.  
  45. public class RankListener
  46. implements Listener {
  47. IWHeadRank plugin;
  48. private static /* synthetic */ int[] $SWITCH_TABLE$org$bukkit$block$BlockFace;
  49.  
  50. public RankListener(IWHeadRank iw) {
  51. this.plugin = iw;
  52. }
  53.  
  54. @EventHandler
  55. public void onRankReload(IslandRankUpdateEvent event) {
  56. this.plugin.getLogger().info("Rank reload " + event.getReason() + ", updating HeadRank!");
  57. Map rank = event.getRank();
  58. List tablelist = this.plugin.getConfig().getStringList("table-coords");
  59. World world = Bukkit.getWorld((String)this.plugin.getConfig().getString("world"));
  60. if (rank != null && tablelist != null && world != null) {
  61. int c = 0;
  62. for (Map.Entry r : rank.entrySet()) {
  63. if (c == tablelist.size()) break;
  64. String owner = (String)r.getKey();
  65. int points = (Integer)r.getValue();
  66. String coo = (String)tablelist.get(c);
  67. String[] dat = coo.split(" ");
  68. Block block = world.getBlockAt(Integer.valueOf(dat[0]).intValue(), Integer.valueOf(dat[1]).intValue(), Integer.valueOf(dat[2]).intValue());
  69. if (block.getType().equals((Object)Material.WALL_SIGN)) {
  70. block.setType(Material.WALL_SIGN);
  71. Sign sign = (Sign)block.getState();
  72. sign.setLine(0, (Object)ChatColor.MAGIC + "||" + (Object)ChatColor.RESET + " " + (c + 1) + " " + (Object)ChatColor.MAGIC + "||");
  73. sign.setLine(1, owner);
  74. sign.setLine(2, String.valueOf(points));
  75. sign.update();
  76. Location loc = block.getLocation();
  77. org.bukkit.material.Sign sign3 = (org.bukkit.material.Sign)sign.getData();
  78. BlockFace signface = sign3.getFacing();
  79. boolean ok = true;
  80. switch (RankListener.$SWITCH_TABLE$org$bukkit$block$BlockFace()[signface.ordinal()]) {
  81. case 1: {
  82. loc.add(0.0, 1.0, 1.0);
  83. break;
  84. }
  85. case 3: {
  86. loc.add(0.0, 1.0, -1.0);
  87. break;
  88. }
  89. case 4: {
  90. loc.add(1.0, 1.0, 0.0);
  91. break;
  92. }
  93. case 2: {
  94. loc.add(-1.0, 1.0, 0.0);
  95. break;
  96. }
  97. default: {
  98. ok = false;
  99. }
  100. }
  101. if (ok) {
  102. Block headblock = world.getBlockAt(loc);
  103. BlockState blockState = headblock.getState();
  104. if (blockState instanceof Skull) {
  105. ((Skull)blockState).setRotation(signface);
  106. Skull skull = (Skull)blockState;
  107. skull.setOwner(owner);
  108. skull.update();
  109. } else {
  110. this.plugin.getLogger().info("Block at " + headblock.getLocation().toString() + " is not skull");
  111. }
  112. }
  113. } else {
  114. this.plugin.getLogger().info("Block at " + block.getLocation().toString() + " not sign!");
  115. }
  116. ++c;
  117. }
  118. }
  119. }
  120.  
  121. static /* synthetic */ int[] $SWITCH_TABLE$org$bukkit$block$BlockFace() {
  122. int[] arrn;
  123. int[] arrn2 = $SWITCH_TABLE$org$bukkit$block$BlockFace;
  124. if (arrn2 != null) {
  125. return arrn2;
  126. }
  127. arrn = new int[BlockFace.values().length];
  128. try {
  129. arrn[BlockFace.DOWN.ordinal()] = 6;
  130. }
  131. catch (NoSuchFieldError v1) {}
  132. try {
  133. arrn[BlockFace.EAST.ordinal()] = 2;
  134. }
  135. catch (NoSuchFieldError v2) {}
  136. try {
  137. arrn[BlockFace.EAST_NORTH_EAST.ordinal()] = 14;
  138. }
  139. catch (NoSuchFieldError v3) {}
  140. try {
  141. arrn[BlockFace.EAST_SOUTH_EAST.ordinal()] = 15;
  142. }
  143. catch (NoSuchFieldError v4) {}
  144. try {
  145. arrn[BlockFace.NORTH.ordinal()] = 1;
  146. }
  147. catch (NoSuchFieldError v5) {}
  148. try {
  149. arrn[BlockFace.NORTH_EAST.ordinal()] = 7;
  150. }
  151. catch (NoSuchFieldError v6) {}
  152. try {
  153. arrn[BlockFace.NORTH_NORTH_EAST.ordinal()] = 13;
  154. }
  155. catch (NoSuchFieldError v7) {}
  156. try {
  157. arrn[BlockFace.NORTH_NORTH_WEST.ordinal()] = 12;
  158. }
  159. catch (NoSuchFieldError v8) {}
  160. try {
  161. arrn[BlockFace.NORTH_WEST.ordinal()] = 8;
  162. }
  163. catch (NoSuchFieldError v9) {}
  164. try {
  165. arrn[BlockFace.SELF.ordinal()] = 19;
  166. }
  167. catch (NoSuchFieldError v10) {}
  168. try {
  169. arrn[BlockFace.SOUTH.ordinal()] = 3;
  170. }
  171. catch (NoSuchFieldError v11) {}
  172. try {
  173. arrn[BlockFace.SOUTH_EAST.ordinal()] = 9;
  174. }
  175. catch (NoSuchFieldError v12) {}
  176. try {
  177. arrn[BlockFace.SOUTH_SOUTH_EAST.ordinal()] = 16;
  178. }
  179. catch (NoSuchFieldError v13) {}
  180. try {
  181. arrn[BlockFace.SOUTH_SOUTH_WEST.ordinal()] = 17;
  182. }
  183. catch (NoSuchFieldError v14) {}
  184. try {
  185. arrn[BlockFace.SOUTH_WEST.ordinal()] = 10;
  186. }
  187. catch (NoSuchFieldError v15) {}
  188. try {
  189. arrn[BlockFace.UP.ordinal()] = 5;
  190. }
  191. catch (NoSuchFieldError v16) {}
  192. try {
  193. arrn[BlockFace.WEST.ordinal()] = 4;
  194. }
  195. catch (NoSuchFieldError v17) {}
  196. try {
  197. arrn[BlockFace.WEST_NORTH_WEST.ordinal()] = 11;
  198. }
  199. catch (NoSuchFieldError v18) {}
  200. try {
  201. arrn[BlockFace.WEST_SOUTH_WEST.ordinal()] = 18;
  202. }
  203. catch (NoSuchFieldError v19) {}
  204. $SWITCH_TABLE$org$bukkit$block$BlockFace = arrn;
  205. return $SWITCH_TABLE$org$bukkit$block$BlockFace;
  206. }
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement