org.dynmap.DynmapCommonAPI Java Examples

The following examples show how to use org.dynmap.DynmapCommonAPI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Civs.java    From Civs with GNU General Public License v3.0 6 votes vote down vote up
private void setupDependencies() {
    if (Bukkit.getPluginManager().isPluginEnabled(Constants.PLACEHOLDER_API)) {
        new PlaceHook().register();
        placeholderAPI = (PlaceholderAPIPlugin) Bukkit.getPluginManager().getPlugin(Constants.PLACEHOLDER_API);
    }
    if (Bukkit.getPluginManager().isPluginEnabled("MMOItems")) {
        mmoItems = MMOItems.plugin;
    }
    if (Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) {
        discordSRV = DiscordSRV.getPlugin();
    }
    Bukkit.getPluginManager().registerEvents(new DynmapHook(), this);
    if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) {
        DynmapHook.dynmapCommonAPI = (DynmapCommonAPI) Bukkit.getPluginManager().getPlugin("dynmap");
        DynmapHook.initMarkerSet();
    }
}
 
Example #2
Source File: CivilianListener.java    From Civs with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onPluginEnable(PluginEnableEvent event) {
    if ("dynmap".equalsIgnoreCase(event.getPlugin().getName())) {
        DynmapHook.dynmapCommonAPI = (DynmapCommonAPI) event.getPlugin();
        DynmapHook.initMarkerSet();
        return;
    }
    if (Constants.PLACEHOLDER_API.equals(event.getPlugin().getName()) &&
            Bukkit.getPluginManager().isPluginEnabled(Constants.PLACEHOLDER_API)) {
        new PlaceHook().register();
        Civs.placeholderAPI = (PlaceholderAPIPlugin) event.getPlugin();
        return;
    }
    if ("MMOItems".equals(event.getPlugin().getName()) &&
            Bukkit.getPluginManager().isPluginEnabled("MMOItems")) {
        Civs.mmoItems = MMOItems.plugin;
        return;
    }
    if ("DiscordSRV".equals(event.getPlugin().getName()) &&
            Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) {
        Civs.discordSRV = DiscordSRV.getPlugin();
        return;
    }
}
 
Example #3
Source File: DynmapProvider.java    From GriefDefender with MIT License 5 votes vote down vote up
public DynmapProvider() {
    this.logger = GriefDefenderPlugin.getInstance().getLogger();
    logger.info("Initializing GriefDefender Dynmap provider...");
    DynmapCommonAPIListener.register(new DynmapCommonAPIListener() {
        @Override
        public void apiEnabled(DynmapCommonAPI api) {
            dynmap = api;
            cfg = GriefDefenderPlugin.getGlobalConfig().getConfig().dynmap;
            activate();
        }
    });
}
 
Example #4
Source File: DynmapProvider.java    From GriefDefender with MIT License 5 votes vote down vote up
public DynmapProvider() {
    this.logger = GriefDefenderPlugin.getInstance().getLogger();
    logger.info("Initializing GriefDefender Dynmap provider...");
    DynmapCommonAPIListener.register(new DynmapCommonAPIListener() {
        @Override
        public void apiEnabled(DynmapCommonAPI api) {
            dynmap = api;
            cfg = GriefDefenderPlugin.getGlobalConfig().getConfig().dynmap;
            activate();
        }
    });
}
 
Example #5
Source File: DynmapService.java    From EagleFactions with MIT License 5 votes vote down vote up
public void activate()
{
    DynmapCommonAPIListener.register(new DynmapCommonAPIListener() {
        @Override
        public void apiEnabled(DynmapCommonAPI api) {
            markerapi = api.getMarkerAPI();
            markerSet = DynmapService.markerapi.createMarkerSet("purpleflag", "EagleFactions", DynmapService.markerapi.getMarkerIcons(), false);

            Task.builder().execute(new DynmapUpdateTask())
                    .interval(10, TimeUnit.SECONDS)
                    .name("EagleFactions Dynmap Update Task")
                    .submit(plugin);
        }
    });
}
 
Example #6
Source File: DynmapHook.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
public DynmapHook() {
    DynmapCommonAPIListener.register(new DynmapCommonAPIListener() {
        @Override
        public void apiEnabled(DynmapCommonAPI api) {
            Dyn = api;
            MApi = Dyn.getMarkerAPI();
            MSet = MApi.getMarkerSet(RedProtect.get().config.configRoot().hooks.dynmap.marks_groupname);
            if (MSet == null) {
                MSet = MApi.createMarkerSet("RedProtect", RedProtect.get().config.configRoot().hooks.dynmap.marks_groupname, null, false);
            }
            MSet.setHideByDefault(RedProtect.get().config.configRoot().hooks.dynmap.hide_by_default);
            MSet.setLayerPriority(RedProtect.get().config.configRoot().hooks.dynmap.layer_priority);
            MSet.setLabelShow(RedProtect.get().config.configRoot().hooks.dynmap.show_label);
            MSet.setDefaultMarkerIcon(MApi.getMarkerIcon(RedProtect.get().config.configRoot().hooks.dynmap.marker.get("player").marker_icon));
            int minzoom = RedProtect.get().config.configRoot().hooks.dynmap.min_zoom;
            if (minzoom > 0) {
                MSet.setMinZoom(minzoom);
            } else {
                MSet.setMinZoom(0);
            }

            //start set markers
            for (World w : RedProtect.get().getServer().getWorlds()) {
                for (Region r : RedProtect.get().rm.getRegionsByWorld(w.getName())) {
                    if (!r.allowDynmap()) continue;
                    addMark(r);
                }
            }
        }
    });
}
 
Example #7
Source File: DynmapHook.java    From DiscordSRV with GNU General Public License v3.0 4 votes vote down vote up
public void broadcastMessageToDynmap(String name, String message) {
    DynmapCommonAPI api = (DynmapCommonAPI) getPlugin();
    api.sendBroadcastToWeb(name, message);
}