Page 1 of 1

ExplodingArrows logger help

Posted: Sun Mar 25, 2012 4:21 pm
by KillzyazMadness
This is my ExplodingArrows.java main file:
package me.killzyazmadness.ExplodingArrows;

import org.bukkit.plugin.java.JavaPlugin;

public class ExplodingArrows {

	protected ExplodingArrowsLogger log;
	
	public void onEnable(){
		this.log = new ExplodingArrowsLogger(this);
		
	}
	
	public void onDisable(){
		
	}
	
}
And this is my ExplodingArrowsLogger:
package me.killzyazmadness.ExplodingArrows;

import java.util.logging.Logger;

import org.bukkit.plugin.PluginDescriptionFile;

public class ExplodingArrowsLogger {
	
	private ExplodingArrows plugin;
	private Logger log;
	
	public ExplodingArrowsLogger(ExplodingArrows plugin){
		this.plugin = plugin;
		this.log = Logger.getLogger("Minecraft");
	}
	
	private String buildString(String msg){
		PluginDescriptionFile pdFile = plugin.getDescription();
		return"[" + pdFile.getName() + " " + pdFile.getVersion() + "]: " + msg;
	}

	public void info(String msg){
		this.log.info(this.buildString(msg));
	}
	
	public void warn(String msg){
		this.log.warning(this.buildString(msg));
	}
	
	public void sever(String msg){
		this.log.severe(this.buildString(msg));
	}
	
}
It gives me this error: "The method getDescription() is undefined for the type ExplodingArrows" and I don't know what I did wrong, and I am pretty sure you didn't go over logging in the TNT video like you said you did? Thanks for the help :)

Re: ExplodingArrows logger help

Posted: Sun Mar 25, 2012 10:47 pm
by KillzyazMadness
omg such a noob forgot the extends JavaPlugin at the end. Sorry please remove this.

Re: ExplodingArrows logger help

Posted: Tue Mar 27, 2012 5:27 pm
by jacek
No problem :)