// Path: src/main/java/me/desht/scrollingmenusign/enums/ViewJustification.java
// public enum ViewJustification {
//     LEFT, RIGHT, CENTER, DEFAULT
// }
// 
// Path: src/main/java/me/desht/scrollingmenusign/views/action/ViewUpdateAction.java
// public abstract class ViewUpdateAction {
// //    private final SMSMenuAction action;
//     private final CommandSender sender;
// 
//     public ViewUpdateAction(CommandSender sender) {
// //        this.action = action;
//         this.sender = sender;
//     }
// 
//     public ViewUpdateAction() {
// //        this.action = action;
//         this.sender = null;
//     }
// //
// //    public SMSMenuAction getAction() {
// //        return action;
// //    }
// 
//     public CommandSender getSender() {
//         return sender;
//     }
// 
//     public static ViewUpdateAction getAction(Object o) {
//         if (o instanceof SMSMenuAction) {
//             switch ((SMSMenuAction) o) {
// //            return new ViewUpdateAction((SMSMenuAction) o, null);
//                 case SCROLLED: return new ScrollAction(null, ScrollAction.ScrollDirection.UNKNOWN);
//                 case REPAINT: return new RepaintAction();
//                 default: return null;
//             }
//         } else if (o instanceof ViewUpdateAction) {
//             return (ViewUpdateAction) o;
//         } else {
//             throw new IllegalArgumentException("Expecting a ViewUpdateAction or SMSMenuAction object");
//         }
//     }
// }


import me.desht.dhutils.ConfigurationManager;
import me.desht.dhutils.LogUtils;
import me.desht.dhutils.MapUtil;
import me.desht.dhutils.PermissionUtils;
import me.desht.scrollingmenusign.*;
import me.desht.scrollingmenusign.enums.ViewJustification;
import me.desht.scrollingmenusign.views.action.ViewUpdateAction;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.map.MapCanvas;
import org.bukkit.map.MapPalette;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Observable;
        Configuration config = ScrollingMenuSign.getInstance().getConfig();

        if (!hasOwnerPermission(player) || !isTypeUsable(player)) {
            BufferedImage di = getDeniedImage();
            if (di != null) {
                g.drawImage(di, 0, 0, null);
            } else {
                drawMessage(g, new String[]{"Access Denied"});
            }
            return result;
        }

        int lineHeight = metrics.getHeight() + getLineSpacing();
        int yPos = getY() + lineHeight;

        // draw the title line(s)
        List<String> titleLines = splitTitle(player);
        for (String line : titleLines) {
            drawText(g, getTitleJustification(), yPos, line);
            yPos += lineHeight;
        }
        Color c = g.getColor();
        g.setColor(MapUtil.getChatColor(7));
        yPos++;
        int lineY = yPos + 1 - lineHeight;
        g.drawLine(x, lineY, x + width, lineY);
        g.setColor(c);

        String prefixNotSel = ScrollingMenuSign.getInstance().getConfigCache().getPrefixNotSelected();
        String prefixSel = ScrollingMenuSign.getInstance().getConfigCache().getPrefixSelected();
// Path: src/main/java/me/desht/scrollingmenusign/enums/ViewJustification.java
// public enum ViewJustification {
//     LEFT, RIGHT, CENTER, DEFAULT
// }
// 
// Path: src/main/java/me/desht/scrollingmenusign/views/action/ViewUpdateAction.java
// public abstract class ViewUpdateAction {
// //    private final SMSMenuAction action;
//     private final CommandSender sender;
// 
//     public ViewUpdateAction(CommandSender sender) {
// //        this.action = action;
//         this.sender = sender;
//     }
// 
//     public ViewUpdateAction() {
// //        this.action = action;
//         this.sender = null;
//     }
// //
// //    public SMSMenuAction getAction() {
// //        return action;
// //    }
// 
//     public CommandSender getSender() {
//         return sender;
//     }
// 
//     public static ViewUpdateAction getAction(Object o) {
//         if (o instanceof SMSMenuAction) {
//             switch ((SMSMenuAction) o) {
// //            return new ViewUpdateAction((SMSMenuAction) o, null);
//                 case SCROLLED: return new ScrollAction(null, ScrollAction.ScrollDirection.UNKNOWN);
//                 case REPAINT: return new RepaintAction();
//                 default: return null;
//             }
//         } else if (o instanceof ViewUpdateAction) {
//             return (ViewUpdateAction) o;
//         } else {
//             throw new IllegalArgumentException("Expecting a ViewUpdateAction or SMSMenuAction object");
//         }
//     }
// }


// Path: src/main/java/me/desht/scrollingmenusign/views/SMSMapView.java
import me.desht.dhutils.ConfigurationManager;
import me.desht.dhutils.LogUtils;
import me.desht.dhutils.MapUtil;
import me.desht.dhutils.PermissionUtils;
import me.desht.scrollingmenusign.*;
import me.desht.scrollingmenusign.enums.ViewJustification;
import me.desht.scrollingmenusign.views.action.ViewUpdateAction;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.map.MapCanvas;
import org.bukkit.map.MapPalette;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Observable;

        Configuration config = ScrollingMenuSign.getInstance().getConfig();

        if (!hasOwnerPermission(player) || !isTypeUsable(player)) {
            BufferedImage di = getDeniedImage();
            if (di != null) {
                g.drawImage(di, 0, 0, null);
            } else {
                drawMessage(g, new String[]{"Access Denied"});
            }
            return result;
        }

        int lineHeight = metrics.getHeight() + getLineSpacing();
        int yPos = getY() + lineHeight;

        // draw the title line(s)
        List<String> titleLines = splitTitle(player);
        for (String line : titleLines) {
            drawText(g, getTitleJustification(), yPos, line);
            yPos += lineHeight;
        }
        Color c = g.getColor();
        g.setColor(MapUtil.getChatColor(7));
        yPos++;
        int lineY = yPos + 1 - lineHeight;
        g.drawLine(x, lineY, x + width, lineY);
        g.setColor(c);

        String prefixNotSel = ScrollingMenuSign.getInstance().getConfigCache().getPrefixNotSelected();
        String prefixSel = ScrollingMenuSign.getInstance().getConfigCache().getPrefixSelected();
        ViewJustification itemJust = getItemJustification();