/*
 * LapisCommons
 * Copyright (c) 2014, LapisDev <https://github.com/LapisDev>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package blue.lapis.common;

import org.spongepowered.api.Game;
import org.spongepowered.api.plugin.Plugin;

/**
 * Plugin class. This is not super-important in itself, but needs to be here so we can guarantee that it's available
 * for declared dependencies and gets onto the ClassLoader to be used.
 */
@Plugin(id="commons", name="lapis Commons", version="design-concept")
public class LapisCommonsPlugin {
    private static LapisCommonsPlugin instance;

    private Game gameInstance;

    public static LapisCommonsPlugin getInstance() {
        return instance;
    }

    public LapisCommonsPlugin() {
        instance = this;
    }

    public Game getGameInstance() {
        return gameInstance;
    }

    /**
     * DO NOT USE: This method is for unit-testing
     */
    public void setGameInstance(Game game) {
        this.gameInstance = game;
    }

}

@@ -1192,34 +1192,239 @@
 ort 
-org.spongepowered.api.Game
+com.google.common.base.Preconditions;%0Aimport org.apache.logging.log4j.Logger;%0Aimport org.spongepowered.api.Game;%0Aimport org.spongepowered.api.event.SpongeEventHandler;%0Aimport org.spongepowered.api.event.state.PreInitializationEvent
 ;%0Aim
@@ -1674,16 +1674,22 @@
 gin(id=%22
+lapis-
 commons%22
@@ -1700,14 +1700,13 @@
 me=%22
-l
+L
 apis
- 
 Comm
@@ -1724,22 +1724,22 @@
 on=%22
-design-concept
+1.0.0-SNAPSHOT
 %22)%0Ap
@@ -1823,39 +1823,198 @@
 ce;%0A
-%0A    private Game gameInstance;
+    private Logger logger;%0A    private Game game;%0A%0A    public LapisCommonsPlugin() %7B%0A        Preconditions.checkState(instance == null, %22Already initialized%22);%0A        instance = this;%0A    %7D
 %0A%0A  
@@ -2107,34 +2107,111 @@
  public 
-LapisCommonsPlugin
+static Game getGame() %7B%0A        return instance.game;%0A    %7D%0A%0A    public static Logger getLogger
 () %7B%0A   
@@ -2211,32 +2211,39 @@
 ) %7B%0A        
+return 
 instance
  = this;%0A   
@@ -2222,39 +2222,210 @@
  return instance
- = this
+.logger;%0A    %7D%0A%0A    @SpongeEventHandler%0A    public void initialize(PreInitializationEvent event) %7B%0A        this.game = event.getGame();%0A        this.logger = event.getPluginLog()
 ;%0A    %7D%0A%0A    pub
@@ -2472,24 +2472,16 @@
 urn game
-Instance
 ;%0A    %7D%0A
@@ -2610,24 +2610,16 @@
 his.game
-Instance
  = game;
@@ -2625,11 +2625,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Initialize game instance on PreInitializationEvent.