mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-25 10:07:37 +01:00
fixed disappearing markers (webbukkit#2533), many thanks to tiagoad
This commit is contained in:
parent
fadfe1ba09
commit
9cf3b74609
@ -178,6 +178,17 @@ public abstract class DynmapServerInterface {
|
|||||||
* @return block ID, or -1 if chunk at given coordinate isn't loaded
|
* @return block ID, or -1 if chunk at given coordinate isn't loaded
|
||||||
*/
|
*/
|
||||||
public abstract int getBlockIDAt(String wname, int x, int y, int z);
|
public abstract int getBlockIDAt(String wname, int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a sign is at a given coordinate in a given world (if chunk is loaded)
|
||||||
|
* @param wname - world name
|
||||||
|
* @param x - X coordinate
|
||||||
|
* @param y - Y coordinate
|
||||||
|
* @param z - Z coordinate
|
||||||
|
* @return 1 if a sign is at the location, 0 if it's not, -1 if the chunk isn't loaded
|
||||||
|
*/
|
||||||
|
public abstract int isSignAt(String wname, int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current TPS for server (20.0 is nominal)
|
* Get current TPS for server (20.0 is nominal)
|
||||||
* @return ticks per second
|
* @return ticks per second
|
||||||
|
@ -20,9 +20,6 @@ public class MarkerSignManager {
|
|||||||
private static DynmapCore plugin = null;
|
private static DynmapCore plugin = null;
|
||||||
private static String defSignSet = null;
|
private static String defSignSet = null;
|
||||||
|
|
||||||
private static final int SIGNPOST_ID = 63;
|
|
||||||
private static final int WALLSIGN_ID = 68;
|
|
||||||
|
|
||||||
private static class SignRec {
|
private static class SignRec {
|
||||||
String wname;
|
String wname;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
@ -143,14 +140,13 @@ public class MarkerSignManager {
|
|||||||
for(Iterator<Entry<String, SignRec>> iter = sign_cache.entrySet().iterator(); iter.hasNext(); ) {
|
for(Iterator<Entry<String, SignRec>> iter = sign_cache.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
Entry<String, SignRec> ent = iter.next();
|
Entry<String, SignRec> ent = iter.next();
|
||||||
SignRec r = ent.getValue();
|
SignRec r = ent.getValue();
|
||||||
/* If deleted marker, remote */
|
/* If deleted marker, remove */
|
||||||
if(r.m.getMarkerSet() == null) {
|
if(r.m.getMarkerSet() == null) {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Get block ID */
|
if(plugin.getServer().isSignAt(r.wname, r.x, r.y, r.z) == 0) {
|
||||||
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
|
System.out.println("Removing from cache sign " + r.m.getLabel());
|
||||||
if((blkid >= 0) && (blkid != WALLSIGN_ID) && (blkid != SIGNPOST_ID)) {
|
|
||||||
r.m.deleteMarker();
|
r.m.deleteMarker();
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -510,6 +513,20 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
int blkid = this.getBlockIDAt(wname, x, y, z);
|
||||||
|
|
||||||
|
if (blkid == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +146,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -518,6 +521,20 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
int blkid = this.getBlockIDAt(wname, x, y, z);
|
||||||
|
|
||||||
|
if (blkid == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +146,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -523,6 +526,20 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
int blkid = this.getBlockIDAt(wname, x, y, z);
|
||||||
|
|
||||||
|
if (blkid == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -157,6 +157,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -514,6 +517,11 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -141,6 +141,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -494,6 +497,20 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
int blkid = this.getBlockIDAt(wname, x, y, z);
|
||||||
|
|
||||||
|
if (blkid == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -139,6 +139,9 @@ public class DynmapPlugin
|
|||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
private Field displayName = null; // MCPC+ display name
|
||||||
|
|
||||||
|
private static final int SIGNPOST_ID = 63;
|
||||||
|
private static final int WALLSIGN_ID = 68;
|
||||||
|
|
||||||
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
private static final String[] TRIGGER_DEFAULTS = { "blockupdate", "chunkpopulate", "chunkgenerate" };
|
||||||
|
|
||||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||||
@ -497,6 +500,20 @@ public class DynmapPlugin
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
int blkid = this.getBlockIDAt(wname, x, y, z);
|
||||||
|
|
||||||
|
if (blkid == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if((blkid == WALLSIGN_ID) || (blkid == SIGNPOST_ID)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay)
|
public void scheduleServerTask(Runnable run, long delay)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -213,6 +214,22 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int isSignAt(String wname, int x, int y, int z) {
|
||||||
|
World w = getServer().getWorld(wname);
|
||||||
|
if((w != null) && w.isChunkLoaded(x >> 4, z >> 4)) {
|
||||||
|
Block b = w.getBlockAt(x, y, z);
|
||||||
|
BlockState s = b.getState();
|
||||||
|
|
||||||
|
if (s instanceof Sign) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleServerTask(Runnable run, long delay) {
|
public void scheduleServerTask(Runnable run, long delay) {
|
||||||
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, run, delay);
|
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, run, delay);
|
||||||
|
Loading…
Reference in New Issue
Block a user