當前位置: 首頁>>代碼示例>>Java>>正文


Java MapView.getRenderers方法代碼示例

本文整理匯總了Java中org.bukkit.map.MapView.getRenderers方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.getRenderers方法的具體用法?Java MapView.getRenderers怎麽用?Java MapView.getRenderers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.map.MapView的用法示例。


在下文中一共展示了MapView.getRenderers方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMapHold

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Make sure all player held maps have triangle overlays. (todo: make sure all maps on item frames do as well)
 * There seem to be some bugs around this. It doesn't always take on the first try.
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled=true)
public void onMapHold(final PlayerItemHeldEvent event) {
    Player player = event.getPlayer();
    ItemStack itemInHand = player.getInventory().getItem(event.getNewSlot());
    if (itemInHand == null) return;
    if (!Material.MAP.equals(itemInHand.getType())) {
        return;
    }
    if (!player.getWorld().equals(getBeaconzWorld())) {
        return;
    }
    @SuppressWarnings("deprecation")
    MapView map = Bukkit.getMap(itemInHand.getDurability());
    for (MapRenderer renderer : map.getRenderers()) {
        if (renderer instanceof TerritoryMapRenderer) {
            return;
        }
    }
    map.addRenderer(new TerritoryMapRenderer(getBeaconzPlugin()));
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:25,代碼來源:BeaconLinkListener.java

示例2: getMapView

import org.bukkit.map.MapView; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected MapView getMapView() {
    if (!enabled) {
        return null;
    }
    MapView mapView = Bukkit.getMap(id);
    if (mapView == null) {
        enabled = false;
        controller.warning("Failed to get map id " + id + " for key " + getKey() + ", disabled, use 'mmap fix' to re-enable");
        return null;
    }
    List<MapRenderer> renderers = mapView.getRenderers();
    boolean needsRenderer = false;
    for (MapRenderer renderer : renderers) {
        if (!(renderer instanceof URLMap)) {
            mapView.removeRenderer(renderer);
            needsRenderer = true;
        }
    }
    if (needsRenderer) {
        mapView.addRenderer(this);
    }
    return mapView;
}
 
開發者ID:elBukkit,項目名稱:MagicLib,代碼行數:25,代碼來源:URLMap.java

示例3: deleteMap

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Delete image map
 * @param mapView map view to remove map
 */
public void deleteMap(MapView mapView) {
    short mapId = mapView.getId();
    List<MapRenderer> renderers = mapView.getRenderers();
    File fileName = new File(ConfigProvider.getImgFolder(), mapId + ".png");
    if (fileName.exists()) {
        fileName.delete();
    }
    for (MapRenderer r : renderers) {
        mapView.removeRenderer(r);
    }

    synchronized (m_mapList) {
        Integer key = (int) mapId;
        if (!m_mapList.containsKey(key)) {
            return;
        }
        renderers = m_mapList.get(key);
        for (MapRenderer mapRenderer : renderers) {
            mapView.addRenderer(mapRenderer);
        }

        m_mapList.remove(key);
    }
}
 
開發者ID:SBPrime,項目名稱:MCPainter,代碼行數:29,代碼來源:MapHelper.java

示例4: storeMap

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Store map image on disk
 * @param mapView map to store
 * @param img current map image
 */
public void storeMap(MapView mapView, BufferedImage img) {
    List<MapRenderer> renderers = mapView.getRenderers();
    short mapId = mapView.getId();

    for (MapRenderer r : renderers) {
        mapView.removeRenderer(r);
    }

    synchronized (m_mapList) {
        Integer key = (int) mapId;
        if (!m_mapList.containsKey(key)) {
            m_mapList.put(key, renderers);
        }
    }

    File fileName = new File(ConfigProvider.getImgFolder(), mapId + ".png");
    try {
        ImageIO.write(img, "png", fileName);
    } catch (IOException ex) {
        ExceptionHelper.printException(ex, "Error storing map image.");
    }
}
 
開發者ID:SBPrime,項目名稱:MCPainter,代碼行數:28,代碼來源:MapHelper.java

示例5: createHandler

import org.bukkit.map.MapView; //導入方法依賴的package包/類
public static void createHandler(MapView mapView, boolean overwrite) {
	if (mapView != null) {
		if (overwrite && mapView.getRenderers() != null) {
			for (MapRenderer renderer : mapView.getRenderers()) {
				mapView.removeRenderer(renderer);
			}
		}
		mapView.addRenderer(new SkellettMapRenderer());
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:11,代碼來源:SkellettMapRenderer.java

示例6: getRenderer

import org.bukkit.map.MapView; //導入方法依賴的package包/類
public static SkellettMapRenderer getRenderer(MapView mapView) {
	if (mapView == null || mapView.getRenderers() == null) {
		return null;
	}
	for (MapRenderer renderer : mapView.getRenderers()) {
		if (renderer instanceof SkellettMapRenderer) {
			return (SkellettMapRenderer)renderer;
		}
	}
	return null;
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:12,代碼來源:SkellettMapRenderer.java

示例7: removeMapRenderers

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Removed Beaconz renderers from maps when the plugin is disabled
 */
public void removeMapRenderers() {
    for (Short id : beaconMaps.keySet()) {
        MapView map = Bukkit.getMap(id);
        if (map != null) {
            for (MapRenderer renderer : map.getRenderers()) {
                if (renderer instanceof TerritoryMapRenderer || renderer instanceof BeaconMap) {
                    map.removeRenderer(renderer);
                }
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:16,代碼來源:Register.java

示例8: changeToSwuMap

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Changes the given MapView to render a ChunkInfo map.
 * 
 * Removes any other renderer from the MapView and adds the
 * ChunkInfoRenderer as the only new one.
 * 
 * @param map
 *            The MapView to change.
 */
public void changeToSwuMap(MapView map) {
    if (map.isVirtual())
        return;

    for (MapRenderer renderer : map.getRenderers()) {
        map.removeRenderer(renderer);
    }

    map.addRenderer(mapRenderer);
}
 
開發者ID:hapm,項目名稱:swu,代碼行數:20,代碼來源:SmoothWorldUpdaterPlugin.java

示例9: applyToMap

import org.bukkit.map.MapView; //導入方法依賴的package包/類
static MapView applyToMap(MapView map, BufferedImage image) {
    for (MapRenderer renderer : map.getRenderers())
        map.removeRenderer(renderer);

    map.addRenderer(new ImageRenderer(image));

    return map;
}
 
開發者ID:DemigodsRPG,項目名稱:CensoredLib,代碼行數:9,代碼來源:BukkitImageUtil.java

示例10: set

import org.bukkit.map.MapView; //導入方法依賴的package包/類
public void set(MapView mw)
{
	for (MapRenderer mr : mw.getRenderers())
		mw.removeRenderer(mr);
	mw.addRenderer(this);
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:7,代碼來源:BPMapRenderer.java

示例11: regenerate

import org.bukkit.map.MapView; //導入方法依賴的package包/類
/**
 * Resets an existing game
 * The idea is that all current beacons will be removed
 * and the region will regenerate "fresh"
 * @param sender
 */
public void regenerate(CommandSender sender) {
    // Set restart flag as true
    gameRestart = true;
    // Move all players in game to lobby
    for (Player player : getServer().getOnlinePlayers()) {
        if (getRegion().isPlayerInRegion(player)) {
            // Clear inventories
            player.getInventory().clear();
            sendToLobby(player);
        }
    }
    // Delete the teams
    scorecard.deleteTeamMembers();
    
    // Handle maps 
    Iterator<Short> it = getRegister().getBeaconMapIndex().iterator();
    while (it.hasNext()) {
        short index = it.next();
        MapView map = Bukkit.getMap(index);
        if (map != null && (map.getWorld().equals(getBeaconzWorld()) && getRegion().containsPoint(map.getCenterX(), map.getCenterZ()))) {
            for (MapRenderer renderer : map.getRenderers()) {
                if (renderer instanceof TerritoryMapRenderer || renderer instanceof BeaconMap) {
                    map.removeRenderer(renderer);
                }
            }
            it.remove();
        }
    }
    // set all beacons to "unowned"
    for (BeaconObj beacon : getRegister().getBeaconRegister().values()) {
        if (this.getRegion().containsBeacon(beacon)) {
            getRegister().removeBeaconOwnership(beacon, true);
        }
    }
    getRegister().saveRegister();
    region.regenerate(sender, "");
    startTime = ((System.currentTimeMillis()+500)/1000)*1000;
    scorecard.reload();
    getBeaconzStore().removeGame(gameName);
    save();
    // Set restart flag as true
    gameRestart = false;
    // It's not over
    isOver = false;
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:52,代碼來源:Game.java

示例12: clearRender

import org.bukkit.map.MapView; //導入方法依賴的package包/類
public void clearRender(MapView view) {
	for (MapRenderer render : view.getRenderers()) view.removeRenderer(render);
}
 
開發者ID:imfanhua,項目名稱:Minecraft-UAPI,代碼行數:4,代碼來源:MapManager.java

示例13: applyToMap

import org.bukkit.map.MapView; //導入方法依賴的package包/類
public void applyToMap(MapView map) {
	for (MapRenderer renderer : map.getRenderers()) {
		map.removeRenderer(renderer);
	}
	map.addRenderer(this);
}
 
開發者ID:MeRPG2,項目名稱:EndHQ-Libraries,代碼行數:7,代碼來源:ImageRenderer.java


注:本文中的org.bukkit.map.MapView.getRenderers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。