本文整理汇总了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()));
}
示例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;
}
示例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);
}
}
示例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.");
}
}
示例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());
}
}
示例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;
}
示例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);
}
}
}
}
}
示例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);
}
示例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;
}
示例10: set
import org.bukkit.map.MapView; //导入方法依赖的package包/类
public void set(MapView mw)
{
for (MapRenderer mr : mw.getRenderers())
mw.removeRenderer(mr);
mw.addRenderer(this);
}
示例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;
}
示例12: clearRender
import org.bukkit.map.MapView; //导入方法依赖的package包/类
public void clearRender(MapView view) {
for (MapRenderer render : view.getRenderers()) view.removeRenderer(render);
}
示例13: applyToMap
import org.bukkit.map.MapView; //导入方法依赖的package包/类
public void applyToMap(MapView map) {
for (MapRenderer renderer : map.getRenderers()) {
map.removeRenderer(renderer);
}
map.addRenderer(this);
}