Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics2D;
- import java.awt.geom.AffineTransform;
- import java.awt.image.BufferedImage;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import me.bigteddy98.bannerboard.Main;
- import me.bigteddy98.bannerboard.api.BannerBoardRenderer;
- import me.bigteddy98.bannerboard.api.Setting;
- import me.bigteddy98.bannerboard.c;
- import me.bigteddy98.bannerboard.cb1a1;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Chunk;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.block.BlockFace;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.ItemFrame;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.scheduler.BukkitTask;
- public class e907 {
- private final int e907;
- private final List c;
- private final BlockFace b28;
- private final List db;
- private int d07;
- private final List c8f92;
- private int fed;
- private int dac4d;
- private int ea7fc;
- private static boolean e907(Location location, Location location2) {
- if (location.getBlockX() == location2.getBlockX() && location.getBlockY() == location2.getBlockY() && location.getBlockZ() == location2.getBlockZ()) {
- return true;
- }
- return false;
- }
- public e907(int n, List list, BlockFace blockFace) {
- this.db = new ArrayList();
- this.d07 = 0;
- this.c8f92 = new ArrayList();
- this.fed = -1;
- this.dac4d = -1;
- this.e907 = n;
- this.c = list;
- this.b28 = blockFace;
- }
- private void c8f92(int n) {
- this.d07 = n;
- }
- public final int e907() {
- return this.d07;
- }
- public final List c() {
- return this.c;
- }
- public final List b28() {
- ArrayList<ItemFrame> arrayList = new ArrayList<ItemFrame>();
- block0 : for (Location location : this.c) {
- for (Entity entity : location.getChunk().getEntities()) {
- if (!(entity instanceof ItemFrame)) continue;
- Location location2 = location;
- Location location3 = entity.getLocation();
- if (!(location3.getBlockX() == location2.getBlockX() && location3.getBlockY() == location2.getBlockY() && location3.getBlockZ() == location2.getBlockZ())) continue;
- arrayList.add((ItemFrame)entity);
- continue block0;
- }
- Bukkit.getConsoleSender().sendMessage((Object)ChatColor.RED + "[WARNING] [BannerBoard] Itemframe missing at " + location.toString() + ". Please restore the missing itemframe and restart your server to prevent errors.");
- }
- return arrayList;
- }
- public final List e907(int n) {
- if (this.db.isEmpty()) {
- throw new RuntimeException("getMapIds() called before setSlides(), not allowed.");
- }
- return (List)this.db.get(n);
- }
- public final int db() {
- return this.e907;
- }
- public final BlockFace d07() {
- return this.b28;
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final Collection c(int n) {
- List list = this.c8f92;
- synchronized (list) {
- return new ArrayList((Collection)this.c8f92.get(n));
- }
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- private Collection d5bd() {
- ArrayList<BannerBoardRenderer> arrayList = new ArrayList<BannerBoardRenderer>();
- List list = this.c8f92;
- synchronized (list) {
- Iterator iterator = this.c8f92.iterator();
- while (iterator.hasNext()) {
- Object object = (List)iterator.next();
- object = object.iterator();
- while (object.hasNext()) {
- BannerBoardRenderer bannerBoardRenderer = (BannerBoardRenderer)object.next();
- arrayList.add(bannerBoardRenderer);
- }
- }
- }
- return arrayList;
- }
- /*
- * WARNING - Removed try catching itself - possible behaviour change.
- */
- public final void e907(int n, BannerBoardRenderer bannerBoardRenderer) {
- List list = this.c8f92;
- synchronized (list) {
- if (this.c8f92.size() <= n) {
- this.c8f92.add(new ArrayList());
- }
- ((List)this.c8f92.get(n)).add(bannerBoardRenderer);
- return;
- }
- }
- public final int c8f92() {
- if (this.fed != -1) {
- return this.fed;
- }
- Iterator iterator = this;
- iterator = iterator.c;
- int n = Integer.MAX_VALUE;
- int n2 = -2147483647;
- int n3 = Integer.MAX_VALUE;
- int n4 = -2147483647;
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- Location location = (Location)iterator.next();
- if (location.getBlockX() < n) {
- n = location.getBlockX();
- }
- if (location.getBlockX() > n2) {
- n2 = location.getBlockX();
- }
- if (location.getBlockZ() < n3) {
- n3 = location.getBlockZ();
- }
- if (location.getBlockZ() <= n4) continue;
- n4 = location.getBlockZ();
- }
- int n5 = -1;
- if (n3 == n4) {
- n5 = Math.abs(n - n2) + 1;
- }
- if (n == n2) {
- n5 = Math.abs(n3 - n4) + 1;
- }
- this.fed = n5;
- return n5;
- }
- public final int fed() {
- int n;
- if (this.dac4d != -1) {
- return this.dac4d;
- }
- Iterator iterator = this;
- iterator = iterator.c;
- int n2 = Integer.MAX_VALUE;
- int n3 = -2147483647;
- iterator = iterator.iterator();
- while (iterator.hasNext()) {
- Location location = (Location)iterator.next();
- if (location.getBlockY() < n2) {
- n2 = location.getBlockY();
- }
- if (location.getBlockY() <= n3) continue;
- n3 = location.getBlockY();
- }
- this.dac4d = n = Math.abs(n2 - n3) + 1;
- return n;
- }
- public final int dac4d() {
- return this.c8f92() << 7;
- }
- public final int ea7fc() {
- return this.fed() << 7;
- }
- public final BufferedImage e907(Player player, Map map, int n) {
- BufferedImage bufferedImage = new BufferedImage(this.dac4d(), this.ea7fc(), 2);
- Graphics2D graphics2D = bufferedImage.createGraphics();
- try {
- for (BannerBoardRenderer bannerBoardRenderer : this.c(n)) {
- Object object;
- if (bannerBoardRenderer.hasSetting("permission") && !player.hasPermission((String)(object = bannerBoardRenderer.getSetting("permission").getValue()))) continue;
- object = graphics2D.getTransform();
- boolean bl = bannerBoardRenderer.getSetting("angle") != null;
- if (bl) {
- String[] arrstring = bannerBoardRenderer.getSetting("angle").getValue().split(",");
- if (arrstring.length >= 3) {
- AffineTransform affineTransform = new AffineTransform();
- affineTransform.rotate(Math.toRadians(Integer.parseInt(arrstring[0])), Integer.parseInt(arrstring[1]), Integer.parseInt(arrstring[2]));
- graphics2D.transform(affineTransform);
- } else {
- bl = false;
- }
- }
- long l = System.currentTimeMillis();
- bannerBoardRenderer.render(player, bufferedImage, graphics2D);
- Object t = null;
- if (map.containsKey(bannerBoardRenderer.getId())) {
- t = map.get(bannerBoardRenderer.getId());
- }
- bannerBoardRenderer.render(player, bufferedImage, graphics2D, t);
- long l2 = System.currentTimeMillis() - l;
- if (l2 >= 3000) {
- Bukkit.getConsoleSender().sendMessage((Object)ChatColor.RED + "[WARNING] [BannerBoard] Took " + (double)l2 / 1000.0 + " second(s) to render " + bannerBoardRenderer.getClass().getSimpleName() + ", the server might be under heavy load, or did the system time change?");
- }
- if (!bl) continue;
- graphics2D.setTransform((AffineTransform)object);
- }
- BufferedImage bufferedImage2 = bufferedImage;
- return bufferedImage2;
- }
- finally {
- graphics2D.dispose();
- }
- }
- public final void b28(int n) {
- long l = (long)n * 20;
- new c(this).runTaskTimer((Plugin)Main.e907(), l, l);
- }
- public final void db(int n) {
- this.ea7fc = n;
- for (int i = 0; i < n; ++i) {
- if (i >= this.db.size()) {
- this.db.add(new ArrayList());
- }
- List list = this.b28();
- for (int j = 0; j < list.size(); ++j) {
- ((List)this.db.get(i)).add(Main.e907().e907.e907());
- }
- }
- this.d07(0);
- }
- public final int cf79b() {
- if (this.ea7fc == 0) {
- throw new RuntimeException("getSlides() called before setSlides(), not allowed.");
- }
- return this.ea7fc;
- }
- public final void d07(int n) {
- this.d07 = n;
- List list = this.b28();
- for (int i = 0; i < list.size(); ++i) {
- ItemStack itemStack = new ItemStack(Material.MAP, 1, ((Short)this.e907(n).get(i)).shortValue());
- ((ItemFrame)list.get(i)).setItem(itemStack);
- }
- }
- static /* synthetic */ List e907(e907 e9072) {
- return e9072.c;
- }
- public e907() {
- }
- public static Object e907(List object) {
- ArrayList<String> arrayList = new ArrayList<String>();
- object = object.iterator();
- while (object.hasNext()) {
- Location location = (Location)object.next();
- arrayList.add(location.getWorld().getName() + "_" + location.getX() + "_" + location.getY() + "_" + location.getZ() + "_" + location.getYaw() + "_" + location.getPitch());
- }
- return arrayList;
- }
- public static String e907(Location location) {
- return location.getWorld().getName() + "_" + location.getX() + "_" + location.getY() + "_" + location.getZ() + "_" + location.getYaw() + "_" + location.getPitch();
- }
- public static List c(List object) {
- ArrayList<Location> arrayList = new ArrayList<Location>();
- object = object.iterator();
- while (object.hasNext()) {
- String string = (String)object.next();
- arrayList.add(e907.e907(string));
- }
- return arrayList;
- }
- public static Location e907(String arrstring) {
- arrstring = arrstring.split("_");
- int n = arrstring.length - 6;
- StringBuilder stringBuilder = new StringBuilder();
- for (int i = 0; i <= n; ++i) {
- stringBuilder.append(arrstring[i]);
- if (i == n) continue;
- stringBuilder.append('_');
- }
- return new Location(Bukkit.getWorld((String)stringBuilder.toString()), Double.parseDouble(arrstring[n + 1]), Double.parseDouble(arrstring[n + 2]), Double.parseDouble(arrstring[n + 3]), Float.parseFloat(arrstring[n + 4]), Float.parseFloat(arrstring[n + 5]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement