Add support for multiple world event markers
This commit is contained in:
parent
dc66a79ef7
commit
31efd50489
|
@ -79,7 +79,7 @@ public class ItemMapRenderer extends MapRenderer
|
|||
|
||||
int scale = info.getScale();
|
||||
int zoom = _itemMap.getZoom(scale);
|
||||
|
||||
|
||||
Byte[][] map = _itemMap.getMap(scale);
|
||||
|
||||
int centerX = info.getX() / zoom;
|
||||
|
@ -113,12 +113,12 @@ public class ItemMapRenderer extends MapRenderer
|
|||
Location location = new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ);
|
||||
|
||||
boolean safezone = _safezone.isInSafeZone(location);
|
||||
|
||||
|
||||
if (safezone)
|
||||
{
|
||||
boolean colorAll = scale > 0;
|
||||
Color areaColor = Color.GREEN;
|
||||
|
||||
|
||||
if (areaColor != null)
|
||||
{
|
||||
if (!((color <= -113 || color >= 0) && color <= 127))
|
||||
|
@ -128,15 +128,11 @@ public class ItemMapRenderer extends MapRenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
// int chunkBX = blockX & 0xF;
|
||||
// int chunkBZ = blockZ & 0xF;
|
||||
// int chunkBX = blockX & 0xF;
|
||||
// int chunkBZ = blockZ & 0xF;
|
||||
|
||||
// Border
|
||||
if (
|
||||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX - 1, STANDARD_Y, blockZ)) ||
|
||||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ - 1)) ||
|
||||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX + 16, STANDARD_Y, blockZ)) ||
|
||||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ + 1)))
|
||||
if (_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX - 1, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ - 1)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX + 16, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ + 1)))
|
||||
{
|
||||
Color cColor = MapPalette.getColor(color);
|
||||
double clans = colorAll ? 1 : 0.8;
|
||||
|
@ -157,7 +153,8 @@ public class ItemMapRenderer extends MapRenderer
|
|||
double clans = 0.065;
|
||||
|
||||
// Stripes
|
||||
//boolean checker = (mapX + (mapZ % 4)) % 4 == 0;
|
||||
// boolean checker = (mapX + (mapZ % 4))
|
||||
// % 4 == 0;
|
||||
double base = 1 - clans;
|
||||
|
||||
int r = (int) ((cColor.getRed() * base) + (areaColor.getRed() * clans));
|
||||
|
@ -194,34 +191,37 @@ public class ItemMapRenderer extends MapRenderer
|
|||
|
||||
for (WorldEvent event : _worldEvent.getActiveEvents())
|
||||
{
|
||||
if (!event.isInProgress())
|
||||
if (!event.isInProgress() || event.getEventLocations() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location point = event.getCurrentLocation();
|
||||
double mapX = (point.getX() - info.getX()) / zoom;
|
||||
double mapZ = (point.getZ() - info.getZ()) / zoom;
|
||||
|
||||
// To make these appear at the edges of the map, just change it from
|
||||
// 64 to something like 128 for double the map size
|
||||
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
|
||||
for (Location point : event.getEventLocations())
|
||||
{
|
||||
byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D);
|
||||
byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D);
|
||||
double mapX = (point.getX() - info.getX()) / zoom;
|
||||
double mapZ = (point.getZ() - info.getZ()) / zoom;
|
||||
|
||||
byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png
|
||||
// Those are byte 5 and 6
|
||||
byte rotation = (byte) (int) ((point.getYaw() * 16D) / 360D);
|
||||
// To make these appear at the edges of the map, just change it
|
||||
// from
|
||||
// 64 to something like 128 for double the map size
|
||||
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
|
||||
{
|
||||
byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D);
|
||||
byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D);
|
||||
|
||||
MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true);
|
||||
byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png
|
||||
// Those are byte 5 and 6
|
||||
byte rotation = (byte) (int) (((point.getYaw() + 180) * 16D) / 360D);
|
||||
|
||||
cursors.addCursor(cursor);
|
||||
MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true);
|
||||
|
||||
cursors.addCursor(cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SupplyDrop supplyDrop = _supply.getActive();
|
||||
|
||||
|
||||
if (_supply.isActive())
|
||||
{
|
||||
Location point = supplyDrop.getCurrentLocation();
|
||||
|
@ -247,7 +247,7 @@ public class ItemMapRenderer extends MapRenderer
|
|||
|
||||
Party party = _party.getPartyByPlayer(player);
|
||||
Set<UUID> shownPlayers = _loot.getShownPlayers();
|
||||
|
||||
|
||||
for (Player other : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.canSee(other) && other.isValid())
|
||||
|
@ -258,7 +258,7 @@ public class ItemMapRenderer extends MapRenderer
|
|||
double mapZ = (l.getZ() - info.getZ()) / zoom;
|
||||
|
||||
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
|
||||
{
|
||||
{
|
||||
MapCursor.Type cursorDisplay = null;
|
||||
|
||||
if (player.equals(other))
|
||||
|
@ -273,7 +273,7 @@ public class ItemMapRenderer extends MapRenderer
|
|||
{
|
||||
cursorDisplay = MapCursor.Type.GREEN_POINTER;
|
||||
}
|
||||
|
||||
|
||||
if (cursorDisplay == null)
|
||||
{
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue