mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Merge remote branch 'upstream/master'
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
commit
87d246c1ae
4 changed files with 83 additions and 4 deletions
|
@ -27,6 +27,11 @@
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.jopt-simple</groupId>
|
||||||
|
<artifactId>jopt-simple</artifactId>
|
||||||
|
<version>3.2</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -27,7 +27,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
pluginManager.RegisterInterface(JavaPluginLoader.class);
|
pluginManager.RegisterInterface(JavaPluginLoader.class);
|
||||||
|
|
||||||
File pluginFolder = new File("plugins");
|
File pluginFolder = (File)console.options.valueOf("plugins");
|
||||||
|
|
||||||
if (pluginFolder.exists()) {
|
if (pluginFolder.exists()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -42,6 +42,10 @@ public class CraftWorld implements World {
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
|
return world.d(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
public Chunk getChunkAt(int x, int z) {
|
public Chunk getChunkAt(int x, int z) {
|
||||||
ChunkCoordinate loc = new ChunkCoordinate(x, z);
|
ChunkCoordinate loc = new ChunkCoordinate(x, z);
|
||||||
|
|
|
@ -1,16 +1,86 @@
|
||||||
|
|
||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import joptsimple.OptionParser;
|
||||||
|
import joptsimple.OptionSet;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Todo: Installation script
|
// Todo: Installation script
|
||||||
|
OptionParser parser = new OptionParser() {
|
||||||
|
{
|
||||||
|
acceptsAll(asList("?", "help"), "Show the help");
|
||||||
|
|
||||||
|
acceptsAll(asList("c", "config"), "Properties file to use")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(File.class)
|
||||||
|
.defaultsTo(new File("server.properties"))
|
||||||
|
.describedAs("Properties file");
|
||||||
|
|
||||||
|
acceptsAll(asList("P", "plugins"), "Plugin directory to use")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(File.class)
|
||||||
|
.defaultsTo(new File("plugins"))
|
||||||
|
.describedAs("Plugin directory");
|
||||||
|
|
||||||
|
acceptsAll(asList("h", "host", "server-ip"), "Host to listen on")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(String.class)
|
||||||
|
.describedAs("Hostname or IP");
|
||||||
|
|
||||||
|
acceptsAll(asList("w", "world", "level-name"), "World directory")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(String.class)
|
||||||
|
.describedAs("World dir");
|
||||||
|
|
||||||
|
acceptsAll(asList("p", "port", "server-port"), "Port to listen on")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Integer.class)
|
||||||
|
.describedAs("Port");
|
||||||
|
|
||||||
|
acceptsAll(asList("o", "online-mode"), "Whether to use online authentication")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Boolean.class)
|
||||||
|
.describedAs("Authentication");
|
||||||
|
|
||||||
|
acceptsAll(asList("s", "size", "max-players"), "Maximum amount of players")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Integer.class)
|
||||||
|
.describedAs("Server size");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
OptionSet options = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MinecraftServer.main(args);
|
options = parser.parse(args);
|
||||||
} catch (Throwable t) {
|
} catch (joptsimple.OptionException ex) {
|
||||||
t.printStackTrace();
|
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((options == null) || (options.has("?"))) {
|
||||||
|
try {
|
||||||
|
parser.printHelpOn(System.out);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
MinecraftServer.main(options);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<String> asList(String... params) {
|
||||||
|
return Arrays.asList(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue