mirror of
https://github.com/PEXPlugins/Modifyworld.git
synced 2024-11-16 10:35:32 +01:00
Fixed material name vs blockid dualism issue
This commit is contained in:
parent
4e957d4a0b
commit
f8673eb49d
@ -43,6 +43,7 @@ public abstract class ModifyworldListener implements Listener {
|
||||
protected PermissionManager permissionsManager;
|
||||
protected ConfigurationNode config;
|
||||
protected boolean informPlayers = false;
|
||||
protected boolean useMaterialNames = true;
|
||||
|
||||
public ModifyworldListener(Plugin plugin, ConfigurationNode config) {
|
||||
this.permissionsManager = PermissionsEx.getPermissionManager();
|
||||
@ -52,6 +53,7 @@ public abstract class ModifyworldListener implements Listener {
|
||||
|
||||
this.informPlayers = config.getBoolean("informPlayers", informPlayers);
|
||||
this.permissionDenied = config.getString("messages.permissionDenied", this.permissionDenied);
|
||||
this.useMaterialNames = config.getBoolean("use-material-names", useMaterialNames);
|
||||
}
|
||||
|
||||
protected void informPlayer(Player player, String message) {
|
||||
@ -109,7 +111,7 @@ public abstract class ModifyworldListener implements Listener {
|
||||
}
|
||||
|
||||
protected boolean canInteractWithMaterial(Player player, String basePermission, Material type) {
|
||||
return permissionsManager.has(player, basePermission + type.name().toLowerCase().replace("_", "")) && permissionsManager.has(player, basePermission + type.getId());
|
||||
return permissionsManager.has(player, basePermission + (this.useMaterialNames ? type.name().toLowerCase().replace("_", "") : type.getId() ) );
|
||||
}
|
||||
|
||||
private void registerEvents(Plugin plugin) {
|
||||
|
@ -38,7 +38,10 @@ public class Modifyworld extends JavaPlugin {
|
||||
|
||||
protected final static Logger logger = Logger.getLogger("Minecraft");
|
||||
protected final static Class<? extends ModifyworldListener>[] LISTENERS = new Class[]{
|
||||
PlayerListener.class, EntityListener.class, BlockListener.class, VehicleListener.class
|
||||
PlayerListener.class,
|
||||
EntityListener.class,
|
||||
BlockListener.class,
|
||||
VehicleListener.class
|
||||
};
|
||||
protected List<ModifyworldListener> listeners = new ArrayList<ModifyworldListener>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user