SolvedHelp with Code

Posts 1–3 of 3 · Page 1 of 1
Help with Code
So I basicly this is my code I wrote not too long ago and what happends is it doesn't read off the items off my config file for some reason, It doesn't give any errors just doesn't read my config file.

 
Code
Code:
package me.danielporsh.Materials2Cake;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener{
	

	
 @eventHandler
	public void onBlockPlace(BlockPlaceEvent e) {
		Material block = e.getBlock().getType();
		if(getConfig().getStringList("bannedblocks").contains(block)){
				e.isCancelled();
				e.getPlayer().sendMessage(ChatColor.RED + "[Materials2Cake] " + ChatColor.DARK_RED + "You are not allowed to use this block.");
				
			}
		}
	
	
		public void onEnable() {
		getLogger().info(ChatColor.RED + "[Materials2Cake] " + ChatColor.AQUA + "Plugin Has Been Enabled");

		
		
		
		
		
		getConfig().options().copyDefaults(true);
		saveConfig();
		Bukkit.getServer().getPluginManager().registerEvents(this, this);
	}
	
	public void onDisable() {
		
		getLogger().info(ChatColor.RED + "[Materials2Cake] " + ChatColor.AQUA + "Plugin Has Been Disabled");
		
	}

}
Your coding style is cancer. but I think what you did wrong was if(getConfig().getStringList("bannedblocks").conta ins(block)). try doing getStringList.matches. Also does it give any errors?
No response after several days, assuming solved.
/Closed
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us