Use getPluginById instead of getPluginByNs
Add checks for blockx and blocky