2010-12-22 16:22:23 +01:00
package net.minecraft.server ;
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
import java.io.File ;
import java.net.InetAddress ;
import java.net.UnknownHostException ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.HashMap ;
2010-12-28 20:52:24 +01:00
import java.util.Iterator ;
2010-12-22 16:22:23 +01:00
import java.util.List ;
import java.util.logging.Level ;
import java.util.logging.Logger ;
2011-01-04 01:43:23 +01:00
import joptsimple.OptionSet ;
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
import org.bukkit.craftbukkit.CraftServer ;
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
public class MinecraftServer
2011-01-01 14:06:04 +01:00
implements ICommandListener , Runnable {
2010-12-22 16:22:23 +01:00
public static Logger a = Logger . getLogger ( " Minecraft " ) ;
2011-01-02 07:36:27 +01:00
public static HashMap < String , Integer > b = new HashMap < String , Integer > ( ) ;
2010-12-26 03:20:29 +01:00
public NetworkListenThread c ;
public PropertyManager d ;
public WorldServer e ;
public ServerConfigurationManager f ;
2010-12-28 20:52:24 +01:00
private boolean o ;
public boolean g ;
int h ;
2010-12-22 16:22:23 +01:00
public String i ;
public int j ;
2011-01-02 07:36:27 +01:00
private List < IUpdatePlayerListBox > p ;
private List < ServerCommand > q ;
2010-12-26 03:20:29 +01:00
public EntityTracker k ;
2010-12-22 16:22:23 +01:00
public boolean l ;
public boolean m ;
public boolean n ;
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
public CraftServer server ; // CraftBukkit
2011-01-04 01:43:23 +01:00
public OptionSet options ; // CraftBukkit
2010-12-22 16:22:23 +01:00
2011-01-04 01:43:23 +01:00
// CraftBukkit: Added arg "OptionSet options"
public MinecraftServer ( final OptionSet options ) {
2010-12-28 20:52:24 +01:00
o = true ;
g = false ;
h = 0 ;
2011-01-02 07:36:27 +01:00
p = new ArrayList < IUpdatePlayerListBox > ( ) ;
q = Collections . synchronizedList ( new ArrayList < ServerCommand > ( ) ) ;
2010-12-26 03:20:29 +01:00
new ThreadSleepForever ( this ) ;
2011-01-04 01:43:23 +01:00
this . options = options ; // CraftBukkit
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
// CraftBukkit: added throws UnknownHostException
2010-12-26 03:20:29 +01:00
private boolean d ( ) throws UnknownHostException {
2010-12-28 20:52:24 +01:00
ThreadCommandReader threadcommandreader = new ThreadCommandReader ( this ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
threadcommandreader . setDaemon ( true ) ;
threadcommandreader . start ( ) ;
2010-12-26 03:20:29 +01:00
ConsoleLogManager . a ( ) ;
a . info ( " Starting minecraft server version Beta 1.1_02 " ) ;
2010-12-22 16:22:23 +01:00
if ( Runtime . getRuntime ( ) . maxMemory ( ) / 1024L / 1024L < 512L ) {
a . warning ( " **** NOT ENOUGH RAM! " ) ;
a . warning ( " To start the server with more ram, launch it as \" java -Xmx1024M -Xms1024M -jar minecraft_server.jar \" " ) ;
}
a . info ( " Loading properties " ) ;
2011-01-04 01:43:23 +01:00
d = new PropertyManager ( options ) ; // Craftbukkit
2010-12-28 20:52:24 +01:00
String s = d . a ( " server-ip " , " " ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
l = d . a ( " online-mode " , true ) ;
m = d . a ( " spawn-animals " , true ) ;
n = d . a ( " pvp " , true ) ;
InetAddress inetaddress = null ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
if ( s . length ( ) > 0 ) {
inetaddress = InetAddress . getByName ( s ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
int i1 = d . a ( " server-port " , 25565 ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
a . info ( ( new StringBuilder ( ) ) . append ( " Starting Minecraft server on " ) . append ( s . length ( ) ! = 0 ? s : " * " ) . append ( " : " ) . append ( i1 ) . toString ( ) ) ;
2010-12-22 16:22:23 +01:00
try {
2010-12-28 20:52:24 +01:00
c = new NetworkListenThread ( this , inetaddress , i1 ) ;
2011-01-01 14:06:04 +01:00
// CraftBukkit: Be more generic; IOException -> Throwable
2010-12-28 20:52:24 +01:00
} catch ( Throwable ioexception ) {
2010-12-22 16:22:23 +01:00
a . warning ( " **** FAILED TO BIND TO PORT! " ) ;
2010-12-28 20:52:24 +01:00
a . log ( Level . WARNING , ( new StringBuilder ( ) ) . append ( " The exception was: " ) . append ( ioexception . toString ( ) ) . toString ( ) ) ;
2010-12-22 16:22:23 +01:00
a . warning ( " Perhaps a server is already running on that port? " ) ;
return false ;
}
2010-12-28 20:52:24 +01:00
if ( ! l ) {
2010-12-22 16:22:23 +01:00
a . warning ( " **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! " ) ;
a . warning ( " The server will make no attempt to authenticate usernames. Beware. " ) ;
a . warning ( " While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. " ) ;
a . warning ( " To change this, set \" online-mode \" to \" true \" in the server.settings file. " ) ;
}
2010-12-28 20:52:24 +01:00
f = new ServerConfigurationManager ( this ) ;
k = new EntityTracker ( this ) ;
String s1 = d . a ( " level-name " , " world " ) ;
2010-12-26 03:20:29 +01:00
2010-12-28 20:52:24 +01:00
a . info ( ( new StringBuilder ( ) ) . append ( " Preparing level \" " ) . append ( s1 ) . append ( " \" " ) . toString ( ) ) ;
c ( s1 ) ;
2010-12-22 16:22:23 +01:00
a . info ( " Done! For help, type \" help \" or \" ? \" " ) ;
return true ;
}
2010-12-28 20:52:24 +01:00
private void c ( String s ) {
2010-12-22 16:22:23 +01:00
a . info ( " Preparing start region " ) ;
2010-12-28 20:52:24 +01:00
e = new WorldServer ( this , new File ( " . " ) , s , d . a ( " hellworld " , false ) ? - 1 : 0 ) ;
e . a ( new WorldManager ( this ) ) ;
e . k = d . a ( " spawn-monsters " , true ) ? 1 : 0 ;
f . a ( e ) ;
byte byte0 = 10 ;
for ( int i1 = - byte0 ; i1 < = byte0 ; i1 + + ) {
a ( " Preparing spawn area " , ( ( i1 + byte0 ) * 100 ) / ( byte0 + byte0 + 1 ) ) ;
for ( int j1 = - byte0 ; j1 < = byte0 ; j1 + + ) {
if ( ! o ) {
2010-12-22 16:22:23 +01:00
return ;
}
2010-12-28 20:52:24 +01:00
e . A . d ( ( e . m > > 4 ) + i1 , ( e . o > > 4 ) + j1 ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
e ( ) ;
}
2010-12-28 20:52:24 +01:00
private void a ( String s , int i1 ) {
i = s ;
j = i1 ;
System . out . println ( ( new StringBuilder ( ) ) . append ( s ) . append ( " : " ) . append ( i1 ) . append ( " % " ) . toString ( ) ) ;
2010-12-22 16:22:23 +01:00
}
private void e ( ) {
2010-12-28 20:52:24 +01:00
i = null ;
j = 0 ;
2010-12-22 16:22:23 +01:00
}
private void f ( ) {
a . info ( " Saving chunks " ) ;
2010-12-28 20:52:24 +01:00
e . a ( true , null ) ;
2010-12-22 16:22:23 +01:00
}
private void g ( ) {
a . info ( " Stopping server " ) ;
2010-12-28 20:52:24 +01:00
if ( f ! = null ) {
f . d ( ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
if ( e ! = null ) {
2010-12-22 16:22:23 +01:00
f ( ) ;
}
}
public void a ( ) {
2010-12-28 20:52:24 +01:00
o = false ;
2010-12-22 16:22:23 +01:00
}
public void run ( ) {
try {
if ( d ( ) ) {
long l1 = System . currentTimeMillis ( ) ;
long l2 = 0L ;
2010-12-28 20:52:24 +01:00
while ( o ) {
2010-12-22 16:22:23 +01:00
long l3 = System . currentTimeMillis ( ) ;
long l4 = l3 - l1 ;
2010-12-28 20:52:24 +01:00
2010-12-22 16:22:23 +01:00
if ( l4 > 2000L ) {
a . warning ( " Can't keep up! Did the system time change, or is the server overloaded? " ) ;
l4 = 2000L ;
}
if ( l4 < 0L ) {
a . warning ( " Time ran backwards! Did the system time change? " ) ;
l4 = 0L ;
}
l2 + = l4 ;
l1 = l3 ;
while ( l2 > 50L ) {
l2 - = 50L ;
h ( ) ;
}
Thread . sleep ( 1L ) ;
}
} else {
2010-12-28 20:52:24 +01:00
while ( o ) {
2010-12-22 16:22:23 +01:00
b ( ) ;
try {
Thread . sleep ( 10L ) ;
2010-12-28 20:52:24 +01:00
} catch ( InterruptedException interruptedexception ) {
interruptedexception . printStackTrace ( ) ;
2010-12-22 16:22:23 +01:00
}
}
}
2010-12-28 20:52:24 +01:00
} catch ( Exception exception ) {
exception . printStackTrace ( ) ;
a . log ( Level . SEVERE , " Unexpected exception " , exception ) ;
while ( o ) {
2010-12-22 16:22:23 +01:00
b ( ) ;
try {
Thread . sleep ( 10L ) ;
2010-12-28 20:52:24 +01:00
} catch ( InterruptedException interruptedexception1 ) {
interruptedexception1 . printStackTrace ( ) ;
2010-12-22 16:22:23 +01:00
}
}
} finally {
g ( ) ;
2010-12-28 20:52:24 +01:00
g = true ;
2010-12-22 16:22:23 +01:00
System . exit ( 0 ) ;
}
}
private void h ( ) {
2011-01-02 07:36:27 +01:00
ArrayList < String > arraylist = new ArrayList < String > ( ) ;
2010-12-28 20:52:24 +01:00
2011-01-02 07:36:27 +01:00
for ( Iterator < String > iterator = b . keySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) {
2010-12-28 20:52:24 +01:00
String s = ( String ) iterator . next ( ) ;
int k1 = ( ( Integer ) b . get ( s ) ) . intValue ( ) ;
if ( k1 > 0 ) {
b . put ( s , Integer . valueOf ( k1 - 1 ) ) ;
2010-12-22 16:22:23 +01:00
} else {
2010-12-28 20:52:24 +01:00
arraylist . add ( s ) ;
2010-12-22 16:22:23 +01:00
}
}
2010-12-28 20:52:24 +01:00
for ( int i1 = 0 ; i1 < arraylist . size ( ) ; i1 + + ) {
b . remove ( arraylist . get ( i1 ) ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-26 03:20:29 +01:00
AxisAlignedBB . a ( ) ;
Vec3D . a ( ) ;
2010-12-28 20:52:24 +01:00
h + + ;
if ( h % 20 = = 0 ) {
f . a ( new Packet4UpdateTime ( e . e ) ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
e . f ( ) ;
while ( e . d ( ) ) {
;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
e . c ( ) ;
c . a ( ) ;
f . b ( ) ;
k . a ( ) ;
for ( int j1 = 0 ; j1 < p . size ( ) ; j1 + + ) {
( ( IUpdatePlayerListBox ) p . get ( j1 ) ) . a ( ) ;
}
2010-12-22 16:22:23 +01:00
try {
b ( ) ;
2010-12-28 20:52:24 +01:00
} catch ( Exception exception ) {
a . log ( Level . WARNING , " Unexpected exception while parsing console command " , exception ) ;
2010-12-22 16:22:23 +01:00
}
}
2010-12-28 20:52:24 +01:00
public void a ( String s , ICommandListener icommandlistener ) {
q . add ( new ServerCommand ( s , icommandlistener ) ) ;
2010-12-22 16:22:23 +01:00
}
public void b ( ) {
2010-12-28 20:52:24 +01:00
do {
if ( q . size ( ) < = 0 ) {
break ;
}
ServerCommand servercommand = ( ServerCommand ) q . remove ( 0 ) ;
String s = servercommand . a ;
ICommandListener icommandlistener = servercommand . b ;
String s1 = icommandlistener . c ( ) ;
if ( s . toLowerCase ( ) . startsWith ( " help " ) | | s . toLowerCase ( ) . startsWith ( " ? " ) ) {
icommandlistener . b ( " To run the server without a gui, start it like this: " ) ;
icommandlistener . b ( " java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui " ) ;
icommandlistener . b ( " Console commands: " ) ;
icommandlistener . b ( " help or ? shows this message " ) ;
icommandlistener . b ( " kick <player> removes a player from the server " ) ;
icommandlistener . b ( " ban <player> bans a player from the server " ) ;
icommandlistener . b ( " pardon <player> pardons a banned player so that they can connect again " ) ;
icommandlistener . b ( " ban-ip <ip> bans an IP address from the server " ) ;
icommandlistener . b ( " pardon-ip <ip> pardons a banned IP address so that they can connect again " ) ;
icommandlistener . b ( " op <player> turns a player into an op " ) ;
icommandlistener . b ( " deop <player> removes op status from a player " ) ;
icommandlistener . b ( " tp <player1> <player2> moves one player to the same location as another player " ) ;
icommandlistener . b ( " give <player> <id> [num] gives a player a resource " ) ;
icommandlistener . b ( " tell <player> <message> sends a private message to a player " ) ;
icommandlistener . b ( " stop gracefully stops the server " ) ;
icommandlistener . b ( " save-all forces a server-wide level save " ) ;
icommandlistener . b ( " save-off disables terrain saving (useful for backup scripts) " ) ;
icommandlistener . b ( " save-on re-enables terrain saving " ) ;
icommandlistener . b ( " list lists all currently connected players " ) ;
icommandlistener . b ( " say <message> broadcasts a message to all players " ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " list " ) ) {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " Connected players: " ) . append ( f . c ( ) ) . toString ( ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " stop " ) ) {
a ( s1 , " Stopping the server.. " ) ;
o = false ;
} else if ( s . toLowerCase ( ) . startsWith ( " save-all " ) ) {
a ( s1 , " Forcing save.. " ) ;
e . a ( true , null ) ;
a ( s1 , " Save complete. " ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " save-off " ) ) {
a ( s1 , " Disabling level saving.. " ) ;
e . C = true ;
} else if ( s . toLowerCase ( ) . startsWith ( " save-on " ) ) {
a ( s1 , " Enabling level saving.. " ) ;
e . C = false ;
} else if ( s . toLowerCase ( ) . startsWith ( " op " ) ) {
String s2 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
f . e ( s2 ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Opping " ) . append ( s2 ) . toString ( ) ) ;
f . a ( s2 , " \ 247eYou are now op! " ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " deop " ) ) {
String s3 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
f . f ( s3 ) ;
f . a ( s3 , " \ 247eYou are no longer op! " ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " De-opping " ) . append ( s3 ) . toString ( ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " ban-ip " ) ) {
String s4 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
f . c ( s4 ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Banning ip " ) . append ( s4 ) . toString ( ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " pardon-ip " ) ) {
String s5 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
f . d ( s5 ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Pardoning ip " ) . append ( s5 ) . toString ( ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " ban " ) ) {
String s6 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
f . a ( s6 ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Banning " ) . append ( s6 ) . toString ( ) ) ;
EntityPlayerMP entityplayermp = f . h ( s6 ) ;
if ( entityplayermp ! = null ) {
entityplayermp . a . a ( " Banned by admin " ) ;
}
} else if ( s . toLowerCase ( ) . startsWith ( " pardon " ) ) {
String s7 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
f . b ( s7 ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Pardoning " ) . append ( s7 ) . toString ( ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " kick " ) ) {
String s8 = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
EntityPlayerMP entityplayermp1 = null ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
for ( int i1 = 0 ; i1 < f . b . size ( ) ; i1 + + ) {
EntityPlayerMP entityplayermp5 = ( EntityPlayerMP ) f . b . get ( i1 ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
if ( entityplayermp5 . aw . equalsIgnoreCase ( s8 ) ) {
entityplayermp1 = entityplayermp5 ;
}
}
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
if ( entityplayermp1 ! = null ) {
entityplayermp1 . a . a ( " Kicked by admin " ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Kicking " ) . append ( entityplayermp1 . aw ) . toString ( ) ) ;
} else {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " Can't find user " ) . append ( s8 ) . append ( " . No kick. " ) . toString ( ) ) ;
}
} else if ( s . toLowerCase ( ) . startsWith ( " tp " ) ) {
String as [ ] = s . split ( " " ) ;
if ( as . length = = 3 ) {
EntityPlayerMP entityplayermp2 = f . h ( as [ 1 ] ) ;
EntityPlayerMP entityplayermp3 = f . h ( as [ 2 ] ) ;
if ( entityplayermp2 = = null ) {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " Can't find user " ) . append ( as [ 1 ] ) . append ( " . No tp. " ) . toString ( ) ) ;
} else if ( entityplayermp3 = = null ) {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " Can't find user " ) . append ( as [ 2 ] ) . append ( " . No tp. " ) . toString ( ) ) ;
2010-12-22 16:22:23 +01:00
} else {
2010-12-28 20:52:24 +01:00
entityplayermp2 . a . a ( entityplayermp3 . p , entityplayermp3 . q , entityplayermp3 . r , entityplayermp3 . v , entityplayermp3 . w ) ;
a ( s1 , ( new StringBuilder ( ) ) . append ( " Teleporting " ) . append ( as [ 1 ] ) . append ( " to " ) . append ( as [ 2 ] ) . append ( " . " ) . toString ( ) ) ;
}
} else {
icommandlistener . b ( " Syntax error, please provice a source and a target. " ) ;
}
} else if ( s . toLowerCase ( ) . startsWith ( " give " ) ) {
String as1 [ ] = s . split ( " " ) ;
if ( as1 . length ! = 3 & & as1 . length ! = 4 ) {
return ;
}
String s9 = as1 [ 1 ] ;
EntityPlayerMP entityplayermp4 = f . h ( s9 ) ;
if ( entityplayermp4 ! = null ) {
try {
int j1 = Integer . parseInt ( as1 [ 2 ] ) ;
if ( Item . c [ j1 ] ! = null ) {
a ( s1 , ( new StringBuilder ( ) ) . append ( " Giving " ) . append ( entityplayermp4 . aw ) . append ( " some " ) . append ( j1 ) . toString ( ) ) ;
int k1 = 1 ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
if ( as1 . length > 3 ) {
k1 = b ( as1 [ 3 ] , 1 ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
if ( k1 < 1 ) {
k1 = 1 ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
if ( k1 > 64 ) {
k1 = 64 ;
}
entityplayermp4 . b ( new ItemStack ( j1 , k1 ) ) ;
2010-12-22 16:22:23 +01:00
} else {
2010-12-28 20:52:24 +01:00
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " There's no item with id " ) . append ( j1 ) . toString ( ) ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
} catch ( NumberFormatException numberformatexception ) {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " There's no item with id " ) . append ( as1 [ 2 ] ) . toString ( ) ) ;
}
} else {
icommandlistener . b ( ( new StringBuilder ( ) ) . append ( " Can't find user " ) . append ( s9 ) . toString ( ) ) ;
}
} else if ( s . toLowerCase ( ) . startsWith ( " say " ) ) {
s = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
a . info ( ( new StringBuilder ( ) ) . append ( " [ " ) . append ( s1 ) . append ( " ] " ) . append ( s ) . toString ( ) ) ;
f . a ( new Packet3Chat ( ( new StringBuilder ( ) ) . append ( " \ 247d[Server] " ) . append ( s ) . toString ( ) ) ) ;
} else if ( s . toLowerCase ( ) . startsWith ( " tell " ) ) {
String as2 [ ] = s . split ( " " ) ;
if ( as2 . length > = 3 ) {
s = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
s = s . substring ( s . indexOf ( " " ) ) . trim ( ) ;
a . info ( ( new StringBuilder ( ) ) . append ( " [ " ) . append ( s1 ) . append ( " -> " ) . append ( as2 [ 1 ] ) . append ( " ] " ) . append ( s ) . toString ( ) ) ;
s = ( new StringBuilder ( ) ) . append ( " \ 2477 " ) . append ( s1 ) . append ( " whispers " ) . append ( s ) . toString ( ) ;
a . info ( s ) ;
if ( ! f . a ( as2 [ 1 ] , new Packet3Chat ( s ) ) ) {
icommandlistener . b ( " There's no player by that name online. " ) ;
2010-12-22 16:22:23 +01:00
}
}
2010-12-28 20:52:24 +01:00
} else {
a . info ( " Unknown console command. Type \" help \" for help. " ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
} while ( true ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
private void a ( String s , String s1 ) {
String s2 = ( new StringBuilder ( ) ) . append ( s ) . append ( " : " ) . append ( s1 ) . toString ( ) ;
f . i ( ( new StringBuilder ( ) ) . append ( " \ 2477( " ) . append ( s2 ) . append ( " ) " ) . toString ( ) ) ;
a . info ( s2 ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
private int b ( String s , int i1 ) {
2010-12-22 16:22:23 +01:00
try {
2010-12-28 20:52:24 +01:00
return Integer . parseInt ( s ) ;
} catch ( NumberFormatException numberformatexception ) {
return i1 ;
2010-12-22 16:22:23 +01:00
}
}
2010-12-28 20:52:24 +01:00
public void a ( IUpdatePlayerListBox iupdateplayerlistbox ) {
p . add ( iupdateplayerlistbox ) ;
2010-12-22 16:22:23 +01:00
}
2011-01-04 01:43:23 +01:00
// Craftbukkit start - replaces main(String args[])
public static void main ( final OptionSet options ) {
2010-12-22 16:22:23 +01:00
try {
2011-01-04 01:43:23 +01:00
MinecraftServer minecraftserver = new MinecraftServer ( options ) ;
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
( new ThreadServerApplication ( " Server thread " , minecraftserver ) ) . start ( ) ;
} catch ( Exception exception ) {
a . log ( Level . SEVERE , " Failed to start the minecraft server " , exception ) ;
2010-12-22 16:22:23 +01:00
}
}
2011-01-04 01:43:23 +01:00
// Craftbukkit end
2010-12-22 16:22:23 +01:00
2010-12-28 20:52:24 +01:00
public File a ( String s ) {
return new File ( s ) ;
2010-12-22 16:22:23 +01:00
}
2010-12-28 20:52:24 +01:00
public void b ( String s ) {
a . info ( s ) ;
2010-12-22 16:22:23 +01:00
}
public String c ( ) {
return " CONSOLE " ;
}
2010-12-28 20:52:24 +01:00
public static boolean a ( MinecraftServer minecraftserver ) {
return minecraftserver . o ;
}
}