⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 externalmapgenerator.java

📁 good project for programmer,,
💻 JAVA
字号:
package com.sillysoft.lux;////  ExternalMapGenerator.java//  Lux////  This class is a implementation of the MapGenerator interface //	that uses an external script to do the work.//import java.io.*;import java.util.*;public class ExternalMapGenerator implements LuxMapGenerator{private static final String externalScriptName = "luxmap.pl";public String name()	{	return "ExternalMapGenerator";	}public List getChoices()	{	List choices = new Vector();	choices.add("ExternalMap");	return choices;	}public float version()	{	return 1.0f;	}public String description()	{	return "The ExternalMapGenerator uses the perl script 'luxmap.pl' to do the work of generating the map.";	}	public boolean generate(PrintWriter out, String choice, int seed, MapLoader loader)	{	try        {        loader.setLoadText("Invoking external script");                // Invoke an OS command to run the external script.        // The first element is the path of the script to run.        // All other elements are the arguments sent to the script.		String[] commands = new String[] {			MapLoader.getMapGeneratorPath() + externalScriptName,			choice,			String.valueOf(seed)				};					Process pr = Runtime.getRuntime().exec( commands );				// Get a reader for the process:		BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));		// Read in the result and send it along to the PrintWriter:		String result;		while ( (result = in.readLine()) != null )			{			out.println(result);			}		}	catch (Exception e)		{		System.out.println("ExternalMapGenerator caught an exception: "+e);		return false;		}		return true;	}public boolean canCache()	{	return true;	}public String message( String message, Object data )	{	return null;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -