Removed unneed volatile and atomic
This commit is contained in:
@@ -33,7 +33,6 @@ import org.bukkit.inventory.MainHand;
|
||||
|
||||
/**
|
||||
* Akarin Changes Note
|
||||
* 1) Add volatile to fields (time update)
|
||||
* 2) Add lock to player track (safety issue)
|
||||
*/
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@@ -1455,8 +1454,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
// CraftBukkit start - Add per-player time and weather.
|
||||
public volatile long timeOffset = 0; // Akarin - volatile
|
||||
public volatile boolean relativeTime = true; // Akarin - volatile
|
||||
public long timeOffset = 0;
|
||||
public boolean relativeTime = true;
|
||||
|
||||
public long getPlayerTime() {
|
||||
if (this.relativeTime) {
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -44,10 +42,10 @@ public class PlayerChunkMap {
|
||||
private final List<PlayerChunk> g = Lists.newLinkedList();
|
||||
private final List<PlayerChunk> h = Lists.newLinkedList();
|
||||
private final List<PlayerChunk> i = Lists.newCopyOnWriteArrayList(); // Akarin - bad plugin will access this
|
||||
private AtomicInteger j = new AtomicInteger(); public int getViewDistance() { return j.get(); } // Paper OBFHELPER // Akarin - atmoic
|
||||
private int j; public int getViewDistance() { return j; } // Paper OBFHELPER
|
||||
private long k;
|
||||
private AtomicBoolean l = new AtomicBoolean(true); // Akarin - atmoic
|
||||
private AtomicBoolean m = new AtomicBoolean(true); // Akarin - atmoic
|
||||
private boolean l = true;
|
||||
private boolean m = true;
|
||||
private boolean wasNotEmpty; // CraftBukkit - add field
|
||||
|
||||
public PlayerChunkMap(WorldServer worldserver) {
|
||||
@@ -124,8 +122,8 @@ public class PlayerChunkMap {
|
||||
} // Paper timing
|
||||
}
|
||||
|
||||
if (this.l.get() && i % 4L == 0L) { // Akarin
|
||||
this.l.getAndSet(false); // Akarin
|
||||
if (this.l && i % 4L == 0L) {
|
||||
this.l = false;
|
||||
try (Timing ignored = world.timings.doChunkMapSortMissing.startTiming()) { // Paper
|
||||
// CraftBukkit start
|
||||
Collections.sort(this.h, (playerchunkx, playerchunk1x) -> {
|
||||
@@ -134,8 +132,8 @@ public class PlayerChunkMap {
|
||||
} // Paper timing
|
||||
}
|
||||
|
||||
if (this.m.get() && i % 4L == 2L) { // Akarin
|
||||
this.m.getAndSet(false); // Akarin
|
||||
if (this.m && i % 4L == 2L) {
|
||||
this.m = false;
|
||||
try (Timing ignored = world.timings.doChunkMapSortSendToPlayers.startTiming()) { // Paper
|
||||
Collections.sort(this.g, (playerchunkx, playerchunk1x) -> {
|
||||
return ComparisonChain.start().compare(playerchunkx.g(), playerchunk1x.g()).result();
|
||||
@@ -397,8 +395,8 @@ public class PlayerChunkMap {
|
||||
// Paper start - Separate into two methods
|
||||
public void a(int i) {
|
||||
i = MathHelper.clamp(i, 3, 32);
|
||||
if (i != this.j.get()) { // Akarin
|
||||
int j = i - this.j.get(); // Akarin
|
||||
if (i != this.j) { // Akarin
|
||||
int j = i - this.j; // Akarin
|
||||
managedPlayersLock.readLock().lock(); // Akarin
|
||||
ArrayList arraylist = Lists.newArrayList(this.managedPlayers);
|
||||
managedPlayersLock.readLock().unlock(); // Akarin
|
||||
@@ -409,7 +407,7 @@ public class PlayerChunkMap {
|
||||
this.setViewDistance(entityplayer, i, false); // Paper - Split, don't mark sort pending, we'll handle it after
|
||||
}
|
||||
|
||||
this.j.getAndSet(i); // Akarin
|
||||
this.j = i;
|
||||
this.e();
|
||||
}
|
||||
}
|
||||
@@ -461,8 +459,8 @@ public class PlayerChunkMap {
|
||||
// Paper end
|
||||
|
||||
private void e() {
|
||||
this.l.getAndSet(true); // Akarin
|
||||
this.m.getAndSet(true); // Akarin
|
||||
this.l = true;
|
||||
this.m = true;
|
||||
}
|
||||
|
||||
public static int getFurthestViewableBlock(int i) {
|
||||
|
||||
@@ -75,9 +75,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
private final MinecraftServer minecraftServer;
|
||||
public EntityPlayer player;
|
||||
private int e;
|
||||
private volatile long f = SystemUtils.b(); public void setLastPing(long lastPing) { this.f = lastPing;}; public long getLastPing() { return this.f;}; // Paper - OBFHELPER - set ping to delay initial // Akarin - private -> public - volatile
|
||||
private volatile boolean g; public void setPendingPing(boolean isPending) { this.g = isPending;}; public boolean isPendingPing() { return this.g;}; // Paper - OBFHELPER // Akarin - private -> public - volatile
|
||||
private volatile long h; public void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; public long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER // Akarin - private -> public - volatile
|
||||
private long f = SystemUtils.b(); public void setLastPing(long lastPing) { this.f = lastPing;}; public long getLastPing() { return this.f;}; // Paper - OBFHELPER - set ping to delay initial // Akarin - private -> public
|
||||
private boolean g; public void setPendingPing(boolean isPending) { this.g = isPending;}; public boolean isPendingPing() { return this.g;}; // Paper - OBFHELPER // Akarin - private -> public
|
||||
private long h; public void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; public long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER // Akarin - private -> public
|
||||
// CraftBukkit start - multithreaded fields
|
||||
private volatile int chatThrottle;
|
||||
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle");
|
||||
|
||||
@@ -1,772 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.datafixers.DataFixTypes;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.JsonOps;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import javax.annotation.Nullable;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
/**
|
||||
* Akarin Changes Note
|
||||
* 1) Add volatile to fields (slack service)
|
||||
*/
|
||||
public class WorldData {
|
||||
|
||||
private String b;
|
||||
private int c;
|
||||
private boolean d;
|
||||
public static final EnumDifficulty a = EnumDifficulty.NORMAL;
|
||||
private long e;
|
||||
private WorldType f;
|
||||
private NBTTagCompound g;
|
||||
@Nullable
|
||||
private String h;
|
||||
private int i;
|
||||
private int j;
|
||||
private int k;
|
||||
private volatile long l; // Akarin - volatile - OBFHELPER: time
|
||||
private volatile long m; // Akarin - volatile - OBFHELPER: dayTime
|
||||
private long n;
|
||||
private long o;
|
||||
@Nullable
|
||||
private final DataFixer p;
|
||||
private final int q;
|
||||
private boolean r;
|
||||
private NBTTagCompound s;
|
||||
private int t;
|
||||
private String levelName;
|
||||
private int v;
|
||||
private int w;
|
||||
private boolean x;
|
||||
private int y;
|
||||
private boolean z;
|
||||
private int A;
|
||||
private EnumGamemode B;
|
||||
private boolean C;
|
||||
private boolean D;
|
||||
private boolean E;
|
||||
private boolean F;
|
||||
private volatile EnumDifficulty G; // Akarin - volatile
|
||||
private boolean H;
|
||||
private double I;
|
||||
private double J;
|
||||
private double K;
|
||||
private long L;
|
||||
private double M;
|
||||
private double N;
|
||||
private double O;
|
||||
private int P;
|
||||
private int Q;
|
||||
private final Set<String> R;
|
||||
private final Set<String> S;
|
||||
private final Map<DimensionManager, NBTTagCompound> T;
|
||||
private NBTTagCompound U;
|
||||
private final GameRules V;
|
||||
public WorldServer world; // CraftBukkit
|
||||
|
||||
protected WorldData() {
|
||||
this.f = WorldType.NORMAL;
|
||||
this.g = new NBTTagCompound();
|
||||
this.K = 6.0E7D;
|
||||
this.N = 5.0D;
|
||||
this.O = 0.2D;
|
||||
this.P = 5;
|
||||
this.Q = 15;
|
||||
this.R = Sets.newHashSet();
|
||||
this.S = Sets.newLinkedHashSet();
|
||||
this.T = Maps.newEnumMap(DimensionManager.class);
|
||||
this.V = new GameRules();
|
||||
this.p = null;
|
||||
this.q = 1519;
|
||||
this.b(new NBTTagCompound());
|
||||
}
|
||||
|
||||
public WorldData(NBTTagCompound nbttagcompound, DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound1) {
|
||||
this.f = WorldType.NORMAL;
|
||||
this.g = new NBTTagCompound();
|
||||
this.K = 6.0E7D;
|
||||
this.N = 5.0D;
|
||||
this.O = 0.2D;
|
||||
this.P = 5;
|
||||
this.Q = 15;
|
||||
this.R = Sets.newHashSet();
|
||||
this.S = Sets.newLinkedHashSet();
|
||||
this.T = Maps.newEnumMap(DimensionManager.class);
|
||||
this.V = new GameRules();
|
||||
this.p = datafixer;
|
||||
NBTTagCompound nbttagcompound2;
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("Version", 10)) {
|
||||
nbttagcompound2 = nbttagcompound.getCompound("Version");
|
||||
this.b = nbttagcompound2.getString("Name");
|
||||
this.c = nbttagcompound2.getInt("Id");
|
||||
this.d = nbttagcompound2.getBoolean("Snapshot");
|
||||
}
|
||||
|
||||
this.e = nbttagcompound.getLong("RandomSeed");
|
||||
if (nbttagcompound.hasKeyOfType("generatorName", 8)) {
|
||||
String s = nbttagcompound.getString("generatorName");
|
||||
|
||||
this.f = WorldType.getType(s);
|
||||
if (this.f == null) {
|
||||
this.f = WorldType.NORMAL;
|
||||
} else if (this.f == WorldType.CUSTOMIZED) {
|
||||
this.h = nbttagcompound.getString("generatorOptions");
|
||||
} else if (this.f.h()) {
|
||||
int j = 0;
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("generatorVersion", 99)) {
|
||||
j = nbttagcompound.getInt("generatorVersion");
|
||||
}
|
||||
|
||||
this.f = this.f.a(j);
|
||||
}
|
||||
|
||||
this.b(nbttagcompound.getCompound("generatorOptions"));
|
||||
}
|
||||
|
||||
this.B = EnumGamemode.getById(nbttagcompound.getInt("GameType"));
|
||||
if (nbttagcompound.hasKeyOfType("legacy_custom_options", 8)) {
|
||||
this.h = nbttagcompound.getString("legacy_custom_options");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("MapFeatures", 99)) {
|
||||
this.C = nbttagcompound.getBoolean("MapFeatures");
|
||||
} else {
|
||||
this.C = true;
|
||||
}
|
||||
|
||||
this.i = nbttagcompound.getInt("SpawnX");
|
||||
this.j = nbttagcompound.getInt("SpawnY");
|
||||
this.k = nbttagcompound.getInt("SpawnZ");
|
||||
this.l = nbttagcompound.getLong("Time");
|
||||
if (nbttagcompound.hasKeyOfType("DayTime", 99)) {
|
||||
this.m = nbttagcompound.getLong("DayTime");
|
||||
} else {
|
||||
this.m = this.l;
|
||||
}
|
||||
|
||||
this.n = nbttagcompound.getLong("LastPlayed");
|
||||
this.o = nbttagcompound.getLong("SizeOnDisk");
|
||||
this.levelName = nbttagcompound.getString("LevelName");
|
||||
this.v = nbttagcompound.getInt("version");
|
||||
this.w = nbttagcompound.getInt("clearWeatherTime");
|
||||
this.y = nbttagcompound.getInt("rainTime");
|
||||
this.x = nbttagcompound.getBoolean("raining");
|
||||
this.A = nbttagcompound.getInt("thunderTime");
|
||||
this.z = nbttagcompound.getBoolean("thundering");
|
||||
this.D = nbttagcompound.getBoolean("hardcore");
|
||||
if (nbttagcompound.hasKeyOfType("initialized", 99)) {
|
||||
this.F = nbttagcompound.getBoolean("initialized");
|
||||
} else {
|
||||
this.F = true;
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("allowCommands", 99)) {
|
||||
this.E = nbttagcompound.getBoolean("allowCommands");
|
||||
} else {
|
||||
this.E = this.B == EnumGamemode.CREATIVE;
|
||||
}
|
||||
|
||||
this.q = i;
|
||||
if (nbttagcompound1 != null) {
|
||||
this.s = nbttagcompound1;
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("GameRules", 10)) {
|
||||
this.V.a(nbttagcompound.getCompound("GameRules"));
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("Difficulty", 99)) {
|
||||
this.G = EnumDifficulty.getById(nbttagcompound.getByte("Difficulty"));
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("DifficultyLocked", 1)) {
|
||||
this.H = nbttagcompound.getBoolean("DifficultyLocked");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderCenterX", 99)) {
|
||||
this.I = nbttagcompound.getDouble("BorderCenterX");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderCenterZ", 99)) {
|
||||
this.J = nbttagcompound.getDouble("BorderCenterZ");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderSize", 99)) {
|
||||
this.K = nbttagcompound.getDouble("BorderSize");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderSizeLerpTime", 99)) {
|
||||
this.L = nbttagcompound.getLong("BorderSizeLerpTime");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderSizeLerpTarget", 99)) {
|
||||
this.M = nbttagcompound.getDouble("BorderSizeLerpTarget");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderSafeZone", 99)) {
|
||||
this.N = nbttagcompound.getDouble("BorderSafeZone");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderDamagePerBlock", 99)) {
|
||||
this.O = nbttagcompound.getDouble("BorderDamagePerBlock");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderWarningBlocks", 99)) {
|
||||
this.P = nbttagcompound.getInt("BorderWarningBlocks");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("BorderWarningTime", 99)) {
|
||||
this.Q = nbttagcompound.getInt("BorderWarningTime");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("DimensionData", 10)) {
|
||||
nbttagcompound2 = nbttagcompound.getCompound("DimensionData");
|
||||
Iterator iterator = nbttagcompound2.getKeys().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String s1 = (String) iterator.next();
|
||||
|
||||
this.T.put(DimensionManager.a(Integer.parseInt(s1)), nbttagcompound2.getCompound(s1));
|
||||
}
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("DataPacks", 10)) {
|
||||
nbttagcompound2 = nbttagcompound.getCompound("DataPacks");
|
||||
NBTTagList nbttaglist = nbttagcompound2.getList("Disabled", 8);
|
||||
|
||||
for (int k = 0; k < nbttaglist.size(); ++k) {
|
||||
this.R.add(nbttaglist.getString(k));
|
||||
}
|
||||
|
||||
NBTTagList nbttaglist1 = nbttagcompound2.getList("Enabled", 8);
|
||||
|
||||
for (int l = 0; l < nbttaglist1.size(); ++l) {
|
||||
this.S.add(nbttaglist1.getString(l));
|
||||
}
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("CustomBossEvents", 10)) {
|
||||
this.U = nbttagcompound.getCompound("CustomBossEvents");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public WorldData(WorldSettings worldsettings, String s) {
|
||||
this.f = WorldType.NORMAL;
|
||||
this.g = new NBTTagCompound();
|
||||
this.K = 6.0E7D;
|
||||
this.N = 5.0D;
|
||||
this.O = 0.2D;
|
||||
this.P = 5;
|
||||
this.Q = 15;
|
||||
this.R = Sets.newHashSet();
|
||||
this.S = Sets.newLinkedHashSet();
|
||||
this.T = Maps.newEnumMap(DimensionManager.class);
|
||||
this.V = new GameRules();
|
||||
this.p = null;
|
||||
this.q = 1519;
|
||||
this.a(worldsettings);
|
||||
this.levelName = s;
|
||||
this.G = WorldData.a;
|
||||
this.F = false;
|
||||
}
|
||||
|
||||
public void a(WorldSettings worldsettings) {
|
||||
this.e = worldsettings.d();
|
||||
this.B = worldsettings.e();
|
||||
this.C = worldsettings.g();
|
||||
this.D = worldsettings.f();
|
||||
this.f = worldsettings.h();
|
||||
this.b((NBTTagCompound) Dynamic.convert(JsonOps.INSTANCE, DynamicOpsNBT.a, worldsettings.j()));
|
||||
this.E = worldsettings.i();
|
||||
}
|
||||
|
||||
public NBTTagCompound a(@Nullable NBTTagCompound nbttagcompound) {
|
||||
this.Q();
|
||||
if (nbttagcompound == null) {
|
||||
nbttagcompound = this.s;
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
this.a(nbttagcompound1, nbttagcompound);
|
||||
return nbttagcompound1;
|
||||
}
|
||||
|
||||
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound2.setString("Name", "1.13");
|
||||
nbttagcompound2.setInt("Id", 1519);
|
||||
nbttagcompound2.setBoolean("Snapshot", false);
|
||||
nbttagcompound.set("Version", nbttagcompound2);
|
||||
nbttagcompound.setInt("DataVersion", 1519);
|
||||
if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1519) throw new AssertionError(); // CraftBukkit - sentinel
|
||||
nbttagcompound.setLong("RandomSeed", this.e);
|
||||
nbttagcompound.setString("generatorName", this.f.b());
|
||||
nbttagcompound.setInt("generatorVersion", this.f.getVersion());
|
||||
if (!this.g.isEmpty()) {
|
||||
nbttagcompound.set("generatorOptions", this.g);
|
||||
}
|
||||
|
||||
if (this.h != null) {
|
||||
nbttagcompound.setString("legacy_custom_options", this.h);
|
||||
}
|
||||
|
||||
nbttagcompound.setInt("GameType", this.B.getId());
|
||||
nbttagcompound.setBoolean("MapFeatures", this.C);
|
||||
nbttagcompound.setInt("SpawnX", this.i);
|
||||
nbttagcompound.setInt("SpawnY", this.j);
|
||||
nbttagcompound.setInt("SpawnZ", this.k);
|
||||
nbttagcompound.setLong("Time", this.l);
|
||||
nbttagcompound.setLong("DayTime", this.m);
|
||||
nbttagcompound.setLong("SizeOnDisk", this.o);
|
||||
nbttagcompound.setLong("LastPlayed", SystemUtils.d());
|
||||
nbttagcompound.setString("LevelName", this.levelName);
|
||||
nbttagcompound.setInt("version", this.v);
|
||||
nbttagcompound.setInt("clearWeatherTime", this.w);
|
||||
nbttagcompound.setInt("rainTime", this.y);
|
||||
nbttagcompound.setBoolean("raining", this.x);
|
||||
nbttagcompound.setInt("thunderTime", this.A);
|
||||
nbttagcompound.setBoolean("thundering", this.z);
|
||||
nbttagcompound.setBoolean("hardcore", this.D);
|
||||
nbttagcompound.setBoolean("allowCommands", this.E);
|
||||
nbttagcompound.setBoolean("initialized", this.F);
|
||||
nbttagcompound.setDouble("BorderCenterX", this.I);
|
||||
nbttagcompound.setDouble("BorderCenterZ", this.J);
|
||||
nbttagcompound.setDouble("BorderSize", this.K);
|
||||
nbttagcompound.setLong("BorderSizeLerpTime", this.L);
|
||||
nbttagcompound.setDouble("BorderSafeZone", this.N);
|
||||
nbttagcompound.setDouble("BorderDamagePerBlock", this.O);
|
||||
nbttagcompound.setDouble("BorderSizeLerpTarget", this.M);
|
||||
nbttagcompound.setDouble("BorderWarningBlocks", (double) this.P);
|
||||
nbttagcompound.setDouble("BorderWarningTime", (double) this.Q);
|
||||
if (this.G != null) {
|
||||
nbttagcompound.setByte("Difficulty", (byte) this.G.a());
|
||||
}
|
||||
|
||||
nbttagcompound.setBoolean("DifficultyLocked", this.H);
|
||||
nbttagcompound.set("GameRules", this.V.a());
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
Iterator iterator = this.T.entrySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entry entry = (Entry) iterator.next();
|
||||
|
||||
nbttagcompound3.set(String.valueOf(((DimensionManager) entry.getKey()).getDimensionID()), (NBTBase) entry.getValue());
|
||||
}
|
||||
|
||||
nbttagcompound.set("DimensionData", nbttagcompound3);
|
||||
if (nbttagcompound1 != null) {
|
||||
nbttagcompound.set("Player", nbttagcompound1);
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound4 = new NBTTagCompound();
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
Iterator iterator1 = this.S.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
String s = (String) iterator1.next();
|
||||
|
||||
nbttaglist.add((NBTBase) (new NBTTagString(s)));
|
||||
}
|
||||
|
||||
nbttagcompound4.set("Enabled", nbttaglist);
|
||||
NBTTagList nbttaglist1 = new NBTTagList();
|
||||
Iterator iterator2 = this.R.iterator();
|
||||
|
||||
while (iterator2.hasNext()) {
|
||||
String s1 = (String) iterator2.next();
|
||||
|
||||
nbttaglist1.add((NBTBase) (new NBTTagString(s1)));
|
||||
}
|
||||
|
||||
nbttagcompound4.set("Disabled", nbttaglist1);
|
||||
nbttagcompound.set("DataPacks", nbttagcompound4);
|
||||
if (this.U != null) {
|
||||
nbttagcompound.set("CustomBossEvents", this.U);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public long getDayTime() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
private void Q() {
|
||||
if (!this.r && this.s != null) {
|
||||
if (this.q < 1519) {
|
||||
if (this.p == null) {
|
||||
throw new NullPointerException("Fixer Upper not set inside LevelData, and the player tag is not upgraded.");
|
||||
}
|
||||
|
||||
this.s = GameProfileSerializer.a(this.p, DataFixTypes.PLAYER, this.s, this.q);
|
||||
}
|
||||
|
||||
this.t = this.s.getInt("Dimension");
|
||||
this.r = true;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound h() {
|
||||
this.Q();
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public void setTime(long i) {
|
||||
this.l = i;
|
||||
}
|
||||
|
||||
public void setDayTime(long i) {
|
||||
this.m = i;
|
||||
}
|
||||
|
||||
public void setSpawn(BlockPosition blockposition) {
|
||||
this.i = blockposition.getX();
|
||||
this.j = blockposition.getY();
|
||||
this.k = blockposition.getZ();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.levelName;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
this.levelName = s;
|
||||
}
|
||||
|
||||
public int k() {
|
||||
return this.v;
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
this.v = i;
|
||||
}
|
||||
|
||||
public int z() {
|
||||
return this.w;
|
||||
}
|
||||
|
||||
public void g(int i) {
|
||||
this.w = i;
|
||||
}
|
||||
|
||||
public boolean isThundering() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public void setThundering(boolean flag) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World world = Bukkit.getWorld(getName());
|
||||
if (world != null) {
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(world, flag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(thunder);
|
||||
if (thunder.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.z = flag;
|
||||
}
|
||||
|
||||
public int getThunderDuration() {
|
||||
return this.A;
|
||||
}
|
||||
|
||||
public void setThunderDuration(int i) {
|
||||
this.A = i;
|
||||
}
|
||||
|
||||
public boolean hasStorm() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public void setStorm(boolean flag) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World world = Bukkit.getWorld(getName());
|
||||
if (world != null) {
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(world, flag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(weather);
|
||||
if (weather.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.x = flag;
|
||||
}
|
||||
|
||||
public int getWeatherDuration() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public void setWeatherDuration(int i) {
|
||||
this.y = i;
|
||||
}
|
||||
|
||||
public EnumGamemode getGameType() {
|
||||
return this.B;
|
||||
}
|
||||
|
||||
public boolean shouldGenerateMapFeatures() {
|
||||
return this.C;
|
||||
}
|
||||
|
||||
public void f(boolean flag) {
|
||||
this.C = flag;
|
||||
}
|
||||
|
||||
public void setGameType(EnumGamemode enumgamemode) {
|
||||
this.B = enumgamemode;
|
||||
}
|
||||
|
||||
public boolean isHardcore() {
|
||||
return this.D;
|
||||
}
|
||||
|
||||
public void g(boolean flag) {
|
||||
this.D = flag;
|
||||
}
|
||||
|
||||
public WorldType getType() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public void a(WorldType worldtype) {
|
||||
this.f = worldtype;
|
||||
}
|
||||
|
||||
public NBTTagCompound getGeneratorOptions() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
this.g = nbttagcompound;
|
||||
}
|
||||
|
||||
public boolean u() {
|
||||
return this.E;
|
||||
}
|
||||
|
||||
public void c(boolean flag) {
|
||||
this.E = flag;
|
||||
}
|
||||
|
||||
public boolean v() {
|
||||
return this.F;
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
this.F = flag;
|
||||
}
|
||||
|
||||
public GameRules w() {
|
||||
return this.V;
|
||||
}
|
||||
|
||||
public double B() {
|
||||
return this.I;
|
||||
}
|
||||
|
||||
public double C() {
|
||||
return this.J;
|
||||
}
|
||||
|
||||
public double D() {
|
||||
return this.K;
|
||||
}
|
||||
|
||||
public void a(double d0) {
|
||||
this.K = d0;
|
||||
}
|
||||
|
||||
public long E() {
|
||||
return this.L;
|
||||
}
|
||||
|
||||
public void c(long i) {
|
||||
this.L = i;
|
||||
}
|
||||
|
||||
public double F() {
|
||||
return this.M;
|
||||
}
|
||||
|
||||
public void b(double d0) {
|
||||
this.M = d0;
|
||||
}
|
||||
|
||||
public void c(double d0) {
|
||||
this.J = d0;
|
||||
}
|
||||
|
||||
public void d(double d0) {
|
||||
this.I = d0;
|
||||
}
|
||||
|
||||
public double G() {
|
||||
return this.N;
|
||||
}
|
||||
|
||||
public void e(double d0) {
|
||||
this.N = d0;
|
||||
}
|
||||
|
||||
public double H() {
|
||||
return this.O;
|
||||
}
|
||||
|
||||
public void f(double d0) {
|
||||
this.O = d0;
|
||||
}
|
||||
|
||||
public int I() {
|
||||
return this.P;
|
||||
}
|
||||
|
||||
public int J() {
|
||||
return this.Q;
|
||||
}
|
||||
|
||||
public void h(int i) {
|
||||
this.P = i;
|
||||
}
|
||||
|
||||
public void i(int i) {
|
||||
this.Q = i;
|
||||
}
|
||||
|
||||
public EnumDifficulty getDifficulty() {
|
||||
return this.G;
|
||||
}
|
||||
|
||||
public void setDifficulty(EnumDifficulty enumdifficulty) {
|
||||
this.G = enumdifficulty;
|
||||
// CraftBukkit start
|
||||
PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
|
||||
for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.players) {
|
||||
player.playerConnection.sendPacket(packet);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean isDifficultyLocked() {
|
||||
return this.H;
|
||||
}
|
||||
|
||||
public void e(boolean flag) {
|
||||
this.H = flag;
|
||||
}
|
||||
|
||||
public void a(CrashReportSystemDetails crashreportsystemdetails) {
|
||||
crashreportsystemdetails.a("Level seed", () -> {
|
||||
return String.valueOf(this.getSeed());
|
||||
});
|
||||
crashreportsystemdetails.a("Level generator", () -> {
|
||||
return String.format("ID %02d - %s, ver %d. Features enabled: %b", new Object[] { Integer.valueOf(this.f.i()), this.f.name(), Integer.valueOf(this.f.getVersion()), Boolean.valueOf(this.C)});
|
||||
});
|
||||
crashreportsystemdetails.a("Level generator options", () -> {
|
||||
return this.g.toString();
|
||||
});
|
||||
crashreportsystemdetails.a("Level spawn location", () -> {
|
||||
return CrashReportSystemDetails.a(this.i, this.j, this.k);
|
||||
});
|
||||
crashreportsystemdetails.a("Level time", () -> {
|
||||
return String.format("%d game time, %d day time", new Object[] { Long.valueOf(this.l), Long.valueOf(this.m)});
|
||||
});
|
||||
crashreportsystemdetails.a("Level dimension", () -> {
|
||||
return String.valueOf(this.t);
|
||||
});
|
||||
crashreportsystemdetails.a("Level storage version", () -> {
|
||||
String s = "Unknown?";
|
||||
|
||||
try {
|
||||
switch (this.v) {
|
||||
case 19132:
|
||||
s = "McRegion";
|
||||
break;
|
||||
|
||||
case 19133:
|
||||
s = "Anvil";
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
;
|
||||
}
|
||||
|
||||
return String.format("0x%05X - %s", new Object[] { Integer.valueOf(this.v), s});
|
||||
});
|
||||
crashreportsystemdetails.a("Level weather", () -> {
|
||||
return String.format("Rain time: %d (now: %b), thunder time: %d (now: %b)", new Object[] { Integer.valueOf(this.y), Boolean.valueOf(this.x), Integer.valueOf(this.A), Boolean.valueOf(this.z)});
|
||||
});
|
||||
crashreportsystemdetails.a("Level game mode", () -> {
|
||||
return String.format("Game mode: %s (ID %d). Hardcore: %b. Cheats: %b", new Object[] { this.B.b(), Integer.valueOf(this.B.getId()), Boolean.valueOf(this.D), Boolean.valueOf(this.E)});
|
||||
});
|
||||
}
|
||||
|
||||
public NBTTagCompound a(DimensionManager dimensionmanager) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.T.get(dimensionmanager);
|
||||
|
||||
return nbttagcompound == null ? new NBTTagCompound() : nbttagcompound;
|
||||
}
|
||||
|
||||
public void a(DimensionManager dimensionmanager, NBTTagCompound nbttagcompound) {
|
||||
this.T.put(dimensionmanager, nbttagcompound);
|
||||
}
|
||||
|
||||
public Set<String> N() {
|
||||
return this.R;
|
||||
}
|
||||
|
||||
public Set<String> O() {
|
||||
return this.S;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public NBTTagCompound P() {
|
||||
return this.U;
|
||||
}
|
||||
|
||||
public void c(@Nullable NBTTagCompound nbttagcompound) {
|
||||
this.U = nbttagcompound;
|
||||
}
|
||||
|
||||
// CraftBukkit start - Check if the name stored in NBT is the correct one
|
||||
public void checkName( String name ) {
|
||||
if ( !this.levelName.equals( name ) ) {
|
||||
this.levelName = name;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
Reference in New Issue
Block a user