2010-12-10 07:48:09 +01:00
|
|
|
import java.awt.Color;
|
|
|
|
import java.awt.Graphics2D;
|
|
|
|
import java.awt.RenderingHints;
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import java.awt.image.WritableRaster;
|
|
|
|
import java.io.File;
|
2010-12-05 22:00:52 +01:00
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.FileOutputStream;
|
2010-12-10 07:48:09 +01:00
|
|
|
import java.io.IOException;
|
2010-12-05 22:00:52 +01:00
|
|
|
import java.io.OutputStreamWriter;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.io.Writer;
|
|
|
|
import java.util.Collection;
|
2010-12-10 07:48:09 +01:00
|
|
|
import java.util.Comparator;
|
2010-12-04 14:24:32 +01:00
|
|
|
import java.util.HashMap;
|
2010-12-08 08:18:12 +01:00
|
|
|
import java.util.HashSet;
|
2010-12-04 14:24:32 +01:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.LinkedList;
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
import java.util.List;
|
2010-12-04 14:24:32 +01:00
|
|
|
import java.util.ListIterator;
|
|
|
|
import java.util.NoSuchElementException;
|
2010-12-05 22:00:52 +01:00
|
|
|
import java.util.Scanner;
|
2010-12-04 14:24:32 +01:00
|
|
|
import java.util.Vector;
|
2010-12-05 22:00:52 +01:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
2010-12-04 14:24:32 +01:00
|
|
|
|
2010-12-08 08:18:12 +01:00
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
public class MapManager extends Thread {
|
|
|
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
|
|
|
|
|
|
|
/* dimensions of a map tile */
|
|
|
|
public static final int tileWidth = 128;
|
|
|
|
public static final int tileHeight = 128;
|
|
|
|
|
2010-12-08 08:18:12 +01:00
|
|
|
/* (logical!) dimensions of a zoomed out map tile
|
|
|
|
* must be twice the size of the normal tile */
|
|
|
|
public static final int zTileWidth = 256;
|
|
|
|
public static final int zTileHeight = 256;
|
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
/* lock for our data structures */
|
|
|
|
public static final Object lock = new Object();
|
|
|
|
|
|
|
|
/* a hash table of known MapTiles, by their key (projection coords) */
|
|
|
|
private HashMap<Long, MapTile> tileStore;
|
|
|
|
|
|
|
|
/* a list of MapTiles to be updated */
|
|
|
|
private LinkedList<MapTile> staleTiles;
|
|
|
|
|
|
|
|
/* whether the worker thread should be running now */
|
|
|
|
private boolean running = false;
|
|
|
|
|
|
|
|
/* map x, y, z for projection origin */
|
|
|
|
public static final int anchorx = 0;
|
|
|
|
public static final int anchory = 127;
|
|
|
|
public static final int anchorz = 0;
|
|
|
|
|
|
|
|
/* color database: id -> Color */
|
|
|
|
public HashMap<Integer, Color[]> colors = null;
|
|
|
|
|
|
|
|
/* path to colors.txt */
|
|
|
|
private String colorsetpath = "colors.txt";
|
|
|
|
|
|
|
|
/* path to image tile directory */
|
|
|
|
public String tilepath = "tiles/";
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* path to signs file */
|
|
|
|
public String signspath = "signs.txt";
|
2010-12-05 22:00:52 +01:00
|
|
|
|
|
|
|
/* port to run web server on */
|
|
|
|
public int serverport = 8123;
|
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
/* time to pause between rendering tiles (ms) */
|
|
|
|
public int renderWait = 500;
|
|
|
|
|
|
|
|
/* remember up to this old tile updates (ms) */
|
|
|
|
private static final int maxTileAge = 60000;
|
|
|
|
|
|
|
|
/* this list stores the tile updates */
|
|
|
|
public LinkedList<TileUpdate> tileUpdates = null;
|
|
|
|
|
|
|
|
/* map debugging mode (send debugging messages to this player) */
|
|
|
|
public String debugPlayer = null;
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* hashmap of signs */
|
|
|
|
public HashMap<String, Warp> signs = null;
|
2010-12-04 14:24:32 +01:00
|
|
|
|
2010-12-08 08:18:12 +01:00
|
|
|
/* cache this many zoomed-out tiles */
|
|
|
|
public static final int zoomCacheSize = 64;
|
|
|
|
|
|
|
|
/* zoomed-out tile cache */
|
|
|
|
public Cache<String, BufferedImage> zoomCache;
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
|
|
|
|
/* data source */
|
|
|
|
public String datasource = "flatfile";
|
|
|
|
|
|
|
|
/* which markers to show (spawn,homes,warps,signs,players,all,none) */
|
|
|
|
public String showmarkers = "all";
|
|
|
|
|
|
|
|
/* booleans designating what to show on the map */
|
|
|
|
public Boolean showSpawn = false;
|
|
|
|
public Boolean showHomes = false;
|
|
|
|
public Boolean showWarps = false;
|
|
|
|
public Boolean showSigns = false;
|
|
|
|
public Boolean showPlayers = false;
|
2010-12-08 08:18:12 +01:00
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
public void debug(String msg)
|
|
|
|
{
|
|
|
|
if(debugPlayer == null) return;
|
|
|
|
Server s = etc.getServer();
|
|
|
|
Player p = s.getPlayer(debugPlayer);
|
|
|
|
if(p == null) return;
|
|
|
|
p.sendMessage("Map> " + Colors.Red + msg);
|
|
|
|
}
|
2010-12-05 22:00:52 +01:00
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
public MapManager()
|
|
|
|
{
|
|
|
|
/* load configuration */
|
|
|
|
PropertiesFile properties;
|
|
|
|
|
|
|
|
properties = new PropertiesFile("server.properties");
|
|
|
|
try {
|
|
|
|
tilepath = properties.getString("map-tilepath", "tiles/");
|
|
|
|
colorsetpath = properties.getString("map-colorsetpath", "colors.txt");
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
signspath = properties.getString("map-signspath", "signs.txt");
|
2010-12-05 22:00:52 +01:00
|
|
|
serverport = Integer.parseInt(properties.getString("map-serverport", "8123"));
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
datasource = properties.getString("data-source", "flatfile");
|
|
|
|
showmarkers = properties.getString("map-showmarkers", "all");
|
2010-12-04 14:24:32 +01:00
|
|
|
} catch(Exception ex) {
|
|
|
|
log.log(Level.SEVERE, "Exception while reading properties for dynamic map", ex);
|
|
|
|
}
|
|
|
|
|
|
|
|
tileStore = new HashMap<Long, MapTile>();
|
|
|
|
staleTiles = new LinkedList<MapTile>();
|
|
|
|
tileUpdates = new LinkedList<TileUpdate>();
|
2010-12-08 08:18:12 +01:00
|
|
|
zoomCache = new Cache<String, BufferedImage>(zoomCacheSize);
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
signs = new HashMap<String, Warp>();
|
|
|
|
|
|
|
|
loadShowOptions();
|
2010-12-04 14:24:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tile X for position x */
|
|
|
|
static int tilex(int x)
|
|
|
|
{
|
|
|
|
if(x < 0)
|
|
|
|
return x - (tileWidth + (x % tileWidth));
|
|
|
|
else
|
|
|
|
return x - (x % tileWidth);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tile Y for position y */
|
|
|
|
static int tiley(int y)
|
|
|
|
{
|
|
|
|
if(y < 0)
|
|
|
|
return y - (tileHeight + (y % tileHeight));
|
|
|
|
else
|
|
|
|
return y - (y % tileHeight);
|
|
|
|
}
|
|
|
|
|
2010-12-08 08:18:12 +01:00
|
|
|
/* zoomed-out tile X for tile position x */
|
|
|
|
static int ztilex(int x)
|
|
|
|
{
|
|
|
|
if(x < 0)
|
|
|
|
return x + x % zTileWidth;
|
|
|
|
else
|
|
|
|
return x - (x % zTileWidth);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* zoomed-out tile Y for tile position y */
|
|
|
|
static int ztiley(int y)
|
|
|
|
{
|
|
|
|
if(y < 0)
|
|
|
|
return y + y % zTileHeight;
|
|
|
|
//return y - (zTileHeight + (y % zTileHeight));
|
|
|
|
else
|
|
|
|
return y - (y % zTileHeight);
|
|
|
|
}
|
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
/* initialize and start map manager */
|
|
|
|
public void startManager()
|
|
|
|
{
|
|
|
|
colors = new HashMap<Integer, Color[]>();
|
|
|
|
|
|
|
|
/* load colorset */
|
|
|
|
File cfile = new File(colorsetpath);
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
loadSigns();
|
2010-12-05 22:00:52 +01:00
|
|
|
|
2010-12-04 14:24:32 +01:00
|
|
|
try {
|
|
|
|
Scanner scanner = new Scanner(cfile);
|
|
|
|
int nc = 0;
|
|
|
|
while(scanner.hasNextLine()) {
|
|
|
|
String line = scanner.nextLine();
|
|
|
|
if (line.startsWith("#") || line.equals("")) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
String[] split = line.split("\t");
|
|
|
|
if (split.length < 17) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
Integer id = new Integer(split[0]);
|
|
|
|
|
|
|
|
Color[] c = new Color[4];
|
|
|
|
|
|
|
|
/* store colors by raycast sequence number */
|
|
|
|
c[0] = new Color(Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3]), Integer.parseInt(split[4]));
|
|
|
|
c[3] = new Color(Integer.parseInt(split[5]), Integer.parseInt(split[6]), Integer.parseInt(split[7]), Integer.parseInt(split[8]));
|
|
|
|
c[1] = new Color(Integer.parseInt(split[9]), Integer.parseInt(split[10]), Integer.parseInt(split[11]), Integer.parseInt(split[12]));
|
|
|
|
c[2] = new Color(Integer.parseInt(split[13]), Integer.parseInt(split[14]), Integer.parseInt(split[15]), Integer.parseInt(split[16]));
|
|
|
|
|
|
|
|
colors.put(id, c);
|
|
|
|
nc += 1;
|
|
|
|
}
|
|
|
|
scanner.close();
|
|
|
|
|
|
|
|
log.info(nc + " colors loaded from " + colorsetpath);
|
|
|
|
} catch(Exception e) {
|
|
|
|
log.log(Level.SEVERE, "Failed to load colorset: " + colorsetpath, e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
running = true;
|
|
|
|
this.start();
|
|
|
|
try {
|
|
|
|
this.setPriority(MIN_PRIORITY);
|
|
|
|
log.info("Set minimum priority for worker thread");
|
|
|
|
} catch(SecurityException e) {
|
|
|
|
log.info("Failed to set minimum priority for worker thread!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stop map manager */
|
|
|
|
public void stopManager()
|
|
|
|
{
|
|
|
|
if(!running)
|
|
|
|
return;
|
|
|
|
|
|
|
|
log.info("Stopping map renderer...");
|
|
|
|
running = false;
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.join();
|
|
|
|
} catch(InterruptedException e) {
|
|
|
|
log.info("Waiting for map renderer to stop is interrupted");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the worker/renderer thread */
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
log.info("Map renderer has started.");
|
|
|
|
|
|
|
|
while(running) {
|
|
|
|
MapTile t = this.popStaleTile();
|
|
|
|
if(t != null) {
|
|
|
|
t.render(this);
|
|
|
|
|
|
|
|
long now = System.currentTimeMillis();
|
|
|
|
long deadline = now - maxTileAge;
|
|
|
|
|
|
|
|
/* update the tileupdate list */
|
|
|
|
synchronized(lock) {
|
|
|
|
ListIterator<TileUpdate> it = tileUpdates.listIterator(0);
|
|
|
|
while(it.hasNext()) {
|
|
|
|
TileUpdate tu = it.next();
|
|
|
|
if(tu.at < deadline || tu.tile == t)
|
|
|
|
it.remove();
|
|
|
|
}
|
|
|
|
tileUpdates.addLast(new TileUpdate(now, t));
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.sleep(renderWait);
|
|
|
|
} catch(InterruptedException e) {
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
this.sleep(1000);
|
|
|
|
} catch(InterruptedException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info("Map renderer has stopped.");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* "touch" a block - its map tile will be regenerated */
|
|
|
|
public boolean touch(int x, int y, int z)
|
|
|
|
{
|
|
|
|
int dx = x - anchorx;
|
|
|
|
int dy = y - anchory;
|
|
|
|
int dz = z - anchorz;
|
|
|
|
int px = dx + dz;
|
|
|
|
int py = dx - dz - dy;
|
|
|
|
|
|
|
|
int tx = tilex(px);
|
|
|
|
int ty = tiley(py);
|
|
|
|
|
|
|
|
boolean r;
|
|
|
|
|
|
|
|
r = pushStaleTile(tx, ty);
|
|
|
|
|
|
|
|
boolean ledge = tilex(px - 4) != tx;
|
|
|
|
boolean tedge = tiley(py - 4) != ty;
|
|
|
|
boolean redge = tilex(px + 4) != tx;
|
|
|
|
boolean bedge = tiley(py + 4) != ty;
|
|
|
|
|
|
|
|
if(ledge)
|
|
|
|
r = pushStaleTile(tx - tileWidth, ty) || r;
|
|
|
|
if(redge)
|
|
|
|
r = pushStaleTile(tx + tileWidth, ty) || r;
|
|
|
|
if(tedge)
|
|
|
|
r = pushStaleTile(tx, ty - tileHeight) || r;
|
|
|
|
if(bedge)
|
|
|
|
r = pushStaleTile(tx, ty + tileHeight) || r;
|
|
|
|
|
|
|
|
if(ledge && tedge)
|
|
|
|
r = pushStaleTile(tx - tileWidth, ty - tileHeight) || r;
|
|
|
|
if(ledge && bedge)
|
|
|
|
r = pushStaleTile(tx - tileWidth, ty + tileHeight) || r;
|
|
|
|
if(redge && tedge)
|
|
|
|
r = pushStaleTile(tx + tileWidth, ty - tileHeight) || r;
|
|
|
|
if(redge && bedge)
|
|
|
|
r = pushStaleTile(tx + tileWidth, ty + tileHeight) || r;
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get next MapTile that needs to be regenerated, or null
|
|
|
|
* the mapTile is removed from the list of stale tiles! */
|
|
|
|
public MapTile popStaleTile()
|
|
|
|
{
|
|
|
|
synchronized(lock) {
|
|
|
|
try {
|
|
|
|
MapTile t = staleTiles.removeFirst();
|
|
|
|
t.stale = false;
|
|
|
|
return t;
|
|
|
|
} catch(NoSuchElementException e) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* put a MapTile that needs to be regenerated on the list of stale tiles */
|
|
|
|
public boolean pushStaleTile(MapTile m)
|
|
|
|
{
|
|
|
|
synchronized(lock) {
|
|
|
|
if(m.stale) return false;
|
|
|
|
|
|
|
|
m.stale = true;
|
|
|
|
staleTiles.addLast(m);
|
|
|
|
|
|
|
|
debug(m.toString() + " is now stale");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make a MapTile stale by projection position */
|
|
|
|
public boolean pushStaleTile(int tx, int ty)
|
|
|
|
{
|
|
|
|
return pushStaleTile(getTileByPosition(tx, ty));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get (or create) MapTile by projection position */
|
|
|
|
private MapTile getTileByPosition(int px, int py)
|
|
|
|
{
|
|
|
|
Long key = MapTile.key(px, py);
|
|
|
|
synchronized(lock) {
|
|
|
|
MapTile t = tileStore.get(key);
|
|
|
|
if(t == null) {
|
|
|
|
/* no maptile exists, need to create one */
|
2010-12-08 08:18:12 +01:00
|
|
|
|
|
|
|
t = new MapTile(px, py, ztilex(px), ztiley(py));
|
2010-12-04 14:24:32 +01:00
|
|
|
tileStore.put(key, t);
|
|
|
|
return t;
|
|
|
|
} else {
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return number of stale tiles */
|
|
|
|
public int getStaleCount()
|
|
|
|
{
|
|
|
|
synchronized(lock) {
|
|
|
|
return staleTiles.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return number of recently updated tiles */
|
|
|
|
public int getRecentUpdateCount()
|
|
|
|
{
|
|
|
|
synchronized(lock) {
|
|
|
|
return tileUpdates.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* regenerate the entire map, starting at position */
|
|
|
|
public void regenerate(int x, int y, int z)
|
|
|
|
{
|
|
|
|
int dx = x - anchorx;
|
|
|
|
int dy = y - anchory;
|
|
|
|
int dz = z - anchorz;
|
|
|
|
int px = dx + dz;
|
|
|
|
int py = dx - dz - dy;
|
|
|
|
|
|
|
|
int tx = tilex(px);
|
|
|
|
int ty = tiley(py);
|
|
|
|
|
|
|
|
MapTile first = getTileByPosition(tx, ty);
|
|
|
|
|
|
|
|
Vector<MapTile> open = new Vector<MapTile>();
|
|
|
|
open.add(first);
|
|
|
|
|
|
|
|
Server s = etc.getServer();
|
|
|
|
|
|
|
|
while(open.size() > 0) {
|
|
|
|
MapTile t = open.remove(open.size() - 1);
|
|
|
|
if(t.stale) continue;
|
|
|
|
int h = s.getHighestBlockY(t.mx, t.mz);
|
|
|
|
|
|
|
|
log.info("walking: " + t.mx + ", " + t.mz + ", h = " + h);
|
|
|
|
if(h < 1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
pushStaleTile(t);
|
|
|
|
|
|
|
|
open.add(getTileByPosition(t.px + tileWidth, t.py));
|
|
|
|
open.add(getTileByPosition(t.px - tileWidth, t.py));
|
|
|
|
open.add(getTileByPosition(t.px, t.py + tileHeight));
|
|
|
|
open.add(getTileByPosition(t.px, t.py - tileHeight));
|
|
|
|
}
|
|
|
|
}
|
2010-12-08 08:18:12 +01:00
|
|
|
|
|
|
|
/* regenerate all zoom tiles, starting at position */
|
|
|
|
public void regenerateZoom(int x, int y, int z)
|
|
|
|
{
|
|
|
|
int dx = x - anchorx;
|
|
|
|
int dy = y - anchory;
|
|
|
|
int dz = z - anchorz;
|
|
|
|
int px = dx + dz;
|
|
|
|
int py = dx - dz - dy;
|
|
|
|
|
2010-12-08 08:20:49 +01:00
|
|
|
int fzpx = ztilex(tilex(px));
|
|
|
|
int fzpy = ztiley(tiley(py));
|
2010-12-08 08:18:12 +01:00
|
|
|
|
2010-12-08 08:20:49 +01:00
|
|
|
class Pair implements Comparator {
|
2010-12-08 08:18:12 +01:00
|
|
|
public int x;
|
|
|
|
public int y;
|
|
|
|
public Pair(int x, int y)
|
|
|
|
{
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return (x << 16) ^ y;
|
|
|
|
}
|
|
|
|
|
2010-12-08 08:20:49 +01:00
|
|
|
public boolean equals(Object o)
|
2010-12-08 08:18:12 +01:00
|
|
|
{
|
2010-12-08 08:20:49 +01:00
|
|
|
Pair p = (Pair) o;
|
|
|
|
return x == p.x && y == p.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int compare(Object o1, Object o2)
|
|
|
|
{
|
|
|
|
Pair p1 = (Pair) o1;
|
|
|
|
Pair p2 = (Pair) o2;
|
|
|
|
if(p1.x < p1.x) return -1;
|
|
|
|
if(p1.x > p1.x) return 1;
|
|
|
|
if(p1.y < p1.y) return -1;
|
|
|
|
if(p1.y > p1.y) return 1;
|
|
|
|
return 0;
|
2010-12-08 08:18:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HashSet<Pair> visited = new HashSet<Pair>();
|
2010-12-08 08:20:49 +01:00
|
|
|
Vector<Pair> open = new Vector<Pair>();
|
|
|
|
|
|
|
|
Pair fp = new Pair(fzpx, fzpy);
|
|
|
|
open.add(fp);
|
|
|
|
visited.add(fp);
|
|
|
|
|
|
|
|
while(open.size() > 0) {
|
|
|
|
Pair p = open.remove(open.size() - 1);
|
|
|
|
|
|
|
|
int zpx = p.x;
|
|
|
|
int zpy = p.y;
|
|
|
|
|
|
|
|
log.info("Regenerating zoom tile " + zpx + "," + zpy);
|
|
|
|
|
|
|
|
int g = regenZoomTile(zpx, zpy);
|
|
|
|
|
|
|
|
if(g > 0) {
|
|
|
|
Pair[] np = new Pair[4];
|
|
|
|
np[0] = new Pair(zpx-zTileWidth, zpy);
|
|
|
|
np[1] = new Pair(zpx+zTileWidth, zpy);
|
|
|
|
np[2] = new Pair(zpx, zpy-zTileHeight);
|
|
|
|
np[3] = new Pair(zpx, zpy+zTileHeight);
|
|
|
|
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
if(!visited.contains(np[i])) {
|
|
|
|
visited.add(np[i]);
|
|
|
|
open.add(np[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-08 08:18:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* regenerate zoom-out tile
|
|
|
|
* returns number of valid subtiles */
|
|
|
|
public int regenZoomTile(int zpx, int zpy)
|
|
|
|
{
|
2010-12-08 08:20:49 +01:00
|
|
|
int px1 = zpx + tileWidth;
|
|
|
|
int py1 = zpy;
|
|
|
|
int px2 = zpx;
|
2010-12-08 08:18:12 +01:00
|
|
|
int py2 = py1 + tileHeight;
|
|
|
|
|
|
|
|
MapTile t1 = getTileByPosition(px1, py1);
|
|
|
|
MapTile t2 = getTileByPosition(px2, py1);
|
|
|
|
MapTile t3 = getTileByPosition(px1, py2);
|
|
|
|
MapTile t4 = getTileByPosition(px2, py2);
|
|
|
|
|
|
|
|
BufferedImage im1 = t1.loadTile(this);
|
|
|
|
BufferedImage im2 = t2.loadTile(this);
|
|
|
|
BufferedImage im3 = t3.loadTile(this);
|
|
|
|
BufferedImage im4 = t4.loadTile(this);
|
|
|
|
|
|
|
|
BufferedImage zIm = new BufferedImage(MapManager.tileWidth, MapManager.tileHeight, BufferedImage.TYPE_INT_RGB);
|
|
|
|
WritableRaster zr = zIm.getRaster();
|
|
|
|
Graphics2D g2 = zIm.createGraphics();
|
|
|
|
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
|
|
|
|
|
|
|
int scw = tileWidth / 2;
|
|
|
|
int sch = tileHeight / 2;
|
|
|
|
|
|
|
|
int good = 0;
|
|
|
|
|
|
|
|
if(im1 != null) {
|
|
|
|
g2.drawImage(im1, 0, 0, scw, sch, null);
|
|
|
|
good ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(im2 != null) {
|
|
|
|
g2.drawImage(im2, scw, 0, scw, sch, null);
|
|
|
|
good ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(im3 != null) {
|
|
|
|
g2.drawImage(im3, 0, sch, scw, sch, null);
|
|
|
|
good ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(im4 != null) {
|
|
|
|
g2.drawImage(im4, scw, sch, scw, sch, null);
|
|
|
|
good ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(good == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
String zPath = t1.getZoomPath(this);
|
|
|
|
/* save zoom-out tile */
|
|
|
|
try {
|
|
|
|
File file = new File(zPath);
|
|
|
|
ImageIO.write(zIm, "png", file);
|
|
|
|
log.info("regenZoomTile saved zoom-out tile at " + zPath);
|
|
|
|
} catch(IOException e) {
|
|
|
|
log.log(Level.SEVERE, "Failed to save zoom-out tile: " + zPath, e);
|
|
|
|
} catch(java.lang.NullPointerException e) {
|
|
|
|
log.log(Level.SEVERE, "Failed to save zoom-out tile (NullPointerException): " + zPath, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
return good;
|
|
|
|
}
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* adds a sign to the map */
|
|
|
|
public boolean addSign(Player player, String name, double px, double py, double pz)
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (signs.containsKey(name))
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
player.sendMessage("Map> " + Colors.Red + "Sign \"" + name + "\" already exists.");
|
2010-12-05 22:00:52 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
Warp sign = new Warp();
|
|
|
|
sign.Name = name;
|
|
|
|
sign.Location = new Location(px,py,pz);
|
|
|
|
signs.put(name, sign);
|
2010-12-05 22:00:52 +01:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
saveSigns();
|
2010-12-05 22:00:52 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch(IOException e)
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
log.log(Level.SEVERE, "Failed to save signs.txt", e);
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* removes a sign from the map */
|
|
|
|
public boolean removeSign(Player player, String name)
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (signs.containsKey(name))
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
Warp sign = signs.get(name);
|
|
|
|
|
|
|
|
signs.remove(name);
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
saveSigns();
|
|
|
|
return true;
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
catch(IOException e)
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
log.log(Level.SEVERE, "Failed to save signs.txt", e);
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
player.sendMessage("Map> " + Colors.Red + "Sign \"" + name + "\" does not exist.");
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* teleports a user to a sign */
|
|
|
|
public boolean teleportToSign(Player player, String name)
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (signs.containsKey(name))
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
Warp sign = signs.get(name);
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
player.teleportTo(sign.Location.x, sign.Location.y, sign.Location.z, 0, 0);
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
player.sendMessage("Map> " + Colors.Red + "Sign \"" + name + "\" does not exist.");
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* load the map sign file */
|
|
|
|
private void loadSigns()
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
|
|
|
Scanner scanner = null;
|
|
|
|
try
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
scanner = new Scanner(new FileInputStream(signspath), "UTF-8");
|
2010-12-05 22:00:52 +01:00
|
|
|
while (scanner.hasNextLine())
|
|
|
|
{
|
|
|
|
String line = scanner.nextLine();
|
2010-12-10 07:48:09 +01:00
|
|
|
String[] values = line.split(":");
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
String name = "";
|
|
|
|
Double x = 0.0,y = 0.0,z = 0.0;
|
|
|
|
|
2010-12-10 07:48:09 +01:00
|
|
|
// If user has old style of file (CSV)
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (values.length == 1)
|
2010-12-10 07:48:09 +01:00
|
|
|
{
|
|
|
|
values = line.split(",");
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
// If user has old style of file (owners)
|
2010-12-10 07:48:09 +01:00
|
|
|
if (values.length == 5)
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
name = values[0];
|
|
|
|
x = Double.parseDouble(values[2]);
|
|
|
|
y = Double.parseDouble(values[3]);
|
|
|
|
z = Double.parseDouble(values[4]);
|
|
|
|
}
|
|
|
|
else if (values.length == 4)
|
|
|
|
{
|
|
|
|
name = values[0];
|
|
|
|
x = Double.parseDouble(values[1]);
|
|
|
|
y = Double.parseDouble(values[2]);
|
|
|
|
z = Double.parseDouble(values[3]);
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
log.log(Level.INFO, "Failed to load sign: " + values[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If a sign was loaded, add it to the hash
|
|
|
|
if (name.isEmpty() == false && x != 0.0 && y != 0.0 && z != 0.0)
|
|
|
|
{
|
|
|
|
Warp sign = new Warp();
|
|
|
|
sign.Name = name;
|
|
|
|
sign.Location = new Location(x, y, z);
|
|
|
|
signs.put(sign.Name, sign);
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(FileNotFoundException e)
|
|
|
|
{
|
2010-12-06 01:18:57 +01:00
|
|
|
// No need to log FileNotFoundException
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
if (scanner != null) scanner.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
/* save the map sign file */
|
|
|
|
private void saveSigns() throws IOException
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
|
|
|
Writer out = null;
|
|
|
|
try
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
out = new OutputStreamWriter(new FileOutputStream(signspath), "UTF-8");
|
|
|
|
Collection<Warp> values = signs.values();
|
|
|
|
Iterator<Warp> it = values.iterator();
|
2010-12-05 22:00:52 +01:00
|
|
|
while(it.hasNext())
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
Warp sign = it.next();
|
|
|
|
String line = sign.Name + ":" + sign.Location.x + ":" + sign.Location.y + ":" + sign.Location.z + "\n";
|
2010-12-05 22:00:52 +01:00
|
|
|
out.write(line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(UnsupportedEncodingException e)
|
|
|
|
{
|
|
|
|
log.log(Level.SEVERE, "Unsupported encoding", e);
|
|
|
|
}
|
|
|
|
catch(FileNotFoundException e)
|
|
|
|
{
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
log.log(Level.SEVERE, "signs.txt not found", e);
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
if (out != null) out.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-10 07:48:09 +01:00
|
|
|
/* TODO: Is there a cleaner way to get warps/homes than using custom DataSource classes to expose the protected properties? */
|
|
|
|
|
|
|
|
protected List<Warp> loadWarps()
|
2010-12-05 22:00:52 +01:00
|
|
|
{
|
2010-12-10 07:48:09 +01:00
|
|
|
List<Warp> warps = null;
|
2010-12-05 22:00:52 +01:00
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (datasource.equals("flatfile")) {
|
|
|
|
DMFlatFileSource ds = new DMFlatFileSource();
|
|
|
|
ds.initialize();
|
|
|
|
ds.loadWarps();
|
|
|
|
warps = ds.getAllWarps();
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
else if (datasource.equals("mysql")) {
|
|
|
|
DMMySQLSource ds = new DMMySQLSource();
|
|
|
|
ds.initialize();
|
|
|
|
ds.loadWarps();
|
|
|
|
warps = ds.getAllWarps();
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return warps;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected List<Warp> loadHomes()
|
|
|
|
{
|
|
|
|
List<Warp> homes = null;
|
|
|
|
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
if (datasource.equals("flatfile")) {
|
|
|
|
DMFlatFileSource ds = new DMFlatFileSource();
|
|
|
|
ds.initialize();
|
|
|
|
ds.loadHomes();
|
|
|
|
homes = ds.getAllHomes();
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
else if (datasource.equals("mysql")) {
|
|
|
|
DMMySQLSource ds = new DMMySQLSource();
|
|
|
|
ds.initialize();
|
|
|
|
ds.loadHomes();
|
|
|
|
homes = ds.getAllHomes();
|
2010-12-10 07:48:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return homes;
|
2010-12-05 22:00:52 +01:00
|
|
|
}
|
- Markers are now known as "Signs"
- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
- Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
- New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
- map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
- Internally, signs are now Warp based so no longer owner based
- index.html updated to add divs around checkboxes
- map.js updated to consolidate both players and markers into a single if statement
- checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
- Player list shows/hides based on number of players (or map-showmarkers setting)
2010-12-11 05:56:06 +01:00
|
|
|
|
|
|
|
private void loadShowOptions()
|
|
|
|
{
|
|
|
|
String[] values = showmarkers.split(",");
|
|
|
|
|
|
|
|
for (int i = 0; i < values.length; i++)
|
|
|
|
{
|
|
|
|
String opt = values[i];
|
|
|
|
|
|
|
|
if (opt.equals("all"))
|
|
|
|
{
|
|
|
|
showSpawn = true;
|
|
|
|
showHomes = true;
|
|
|
|
showWarps = true;
|
|
|
|
showSigns = true;
|
|
|
|
showPlayers = true;
|
|
|
|
}
|
|
|
|
else if (opt.equals("none"))
|
|
|
|
{
|
|
|
|
showSpawn = false;
|
|
|
|
showHomes = false;
|
|
|
|
showWarps = false;
|
|
|
|
showSigns = false;
|
|
|
|
showPlayers = false;
|
|
|
|
}
|
|
|
|
else if (opt.equals("spawn"))
|
|
|
|
{
|
|
|
|
showSpawn = true;
|
|
|
|
}
|
|
|
|
else if (opt.equals("homes"))
|
|
|
|
{
|
|
|
|
showHomes = true;
|
|
|
|
}
|
|
|
|
else if (opt.equals("warps"))
|
|
|
|
{
|
|
|
|
showWarps = true;
|
|
|
|
}
|
|
|
|
else if (opt.equals("signs"))
|
|
|
|
{
|
|
|
|
showSigns = true;
|
|
|
|
}
|
|
|
|
else if (opt.equals("players"))
|
|
|
|
{
|
|
|
|
showPlayers = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-04 14:24:32 +01:00
|
|
|
}
|