fixed disappearing markers (webbukkit#2533), many thanks to tiagoad

This commit is contained in:
Gabriel Hautclocq 2019-10-04 00:51:57 +02:00
parent fadfe1ba09
commit 9cf3b74609
9 changed files with 125 additions and 8 deletions

View file

@ -178,6 +178,17 @@ public abstract class DynmapServerInterface {
* @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);
/**
* 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)
* @return ticks per second

View file

@ -19,10 +19,7 @@ public class MarkerSignManager {
private static MarkerSignManager mgr = null;
private static DynmapCore plugin = null;
private static String defSignSet = null;
private static final int SIGNPOST_ID = 63;
private static final int WALLSIGN_ID = 68;
private static class SignRec {
String wname;
int x, y, z;
@ -143,14 +140,13 @@ public class MarkerSignManager {
for(Iterator<Entry<String, SignRec>> iter = sign_cache.entrySet().iterator(); iter.hasNext(); ) {
Entry<String, SignRec> ent = iter.next();
SignRec r = ent.getValue();
/* If deleted marker, remote */
/* If deleted marker, remove */
if(r.m.getMarkerSet() == null) {
iter.remove();
}
else {
/* Get block ID */
int blkid = plugin.getServer().getBlockIDAt(r.wname, r.x, r.y, r.z);
if((blkid >= 0) && (blkid != WALLSIGN_ID) && (blkid != SIGNPOST_ID)) {
if(plugin.getServer().isSignAt(r.wname, r.x, r.y, r.z) == 0) {
System.out.println("Removing from cache sign " + r.m.getLabel());
r.m.deleteMarker();
iter.remove();
}