mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Merge pull request #2710 from MitchTalmadge/v3.0
Use Material instead of Block ID in SignChangeEvent and BlockEvent (Fixes #2699)
This commit is contained in:
commit
96aa816227
@ -84,7 +84,7 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
*/
|
||||
public static abstract class EnableCoreCallbacks {
|
||||
/**
|
||||
* Called during enableCore to report that confniguration.txt is loaded
|
||||
* Called during enableCore to report that configuration.txt is loaded
|
||||
*/
|
||||
public abstract void configurationLoaded();
|
||||
}
|
||||
@ -2400,10 +2400,10 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSignChange(int blkid, String world, int x, int y, int z,
|
||||
public void processSignChange(String material, String world, int x, int y, int z,
|
||||
String[] lines, String playerid) {
|
||||
DynmapPlayer dp = server.getPlayer(playerid);
|
||||
listenerManager.processSignChangeEvent(EventType.SIGN_CHANGE, blkid, world, x, y, z, lines, dp);
|
||||
listenerManager.processSignChangeEvent(EventType.SIGN_CHANGE, material, world, x, y, z, lines, dp);
|
||||
}
|
||||
|
||||
public MapStorage getDefaultMapStorage() {
|
||||
|
@ -30,10 +30,10 @@ public class DynmapListenerManager {
|
||||
public void chatEvent(DynmapPlayer p, String msg);
|
||||
}
|
||||
public interface BlockEventListener extends EventListener {
|
||||
public void blockEvent(int blkid, String w, int x, int y, int z);
|
||||
public void blockEvent(String material, String w, int x, int y, int z);
|
||||
}
|
||||
public interface SignChangeEventListener extends EventListener {
|
||||
public void signChangeEvent(int blkid, String w, int x, int y, int z, String[] lines, DynmapPlayer p);
|
||||
public void signChangeEvent(String material, String w, int x, int y, int z, String[] lines, DynmapPlayer p);
|
||||
}
|
||||
public enum EventType {
|
||||
WORLD_LOAD,
|
||||
@ -105,7 +105,7 @@ public class DynmapListenerManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void processBlockEvent(EventType type, int blkid, String world, int x, int y, int z)
|
||||
public void processBlockEvent(EventType type, String material, String world, int x, int y, int z)
|
||||
{
|
||||
ArrayList<EventListener> lst = listeners.get(type);
|
||||
if(lst == null) return;
|
||||
@ -114,14 +114,14 @@ public class DynmapListenerManager {
|
||||
EventListener el = lst.get(i);
|
||||
if(el instanceof BlockEventListener) {
|
||||
try {
|
||||
((BlockEventListener)el).blockEvent(blkid, world, x, y, z);
|
||||
((BlockEventListener)el).blockEvent(material, world, x, y, z);
|
||||
} catch (Throwable t) {
|
||||
Log.warning("processBlockEvent(" + type + "," + blkid + "," + world + "," + x + "," + y + "," + z + ") - exception", t);
|
||||
Log.warning("processBlockEvent(" + type + "," + material + "," + world + "," + x + "," + y + "," + z + ") - exception", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void processSignChangeEvent(EventType type, int blkid, String world, int x, int y, int z, String[] lines, DynmapPlayer p)
|
||||
public void processSignChangeEvent(EventType type, String material, String world, int x, int y, int z, String[] lines, DynmapPlayer p)
|
||||
{
|
||||
ArrayList<EventListener> lst = listeners.get(type);
|
||||
if(lst == null) return;
|
||||
@ -130,9 +130,9 @@ public class DynmapListenerManager {
|
||||
EventListener el = lst.get(i);
|
||||
if(el instanceof SignChangeEventListener) {
|
||||
try {
|
||||
((SignChangeEventListener)el).signChangeEvent(blkid, world, x, y, z, lines, p);
|
||||
((SignChangeEventListener)el).signChangeEvent(material, world, x, y, z, lines, p);
|
||||
} catch (Throwable t) {
|
||||
Log.warning("processSignChangeEvent(" + type + "," + blkid + "," + world + "," + x + "," + y + "," + z + ") - exception", t);
|
||||
Log.warning("processSignChangeEvent(" + type + "," + material + "," + world + "," + x + "," + y + "," + z + ") - exception", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2603,7 +2603,7 @@ public class TexturePack {
|
||||
* @param ps - perspective state
|
||||
* @param mapiter - map iterator
|
||||
* @param rslt - color result (returned with value)
|
||||
* @param blkid - block ID
|
||||
* @param blk - block state
|
||||
* @param lastblocktype - last block ID
|
||||
* @param ss - shader state
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ public class MarkerSignManager {
|
||||
|
||||
private static class SignListener implements DynmapListenerManager.SignChangeEventListener, Runnable {
|
||||
@Override
|
||||
public void signChangeEvent(int blkid, String wname, int x, int y, int z, String[] lines, DynmapPlayer p) {
|
||||
public void signChangeEvent(String material, String wname, int x, int y, int z, String[] lines, DynmapPlayer p) {
|
||||
if(mgr == null)
|
||||
return;
|
||||
|
||||
|
@ -135,7 +135,7 @@ public interface DynmapCommonAPI {
|
||||
public boolean testIfPlayerInfoProtected();
|
||||
/**
|
||||
* Process sign change
|
||||
* @param blkid - block ID
|
||||
* @param material - block's Material enum value as a string
|
||||
* @param world - world name
|
||||
* @param x - x coord
|
||||
* @param y - y coord
|
||||
@ -143,5 +143,5 @@ public interface DynmapCommonAPI {
|
||||
* @param lines - sign lines (input and output)
|
||||
* @param playerid - player ID
|
||||
*/
|
||||
public void processSignChange(int blkid, String world, int x, int y, int z, String[] lines, String playerid);
|
||||
public void processSignChange(String material, String world, int x, int y, int z, String[] lines, String playerid);
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
import org.dynmap.hdmap.HDMap;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
import org.dynmap.modsupport.ModSupportImpl;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.Polygon;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
@ -351,7 +352,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
Block b = evt.getBlock();
|
||||
if(b == null) return; /* Work around for stupid mods.... */
|
||||
Location l = b.getLocation();
|
||||
core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().getId(),
|
||||
core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().name(),
|
||||
getWorld(l.getWorld()).getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
}
|
||||
}, DynmapPlugin.this);
|
||||
@ -366,7 +367,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
DynmapPlayer dp = null;
|
||||
Player p = evt.getPlayer();
|
||||
if(p != null) dp = new BukkitPlayer(p);
|
||||
core.listenerManager.processSignChangeEvent(EventType.SIGN_CHANGE, b.getType().getId(),
|
||||
core.listenerManager.processSignChangeEvent(EventType.SIGN_CHANGE, b.getType().name(),
|
||||
getWorld(l.getWorld()).getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ(), lines, dp);
|
||||
}
|
||||
}, DynmapPlugin.this);
|
||||
@ -1631,9 +1632,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
}));
|
||||
}
|
||||
@Override
|
||||
public void processSignChange(int blkid, String world, int x, int y, int z,
|
||||
public void processSignChange(String material, String world, int x, int y, int z,
|
||||
String[] lines, String playerid) {
|
||||
core.processSignChange(blkid, world, x, y, z, lines, playerid);
|
||||
core.processSignChange(material, world, x, y, z, lines, playerid);
|
||||
}
|
||||
|
||||
Polygon getWorldBorder(World w) {
|
||||
|
Loading…
Reference in New Issue
Block a user