Created
December 2, 2014 01:13
-
-
Save SpaceManiac/ed8886a6d71657f5c694 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spongetest; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.spongepowered.api.Game; | |
import org.spongepowered.api.util.event.Subscribe; | |
import org.spongepowered.api.event.state.PreInitializationEvent; | |
import org.spongepowered.api.plugin.Plugin; | |
import org.spongepowered.api.plugin.PluginContainer; | |
import javax.inject.Inject; | |
import java.io.File; | |
@Plugin(id = "spongetest", name = "Sponge Test") | |
public class SpongeTestPlugin { | |
public final Game game; | |
public final PluginContainer container; | |
public Logger factory_logger; | |
public Logger event_logger; | |
public File main_config_dir; | |
public File rec_config_file; | |
public File rec_config_dir; | |
@Inject | |
public SpongeTestPlugin(Game game, PluginContainer container) { | |
this.game = game; | |
this.container = container; | |
this.factory_logger = LoggerFactory.getLogger("spongetest"); | |
this.factory_logger.info("SpongeTestPlugin constructed"); | |
this.factory_logger.info("game = " + game); | |
this.factory_logger.info("container = " + container.getId()); | |
} | |
@Subscribe | |
public void onPreInit(PreInitializationEvent e) { | |
this.event_logger = e.getPluginLog(); | |
this.main_config_dir = e.getConfigurationDirectory(); | |
this.rec_config_file = e.getRecommendedConfigurationFile(); | |
this.rec_config_dir = e.getRecommendedConfigurationDirectory(); | |
try { | |
this.event_logger.info("Main Config Directory: " + this.main_config_dir.getCanonicalPath()); | |
} catch (Throwable t) { | |
this.event_logger.info("Display Main Config Directory Failed", t); | |
} | |
try { | |
this.event_logger.info("Recommended Config File: " + this.rec_config_file.getCanonicalPath()); | |
} catch (Throwable t) { | |
this.event_logger.info("Display Recommended Config File Failed", t); | |
} | |
try { | |
this.event_logger.info("Recommended Config Directory: " + this.rec_config_dir.getCanonicalPath()); | |
} catch (Throwable t) { | |
this.event_logger.info("Display Recommended Config Directory Failed", t); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment