Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Decompiled with CFR 0_118.
- *
- * Could not load the following classes:
- * net.md_5.bungee.api.ChatColor
- * org.bukkit.Bukkit
- * org.bukkit.Location
- * org.bukkit.Material
- * org.bukkit.World
- * org.bukkit.block.Block
- * org.bukkit.block.BlockFace
- * org.bukkit.block.BlockState
- * org.bukkit.block.Sign
- * org.bukkit.block.Skull
- * org.bukkit.configuration.file.FileConfiguration
- * org.bukkit.event.EventHandler
- * org.bukkit.event.Listener
- * org.bukkit.material.MaterialData
- * org.bukkit.material.Sign
- * pl.islandworld.api.events.IslandRankUpdateEvent
- */
- package pl.iwhr.listeners;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import java.util.logging.Logger;
- import net.md_5.bungee.api.ChatColor;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.block.Block;
- import org.bukkit.block.BlockFace;
- import org.bukkit.block.BlockState;
- import org.bukkit.block.Sign;
- import org.bukkit.block.Skull;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.material.MaterialData;
- import pl.islandworld.api.events.IslandRankUpdateEvent;
- import pl.iwhr.IWHeadRank;
- public class RankListener
- implements Listener {
- IWHeadRank plugin;
- private static /* synthetic */ int[] $SWITCH_TABLE$org$bukkit$block$BlockFace;
- public RankListener(IWHeadRank iw) {
- this.plugin = iw;
- }
- @EventHandler
- public void onRankReload(IslandRankUpdateEvent event) {
- this.plugin.getLogger().info("Rank reload " + event.getReason() + ", updating HeadRank!");
- Map rank = event.getRank();
- List tablelist = this.plugin.getConfig().getStringList("table-coords");
- World world = Bukkit.getWorld((String)this.plugin.getConfig().getString("world"));
- if (rank != null && tablelist != null && world != null) {
- int c = 0;
- for (Map.Entry r : rank.entrySet()) {
- if (c == tablelist.size()) break;
- String owner = (String)r.getKey();
- int points = (Integer)r.getValue();
- String coo = (String)tablelist.get(c);
- String[] dat = coo.split(" ");
- Block block = world.getBlockAt(Integer.valueOf(dat[0]).intValue(), Integer.valueOf(dat[1]).intValue(), Integer.valueOf(dat[2]).intValue());
- if (block.getType().equals((Object)Material.WALL_SIGN)) {
- block.setType(Material.WALL_SIGN);
- Sign sign = (Sign)block.getState();
- sign.setLine(0, (Object)ChatColor.MAGIC + "||" + (Object)ChatColor.RESET + " " + (c + 1) + " " + (Object)ChatColor.MAGIC + "||");
- sign.setLine(1, owner);
- sign.setLine(2, String.valueOf(points));
- sign.update();
- Location loc = block.getLocation();
- org.bukkit.material.Sign sign3 = (org.bukkit.material.Sign)sign.getData();
- BlockFace signface = sign3.getFacing();
- boolean ok = true;
- switch (RankListener.$SWITCH_TABLE$org$bukkit$block$BlockFace()[signface.ordinal()]) {
- case 1: {
- loc.add(0.0, 1.0, 1.0);
- break;
- }
- case 3: {
- loc.add(0.0, 1.0, -1.0);
- break;
- }
- case 4: {
- loc.add(1.0, 1.0, 0.0);
- break;
- }
- case 2: {
- loc.add(-1.0, 1.0, 0.0);
- break;
- }
- default: {
- ok = false;
- }
- }
- if (ok) {
- Block headblock = world.getBlockAt(loc);
- BlockState blockState = headblock.getState();
- if (blockState instanceof Skull) {
- ((Skull)blockState).setRotation(signface);
- Skull skull = (Skull)blockState;
- skull.setOwner(owner);
- skull.update();
- } else {
- this.plugin.getLogger().info("Block at " + headblock.getLocation().toString() + " is not skull");
- }
- }
- } else {
- this.plugin.getLogger().info("Block at " + block.getLocation().toString() + " not sign!");
- }
- ++c;
- }
- }
- }
- static /* synthetic */ int[] $SWITCH_TABLE$org$bukkit$block$BlockFace() {
- int[] arrn;
- int[] arrn2 = $SWITCH_TABLE$org$bukkit$block$BlockFace;
- if (arrn2 != null) {
- return arrn2;
- }
- arrn = new int[BlockFace.values().length];
- try {
- arrn[BlockFace.DOWN.ordinal()] = 6;
- }
- catch (NoSuchFieldError v1) {}
- try {
- arrn[BlockFace.EAST.ordinal()] = 2;
- }
- catch (NoSuchFieldError v2) {}
- try {
- arrn[BlockFace.EAST_NORTH_EAST.ordinal()] = 14;
- }
- catch (NoSuchFieldError v3) {}
- try {
- arrn[BlockFace.EAST_SOUTH_EAST.ordinal()] = 15;
- }
- catch (NoSuchFieldError v4) {}
- try {
- arrn[BlockFace.NORTH.ordinal()] = 1;
- }
- catch (NoSuchFieldError v5) {}
- try {
- arrn[BlockFace.NORTH_EAST.ordinal()] = 7;
- }
- catch (NoSuchFieldError v6) {}
- try {
- arrn[BlockFace.NORTH_NORTH_EAST.ordinal()] = 13;
- }
- catch (NoSuchFieldError v7) {}
- try {
- arrn[BlockFace.NORTH_NORTH_WEST.ordinal()] = 12;
- }
- catch (NoSuchFieldError v8) {}
- try {
- arrn[BlockFace.NORTH_WEST.ordinal()] = 8;
- }
- catch (NoSuchFieldError v9) {}
- try {
- arrn[BlockFace.SELF.ordinal()] = 19;
- }
- catch (NoSuchFieldError v10) {}
- try {
- arrn[BlockFace.SOUTH.ordinal()] = 3;
- }
- catch (NoSuchFieldError v11) {}
- try {
- arrn[BlockFace.SOUTH_EAST.ordinal()] = 9;
- }
- catch (NoSuchFieldError v12) {}
- try {
- arrn[BlockFace.SOUTH_SOUTH_EAST.ordinal()] = 16;
- }
- catch (NoSuchFieldError v13) {}
- try {
- arrn[BlockFace.SOUTH_SOUTH_WEST.ordinal()] = 17;
- }
- catch (NoSuchFieldError v14) {}
- try {
- arrn[BlockFace.SOUTH_WEST.ordinal()] = 10;
- }
- catch (NoSuchFieldError v15) {}
- try {
- arrn[BlockFace.UP.ordinal()] = 5;
- }
- catch (NoSuchFieldError v16) {}
- try {
- arrn[BlockFace.WEST.ordinal()] = 4;
- }
- catch (NoSuchFieldError v17) {}
- try {
- arrn[BlockFace.WEST_NORTH_WEST.ordinal()] = 11;
- }
- catch (NoSuchFieldError v18) {}
- try {
- arrn[BlockFace.WEST_SOUTH_WEST.ordinal()] = 18;
- }
- catch (NoSuchFieldError v19) {}
- $SWITCH_TABLE$org$bukkit$block$BlockFace = arrn;
- return $SWITCH_TABLE$org$bukkit$block$BlockFace;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement