mirror of
https://github.com/PEXPlugins/Modifyworld.git
synced 2025-02-09 00:03:01 +01:00
Changed item/blocks metadata check. Now it's done in much more standard way.
This commit is contained in:
parent
91e2c85332
commit
6666353f02
@ -100,12 +100,16 @@ public abstract class ModifyworldListener implements Listener {
|
||||
return this.useMaterialNames ? type.name().toLowerCase().replace("_", "") : Integer.toString(type.getId());
|
||||
}
|
||||
|
||||
protected String getMaterialPermission(Material type, byte metadata) {
|
||||
return this.getMaterialPermission(type) + (metadata > 0 ? ":" + metadata : "");
|
||||
}
|
||||
|
||||
protected String getItemPermission(ItemStack item) {
|
||||
return this.getMaterialPermission(item.getType()) + (this.checkMetadata ? "." + item.getData().getData() : "");
|
||||
return this.getMaterialPermission(item.getType(), item.getData().getData());
|
||||
}
|
||||
|
||||
protected String getBlockPermission(Block block) {
|
||||
return this.getMaterialPermission(block.getType()) + (this.checkMetadata ? "." + block.getData() : "");
|
||||
return this.getMaterialPermission(block.getType(), block.getData());
|
||||
}
|
||||
|
||||
protected boolean canInteractWithMaterial(Player player, String basePermission, Material type) {
|
||||
@ -113,11 +117,11 @@ public abstract class ModifyworldListener implements Listener {
|
||||
}
|
||||
|
||||
protected boolean canInteractWithItem(Player player, String basePermission, ItemStack item) {
|
||||
return permissionsManager.has(player, basePermission + this.getItemPermission(item));
|
||||
return permissionsManager.has(player, basePermission + this.getMaterialPermission(item.getType(), item.getData().getData()));
|
||||
}
|
||||
|
||||
protected boolean canInteractWithBlock(Player player, String basePermission, Block block) {
|
||||
return permissionsManager.has(player, basePermission + this.getBlockPermission(block));
|
||||
return permissionsManager.has(player, basePermission + this.getMaterialPermission(block.getType(), block.getData()));
|
||||
}
|
||||
|
||||
private void registerEvents(Plugin plugin) {
|
||||
|
Loading…
Reference in New Issue
Block a user