本文整理汇总了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);
}
});
}
}
示例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;
}
}
}
示例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()]);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例7: RenderData
import org.bukkit.map.MapCursor; //导入依赖的package包/类
public RenderData() {
this.buffer = new byte[128 * 128];
this.cursors = new ArrayList<MapCursor>();
}
示例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;
}
示例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;
}
示例10: getReturnType
import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Override
public Class<? extends MapCursor> getReturnType() {
return MapCursor.class;
}
示例11: TeamCursor
import org.bukkit.map.MapCursor; //导入依赖的package包/类
public TeamCursor(MapCursor.Type type, int direction) {
this.type = type;
this.direction = (byte)direction;
}
示例12: MapCursor
import org.bukkit.map.MapCursor; //导入依赖的package包/类
@Deprecated public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
}
示例13: getType
import org.bukkit.map.MapCursor; //导入依赖的package包/类
public MapCursor.Type getType() {
return null;
}
示例14: setType
import org.bukkit.map.MapCursor; //导入依赖的package包/类
public void setType(MapCursor.Type type) {
}
示例15: getCursor
import org.bukkit.map.MapCursor; //导入依赖的package包/类
public MapCursor getCursor(int index) {
return null;
}