Projects >> dynmap >>f7dbc89ab431715743b70a44e8a9bc4bb6a6a1f7

Chunk
Conflicting content
import org.dynmap.web.handlers.ClientConfigurationHandler;
import org.dynmap.web.handlers.ClientUpdateHandler;
import org.dynmap.web.handlers.FilesystemHandler;
<<<<<<< HEAD
import org.dynmap.web.Json;
=======
import org.dynmap.web.handlers.SendMessageHandler;
import org.dynmap.web.handlers.SendMessageHandler.Message;
>>>>>>> 909207ac26cdaa566c070439bda0d6d32fb737c6

public class DynmapPlugin extends JavaPlugin {
Solution content
import org.dynmap.web.handlers.ClientConfigurationHandler;
import org.dynmap.web.handlers.ClientUpdateHandler;
import org.dynmap.web.handlers.FilesystemHandler;
import org.dynmap.web.handlers.SendMessageHandler;
import org.dynmap.web.handlers.SendMessageHandler.Message;
import org.dynmap.web.Json;

public class DynmapPlugin extends JavaPlugin {
File
DynmapPlugin.java
Developer's decision
Concatenation
Kind of conflict
Import
Chunk
Conflicting content
    private PlayerList playerList;
    private Configuration configuration;

<<<<<<< HEAD
	private Timer timer;

    private BukkitPlayerDebugger debugger = new BukkitPlayerDebugger(this);

=======
    public static File tilesDirectory;
>>>>>>> 909207ac26cdaa566c070439bda0d6d32fb737c6
    public static File dataRoot;

    public DynmapPlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
Solution content
    private PlayerList playerList;
    private Configuration configuration;

    public static File tilesDirectory;
	private Timer timer;
    public static File dataRoot;

    public DynmapPlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
File
DynmapPlugin.java
Developer's decision
Combination
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        mapManager = new MapManager(configuration);
        mapManager.startRendering();

<<<<<<< HEAD
		if(!configuration.getBoolean("disable-webserver", true)) {
			InetAddress bindAddress;
			{
				String address = configuration.getString("webserver-bindaddress", "0.0.0.0");
				try {
					bindAddress = address.equals("0.0.0.0")
							? null
							: InetAddress.getByName(address);
				} catch (UnknownHostException e) {
					bindAddress = null;
				}
			}
			int port = configuration.getInt("webserver-port", 8123);

			webServer = new HttpServer(bindAddress, port);
			webServer.handlers.put("/", new FilesystemHandler(mapManager.webDirectory));
			webServer.handlers.put("/tiles/", new FilesystemHandler(mapManager.tileDirectory));
			webServer.handlers.put("/up/", new ClientUpdateHandler(mapManager, playerList, getWorld()));
			webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map) configuration.getProperty("web")));

			try {
				webServer.startServer();
			} catch (IOException e) {
				log.severe("Failed to start WebServer on " + bindAddress + ":" + port + "!");
			}
		}

		if(configuration.getBoolean("jsonfile", false)) {
			jsonConfig();
			int jsonInterval = configuration.getInt("jsonfile", 1) * 1000;
			 timer = new Timer();
			 timer.scheduleAtFixedRate(new JsonTimerTask(this, configuration), jsonInterval, jsonInterval);
		}
=======
        InetAddress bindAddress;
        {
            String address = configuration.getString("webserver-bindaddress", "0.0.0.0");
            try {
                bindAddress = address.equals("0.0.0.0")
                        ? null
                        : InetAddress.getByName(address);
            } catch (UnknownHostException e) {
                bindAddress = null;
            }
        }
        int port = configuration.getInt("webserver-port", 8123);

        webServer = new HttpServer(bindAddress, port);
        webServer.handlers.put("/", new FilesystemHandler(getFile(configuration.getString("webpath", "web"))));
        webServer.handlers.put("/tiles/", new FilesystemHandler(tilesDirectory));
        webServer.handlers.put("/up/", new ClientUpdateHandler(mapManager, playerList, getServer()));
        webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map) configuration.getProperty("web")));

        SendMessageHandler messageHandler = new SendMessageHandler();
        messageHandler.onMessageReceived.addListener(new Listener() {
            @Override
            public void triggered(Message t) {
                log.info("[WEB] " + t.name + ": " + t.message);
                getServer().broadcastMessage("[WEB] " + t.name + ": " + t.message);
            }
        });
        webServer.handlers.put("/up/sendmessage", messageHandler);

        try {
            webServer.startServer();
        } catch (IOException e) {
            log.severe("Failed to start WebServer on " + bindAddress + ":" + port + "!");
        }
