Load Materials from a String

Discussion in 'Plugin Development' started by surtic, Jan 6, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    surtic

    Hi @all,

    I want to define in the Plugin Config what my Plugin Protect. But how i can Load the right Material form a String?

    This is my Code, but i don't know how i can Load the Material from the String. Can i do Something like "landProtection.add( Material.+name );"

    Code:
    
    	public void setLandProtection( List<String> list ) {
    
    		this.landProtection = new ArrayList<Material>();
    
    		for ( String name : list ) {
    
    			landProtection.add( Material.AIR );
    
    		}		
    
    	}
    
    Thanks for Help
     
  2. Material.getMaterial(name);
     
  3. Offline

    spywhere

    DataValue is preferred (for me)
     
  4. Offline

    surtic

    Thanks :D

    I had oversee this methode. I had search for set Material oder create new Material an others.
     
Thread Status:
Not open for further replies.

Share This Page