当前位置: 首页>>代码示例>>Java>>正文


Java MapCursor类代码示例

本文整理汇总了Java中org.bukkit.map.MapCursor的典型用法代码示例。如果您正苦于以下问题:Java MapCursor类的具体用法?Java MapCursor怎么用?Java MapCursor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapCursor类属于org.bukkit.map包,在下文中一共展示了MapCursor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
protected void execute(Event e) {
	SkellettMapRenderer render = SkellettMapRenderer.getRenderer(map.getSingle(e));
	if (render != null) {
		render.update(new MapRenderTask() {
			@SuppressWarnings("deprecation")
			@Override
			public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
				MapCursor cursor = new MapCursor((byte)x.getSingle(e).intValue(), (byte)y.getSingle(e).intValue(), (byte)direction.getSingle(e).intValue(), (byte) 2, true);
				try {
					MapCursor.Type type = MapCursor.Type.valueOf(cursorType.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
					if (type != null) {
						cursor.setType(type);
					}
				} catch (IllegalArgumentException error) {
					Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cUnknown mapcursor type " + cursorType.getSingle(e)));
					return;
				}
				mapCanvas.getCursors().addCursor(cursor);
			}
		});
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:24,代码来源:EffMapDrawCursor.java

示例2: change

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	String input = (String)delta[0];
	if (mode == ChangeMode.SET) {
		try {
			MapCursor.Type type = MapCursor.Type.valueOf(input.replace("\"", "").trim().replace(" ", "_").toUpperCase());
			if (type != null) {
				cursor.getSingle(e).setType(type);
			}
		} catch (IllegalArgumentException error) {
			Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cUnknown mapcursor type " + input));
			return;
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:16,代码来源:ExprCursorType.java

示例3: get

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
@Nullable
protected MapCursor[] get(Event e) {
	ArrayList<MapCursor> cursors = new ArrayList<MapCursor>();
	MapCursorCollection collection = SkellettMapRenderer.getCanvas(map.getSingle(e)).getCursors();
	for (int i = 0; i < collection.size(); i++) {
		cursors.add(collection.getCursor(i));
	}
	return cursors.toArray(new MapCursor[cursors.size()]);
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:11,代码来源:ExprMapCursors.java

示例4: setCursors

import org.bukkit.map.MapCursor; //导入依赖的package包/类
/**
 * Places the beacon cursors on the map
 * @param canvas
 * @param coordConverter
 * @param cursors
 * @param showUnclaimedBeacons
 */
@SuppressWarnings("deprecation")
private void setCursors(MapCanvas canvas, MapCoordinateConverter coordConverter, MapCursorCollection cursors, boolean showUnclaimedBeacons) {
    for (int i = 0; i < cursors.size(); i++) {
        cursors.removeCursor(cursors.getCursor(i));
    }
    for (Map.Entry<Point2D, CachedBeacon> entry : beaconRegisterCache.entrySet()) {
        Team team = entry.getValue().owner;
        if (!showUnclaimedBeacons && team == null) continue;
        Point2D point = entry.getKey();
        int x = coordConverter.blockXToPixelX((int) point.getX());
        if (x < 0 || x > 127) continue;
        int z = coordConverter.blockZToPixelZ((int) point.getY());
        if (z < 0 || z > 127) continue;
        // Only add cursors to the portion of the map that has been discovered
        if (canvas.getBasePixel(x, z) != 0) {
            x = x * 2 - 128; // Pixels range from 0 to 127, but cursors range from -128 to 127. (wtf)
            z = z * 2 - 128;
            int color = 16;
            if (team != null) {
                Scorecard sc = beaconz.getGameMgr().getSC(point);
                if (sc != null && sc.getBlockID(team) != null) {
                    color = sc.getBlockID(team).getData();
                }
            }
            TeamCursor teamCursor = TEAM_CURSORS[color];
            MapCursor cursor = cursors.addCursor(x, z, (byte)0);
            cursor.setDirection(teamCursor.direction);
            cursor.setType(teamCursor.type);
        }
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:39,代码来源:TerritoryMapRenderer.java

示例5: sendMap

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
public void sendMap(MapView map) {
    if (getHandle().playerConnection == null) return;

    RenderData data = ((CraftMapView) map).render(this);
    Collection<MapIcon> icons = new ArrayList<MapIcon>();
    for (MapCursor cursor : data.cursors) {
        if (cursor.isVisible()) {
            icons.add(new MapIcon(cursor.getRawType(), cursor.getX(), cursor.getY(), cursor.getDirection()));
        }
    }

    PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), map.getScale().getValue(), icons, data.buffer, 0, 0, 0, 0);
    getHandle().playerConnection.sendPacket(packet);
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:16,代码来源:CraftPlayer.java

示例6: sendMap

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
public void sendMap(MapView map) {
    if (getHandle().playerConnection == null) return;

    RenderData data = ((CraftMapView) map).render(this);
    Collection<MapIcon> icons = new ArrayList<MapIcon>();
    for (MapCursor cursor : data.cursors) {
        if (cursor.isVisible()) {
            icons.add(new MapIcon(cursor.getRawType(), cursor.getX(), cursor.getY(), cursor.getDirection()));
        }
    }

    PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), map.getScale().getValue(), true, icons, data.buffer, 0, 0, 0, 0);
    getHandle().playerConnection.sendPacket(packet);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:16,代码来源:CraftPlayer.java

示例7: RenderData

import org.bukkit.map.MapCursor; //导入依赖的package包/类
public RenderData() {
    this.buffer = new byte[128 * 128];
    this.cursors = new ArrayList<MapCursor>();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:5,代码来源:RenderData.java

示例8: init

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
	cursor = (Expression<MapCursor>) e[0];
	return true;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:6,代码来源:ExprCursorVisible.java

示例9: init

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
	cursor = (Expression<MapCursor>) e[0];
	marker = parser.mark;
	return true;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprCursorCoordinate.java

示例10: getReturnType

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
public Class<? extends MapCursor> getReturnType() {
	return MapCursor.class;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:5,代码来源:ExprMapCursors.java

示例11: TeamCursor

import org.bukkit.map.MapCursor; //导入依赖的package包/类
public TeamCursor(MapCursor.Type type, int direction) {
    this.type = type;
    this.direction = (byte)direction;
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:5,代码来源:TerritoryMapRenderer.java

示例12: MapCursor

import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Deprecated public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:3,代码来源:MapCursor.java

示例13: getType

import org.bukkit.map.MapCursor; //导入依赖的package包/类
public MapCursor.Type getType() {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:MapCursor.java

示例14: setType

import org.bukkit.map.MapCursor; //导入依赖的package包/类
public void setType(MapCursor.Type type) {
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:3,代码来源:MapCursor.java

示例15: getCursor

import org.bukkit.map.MapCursor; //导入依赖的package包/类
public MapCursor getCursor(int index) {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:MapCursorCollection.java


注:本文中的org.bukkit.map.MapCursor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。