>>>>>>> 909207ac26cdaa566c070439bda0d6d32fb737c6

        registerEvents();
    }
Solution content
        mapManager = new MapManager(configuration);
        mapManager.startRendering();

		if(!configuration.getBoolean("disable-webserver", true)) {
			InetAddress bindAddress;
			{
				String address = configuration.getString("webserver-bindaddress", "0.0.0.0");
				try {
					bindAddress = address.equals("0.0.0.0")
							? null
							: InetAddress.getByName(address);
				} catch (UnknownHostException e) {
					bindAddress = null;
				}
			}
			int port = configuration.getInt("webserver-port", 8123);

			webServer = new HttpServer(bindAddress, port);
			webServer.handlers.put("/", new FilesystemHandler(getFile(configuration.getString("webpath", "web"))));
			webServer.handlers.put("/tiles/", new FilesystemHandler(tilesDirectory));
			webServer.handlers.put("/up/", new ClientUpdateHandler(mapManager, playerList, getServer()));
			webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map) configuration.getProperty("web")));

			SendMessageHandler messageHandler = new SendMessageHandler();
			messageHandler.onMessageReceived.addListener(new Listener() {
				@Override
				public void triggered(Message t) {
					log.info("[WEB] " + t.name + ": " + t.message);
					getServer().broadcastMessage("[WEB] " + t.name + ": " + t.message);
				}
			});
			webServer.handlers.put("/up/sendmessage", messageHandler);

			try {
				webServer.startServer();
			} catch (IOException e) {
				log.severe("Failed to start WebServer on " + bindAddress + ":" + port + "!");
			}
		}

		if(configuration.getBoolean("jsonfile", false)) {
			jsonConfig();
			int jsonInterval = configuration.getInt("jsonfile", 1) * 1000;
			 timer = new Timer();
			 timer.scheduleAtFixedRate(new JsonTimerTask(this, configuration), jsonInterval, jsonInterval);
		}

        registerEvents();
    }
File
DynmapPlugin.java
Developer's decision
Combination
Kind of conflict
Attribute
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
        getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this);
    }

<<<<<<< HEAD
	private void jsonConfig()
	{
		File outputFile;
		Map clientConfig =  (Map) configuration.getProperty("web");
		File webpath = new File(configuration.getString("webpath", "web"), "dynmap_config.json");
		if(webpath.isAbsolute())
			outputFile = webpath;
		else
			outputFile = new File(DynmapPlugin.dataRoot, webpath.toString());

		try
		{
			FileOutputStream fos = new FileOutputStream(outputFile);
			fos.write(Json.stringifyJson(clientConfig).getBytes());
			fos.close();
		}
		catch(FileNotFoundException ex)
		{
			System.out.println("FileNotFoundException : " + ex);
		}
		catch(IOException ioe)
		{
			System.out.println("IOException : " + ioe);
		}
	}
=======
    private static File combinePaths(File parent, String path) {
        return combinePaths(parent, new File(path));
    }

    private static File combinePaths(File parent, File path) {
        if (path.isAbsolute())
            return path;
        return new File(parent, path.getPath());
    }

    public File getFile(String path) {
        return combinePaths(DynmapPlugin.dataRoot, path);
    }
>>>>>>> 909207ac26cdaa566c070439bda0d6d32fb737c6
}
Solution content
    }
        getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this);
    }

    private static File combinePaths(File parent, String path) {
        return combinePaths(parent, new File(path));
    }

    private static File combinePaths(File parent, File path) {
        if (path.isAbsolute())
            return path;
        return new File(parent, path.getPath());
    }

    public File getFile(String path) {
        return combinePaths(DynmapPlugin.dataRoot, path);

	private void jsonConfig()
	{
		File outputFile;
		Map clientConfig =  (Map) configuration.getProperty("web");
		File webpath = new File(configuration.getString("webpath", "web"), "dynmap_config.json");
		if(webpath.isAbsolute())
			outputFile = webpath;
		else
			outputFile = new File(DynmapPlugin.dataRoot, webpath.toString());

		try
		{
			FileOutputStream fos = new FileOutputStream(outputFile);
			fos.write(Json.stringifyJson(clientConfig).getBytes());
			fos.close();
		}
		catch(FileNotFoundException ex)
		{
			System.out.println("FileNotFoundException : " + ex);
		}
		catch(IOException ioe)
		{
			System.out.println("IOException : " + ioe);
		}
	}
}
File
DynmapPlugin.java
Developer's decision
Concatenation
Kind of conflict
Method declaration