Copy on write hidden players
This commit is contained in:
@@ -45,7 +45,7 @@ public class BlockJukeBox extends BlockTileEntity {
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
world.triggerEffect(1010, blockposition, 0);
|
||||
world.a(blockposition, (SoundEffect) null);
|
||||
//world.a(blockposition, (SoundEffect) null); // Akarin
|
||||
tileentityjukebox.setRecord(ItemStack.a);
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
this.b(world, blockposition, iblockdata, true);
|
||||
world.applyPhysics(blockposition, this);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
world.a(blockposition, blockposition);
|
||||
//world.a(blockposition, blockposition); // Akarin
|
||||
}
|
||||
|
||||
if (!flag1 && flag) {
|
||||
@@ -81,7 +81,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
this.b(world, blockposition, iblockdata, false);
|
||||
world.applyPhysics(blockposition, this);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
world.a(blockposition, blockposition);
|
||||
//world.a(blockposition, blockposition); // Akarin
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
|
||||
iblockdata = this.a(iblockdata, j);
|
||||
world.setTypeAndData(blockposition, iblockdata, 2);
|
||||
this.a(world, blockposition);
|
||||
world.a(blockposition, blockposition);
|
||||
//world.a(blockposition, blockposition); // Akarin
|
||||
}
|
||||
|
||||
if (!flag1 && flag) {
|
||||
|
||||
@@ -280,7 +280,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
if (chunksection != Chunk.a) {
|
||||
chunksection.a(j, i1 & 15, k, l);
|
||||
this.world.m(new BlockPosition((this.locX << 4) + j, i1, (this.locZ << 4) + k));
|
||||
//this.world.m(new BlockPosition((this.locX << 4) + j, i1, (this.locZ << 4) + k)); // Akarin
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
if (chunksection != Chunk.a) {
|
||||
chunksection.a(i, k2 & 15, k, j2);
|
||||
this.world.m(new BlockPosition((this.locX << 4) + i, k2, (this.locZ << 4) + k));
|
||||
//this.world.m(new BlockPosition((this.locX << 4) + i, k2, (this.locZ << 4) + k)); // Akarin
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1182,7 +1182,7 @@ public class Chunk implements IChunkAccess {
|
||||
TileEntity tileentity = this.j(blockposition);
|
||||
|
||||
this.world.setTileEntity(blockposition, tileentity);
|
||||
this.world.a(blockposition, blockposition);
|
||||
//this.world.a(blockposition, blockposition); // Akarin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,11 +252,15 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
float f3 = 0.05F;
|
||||
|
||||
if (this.isInWater()) {
|
||||
// Akarin start - this handle by client
|
||||
/*
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
this.world.addParticle(Particles.e, this.locX - this.motX * 0.25D, this.locY - this.motY * 0.25D, this.locZ - this.motZ * 0.25D, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
*/
|
||||
// Akarin end
|
||||
|
||||
f2 = this.p();
|
||||
}
|
||||
|
||||
@@ -560,6 +560,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
}
|
||||
|
||||
++this.bO;
|
||||
// Akarin start - this handle by client
|
||||
/*
|
||||
if (this.bO >= 180 && this.bO <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
@@ -567,6 +569,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
|
||||
this.world.addParticle(Particles.t, this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
*/
|
||||
// Akarin end
|
||||
|
||||
boolean flag = this.world.getGameRules().getBoolean("doMobLoot");
|
||||
short short0 = 500;
|
||||
|
||||
@@ -646,6 +646,8 @@ public abstract class EntityLiving extends Entity {
|
||||
int i = (Integer) this.datawatcher.get(EntityLiving.g);
|
||||
boolean flag = (Boolean) this.datawatcher.get(EntityLiving.h);
|
||||
|
||||
// Akarin start - this handle by client
|
||||
/*
|
||||
if (i > 0) {
|
||||
boolean flag1;
|
||||
|
||||
@@ -667,6 +669,8 @@ public abstract class EntityLiving extends Entity {
|
||||
this.world.addParticle(flag ? Particles.a : Particles.s, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2);
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Akarin end
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -499,9 +499,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
IBlockData iblockdata1 = oldBlock;
|
||||
IBlockData iblockdata2 = actualBlock;
|
||||
if (iblockdata2 == iblockdata) {
|
||||
// Akarin start
|
||||
/*
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.a(blockposition, blockposition);
|
||||
}
|
||||
*/
|
||||
// Akarin end
|
||||
|
||||
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (chunk == null || chunk.isReady())) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
|
||||
this.notify(blockposition, iblockdata1, iblockdata, i);
|
||||
@@ -610,7 +614,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
}
|
||||
}
|
||||
|
||||
this.a(i, k, j, i, l, j);
|
||||
//this.a(i, k, j, i, l, j); // Akarin
|
||||
}
|
||||
|
||||
public void a(BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
@@ -765,7 +769,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
if (blockposition.isValidLocation()) { // Paper
|
||||
if (this.isLoaded(blockposition)) {
|
||||
this.getChunkAtWorldCoords(blockposition).a(enumskyblock, blockposition, i);
|
||||
this.m(blockposition);
|
||||
//this.m(blockposition); // Akarin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class WorldManager implements IWorldAccess {
|
||||
// CraftBukkit end
|
||||
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
//entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.koloboke.collect.map.hash.HashObjObjMap;
|
||||
import com.koloboke.collect.map.hash.HashObjObjMaps;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
@@ -122,7 +124,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private boolean hasPlayedBefore = false;
|
||||
private final ConversationTracker conversationTracker = new ConversationTracker();
|
||||
private final Set<String> channels = new HashSet<String>();
|
||||
private final Map<UUID, Set<WeakReference<Plugin>>> hiddenPlayers = new HashMap<>();
|
||||
private Map<UUID, Set<WeakReference<Plugin>>> hiddenPlayers; // Akarin
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
private double health = 20;
|
||||
@@ -1162,7 +1164,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
hidingPlugins = new HashSet<>();
|
||||
hidingPlugins.add(getPluginWeakReference(plugin));
|
||||
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
|
||||
// Akarin start - copy on write
|
||||
HashObjObjMap<UUID, Set<WeakReference<Plugin>>> toImmutable = HashObjObjMaps.newMutableMap(hiddenPlayers);
|
||||
toImmutable.put(player.getUniqueId(), hidingPlugins);
|
||||
hiddenPlayers = toImmutable;
|
||||
//hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
|
||||
// Akarin end
|
||||
|
||||
// Remove this player from the hidden player's EntityTrackerEntry
|
||||
EntityPlayer other = ((CraftPlayer) player).getHandle();
|
||||
@@ -1211,7 +1218,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (!hidingPlugins.isEmpty()) {
|
||||
return; // Some other plugins still want the player hidden
|
||||
}
|
||||
hiddenPlayers.remove(player.getUniqueId());
|
||||
// Akarin start - copy on write
|
||||
HashObjObjMap<UUID, Set<WeakReference<Plugin>>> toImmutable = HashObjObjMaps.newMutableMap(hiddenPlayers);
|
||||
toImmutable.remove(player.getUniqueId());
|
||||
hiddenPlayers = toImmutable;
|
||||
//hiddenPlayers.remove(player.getUniqueId());
|
||||
// Akarin end
|
||||
|
||||
// Paper start
|
||||
EntityPlayer other = ((CraftPlayer) player).getHandle();
|
||||
@@ -1270,7 +1282,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
|
||||
public void removeDisconnectingPlayer(Player player) {
|
||||
hiddenPlayers.remove(player.getUniqueId());
|
||||
// Akarin start - copy on write
|
||||
HashObjObjMap<UUID, Set<WeakReference<Plugin>>> toImmutable = HashObjObjMaps.newMutableMap(hiddenPlayers);
|
||||
toImmutable.remove(player.getUniqueId());
|
||||
hiddenPlayers = HashObjObjMaps.newImmutableMap(toImmutable);
|
||||
//hiddenPlayers.remove(player.getUniqueId());
|
||||
// Akarin end
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user