2011-02-23 03:37:56 +01:00
package net.minecraft.server ;
import java.util.List ;
2011-07-07 21:49:13 +02:00
import org.bukkit.Bukkit ;
2011-02-23 03:37:56 +01:00
public class WorldData {
private long a ;
private int b ;
private int c ;
private int d ;
private long e ;
private long f ;
private long g ;
private NBTTagCompound h ;
private int i ;
2011-05-14 16:29:42 +02:00
public String name ; // CraftBukkit - private -> public
2011-02-23 03:37:56 +01:00
private int k ;
2011-04-20 22:47:26 +02:00
private boolean l ;
private int m ;
private boolean n ;
private int o ;
2011-07-05 05:48:27 +02:00
private long worldUID ; // CraftBukkit
2011-02-23 03:37:56 +01:00
public WorldData ( NBTTagCompound nbttagcompound ) {
2011-06-27 00:25:01 +02:00
this . a = nbttagcompound . getLong ( " RandomSeed " ) ;
2011-02-23 03:37:56 +01:00
this . b = nbttagcompound . e ( " SpawnX " ) ;
this . c = nbttagcompound . e ( " SpawnY " ) ;
this . d = nbttagcompound . e ( " SpawnZ " ) ;
2011-06-27 00:25:01 +02:00
this . e = nbttagcompound . getLong ( " Time " ) ;
this . f = nbttagcompound . getLong ( " LastPlayed " ) ;
this . g = nbttagcompound . getLong ( " SizeOnDisk " ) ;
2011-04-20 19:05:14 +02:00
this . name = nbttagcompound . getString ( " LevelName " ) ;
2011-02-23 03:37:56 +01:00
this . k = nbttagcompound . e ( " version " ) ;
2011-04-20 22:47:26 +02:00
this . m = nbttagcompound . e ( " rainTime " ) ;
this . l = nbttagcompound . m ( " raining " ) ;
this . o = nbttagcompound . e ( " thunderTime " ) ;
this . n = nbttagcompound . m ( " thundering " ) ;
2011-04-20 19:05:14 +02:00
if ( nbttagcompound . hasKey ( " Player " ) ) {
2011-02-23 03:37:56 +01:00
this . h = nbttagcompound . k ( " Player " ) ;
this . i = this . h . e ( " Dimension " ) ;
}
2011-07-05 05:48:27 +02:00
// CraftBukkit start
if ( nbttagcompound . hasKey ( " WorldUID " ) ) {
this . worldUID = nbttagcompound . getLong ( " WorldUID " ) ;
} else {
this . worldUID = ( System . nanoTime ( ) < < 20 ) + this . a ;
nbttagcompound . setLong ( " WorldUID " , this . worldUID ) ;
}
2011-07-07 21:49:13 +02:00
if ( Bukkit . getServer ( ) . getWorld ( worldUID ) ! = null ) {
throw new IllegalStateException ( " World ' " + name + " ' contains a conflicting UID with existing world. Please edit its level.dat and remove WorldUID, or delete its level.dat (and lose its seed/etc). " ) ;
}
2011-07-05 05:48:27 +02:00
// CraftBukkit end
2011-02-23 03:37:56 +01:00
}
public WorldData ( long i , String s ) {
this . a = i ;
2011-04-20 19:05:14 +02:00
this . name = s ;
2011-07-05 05:48:27 +02:00
this . worldUID = ( System . nanoTime ( ) < < 20 ) + this . a ; // CraftBukkit
2011-02-23 03:37:56 +01:00
}
public WorldData ( WorldData worlddata ) {
this . a = worlddata . a ;
this . b = worlddata . b ;
this . c = worlddata . c ;
this . d = worlddata . d ;
this . e = worlddata . e ;
this . f = worlddata . f ;
this . g = worlddata . g ;
this . h = worlddata . h ;
this . i = worlddata . i ;
2011-04-20 19:05:14 +02:00
this . name = worlddata . name ;
2011-02-23 03:37:56 +01:00
this . k = worlddata . k ;
2011-04-20 22:47:26 +02:00
this . m = worlddata . m ;
this . l = worlddata . l ;
this . o = worlddata . o ;
this . n = worlddata . n ;
2011-02-23 03:37:56 +01:00
}
public NBTTagCompound a ( ) {
NBTTagCompound nbttagcompound = new NBTTagCompound ( ) ;
this . a ( nbttagcompound , this . h ) ;
return nbttagcompound ;
}
public NBTTagCompound a ( List list ) {
NBTTagCompound nbttagcompound = new NBTTagCompound ( ) ;
EntityHuman entityhuman = null ;
NBTTagCompound nbttagcompound1 = null ;
if ( list . size ( ) > 0 ) {
entityhuman = ( EntityHuman ) list . get ( 0 ) ;
}
if ( entityhuman ! = null ) {
nbttagcompound1 = new NBTTagCompound ( ) ;
entityhuman . d ( nbttagcompound1 ) ;
}
this . a ( nbttagcompound , nbttagcompound1 ) ;
return nbttagcompound ;
}
private void a ( NBTTagCompound nbttagcompound , NBTTagCompound nbttagcompound1 ) {
2011-06-27 00:25:01 +02:00
nbttagcompound . setLong ( " RandomSeed " , this . a ) ;
2011-02-23 03:37:56 +01:00
nbttagcompound . a ( " SpawnX " , this . b ) ;
nbttagcompound . a ( " SpawnY " , this . c ) ;
nbttagcompound . a ( " SpawnZ " , this . d ) ;
2011-06-27 00:25:01 +02:00
nbttagcompound . setLong ( " Time " , this . e ) ;
nbttagcompound . setLong ( " SizeOnDisk " , this . g ) ;
nbttagcompound . setLong ( " LastPlayed " , System . currentTimeMillis ( ) ) ;
2011-04-20 19:05:14 +02:00
nbttagcompound . setString ( " LevelName " , this . name ) ;
2011-02-23 03:37:56 +01:00
nbttagcompound . a ( " version " , this . k ) ;
2011-04-20 22:47:26 +02:00
nbttagcompound . a ( " rainTime " , this . m ) ;
nbttagcompound . a ( " raining " , this . l ) ;
nbttagcompound . a ( " thunderTime " , this . o ) ;
nbttagcompound . a ( " thundering " , this . n ) ;
2011-02-23 03:37:56 +01:00
if ( nbttagcompound1 ! = null ) {
nbttagcompound . a ( " Player " , nbttagcompound1 ) ;
}
2011-07-05 05:48:27 +02:00
nbttagcompound . setLong ( " WorldUID " , this . worldUID ) ; // CraftBukkit
2011-02-23 03:37:56 +01:00
}
2011-06-27 00:25:01 +02:00
public long getSeed ( ) {
2011-02-23 03:37:56 +01:00
return this . a ;
}
public int c ( ) {
return this . b ;
}
public int d ( ) {
return this . c ;
}
public int e ( ) {
return this . d ;
}
public long f ( ) {
return this . e ;
}
public long g ( ) {
return this . g ;
}
public int h ( ) {
return this . i ;
}
public void a ( long i ) {
this . e = i ;
}
public void b ( long i ) {
this . g = i ;
}
2011-04-20 19:05:14 +02:00
public void setSpawn ( int i , int j , int k ) {
2011-02-23 03:37:56 +01:00
this . b = i ;
this . c = j ;
this . d = k ;
}
public void a ( String s ) {
2011-04-20 19:05:14 +02:00
this . name = s ;
2011-02-23 03:37:56 +01:00
}
public int i ( ) {
return this . k ;
}
public void a ( int i ) {
this . k = i ;
}
2011-04-20 22:47:26 +02:00
2011-06-27 00:25:01 +02:00
public boolean isThundering ( ) {
2011-04-20 22:47:26 +02:00
return this . n ;
}
2011-06-27 00:25:01 +02:00
public void setThundering ( boolean flag ) {
2011-04-20 22:47:26 +02:00
this . n = flag ;
}
2011-06-27 00:25:01 +02:00
public int getThunderDuration ( ) {
2011-04-20 22:47:26 +02:00
return this . o ;
}
2011-06-27 00:25:01 +02:00
public void setThunderDuration ( int i ) {
2011-04-20 22:47:26 +02:00
this . o = i ;
}
2011-06-27 00:25:01 +02:00
public boolean hasStorm ( ) {
2011-04-20 22:47:26 +02:00
return this . l ;
}
2011-06-27 00:25:01 +02:00
public void setStorm ( boolean flag ) {
2011-04-20 22:47:26 +02:00
this . l = flag ;
}
2011-06-27 00:25:01 +02:00
public int getWeatherDuration ( ) {
2011-04-20 22:47:26 +02:00
return this . m ;
}
2011-06-27 00:25:01 +02:00
public void setWeatherDuration ( int i ) {
2011-04-20 22:47:26 +02:00
this . m = i ;
}
2011-07-05 05:48:27 +02:00
// CraftBukkit start
public long getWorldUID ( ) {
return this . worldUID ;
}
// CraftBukkit end
2011-02-23 03:37:56 +01:00
}