当前位置: 首页>>代码示例>>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;未经允许,请勿转载。