TownyAdvanced / MapTowny

A Towny add-on Bukkit plugin that enables towns to show up on a web-map.
MIT License
15 stars 17 forks source link

Help with api #48

Open FiLKoNd opened 12 months ago

FiLKoNd commented 12 months ago

Describe the Bug

Expected Behavior

I can't register custom tooltip replacements. Log: java.lang.ClassCastException: class me.silverwolfg11.maptowny.MapTowny cannot be cast to class me.silverwolfg11.maptowny.MapTownyPlugin (me.silverwolfg11.maptowny.MapTowny is in unnamed module of loader 'maptowny-2.2.0.jar' @35e6ff92; me.silverwolfg11.maptowny.MapTownyPlugin is in unnamed module of loader 'Town-Buy.jar' @73c8de3d)

Code:

   private void setupDynMap(){
        Plugin plugin = Bukkit.getPluginManager().getPlugin("MapTowny");
        if(plugin != null){
            MapTownyPlugin mapTownyPlugin = (MapTownyPlugin) plugin;
            mapTownyPlugin.getLayerManager().registerReplacement("town_price",
                (town) -> townsConfig.getTownPrice(town).toString());
        }
        else MessageUtils.msgToConsole("&cMapTowny не обнаружен.");
    }

Plugin Version

2.2.0

Towny Version

Towny-0.99.5.0

DynMap Version

Dynmap-3.6-spigot

Server Software Version

Paper 1.19.4#72

Additional Comments

silverwolfg11 commented 8 months ago

Hi, sorry for the really late response.

I'm not able to reproduce this issue. Some followup questions: are you shading in MapTowny into your jar? Are you depending on the maptowny-api?