[CI-SKIP] Removes unused nms changes w/ Better changes note for unmixinable classes

This commit is contained in:
Sotr
2018-07-16 04:30:57 +08:00
parent fd733df52a
commit cede9c99fa
20 changed files with 55 additions and 162 deletions

View File

@@ -30,10 +30,8 @@ import org.bukkit.Bukkit;
import java.util.logging.Level; import java.util.logging.Level;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (safety issue)
* 1) Add volatile to fields<br>
* @author cakoyo
*/ */
class TimingHandler implements Timing { class TimingHandler implements Timing {

View File

@@ -293,7 +293,7 @@ public abstract class MixinChunk implements IMixinChunk {
if (chunk == null) { if (chunk == null) {
continue; continue;
} }
chunk.checkLightSide(enumfacing.opposite()); chunk.a(enumfacing.opposite()); // PAIL: checkLightSide
} }
this.setSkylightUpdated(); this.setSkylightUpdated();

View File

@@ -20,11 +20,9 @@ import org.bukkit.Server; // CraftBukkit
import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (async lighting)
* 1) Add volatile to fields<br> * 2) Expose private methods (async lighting)
* 2) Add OBFHELPER<br>
* @author cakoyo
*/ */
public class Chunk { public class Chunk {
@@ -1340,8 +1338,7 @@ public class Chunk {
this.h(false); this.h(false);
} }
public void checkLightSide(EnumDirection direction) { a(direction); } // Akarin - OBFHELPER public void a(EnumDirection enumdirection) { // Akarin - private -> public
private void a(EnumDirection enumdirection) {
if (this.done) { if (this.done) {
int i; int i;

View File

@@ -11,10 +11,8 @@ import java.util.Random;
import java.util.Map.Entry; import java.util.Map.Entry;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Expose private members (cause mixin errors)
* 1) Expose private members<br>
* @author cakoyo
*/ */
public class EnchantmentManager { public class EnchantmentManager {

View File

@@ -32,10 +32,9 @@ import org.bukkit.inventory.MainHand;
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (time update)
* 1) Add volatile to fields<br> * 2) Add lock to player track (safety issue)
* @author cakoyo
*/ */
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {

View File

@@ -12,10 +12,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add lock for entries set operations (safety issue)
* 1) Add lock for entries-set operations<br>
* @author cakoyo
*/ */
public class EntityTracker { public class EntityTracker {

View File

@@ -13,6 +13,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
// CraftBukkit end // CraftBukkit end
/**
* Akarin Changes Note
* 1) Make trackedPlayerMap thread-safe (safety issue)
*/
public class EntityTrackerEntry { public class EntityTrackerEntry {
private static final Logger c = LogManager.getLogger(); private static final Logger c = LogManager.getLogger();

View File

@@ -10,10 +10,8 @@ import java.util.Random;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add OBFHELPER (panda redstone)
* 1) Add OBFHELPER<br>
* @author cakoyo
*/ */
public enum EnumDirection implements INamable { public enum EnumDirection implements INamable {

View File

@@ -3,10 +3,8 @@ package net.minecraft.server;
import io.akarin.server.core.AkarinGlobalConfig; import io.akarin.server.core.AkarinGlobalConfig;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add end portal disable feature (feature)
* 1) Add end portal disable feature<br>
* @author cakoyo
*/ */
public class ItemEnderEye extends Item { public class ItemEnderEye extends Item {

View File

@@ -43,6 +43,10 @@ import joptsimple.OptionSet;
import org.spigotmc.SlackActivityAccountant; // Spigot import org.spigotmc.SlackActivityAccountant; // Spigot
import co.aikar.timings.MinecraftTimings; // Paper import co.aikar.timings.MinecraftTimings; // Paper
/**
* Akarin Changes Note
* 1) Make worlds list thread-safe (slack service)
*/
public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics { public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics {
private static MinecraftServer SERVER; // Paper private static MinecraftServer SERVER; // Paper

View File

@@ -32,11 +32,11 @@ import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager; import org.apache.logging.log4j.MarkerManager;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (nsc)
* 1) Add volatile to fields<br> * 2) Expose private members (nsc)
* 2) Expose private members<br> * 3) Changes lock type to updatable lock (compatibility)
* @author cakoyo * 4) Removes unneed array creation (performance)
*/ */
public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {

View File

@@ -1,98 +0,0 @@
package net.minecraft.server;
import co.aikar.timings.Timing;
import it.unimi.dsi.fastutil.objects.ObjectCollection;
import java.util.ArrayDeque;
/**
* <b>Akarin Changes Note</b><br>
* <br>
* 1) Expose private members<br>
* @author cakoyo
*/
class PaperLightingQueue {
private static final long MAX_TIME = (long) (1000000000 / 20 * .95);
private static int updatesThisTick;
static void processQueue(long curTime) {
updatesThisTick = 0;
final long startTime = System.nanoTime();
final long maxTickTime = MAX_TIME - (startTime - curTime);
START:
for (World world : MinecraftServer.getServer().worlds) {
if (!world.paperConfig.queueLightUpdates) {
continue;
}
ObjectCollection<Chunk> loadedChunks = ((WorldServer) world).getChunkProviderServer().chunks.values();
for (Chunk chunk : loadedChunks.toArray(new Chunk[loadedChunks.size()])) {
if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) {
break START;
}
}
}
}
public static class LightingQueue extends ArrayDeque<Runnable> { // Akarin - public
final private Chunk chunk;
LightingQueue(Chunk chunk) {
super();
this.chunk = chunk;
}
/**
* Processes the lighting queue for this chunk
*
* @param startTime If start Time is 0, we will not limit execution time
* @param maxTickTime Maximum time to spend processing lighting updates
* @return true to abort processing furthur lighting updates
*/
private boolean processQueue(long startTime, long maxTickTime) {
if (this.isEmpty()) {
return false;
}
try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) {
Runnable lightUpdate;
while ((lightUpdate = this.poll()) != null) {
lightUpdate.run();
if (startTime > 0 && ++PaperLightingQueue.updatesThisTick % 10 == 0 && PaperLightingQueue.updatesThisTick > 10) {
if (System.nanoTime() - startTime > maxTickTime) {
return true;
}
}
}
}
return false;
}
/**
* Flushes lighting updates to unload the chunk
*/
public void processUnload() { // Akarin - public
if (!chunk.world.paperConfig.queueLightUpdates) {
return;
}
processQueue(0, 0); // No timeout
final int radius = 1; // TODO: bitflip, why should this ever be 2?
for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) {
for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) {
if (x == chunk.locX && z == chunk.locZ) {
continue;
}
Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(chunk.world, x, z);
if (neighbor != null) {
neighbor.lightingQueue.processQueue(0, 0); // No timeout
}
}
}
}
}
}

View File

@@ -14,10 +14,8 @@ import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Check whether players empty (performance, MC-120780)
* 1) Check player list empty<br>
* @author cakoyo
*/ */
public class PlayerChunk { public class PlayerChunk {

View File

@@ -62,12 +62,11 @@ import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (slack service)
* 1) Add volatile to fields<br> * 2) Expose private members (slack service)
* 2) Expose private members<br> * 3) Removed keep-alive codes (slack service)
* 3) Migrated keep alive packet handling to service thread<br> * 4) Accessible keep-alive limit (feature, compatibility)
* @author cakoyo
*/ */
public class PlayerConnection implements PacketListenerPlayIn, ITickable { public class PlayerConnection implements PacketListenerPlayIn, ITickable {

View File

@@ -48,10 +48,8 @@ import org.spigotmc.event.player.PlayerSpawnLocationEvent;
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Changes (dis)connect messages (feature)
* 1) Modify disconnect and connect messages<br>
* @author cakoyo
*/ */
public abstract class PlayerList { public abstract class PlayerList {

View File

@@ -24,6 +24,10 @@ import com.mojang.authlib.ProfileLookupCallback;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
// Spigot end // Spigot end
/**
* Akarin Changes Note
* 1) Guava -> Caffeine (performance)
*/
public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
private int a; private int a;

View File

@@ -12,10 +12,8 @@ import org.bukkit.event.weather.WeatherChangeEvent;
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Add volatile to fields (slack service)
* 1) Add volatile to fields<br>
* @author cakoyo
*/ */
public class WorldData { public class WorldData {

View File

@@ -27,10 +27,9 @@ import org.bukkit.event.weather.LightningStrikeEvent;
// CraftBukkit end // CraftBukkit end
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Expose private members (core, safety issue)
* 1) Expose private members<br> * 2) Removed hardcore difficulty codes (slack service, feature)
* @author cakoyo
*/ */
public class WorldServer extends World implements IAsyncTaskHandler { public class WorldServer extends World implements IAsyncTaskHandler {

View File

@@ -138,7 +138,10 @@ import net.md_5.bungee.api.chat.BaseComponent;
import javax.annotation.Nullable; // Paper import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
/**
* Akarin Changes Note
* 1) Guava -> Caffeine (performance)
*/
public final class CraftServer implements Server { public final class CraftServer implements Server {
private final String serverName = "Paper"; private final String serverName = "Paper";
private final String serverVersion; private final String serverVersion;

View File

@@ -76,10 +76,8 @@ import org.bukkit.scoreboard.Scoreboard;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**
* <b>Akarin Changes Note</b><br> * Akarin Changes Note
* <br> * 1) Make hidden players thread-safe (safety issue)
* 1) Make hidden-players-set concurrent<br>
* @author cakoyo
*/ */
@DelegateDeserialization(CraftOfflinePlayer.class) @DelegateDeserialization(CraftOfflinePlayer.class)
public class CraftPlayer extends CraftHumanEntity implements Player { public class CraftPlayer extends CraftHumanEntity implements Player {