mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-21 12:17:23 +01:00
More 1.14 work
This commit is contained in:
parent
f7dfbc078c
commit
9c7e369607
69 changed files with 695 additions and 1796 deletions
Spigot-API-Patches
Spigot-Server-Patches
Activation-Range-Improvements.patchAdd-API-methods-to-control-if-armour-stands-can-move.patchAdd-EntityZapEvent.patchAdd-ProjectileCollideEvent.patchAdd-UnknownCommandEvent.patchAdd-configuration-option-to-prevent-player-names-fro.patchAdd-option-to-make-parrots-stay-on-shoulders-despite.patchAdd-server-name-parameter.patchAdd-setting-for-proxy-online-mode-status.patchAdd-source-to-PlayerExpChangeEvent.patchAdd-system-property-to-disable-book-size-limits.patchAllow-Reloading-of-Command-Aliases.patchAuto-Save-Improvements.patchAuto-fix-bad-Y-levels-on-player-login.patchAvoid-blocking-on-Network-Manager-creation.patchBasic-PlayerProfile-API.patchBound-Treasure-Maps-to-World-Border.patchCache-user-authenticator-threads.patchCap-Entity-Collisions.patchChunk-Save-Stats-Debug-Option.patchChunk-registration-fixes.patchConfigurable-Cartographer-Treasure-Maps.patchConfigurable-flying-kick-messages.patchConfigurable-packet-in-spam-threshold.patchDelay-Chunk-Unloads-based-on-Player-Movement.patchDisable-Vanilla-Chunk-GC.patchDisable-ticking-of-snow-blocks.patchDo-not-let-armorstands-drown.patchDon-t-allow-entities-to-ride-themselves-572.patchDon-t-let-fishinghooks-use-portals.patchDon-t-load-Chunks-from-Hoppers-and-other-things.patchDon-t-lookup-game-profiles-that-have-no-UUID-and-no-.patchEnforce-Sync-Chunk-Unloads.patchEnforce-Sync-Player-Saves.patchEnsure-Chunks-never-ever-load-async.patchExperienceOrbs-API-for-Reason-Source-Triggering-play.patchFaster-redstone-torch-rapid-clock-removal.patchFilter-bad-data-from-ArmorStand-and-SpawnEgg-items.patchFirework-API-s.patchFix-Double-World-Add-issues.patchFix-Old-Sign-Conversion.patchFix-block-break-desync.patchItem-canEntityPickup.patchMake-targetSize-more-aggressive-in-the-chunk-unload-.patchMore-informative-vehicle-moved-wrongly-message.patchOnly-send-Dragon-Wither-Death-sounds-to-same-world.patchOptimise-BlockState-s-hashCode-equals.patchOptimise-removeQueue.patchOptimize-ItemStack.isEmpty.patchOptimize-UserCache-Thread-Safe.patchOptimize-World.isLoaded-BlockPosition-Z.patchOption-to-remove-corrupt-tile-entities.patchOptional-TNT-doesn-t-move-in-water.patchPlayerAttemptPickupItemEvent.patchPlayerPickupItemEvent-setFlyAtPlayer.patchPlayerTeleportEndGatewayEvent.patchPrevent-Auto-Save-if-Save-Queue-is-full.patchPrevent-Pathfinding-out-of-World-Border.patchProperly-fix-item-duplication-bug.patchProperly-handle-async-calls-to-restart-the-server.patchProvide-E-TE-Chunk-count-stat-methods.patchRe-track-players-that-dismount-from-other-players.patchRemove-CraftScheduler-Async-Task-Debugger.patchRemove-FishingHook-reference-on-Craft-Entity-removal.patchShulkerBox-Dupe-Prevention.patchString-based-Action-Bar-API.patchUse-TerminalConsoleAppender-for-console-improvements.patchprovide-a-configurable-option-to-disable-creeper-lin.patch
|
@ -8,7 +8,7 @@ Adds lots of information about why this orb exists.
|
|||
Replaces isFromBottle() with logic that persists entity reloads too.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/ExperienceOrb.java b/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
||||
index c286edfd..57029d9b 100644
|
||||
index c286edfd..dec70bbf 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -78,6 +78,10 @@ index c286edfd..57029d9b 100644
|
|||
+ */
|
||||
+ EXP_BOTTLE,
|
||||
+ /**
|
||||
+ * Spawned by a player using a grindstone
|
||||
+ */
|
||||
+ GRINDSTONE,
|
||||
+ /**
|
||||
+ * We do not know why it was spawned
|
||||
+ */
|
||||
+ UNKNOWN
|
||||
|
|
|
@ -1,408 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 13 May 2016 01:38:06 -0400
|
||||
Subject: [PATCH] Activation Range Improvements
|
||||
|
||||
Optimizes performance of Activation Range
|
||||
|
||||
Fixes and adds new Immunities to improve gameplay behavior
|
||||
|
||||
Adds water Mobs to activation range config and nerfs fish
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index bc364ce371..80e13dfb2e 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
this.c = i;
|
||||
}
|
||||
|
||||
+ public BlockPosition toBlockPosition() { return h(); } // Paper - OBFHELPER
|
||||
public BlockPosition h() {
|
||||
return new BlockPosition(this);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 82994db643..462f94ed18 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.recalcPosition();
|
||||
} else {
|
||||
if (enummovetype == EnumMoveType.PISTON) {
|
||||
+ this.activatedTick = MinecraftServer.currentTick + 20; // Paper
|
||||
long i = this.world.getTime();
|
||||
|
||||
if (i != this.aM) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
|
||||
index 20b7c2c6dc..d659c57dbe 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper
|
||||
+ public BlockPosition movingTarget = null; public BlockPosition getMovingTarget() { return movingTarget; } // Paper
|
||||
private BlockPosition a;
|
||||
private float b;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index e5322de974..c530824596 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
return this.lookController;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void inactiveTick() {
|
||||
+ super.inactiveTick();
|
||||
+ this.goalSelector.inactiveTick();
|
||||
+ if (this.targetSelector.inactiveTick()) {
|
||||
+ this.targetSelector.doTick();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public ControllerMove getControllerMove() {
|
||||
return this.moveController;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index e8f2f11c4d..c0ef0c51f1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
public float aT;
|
||||
public float aU;
|
||||
public EntityHuman killer;
|
||||
- protected int lastDamageByPlayerTime;
|
||||
+ public int lastDamageByPlayerTime; // Paper - public
|
||||
protected boolean killed;
|
||||
protected int ticksFarFromPlayer;
|
||||
protected float aZ;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java
|
||||
index b19bd2b99a..5e19768710 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLlama.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
|
||||
@@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
||||
return this.bR != null;
|
||||
}
|
||||
|
||||
+ public boolean inCaravan() { return this.em(); } // Paper - OBFHELPER
|
||||
public boolean em() {
|
||||
return this.bQ != null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java
|
||||
index a146a8b459..a19853463c 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderGoal {
|
||||
|
||||
public void c() {}
|
||||
|
||||
- public void d() {}
|
||||
+ public void d() {
|
||||
+ onTaskReset(); // Paper
|
||||
+ }
|
||||
+ public void onTaskReset() {} // Paper
|
||||
|
||||
public void e() {}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
|
||||
index d5c08aa7cb..756d63239c 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
||||
public abstract class PathfinderGoalGotoTarget extends PathfinderGoal {
|
||||
|
||||
- private final EntityCreature f;
|
||||
+ private final EntityCreature f;public EntityCreature getEntity() { return f; } // Paper - OBFHELPER
|
||||
public double a;
|
||||
protected int b;
|
||||
protected int c;
|
||||
private int g;
|
||||
- protected BlockPosition d;
|
||||
+ protected BlockPosition d; public BlockPosition getTarget() { return d; } public void setTarget(BlockPosition pos) { this.d = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER
|
||||
private boolean h;
|
||||
private final int i;
|
||||
private final int j;
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal {
|
||||
public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) {
|
||||
this(entitycreature, d0, i, 1);
|
||||
}
|
||||
+ // Paper start - activation range improvements
|
||||
+ @Override
|
||||
+ public void onTaskReset() {
|
||||
+ super.onTaskReset();
|
||||
+ setTarget(BlockPosition.ZERO);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) {
|
||||
this.d = BlockPosition.ZERO;
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal {
|
||||
blockposition_mutableblockposition.g(blockposition).d(i1, k - 1, j1);
|
||||
if (this.f.f((BlockPosition) blockposition_mutableblockposition) && this.a(this.f.world, blockposition_mutableblockposition)) {
|
||||
this.d = blockposition_mutableblockposition;
|
||||
+ setTarget(blockposition_mutableblockposition.toBlockPosition()); // Paper
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
index f3df91181f..3e2f9c749b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalSelector {
|
||||
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private final Set<PathfinderGoalSelector.PathfinderGoalSelectorItem> b = Sets.newLinkedHashSet();
|
||||
- private final Set<PathfinderGoalSelector.PathfinderGoalSelectorItem> c = Sets.newLinkedHashSet();
|
||||
+ private final Set<PathfinderGoalSelector.PathfinderGoalSelectorItem> c = Sets.newLinkedHashSet();private Set<PathfinderGoalSelector.PathfinderGoalSelectorItem> getExecutingTasks() { return c; }// Paper - OBFHELPER
|
||||
private final MethodProfiler d;
|
||||
- private int e;
|
||||
- private int f = 3;
|
||||
+ private int e;private int getCurRate() { return e; } private void incRate() { this.e++; }// Paper - OBFHELPER
|
||||
+ private int f = 3;private int getTickRate() { return f; } // Paper - OBFHELPER
|
||||
private int g;
|
||||
|
||||
public PathfinderGoalSelector(MethodProfiler methodprofiler) {
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalSelector {
|
||||
this.b.add(new PathfinderGoalSelector.PathfinderGoalSelectorItem(i, pathfindergoal));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean inactiveTick() {
|
||||
+ if (getCurRate() % getTickRate() != 0) {
|
||||
+ incRate();
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ public boolean hasTasks() {
|
||||
+ return !getExecutingTasks().isEmpty();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public void a(PathfinderGoal pathfindergoal) {
|
||||
Iterator iterator = this.b.iterator();
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 09df00e94b..d08ef3fe10 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ package org.spigotmc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
+
|
||||
+import co.aikar.timings.MinecraftTimings;
|
||||
import net.minecraft.server.AxisAlignedBB;
|
||||
import net.minecraft.server.Chunk;
|
||||
import net.minecraft.server.Entity;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityCreature;
|
||||
import net.minecraft.server.EntityCreeper;
|
||||
import net.minecraft.server.EntityEnderCrystal;
|
||||
import net.minecraft.server.EntityEnderDragon;
|
||||
-import net.minecraft.server.EntityFallingBlock; // Paper
|
||||
+import net.minecraft.server.EntityFallingBlock;
|
||||
import net.minecraft.server.EntityFireball;
|
||||
import net.minecraft.server.EntityFireworks;
|
||||
+import net.minecraft.server.EntityFish;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
+import net.minecraft.server.EntityInsentient;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
+import net.minecraft.server.EntityLlama;
|
||||
import net.minecraft.server.EntityMonster;
|
||||
import net.minecraft.server.EntityProjectile;
|
||||
import net.minecraft.server.EntitySheep;
|
||||
-import net.minecraft.server.EntitySlice;
|
||||
import net.minecraft.server.EntitySlime;
|
||||
import net.minecraft.server.EntityTNTPrimed;
|
||||
import net.minecraft.server.EntityThrownTrident;
|
||||
import net.minecraft.server.EntityVillager;
|
||||
+import net.minecraft.server.EntityWaterAnimal;
|
||||
import net.minecraft.server.EntityWeather;
|
||||
import net.minecraft.server.EntityWither;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.server.MathHelper;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.NavigationGuardian;
|
||||
import net.minecraft.server.World;
|
||||
-import co.aikar.timings.MinecraftTimings;
|
||||
|
||||
public class ActivationRange
|
||||
{
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
+ static AxisAlignedBB waterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); // Paper
|
||||
static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
*/
|
||||
public static byte initializeEntityActivationType(Entity entity)
|
||||
{
|
||||
+ if (entity instanceof EntityWaterAnimal) { return 4; } // Paper
|
||||
if ( entity instanceof EntityMonster || entity instanceof EntitySlime )
|
||||
{
|
||||
return 1; // Monster
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|
||||
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|
||||
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|
||||
+ || ( entity.activationType == 4 && config.waterActivationRange == 0 ) // Paper
|
||||
|| entity instanceof EntityHuman
|
||||
|| entity instanceof EntityProjectile
|
||||
|| entity instanceof EntityEnderDragon
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
final int miscActivationRange = world.spigotConfig.miscActivationRange;
|
||||
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
||||
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
|
||||
+ final int waterActivationRange = world.spigotConfig.waterActivationRange; // Paper
|
||||
|
||||
int maxRange = Math.max( monsterActivationRange, animalActivationRange );
|
||||
maxRange = Math.max( maxRange, miscActivationRange );
|
||||
//maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); Paper - Use player view distance API below instead
|
||||
|
||||
+ Chunk chunk; // Paper
|
||||
for ( EntityHuman player : world.players )
|
||||
{
|
||||
int playerMaxRange = maxRange = Math.min( ( player.getViewDistance() << 4 ) - 8, maxRange ); // Paper - Use player view distance API
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
maxBB = player.getBoundingBox().grow( playerMaxRange, 256, playerMaxRange ); // Paper - Use player view distance API
|
||||
miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
|
||||
animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
|
||||
+ waterBB = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange ); // Paper
|
||||
monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
|
||||
|
||||
int i = MathHelper.floor( maxBB.minX / 16.0D );
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
{
|
||||
for ( int j1 = k; j1 <= l; ++j1 )
|
||||
{
|
||||
- if ( world.getWorld().isChunkLoaded( i1, j1 ) )
|
||||
+ if ( (chunk = world.getChunkIfLoaded(i1, j1 )) != null ) // Paper
|
||||
{
|
||||
- activateChunkEntities( world.getChunkAt( i1, j1 ) );
|
||||
+ activateChunkEntities( chunk ); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
entity.activatedTick = MinecraftServer.currentTick;
|
||||
}
|
||||
break;
|
||||
+ // Paper start
|
||||
+ case 4:
|
||||
+ if ( waterBB.c( entity.getBoundingBox() ) )
|
||||
+ {
|
||||
+ entity.activatedTick = MinecraftServer.currentTick;
|
||||
+ }
|
||||
+ break;
|
||||
+ // Paper end
|
||||
case 3:
|
||||
default:
|
||||
if ( miscBB.c( entity.getBoundingBox() ) )
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
*/
|
||||
public static boolean checkEntityImmunities(Entity entity)
|
||||
{
|
||||
- // quick checks.
|
||||
- if ( entity.inWater || entity.fireTicks > 0 )
|
||||
- {
|
||||
+ // Paper start - optimize Water cases
|
||||
+ if (entity instanceof EntityFish) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (entity.inWater && (!(entity instanceof EntityInsentient) || !(((EntityInsentient) entity).getNavigation() instanceof NavigationGuardian))) {
|
||||
return true;
|
||||
}
|
||||
+ if (entity.fireTicks > 0) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if ( !( entity instanceof EntityArrow ) )
|
||||
{
|
||||
if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() )
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
if ( entity instanceof EntityLiving )
|
||||
{
|
||||
EntityLiving living = (EntityLiving) entity;
|
||||
- if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 )
|
||||
+ if ( living.lastDamageByPlayerTime > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null )
|
||||
+ if ( entity instanceof EntityCreature )
|
||||
{
|
||||
- return true;
|
||||
+ // Paper start
|
||||
+ EntityCreature creature = (EntityCreature) entity;
|
||||
+ if (creature.getGoalTarget() != null || creature.getMovingTarget() != null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isInLove() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
+ // Paper start
|
||||
+ if ( entity instanceof EntityLlama && ( (EntityLlama ) entity ).inCaravan() )
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if ( entity instanceof EntityAnimal )
|
||||
{
|
||||
EntityAnimal animal = (EntityAnimal) entity;
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
entity.activatedTick = MinecraftServer.currentTick + 20;
|
||||
}
|
||||
isActive = true;
|
||||
+ // Paper start
|
||||
+ } else if (entity instanceof EntityInsentient && ((EntityInsentient) entity).targetSelector.hasTasks()) {
|
||||
+ isActive = true;
|
||||
}
|
||||
+ // Paper end
|
||||
// Add a little performance juice to active entities. Skip 1/4 if not immune.
|
||||
- } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
|
||||
+ } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !(entity instanceof EntityInsentient && ((EntityInsentient) entity).targetSelector.hasTasks()) && !checkEntityImmunities( entity ) ) // Paper - add targetSelector.hasTasks
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
- int x = MathHelper.floor( entity.locX );
|
||||
- int z = MathHelper.floor( entity.locZ );
|
||||
+ //int x = MathHelper.floor( entity.locX ); // Paper
|
||||
+ //int z = MathHelper.floor( entity.locZ ); // Paper
|
||||
// Make sure not on edge of unloaded chunk
|
||||
- Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
|
||||
+ Chunk chunk = entity.getChunkAtLocation(); // Paper
|
||||
if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
|
||||
{
|
||||
isActive = false;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index d3c2abc398..1d222eaff7 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
public int animalActivationRange = 32;
|
||||
public int monsterActivationRange = 32;
|
||||
public int miscActivationRange = 16;
|
||||
+ public int waterActivationRange = 16; // Paper
|
||||
public boolean tickInactiveVillagers = true;
|
||||
private void activationRange()
|
||||
{
|
||||
animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange );
|
||||
monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange );
|
||||
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
|
||||
+ waterActivationRange = getInt( "entity-activation-range.water", waterActivationRange ); // Paper
|
||||
tickInactiveVillagers = getBoolean( "entity-activation-range.tick-inactive-villagers", tickInactiveVillagers );
|
||||
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers );
|
||||
}
|
||||
--
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
index cdbc82bf9e..b570882340 100644
|
||||
index 823041f06..8c6a9ec68 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
|
@ -14,24 +14,24 @@ index cdbc82bf9e..b570882340 100644
|
|||
public Vector3f rightLegPose;
|
||||
+ public boolean canMove = true; // Paper
|
||||
|
||||
public EntityArmorStand(World world) {
|
||||
super(EntityTypes.ARMOR_STAND, world);
|
||||
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
public boolean df() {
|
||||
return false;
|
||||
|
||||
return this.getEntityType().j().a(f);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void move(EnumMoveType moveType, double x, double y, double z) {
|
||||
+ public void move(EnumMoveType moveType, Vec3D vec3d) {
|
||||
+ if (this.canMove) {
|
||||
+ super.move(moveType, x, y, z);
|
||||
+ super.move(moveType, vec3d);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
index 2b66a08ade..124c3185bc 100644
|
||||
index 2b66a08ad..124c3185b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||
|
|
|
@ -5,41 +5,41 @@ Subject: [PATCH] Add EntityZapEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
|
||||
index 7ef67350a5..9dc2d8be27 100644
|
||||
index 01202e4d5..616075569 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPig.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPig.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal {
|
||||
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Paper start
|
||||
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
return;
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index f8e05b75de..213d0b18c9 100644
|
||||
index cc66f565c..c34868324 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
EntityWitch entitywitch = new EntityWitch(this.world);
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
public void onLightningStrike(EntityLightning entitylightning) {
|
||||
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world);
|
||||
|
||||
+ // Paper start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Paper start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
entitywitch.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
entitywitch.prepare(this.world.getDamageScaler(new BlockPosition(entitywitch)), (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitywitch.setNoAI(this.isNoAI());
|
||||
entitywitch.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
entitywitch.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entitywitch)), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitywitch.setNoAI(this.isNoAI());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 4d2fdfe286..fa0eb2ebeb 100644
|
||||
index 9f592d2fc..0d16d1430 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
|
|
|
@ -5,89 +5,94 @@ Subject: [PATCH] Add ProjectileCollideEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index feafb82dd3..6aa518f17f 100644
|
||||
index b5b569ef9..43ece829f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ // TODO: flag - noclip - call cancelled?
|
||||
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ // TODO: flag - noclip - call cancelled?
|
||||
+ if (object instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)object);
|
||||
+ if (event.isCancelled()) {
|
||||
+ object = null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Paper end
|
||||
+
|
||||
if (movingobjectposition != null && !flag) {
|
||||
this.a(movingobjectposition);
|
||||
this.impulse = true;
|
||||
if (object != null && !flag) {
|
||||
this.a((MovingObjectPosition) object);
|
||||
this.impulse = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
index 3e3619d79f..58cc4824cf 100644
|
||||
index 739e48ec7..192ee928f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityFireball extends Entity {
|
||||
++this.f;
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.f >= 25, this.shooter);
|
||||
++this.g;
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.g >= 25, this.shooter, RayTrace.BlockCollisionOption.COLLIDER);
|
||||
|
||||
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (movingobjectposition != null) {
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
this.a(movingobjectposition);
|
||||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 861fc6fd5c..202b8d2158 100644
|
||||
index 15a686cb2..78527f350 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
return !entity.t() && (entity.isInteractable() || entity instanceof EntityItem) && (entity != this.owner || this.g >= 5);
|
||||
}, RayTrace.BlockCollisionOption.COLLIDER, true);
|
||||
|
||||
vec3d = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = new Vec3D(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
+
|
||||
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = new Vec3D(movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z);
|
||||
}
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event
|
||||
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
index 751ea456b9..bab5b89fe9 100644
|
||||
index ac62f836d..bb4679cf7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
this.as = null;
|
||||
}
|
||||
|
||||
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) {
|
||||
this.e(movingobjectposition.getBlockPosition());
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) {
|
||||
this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition());
|
||||
} else {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 3785d4f096..9cbbfed4fe 100644
|
||||
index f22319d78..b75369275 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
|
@ -95,9 +100,9 @@ index 3785d4f096..9cbbfed4fe 100644
|
|||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, MovingObjectPosition position) {
|
||||
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, MovingObjectPositionEntity position) {
|
||||
+ Projectile projectile = (Projectile) entity.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity collided = position.entity.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add UnknownCommandEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7e4f42b3f4..e8991ce1c9 100644
|
||||
index 2bdbc939e..4e5e2d109 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Versioning;
|
||||
|
|
|
@ -6,12 +6,12 @@ Subject: [PATCH] Add configuration option to prevent player names from being
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 17b4e01aa4..d10d60921b 100644
|
||||
index 7ce370e92..1adbb2480 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
||||
}
|
||||
flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage);
|
||||
flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage);
|
||||
}
|
||||
+
|
||||
+ public static boolean suggestPlayersWhenNullTabCompletions = true;
|
||||
|
@ -20,7 +20,7 @@ index 17b4e01aa4..d10d60921b 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index bb7792ce2a..962170cd3f 100644
|
||||
index bc1de9d9e..b2aee24e5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
|
|
|
@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release.
|
|||
To be converted into a Paper-API event at some point in the future?
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 72eb530d7e..8ff454e259 100644
|
||||
index 58fe5a8c4..a34121495 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -26,7 +26,7 @@ index 72eb530d7e..8ff454e259 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 5e5a747e9f..23e7cdfe88 100644
|
||||
index 8a6f8e875..5df763d92 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
@ -39,10 +39,10 @@ index 5e5a747e9f..23e7cdfe88 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 05cc5afea6..ac64fcfb31 100644
|
||||
index 37caa2a70..69a786e8d 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
switch (packetplayinentityaction.c()) {
|
||||
case START_SNEAKING:
|
||||
this.player.setSneaking(true);
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index c85a9bfb91..472a8070e7 100644
|
||||
index a96c144fc..5203e781e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add setting for proxy online mode status
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index c6d2c30339..b7b28591e4 100644
|
||||
index a89a9bfcb..1089be17d 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.configuration.InvalidConfigurationException;
|
||||
|
@ -31,7 +31,7 @@ index c6d2c30339..b7b28591e4 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
index bf67dbf54a..dcaba3c401 100644
|
||||
index 61ea2818b..26c786106 100644
|
||||
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
|
||||
|
@ -45,16 +45,16 @@ index bf67dbf54a..dcaba3c401 100644
|
|||
} else {
|
||||
String[] astring1 = astring;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b0ae0365e0..c26da09849 100644
|
||||
index cf9594ea2..46f902073 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
// Spigot Start
|
||||
GameProfile profile = null;
|
||||
// Only fetch an online UUID in online mode
|
||||
- if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
|
||||
+ if ( MinecraftServer.getServer().getOnlineMode()
|
||||
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) // Paper - Handle via setting
|
||||
- if ( getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
|
||||
+ if ( getOnlineMode()
|
||||
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
|
||||
{
|
||||
profile = console.getUserCache().getProfile( name );
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
index 808d1a120a..3030dd9c31 100644
|
||||
index b20813be6..bfba08fb2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
@ -18,13 +18,13 @@ index 808d1a120a..3030dd9c31 100644
|
|||
|
||||
this.die();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index fa0eb2ebeb..3785d4f096 100644
|
||||
index 0d16d1430..f22319d78 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
+import org.bukkit.entity.ExperienceOrb; // Paper
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
|
|
|
@ -11,7 +11,7 @@ to make books with as much data as they want. Do not use this without
|
|||
limiting incoming data from packets in some other way.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||
index a23ec1461d..20cddd5065 100644
|
||||
index 0291ff194..49c93b75c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Command Aliases
|
|||
Reload the aliases stored in commands.yml
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c26da09849..bb7792ce2a 100644
|
||||
index 46f902073..bc1de9d9e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 19 Sep 2016 23:16:39 -0400
|
||||
Subject: [PATCH] Auto Save Improvements
|
||||
|
||||
Makes Auto Save Rate setting configurable per-world. If the auto save rate is left -1, the global bukkit.yml value will be used.
|
||||
|
||||
Process auto save every tick instead of once per auto tick interval, so that chunk saves will distribute over many ticks instead of all at once.
|
||||
|
||||
Re-introduce a cap per tick for auto save (Spigot disabled the vanilla cap) and make it configurable.
|
||||
|
||||
Adds incremental player auto saving too
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index fb7ada8139..17b4e01aa4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage);
|
||||
flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage);
|
||||
}
|
||||
+
|
||||
+ public static int playerAutoSaveRate = -1;
|
||||
+ public static int maxPlayerAutoSavePerTick = 10;
|
||||
+ private static void playerAutoSaveRate() {
|
||||
+ playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1);
|
||||
+ maxPlayerAutoSavePerTick = getInt("settings.max-player-auto-save-per-tick", -1);
|
||||
+ if (maxPlayerAutoSavePerTick == -1) { // -1 Automatic / "Recommended"
|
||||
+ // 10 should be safe for everyone unless your mass spamming player auto save
|
||||
+ maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index c70771614d..6e28410c37 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void skipEntityTickingInChunksScheduledForUnload() {
|
||||
skipEntityTickingInChunksScheduledForUnload = getBoolean("skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload);
|
||||
}
|
||||
+
|
||||
+ public int autoSavePeriod = -1;
|
||||
+ private void autoSavePeriod() {
|
||||
+ autoSavePeriod = getInt("auto-save-interval", -1);
|
||||
+ if (autoSavePeriod > 0) {
|
||||
+ log("Auto Save Interval: " +autoSavePeriod + " (" + (autoSavePeriod / 20) + "s)");
|
||||
+ } else if (autoSavePeriod < 0) {
|
||||
+ autoSavePeriod = MinecraftServer.getServer().autosavePeriod;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int maxAutoSaveChunksPerTick = 24;
|
||||
+ private void maxAutoSaveChunksPerTick() {
|
||||
+ maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index bdf922db50..0bf614ce57 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
private final TickList<Block> s;
|
||||
private final TickList<FluidType> t;
|
||||
private boolean u;
|
||||
- private boolean v;
|
||||
+ private boolean v;public boolean hasEntities() { return v; } // Paper - OBFHELPER
|
||||
private long lastSaved;
|
||||
- private boolean x;
|
||||
+ private boolean x; public boolean isModified() { return x; } // Paper - OBFHELPER
|
||||
private int y;
|
||||
private long z;
|
||||
private int A;
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
if (this.v && this.world.getTime() != this.lastSaved || this.x) {
|
||||
return true;
|
||||
}
|
||||
- } else if (this.v && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
|
||||
- return true;
|
||||
}
|
||||
-
|
||||
- return this.x;
|
||||
+ // Paper start - Make world configurable and incremental
|
||||
+ // This !flag section should say if isModified or hasEntities, then check auto save
|
||||
+ return ((isModified() || hasEntities()) && this.world.getTime() >= this.lastSaved + world.paperConfig.autoSavePeriod);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index d0bf0f72da..fbc69b5ba5 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
this.saveChunk(chunk, false); // Spigot
|
||||
chunk.a(false);
|
||||
++i;
|
||||
- if (i == 24 && !flag && false) { // Spigot
|
||||
+ if (!flag && i >= world.paperConfig.maxAutoSaveChunksPerTick) { // Spigot - // Paper - Incremental Auto Save - cap max
|
||||
return false;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 621e79bc53..260fa3e678 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
private static final Logger cc = LogManager.getLogger();
|
||||
public String locale = null; // CraftBukkit - lowercase // Paper - default to null
|
||||
+ public long lastSave = MinecraftServer.currentTick; // Paper
|
||||
public PlayerConnection playerConnection;
|
||||
public final MinecraftServer server;
|
||||
public final PlayerInteractManager playerInteractManager;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 7ffb061414..6283c774d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
||||
public ConsoleReader reader;
|
||||
public static int currentTick = 0; // Paper - Further improve tick loop
|
||||
+ public boolean serverAutoSave = false; // Paper
|
||||
public final Thread primaryThread;
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
this.m.b().a(agameprofile);
|
||||
}
|
||||
|
||||
- if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
|
||||
this.methodProfiler.enter("save");
|
||||
- this.playerList.savePlayers();
|
||||
+
|
||||
+ serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper
|
||||
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
|
||||
+ if (playerSaveInterval < 0) {
|
||||
+ playerSaveInterval = autosavePeriod;
|
||||
+ }
|
||||
+ if (playerSaveInterval > 0) { // CraftBukkit // Paper
|
||||
+ this.playerList.savePlayers(playerSaveInterval);
|
||||
// Spigot Start
|
||||
+ } // Paper - Incremental Auto Saving
|
||||
+
|
||||
// We replace this with saving each individual world as this.saveChunks(...) is broken,
|
||||
// and causes the main thread to sleep for random amounts of time depending on chunk activity
|
||||
// Also pass flag to only save modified chunks
|
||||
server.playerCommandState = true;
|
||||
for (World world : getWorlds()) {
|
||||
- world.getWorld().save(false);
|
||||
+ if (world.paperConfig.autoSavePeriod > 0) world.getWorld().save(false); // Paper - Incremental / Configurable Auto Saving
|
||||
}
|
||||
server.playerCommandState = false;
|
||||
// this.saveChunks(true);
|
||||
// Spigot End
|
||||
this.methodProfiler.exit();
|
||||
- }
|
||||
+ //} // Paper - Incremental Auto Saving
|
||||
|
||||
this.methodProfiler.enter("snooper");
|
||||
if (getSnooperEnabled() && !this.snooper.d() && this.ticks > 100) { // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 79641a73a8..fe6649224a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
protected void savePlayerFile(EntityPlayer entityplayer) {
|
||||
if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
||||
+ entityplayer.lastSave = MinecraftServer.currentTick; // Paper
|
||||
this.playerFileData.save(entityplayer);
|
||||
ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
public void savePlayers() {
|
||||
+ savePlayers(null);
|
||||
+ }
|
||||
+
|
||||
+ public void savePlayers(Integer interval) {
|
||||
+ long now = MinecraftServer.currentTick;
|
||||
MinecraftTimings.savePlayers.startTiming(); // Paper
|
||||
+ int numSaved = 0; // Paper
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
- this.savePlayerFile((EntityPlayer) this.players.get(i));
|
||||
+ EntityPlayer entityplayer = this.players.get(i);
|
||||
+ if (interval == null || now - entityplayer.lastSave >= interval) {
|
||||
+ this.savePlayerFile(entityplayer);
|
||||
+ if (interval != null && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; } // Paper
|
||||
+ }
|
||||
}
|
||||
MinecraftTimings.savePlayers.stopTiming(); // Paper
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public WhiteList getWhitelist() {
|
||||
return this.whitelist;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 639068d2dc..49c5b0b5cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
|
||||
|
||||
if (chunkproviderserver.d()) {
|
||||
- org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
||||
+ if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit // Paper - Incremental Auto Saving - Only fire event on full save
|
||||
timings.worldSave.startTiming(); // Paper
|
||||
+ if (flag || server.serverAutoSave) { // Paper
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.c(new ChatMessage("menu.savingChunks", new Object[0]));
|
||||
}
|
||||
+ } // Paper
|
||||
|
||||
timings.worldSaveChunks.startTiming(); // Paper
|
||||
chunkproviderserver.a(flag);
|
||||
--
|
|
@ -6,15 +6,15 @@ Subject: [PATCH] Auto fix bad Y levels on player login
|
|||
Bring down to a saner Y level if super high, as this can cause the server to crash
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 260fa3e678..fcb5f590df 100644
|
||||
index c1ba294ec..5610c539a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
+ if (this.locY > 300) this.locY = 257; // Paper - bring down to a saner Y level if out of world
|
||||
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
|
||||
if (this.bK().getForceGamemode()) {
|
||||
this.playerInteractManager.setGameMode(this.bK().getGamemode());
|
||||
if (this.getMinecraftServer().getForceGamemode()) {
|
||||
this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode());
|
||||
--
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
|
|||
Per Paper issue 294
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
index 41ff55e9e2..baabcd19c4 100644
|
||||
index 42c654a1d..e7ed6af9c 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class ServerConnection {
|
||||
|
|
|
@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
new file mode 100644
|
||||
index 0000000000..b151a13c1b
|
||||
index 000000000..b151a13c1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -293,7 +293,7 @@ index 0000000000..b151a13c1b
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
new file mode 100644
|
||||
index 0000000000..25836b975b
|
||||
index 000000000..25836b975
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -329,7 +329,7 @@ index 0000000000..25836b975b
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
|
||||
new file mode 100644
|
||||
index 0000000000..3bcdb8f93f
|
||||
index 000000000..3bcdb8f93
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -352,7 +352,7 @@ index 0000000000..3bcdb8f93f
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
||||
new file mode 100644
|
||||
index 0000000000..4b2a67423f
|
||||
index 000000000..4b2a67423
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -387,7 +387,7 @@ index 0000000000..4b2a67423f
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
|
||||
new file mode 100644
|
||||
index 0000000000..3aceb0ea8a
|
||||
index 000000000..3aceb0ea8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -403,7 +403,7 @@ index 0000000000..3aceb0ea8a
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index e1af5c4885..0ef5ad1165 100644
|
||||
index e1af5c488..0ef5ad116 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -429,28 +429,28 @@ index e1af5c4885..0ef5ad1165 100644
|
|||
* Calculates distance between 2 entities
|
||||
* @param e1
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index c6ecdf6e8e..5517c5fe81 100644
|
||||
index dc6d7b3a2..27d0d818b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
*/ // CraftBukkit end
|
||||
|
||||
String s1 = "."; // PAIL?
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
DispenserRegistry.init();
|
||||
DispenserRegistry.c();
|
||||
String s = "."; // PAIL?
|
||||
- YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
|
||||
+ YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); // Paper
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
this.G = i;
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName()));
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.H = i;
|
||||
}
|
||||
|
||||
+ public MinecraftSessionService getSessionService() { return ap(); } // Paper - OBFHELPER
|
||||
public MinecraftSessionService ap() {
|
||||
return this.V;
|
||||
+ public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER
|
||||
public MinecraftSessionService getMinecraftSessionService() {
|
||||
return this.minecraftSessionService;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
||||
index 9bf2521be6..0596658362 100644
|
||||
index 409bc6da9..9eaf1539f 100644
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
||||
@@ -0,0 +0,0 @@ public class UserCache {
|
||||
|
@ -486,16 +486,15 @@ index 9bf2521be6..0596658362 100644
|
|||
|
||||
private UserCacheEntry(GameProfile gameprofile, Date date) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e8991ce1c9..1e8c4a85cb 100644
|
||||
index 4e5e2d109..cfcb7a4fd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
import org.bukkit.event.server.TabCompleteEvent;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
|
||||
|
||||
+import javax.annotation.Nullable; // Paper
|
||||
+import javax.annotation.Nonnull; // Paper
|
||||
+
|
||||
+
|
||||
public final class CraftServer implements Server {
|
||||
private final String serverName = "Paper"; // Paper
|
||||
|
@ -505,14 +504,17 @@ index e8991ce1c9..1e8c4a85cb 100644
|
|||
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
|
||||
+ return createProfile(uuid, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull String name) {
|
||||
+ return createProfile(null, name);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
|
||||
+ Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null);
|
||||
+ if (player != null) {
|
||||
|
|
|
@ -11,7 +11,7 @@ that is outside happens to be closer, but unreachable, yet another reachable
|
|||
one is in border that would of been missed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
index 7194c048c9..2ea5ac3161 100644
|
||||
index 464e1e101..7b2eace75 100644
|
||||
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
|
||||
|
@ -19,30 +19,30 @@ index 7194c048c9..2ea5ac3161 100644
|
|||
if (flag1 || flag2) {
|
||||
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
|
||||
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
||||
StructureStart structurestart = this.a(world, chunkgenerator, seededrandom, chunkcoordintpair.a());
|
||||
StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
|
||||
|
||||
if (structurestart != StructureGenerator.a) {
|
||||
if (structurestart != null && structurestart.e()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
index 86ada40a10..a2e856952e 100644
|
||||
index 51739e254..2b5c09c62 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
@@ -0,0 +0,0 @@ public class WorldBorder {
|
||||
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
|
||||
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
|
||||
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
|
||||
+ mutPos.setValues(chunkX, 64, chunkZ);
|
||||
+ return isInBounds(mutPos);
|
||||
+ this.mutPos.setValues(chunkX, 64, chunkZ);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ }
|
||||
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
|
||||
+ mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
||||
+ return isInBounds(mutPos);
|
||||
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return (double) chunkcoordintpair.f() > this.b() && (double) chunkcoordintpair.d() < this.d() && (double) chunkcoordintpair.g() > this.c() && (double) chunkcoordintpair.e() < this.e();
|
||||
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f();
|
||||
}
|
||||
--
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Cache user authenticator threads
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index 0f6ac493f6..e901c066ac 100644
|
||||
index b85b048ac..22d5c7d20 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ index 0f6ac493f6..e901c066ac 100644
|
|||
// Spigot start
|
||||
public void initUUID()
|
||||
{
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.E().getPublic(), this.e));
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e));
|
||||
} else {
|
||||
// Spigot start
|
||||
- new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
|
||||
|
@ -32,7 +32,7 @@ index 0f6ac493f6..e901c066ac 100644
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
||||
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ index 0f6ac493f6..e901c066ac 100644
|
|||
// Spigot end
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
||||
this.loginKey = packetlogininencryptionbegin.a(privatekey);
|
||||
this.g = LoginListener.EnumProtocolState.AUTHENTICATING;
|
||||
this.networkManager.a(this.loginKey);
|
||||
|
@ -52,13 +52,13 @@ index 0f6ac493f6..e901c066ac 100644
|
|||
public void run() {
|
||||
GameProfile gameprofile = LoginListener.this.i;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
return LoginListener.this.server.S() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
|
||||
return LoginListener.this.server.T() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
|
||||
}
|
||||
- };
|
||||
-
|
||||
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.c));
|
||||
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.LOGGER));
|
||||
- thread.start();
|
||||
+ });
|
||||
+ // Paper end
|
||||
|
|
|
@ -12,7 +12,7 @@ just as it does in Vanilla, but entity pushing logic will be capped.
|
|||
You can set this to 0 to disable collisions.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 13f54e05ab..72eb530d7e 100644
|
||||
index 406bc611c..58fe5a8c4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -27,7 +27,7 @@ index 13f54e05ab..72eb530d7e 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 80ff428656..291a304172 100644
|
||||
index 3fd560027..ee7fe30c7 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -39,7 +39,7 @@ index 80ff428656..291a304172 100644
|
|||
// Spigot end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 3bc1f8f9b5..34fbf83621 100644
|
||||
index 014404ade..b0c9eda48 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -53,6 +53,6 @@ index 3bc1f8f9b5..34fbf83621 100644
|
|||
+ entity.numCollisions++; // Paper
|
||||
+ numCollisions++; // Paper
|
||||
|
||||
this.C(entity);
|
||||
this.D(entity);
|
||||
}
|
||||
--
|
|
@ -1,91 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 4 Nov 2016 02:12:10 -0400
|
||||
Subject: [PATCH] Chunk Save Stats Debug Option
|
||||
|
||||
Adds a command line flag to enable stats on how chunk saves are processing.
|
||||
|
||||
Stats on current queue, how many was processed and how many were queued.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 9b5908a5b4..2997767282 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public final LongSet unloadQueue = new LongOpenHashSet();
|
||||
public final ChunkGenerator<?> chunkGenerator;
|
||||
public final IChunkLoader chunkLoader;
|
||||
+ // Paper start - chunk save stats
|
||||
+ private long lastQueuedSaves = 0L; // Paper
|
||||
+ private long lastProcessedSaves = 0L; // Paper
|
||||
+ private long lastSaveStatPrinted = System.currentTimeMillis();
|
||||
+ // Paper end
|
||||
public final Long2ObjectMap<Chunk> chunks = Long2ObjectMaps.synchronize(new ChunkMap(8192));
|
||||
private Chunk lastChunk;
|
||||
private final ChunkTaskScheduler chunkScheduler;
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
// Paper start
|
||||
final ChunkRegionLoader chunkLoader = (ChunkRegionLoader) world.getChunkProvider().chunkLoader;
|
||||
final int queueSize = chunkLoader.getQueueSize();
|
||||
+
|
||||
+ final long now = System.currentTimeMillis();
|
||||
+ final long timeSince = (now - lastSaveStatPrinted) / 1000;
|
||||
+ final Integer printRateSecs = Integer.getInteger("printSaveStats");
|
||||
+ if (printRateSecs != null && timeSince >= printRateSecs) {
|
||||
+ final String timeStr = "/" + timeSince +"s";
|
||||
+ final long queuedSaves = chunkLoader.getQueuedSaves();
|
||||
+ long queuedDiff = queuedSaves - lastQueuedSaves;
|
||||
+ lastQueuedSaves = queuedSaves;
|
||||
+
|
||||
+ final long processedSaves = chunkLoader.getProcessedSaves();
|
||||
+ long processedDiff = processedSaves - lastProcessedSaves;
|
||||
+ lastProcessedSaves = processedSaves;
|
||||
+
|
||||
+ lastSaveStatPrinted = now;
|
||||
+ if (processedDiff > 0 || queueSize > 0 || queuedDiff > 0) {
|
||||
+ System.out.println("[Chunk Save Stats] " + world.worldData.getName() +
|
||||
+ " - Current: " + queueSize +
|
||||
+ " - Queued: " + queuedDiff + timeStr +
|
||||
+ " - Processed: " +processedDiff + timeStr
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
if (!flag && queueSize > world.paperConfig.queueSizeAutoSaveThreshold){
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index adfb5d056f..0fc4d9f520 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
}
|
||||
|
||||
- public int getQueueSize() { return queue.size(); } // Paper
|
||||
+ // Paper start
|
||||
+ private long queuedSaves = 0;
|
||||
+ private final java.util.concurrent.atomic.AtomicLong processedSaves = new java.util.concurrent.atomic.AtomicLong(0L);
|
||||
+ public int getQueueSize() { return queue.size(); }
|
||||
+ public long getQueuedSaves() { return queuedSaves; }
|
||||
+ public long getProcessedSaves() { return processedSaves.longValue(); }
|
||||
+ // Paper end
|
||||
|
||||
// CraftBukkit start - Add async variant, provide compatibility
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
protected void a(ChunkCoordIntPair chunkcoordintpair, Supplier<NBTTagCompound> nbttagcompound) { // Spigot
|
||||
this.saveMap.put(chunkcoordintpair.asLong(), nbttagcompound); // Paper
|
||||
queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements
|
||||
+ queuedSaves++; // Paper
|
||||
FileIOThread.a().a(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
// Paper end
|
||||
ChunkCoordIntPair chunkcoordintpair = chunk.coords; // Paper - Chunk queue improvements
|
||||
Supplier<NBTTagCompound> nbttagcompound = chunk.compoundSupplier; // Spigot // Paper
|
||||
+ processedSaves.incrementAndGet(); // Paper
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
return true;
|
||||
--
|
|
@ -7,16 +7,16 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
|
|||
|
||||
Keep them consistent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 336e6aeef6..282d6ae84c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
}
|
||||
|
||||
i = MathHelper.floor(entity.locX / 16.0D);
|
||||
- j = MathHelper.floor(entity.locY / 16.0D);
|
||||
+ j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 464a132a3..bbf676958 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
public void chunkCheck(Entity entity) {
|
||||
this.getMethodProfiler().enter("chunkCheck");
|
||||
int i = MathHelper.floor(entity.locX / 16.0D);
|
||||
- int j = MathHelper.floor(entity.locY / 16.0D);
|
||||
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
|
||||
int k = MathHelper.floor(entity.locZ / 16.0D);
|
||||
|
||||
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
|
||||
|
|
|
@ -9,7 +9,7 @@ Also allow turning off treasure maps all together as they can eat up Map ID's
|
|||
which are limited in quantity.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 104a3acf31..13f54e05ab 100644
|
||||
index 4892113a1..406bc611c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -27,16 +27,32 @@ index 104a3acf31..13f54e05ab 100644
|
|||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 213d0b18c9..ebe397b15a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
|
||||
public void a(IMerchant imerchant, MerchantRecipeList merchantrecipelist, Random random) {
|
||||
int i = this.a.a(random);
|
||||
World world = imerchant.getWorld();
|
||||
+ if (!world.paperConfig.enableTreasureMaps) return; //Paper
|
||||
BlockPosition blockposition = world.a(this.b, imerchant.getPosition(), 100, true);
|
||||
diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java
|
||||
index 1df86e3bb..83bf9bea2 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillagerTrades.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillagerTrades.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class VillagerTrades {
|
||||
|
||||
- public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix
|
||||
hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WHEAT, 20, 8, 2), new VillagerTrades.b(Items.POTATO, 26, 8, 2), new VillagerTrades.b(Items.CARROT, 22, 8, 2), new VillagerTrades.b(Items.BEETROOT, 15, 8, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Blocks.PUMPKIN, 6, 6, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 8, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 6, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Blocks.CAKE, 1, 1, 6, 15), new VillagerTrades.i(MobEffects.FASTER_MOVEMENT, 160, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)})));
|
||||
- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 20, 8, 2), new VillagerTrades.b(Items.COAL, 10, 8, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 8, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COD, 15, 8, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 8, 5), new VillagerTrades.h(Items.pS, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SALMON, 13, 8, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 2, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.TROPICAL_FISH, 6, 6, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PUFFERFISH, 4, 6, 30), new VillagerTrades.c(1, 6, 30, ImmutableMap.builder().put(VillagerType.c, Items.OAK_BOAT).put(VillagerType.g, Items.SPRUCE_BOAT).put(VillagerType.e, Items.SPRUCE_BOAT).put(VillagerType.a, Items.JUNGLE_BOAT).put(VillagerType.b, Items.JUNGLE_BOAT).put(VillagerType.d, Items.ACACIA_BOAT).put(VillagerType.f, Items.DARK_OAK_BOAT).build())})));
|
||||
+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 20, 8, 2), new VillagerTrades.b(Items.COAL, 10, 8, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 8, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COD, 15, 8, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 8, 5), new VillagerTrades.h(Items.pS, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SALMON, 13, 8, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 2, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.TROPICAL_FISH, 6, 6, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PUFFERFISH, 4, 6, 30), new VillagerTrades.c(1, 6, 30, ImmutableMap.<VillagerType, Item>builder().put(VillagerType.c, Items.OAK_BOAT).put(VillagerType.g, Items.SPRUCE_BOAT).put(VillagerType.e, Items.SPRUCE_BOAT).put(VillagerType.a, Items.JUNGLE_BOAT).put(VillagerType.b, Items.JUNGLE_BOAT).put(VillagerType.d, Items.ACACIA_BOAT).put(VillagerType.f, Items.DARK_OAK_BOAT).build())}))); // Paper - decompile fix
|
||||
hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 8, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WHITE_DYE, 12, 8, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 8, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 8, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 8, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 8, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 8, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.YELLOW_DYE, 12, 8, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 8, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 8, 20), new VillagerTrades.b(Items.RED_DYE, 12, 8, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 8, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BROWN_DYE, 12, 8, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 8, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 8, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 8, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 8, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 8, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 6, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.PAINTING, 2, 3, 30)})));
|
||||
hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STICK, 32, 8, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 6, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.FLINT, 26, 6, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 14, 8, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.FEATHER, 24, 8, 30), new VillagerTrades.e(Items.BOW, 2, 2, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.dE, 8, 6, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 2, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 6, 30)})));
|
||||
- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 6, 3, 6, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BOOK, 4, 6, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pQ, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.INK_SAC, 5, 6, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 6, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build()));
|
||||
+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.<Integer, VillagerTrades.IMerchantRecipeOption[]>builder().put(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 6, 3, 6, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BOOK, 4, 6, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pQ, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.INK_SAC, 5, 6, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 6, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - decompile fix
|
||||
hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.df, 10, 8, 10), new VillagerTrades.k(13, "Monument", MapIcon.Type.MONUMENT, 6, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COMPASS, 1, 6, 20), new VillagerTrades.k(14, "Mansion", MapIcon.Type.MANSION, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)})));
|
||||
hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 8, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.GOLD_INGOT, 3, 6, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.RABBIT_FOOT, 2, 6, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SCUTE, 4, 6, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 6, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.NETHER_WART, 22, 6, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)})));
|
||||
hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COAL, 15, 8, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 6, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.IRON_INGOT, 4, 6, 10), new VillagerTrades.h(new ItemStack(Items.pP), 36, 1, 6, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 6, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 6, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.LAVA_BUCKET, 1, 6, 20), new VillagerTrades.b(Items.DIAMOND, 1, 6, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 6, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 6, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 6, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 2, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 2, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 2, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 2, 30, 0.2F)})));
|
||||
@@ -0,0 +0,0 @@ public class VillagerTrades {
|
||||
@Override
|
||||
public MerchantRecipe a(Entity entity, Random random) {
|
||||
World world = entity.world;
|
||||
+ if (!world.paperConfig.enableTreasureMaps) return null; //Paper
|
||||
BlockPosition blockposition = world.a(this.b, new BlockPosition(entity), 100, true);
|
||||
|
||||
if (blockposition != null) {
|
||||
--
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flying kick messages
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 6562cf54b7..fb7ada8139 100644
|
||||
index a2e204014..7ce370e92 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
|
@ -21,10 +21,10 @@ index 6562cf54b7..fb7ada8139 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index b29a1f340f..4a06527b6f 100644
|
||||
index cb6199603..982b15dec 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
if (this.B) {
|
||||
if (++this.C > 80) {
|
||||
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString());
|
||||
|
@ -33,8 +33,8 @@ index b29a1f340f..4a06527b6f 100644
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
if (this.D && this.player.getRootVehicle().bO() == this.player) {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
if (this.D && this.player.getRootVehicle().getRidingPassenger() == this.player) {
|
||||
if (++this.E > 80) {
|
||||
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString());
|
||||
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable packet in spam threshold
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index b7b28591e4..6562cf54b7 100644
|
||||
index 1089be17d..a2e204014 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
|
@ -23,10 +23,10 @@ index b7b28591e4..6562cf54b7 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 73907b4f0e..b29a1f340f 100644
|
||||
index 57ef91a43..cb6199603 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
// Spigot start - limit place/interactions
|
||||
private int limitedPackets;
|
||||
private long lastLimitedPacket = -1;
|
||||
|
|
|
@ -1,222 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 18 Jun 2016 23:22:12 -0400
|
||||
Subject: [PATCH] Delay Chunk Unloads based on Player Movement
|
||||
|
||||
When players are moving in the world, doing things such as building or exploring,
|
||||
they will commonly go back and forth in a small area. This causes a ton of chunk load
|
||||
and unload activity on the edge chunks of their view distance.
|
||||
|
||||
A simple back and forth movement in 6 blocks could spam a chunk to thrash a
|
||||
loading and unload cycle over and over again.
|
||||
|
||||
This is very wasteful. This system introduces a delay of inactivity on a chunk
|
||||
before it actually unloads, which is maintained separately from ChunkGC.
|
||||
|
||||
This allows servers with smaller worlds who do less long distance exploring to stop
|
||||
wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
|
||||
|
||||
This also makes the Chunk GC System useless, by auto scheduling unload as soon as
|
||||
a spare chunk is added to the server thats outside of view distance.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index bcc2ecaa3a..c70771614d 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
|
||||
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
|
||||
}
|
||||
+
|
||||
+ public long delayChunkUnloadsBy;
|
||||
+ private void delayChunkUnloadsBy() {
|
||||
+ delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "10s"));
|
||||
+ if (delayChunkUnloadsBy > 0) {
|
||||
+ log("Delaying chunk unloads by " + delayChunkUnloadsBy + " seconds");
|
||||
+ delayChunkUnloadsBy *= 1000;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean skipEntityTickingInChunksScheduledForUnload = true;
|
||||
+ private void skipEntityTickingInChunksScheduledForUnload() {
|
||||
+ skipEntityTickingInChunksScheduledForUnload = getBoolean("skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index c74176daa5..bdf922db50 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
private boolean i;public boolean isLoaded() { return i; } // Paper - OBFHELPER
|
||||
public final World world;
|
||||
public final Map<HeightMap.Type, HeightMap> heightMap;
|
||||
+ public Long scheduledForUnload; // Paper - delay chunk unloads
|
||||
public final int locX;
|
||||
public final int locZ;
|
||||
private boolean l;
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java
|
||||
index 8b3738c8f7..2021c0d02e 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start - if this is a spare chunk (not part of any players view distance), go ahead and queue it for unload.
|
||||
+ if (!((WorldServer)chunk.world).getPlayerChunkMap().isChunkInUse(chunk.locX, chunk.locZ)) {
|
||||
+ if (chunk.world.paperConfig.delayChunkUnloadsBy > 0) {
|
||||
+ chunk.scheduledForUnload = System.currentTimeMillis();
|
||||
+ } else {
|
||||
+ ((WorldServer) chunk.world).getChunkProvider().unload(chunk);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
chunk.world.timings.syncChunkLoadPostTimer.stopTiming(); // Paper
|
||||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index c54df45837..d0bf0f72da 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
activityAccountant.endActivity(); // Spigot
|
||||
}
|
||||
+ // Paper start - delayed chunk unloads
|
||||
+ long now = System.currentTimeMillis();
|
||||
+ long unloadAfter = world.paperConfig.delayChunkUnloadsBy;
|
||||
+ if (unloadAfter > 0) {
|
||||
+ //noinspection Convert2streamapi
|
||||
+ for (Chunk chunk : chunks.values()) {
|
||||
+ if (chunk.scheduledForUnload != null && now - chunk.scheduledForUnload > unloadAfter) {
|
||||
+ chunk.scheduledForUnload = null;
|
||||
+ unload(chunk);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
this.chunkScheduler.a(booleansupplier);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index e47aae2f8b..b9d90c4fb8 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
|
||||
chunkproviderserver.a(i, j);
|
||||
this.chunk = chunkproviderserver.getChunkAt(i, j, true, false);
|
||||
+ markChunkUsed(); // Paper - delay chunk unloads
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void markChunkUsed() {
|
||||
+ if (chunk == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (chunkHasPlayers) {
|
||||
+ chunk.scheduledForUnload = null;
|
||||
+ } else if (chunk.scheduledForUnload == null) {
|
||||
+ chunk.scheduledForUnload = System.currentTimeMillis();
|
||||
+ }
|
||||
+ }
|
||||
+ private boolean chunkHasPlayers = false;
|
||||
+ // Paper end
|
||||
+
|
||||
public ChunkCoordIntPair a() {
|
||||
return this.location;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
} else {
|
||||
if (this.players.isEmpty()) {
|
||||
this.i = this.playerChunkMap.getWorld().getTime();
|
||||
+ chunkHasPlayers = true; // Paper - delay chunk unloads
|
||||
+ markChunkUsed(); // Paper - delay chunk unloads
|
||||
}
|
||||
|
||||
this.players.add(entityplayer);
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
|
||||
this.players.remove(entityplayer);
|
||||
if (this.players.isEmpty()) {
|
||||
+ chunkHasPlayers = false; // Paper - delay chunk unloads
|
||||
+ markChunkUsed(); // Paper - delay chunk unloads
|
||||
this.playerChunkMap.b(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunk {
|
||||
return true;
|
||||
} else {
|
||||
this.chunk = this.playerChunkMap.getWorld().getChunkProvider().getChunkAt(this.location.x, this.location.z, true, flag);
|
||||
+ markChunkUsed(); // Paper - delay chunk unloads
|
||||
return this.chunk != null;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 2064576501..ab4f3b7223 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
|
||||
Chunk chunk = playerchunk.f();
|
||||
|
||||
if (chunk != null) {
|
||||
- this.getWorld().getChunkProvider().unload(chunk);
|
||||
+ // Paper start - delay chunk unloads
|
||||
+ if (world.paperConfig.delayChunkUnloadsBy <= 0) {
|
||||
+ this.getWorld().getChunkProvider().unload(chunk);
|
||||
+ } else {
|
||||
+ chunk.scheduledForUnload = System.currentTimeMillis();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 32ee298648..dcff6c8d8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
if (!tileentity.x() && tileentity.hasWorld()) {
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
- if (this.isLoaded(blockposition) && this.K.a(blockposition)) {
|
||||
+ // Paper start - Skip ticking in chunks scheduled for unload
|
||||
+ net.minecraft.server.Chunk chunk = this.getChunkIfLoaded(blockposition);
|
||||
+ boolean shouldTick = chunk != null;
|
||||
+ if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
|
||||
+ shouldTick = shouldTick && chunk.scheduledForUnload == null;
|
||||
+ if (shouldTick && this.K.a(blockposition)) {
|
||||
+ // Paper end
|
||||
try {
|
||||
this.methodProfiler.a(() -> {
|
||||
return String.valueOf(TileEntityTypes.a(tileentity.C()));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index a8c7e7931e..f7883e7085 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
ChunkProviderServer cps = world.getChunkProvider();
|
||||
for (net.minecraft.server.Chunk chunk : cps.chunks.values()) {
|
||||
// If in use, skip it
|
||||
- if (isChunkInUse(chunk.locX, chunk.locZ)) {
|
||||
+ if (isChunkInUse(chunk.locX, chunk.locZ) || chunk.scheduledForUnload != null) { // Paper - delayed chunk unloads
|
||||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index d08ef3fe10..081789a8fe 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
+ // Paper start - Skip ticking in chunks scheduled for unload
|
||||
+ else if (entity.world.paperConfig.skipEntityTickingInChunksScheduledForUnload && (chunk == null || chunk.scheduledForUnload != null)) {
|
||||
+ isActive = false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
return isActive;
|
||||
}
|
||||
}
|
||||
--
|
|
@ -1,30 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 26 Sep 2016 01:51:30 -0400
|
||||
Subject: [PATCH] Disable Vanilla Chunk GC
|
||||
|
||||
Bukkit has its own system for this.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 49c5b0b5cc..15736f7575 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
chunkproviderserver.a(flag);
|
||||
timings.worldSaveChunks.stopTiming(); // Paper
|
||||
// CraftBukkit - ArrayList -> Collection
|
||||
+ /* //Paper start - disable vanilla chunk GC
|
||||
java.util.Collection<Chunk> list = chunkproviderserver.a();
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
if (chunk != null && !this.manager.a(chunk.locX, chunk.locZ)) {
|
||||
chunkproviderserver.unload(chunk);
|
||||
}
|
||||
- }
|
||||
+ }*/
|
||||
+ // Paper end
|
||||
timings.worldSave.stopTiming(); // Paper
|
||||
}
|
||||
}
|
||||
--
|
|
@ -1,27 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: killme <killme-git@ibts.me>
|
||||
Date: Tue, 30 Aug 2016 16:39:48 +0200
|
||||
Subject: [PATCH] Disable ticking of snow blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockSnowBlock.java b/src/main/java/net/minecraft/server/BlockSnowBlock.java
|
||||
index 0c8f9d37fd..44ed656263 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockSnowBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockSnowBlock.java
|
||||
@@ -0,0 +0,0 @@ public class BlockSnowBlock extends Block {
|
||||
return 4;
|
||||
}
|
||||
|
||||
+ // Paper start - snow blocks don't need to tick
|
||||
+ /*
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
|
||||
if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
// CraftBukkit start
|
||||
@@ -0,0 +0,0 @@ public class BlockSnowBlock extends Block {
|
||||
}
|
||||
|
||||
}
|
||||
+ */
|
||||
+ //Paper end
|
||||
}
|
||||
--
|
|
@ -5,11 +5,11 @@ Subject: [PATCH] Do not let armorstands drown
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
index b570882340..694df9e185 100644
|
||||
index 8c6a9ec68..f8cd62199 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
super.move(moveType, x, y, z);
|
||||
super.move(moveType, vec3d);
|
||||
}
|
||||
}
|
||||
+
|
||||
|
@ -20,22 +20,22 @@ index b570882340..694df9e185 100644
|
|||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 34fbf83621..138a224e04 100644
|
||||
index b0c9eda48..121925046 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
super.a(d0, flag, iblockdata, blockposition);
|
||||
}
|
||||
|
||||
+ public boolean canBreatheUnderwater() { return this.ca(); } // Paper - OBFHELPER
|
||||
public boolean ca() {
|
||||
+ public boolean canBreatheUnderwater() { return this.cl(); } // Paper - OBFHELPER
|
||||
public boolean cl() {
|
||||
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (this.isAlive()) {
|
||||
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) {
|
||||
- if (!this.ca() && !MobEffectUtil.c(this) && !flag1) {
|
||||
- if (!this.cl() && !MobEffectUtil.c(this) && !flag1) {
|
||||
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
|
||||
this.setAirTicks(this.k(this.getAirTicks()));
|
||||
if (this.getAirTicks() == -20) {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b6ed9082fd..80ff428656 100644
|
||||
index cbdc267fa..3fd560027 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
|
|
@ -5,25 +5,25 @@ Subject: [PATCH] Don't let fishinghooks use portals
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 113264981e..b6ed9082fd 100644
|
||||
index b68e2fc04..cbdc267fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public boolean ak;
|
||||
public boolean af;
|
||||
public boolean impulse;
|
||||
public int portalCooldown;
|
||||
- protected boolean an;
|
||||
+ protected boolean an; public boolean inPortal() { return an; } // Paper - OBFHELPER
|
||||
protected int ao;
|
||||
- protected boolean ai;
|
||||
+ protected boolean ai; public final boolean inPortal() { return this.ai; } // Paper - OBFHELPER
|
||||
protected int aj;
|
||||
public DimensionManager dimension;
|
||||
protected BlockPosition aq;
|
||||
protected BlockPosition al;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 118b974d76..861fc6fd5c 100644
|
||||
index b082d0a82..15a686cb2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
this.motY *= 0.92D;
|
||||
this.motZ *= 0.92D;
|
||||
|
||||
this.setMot(this.getMot().a(0.92D));
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
+
|
||||
+ // Paper start - These shouldn't be going through portals
|
||||
|
|
|
@ -13,21 +13,21 @@ This of course is undesirable, so just return the loaded side as "primary"
|
|||
and treat it as a single chest if the other sides are unloaded
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
|
||||
index e94786138e..c61721bc3d 100644
|
||||
index ee9d91a8c..e71178ac1 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockChest.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockChest.java
|
||||
@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC
|
||||
return (ITileInventory) object;
|
||||
@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity implements IBlockWaterlogged {
|
||||
return blockchest_chestfinder.b(tileentitychest);
|
||||
} else {
|
||||
BlockPosition blockposition1 = blockposition.shift(k(iblockdata));
|
||||
- IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
BlockPosition blockposition1 = blockposition.shift(j(iblockdata));
|
||||
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
|
||||
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
|
||||
+ final IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition1); // Paper
|
||||
+ if (iblockdata1 == null) {
|
||||
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1);
|
||||
+ if (iblockdata1 == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
if (iblockdata1.getBlock() == this) {
|
||||
if (iblockdata1.getBlock() == iblockdata.getBlock()) {
|
||||
BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b);
|
||||
--
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
||||
index 65d230d45f..9bf2521be6 100644
|
||||
index cd8a652eb..409bc6da9 100644
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
||||
@@ -0,0 +0,0 @@ public class UserCache {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 7 Jan 2017 16:06:44 -0500
|
||||
Subject: [PATCH] Enforce Sync Chunk Unloads
|
||||
|
||||
Unloading Chunks async is extremely dangerous. This will force it to main
|
||||
the same way we handle async chunk loads.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 010c5fc731..6718028190 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save) {
|
||||
+ Boolean result = MCUtil.ensureMain("Unload Chunk", () -> { // Paper - Ensure never async
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
|
||||
if (chunk == null) {
|
||||
return true;
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
||||
// If chunk had previously been queued to save, must do save to avoid loss of that data
|
||||
return world.getChunkProvider().unloadChunk(chunk, chunk.mustSave || save);
|
||||
+ }); return result != null ? result : false; // Paper - Ensure never async
|
||||
}
|
||||
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
--
|
|
@ -7,23 +7,21 @@ Saving players async is extremely dangerous. This will force it to main
|
|||
the same way we handle async chunk loads.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index fe6649224a..9570a8800b 100644
|
||||
index 7003c4a93..a1659e6a2 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void savePlayers(Integer interval) {
|
||||
+ MCUtil.ensureMain("Save Players", () -> { // Paper - ensure main
|
||||
long now = MinecraftServer.currentTick;
|
||||
public void savePlayers() {
|
||||
+ MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
|
||||
MinecraftTimings.savePlayers.startTiming(); // Paper
|
||||
int numSaved = 0; // Paper
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
this.savePlayerFile((EntityPlayer) this.players.get(i));
|
||||
}
|
||||
MinecraftTimings.savePlayers.stopTiming(); // Paper
|
||||
+ return null; }); // Paper - ensure main
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public WhiteList getWhitelist() {
|
||||
--
|
|
@ -1,45 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 27 May 2016 21:41:26 -0400
|
||||
Subject: [PATCH] Ensure Chunks never ever load async
|
||||
|
||||
Safely pushes the operation to main thread, then back to the posting thread
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
||||
index e4fd9bc604..7ffb8f6172 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.chunkio;
|
||||
import net.minecraft.server.Chunk;
|
||||
import net.minecraft.server.ChunkProviderServer;
|
||||
import net.minecraft.server.ChunkRegionLoader;
|
||||
+import net.minecraft.server.MCUtil; // Paper
|
||||
import net.minecraft.server.World;
|
||||
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkIOExecutor {
|
||||
private static final AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException> instance = new AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException>(new ChunkIOProvider(), BASE_THREADS);
|
||||
|
||||
public static Chunk syncChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z) {
|
||||
- return instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider));
|
||||
+ return MCUtil.ensureMain("Async Chunk Load", () -> instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider))); // Paper
|
||||
}
|
||||
|
||||
public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
index 52a8c48fa4..4cfe24df15 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
@@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||
|
||||
// sync stuff
|
||||
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
|
||||
- if (chunk == null) {
|
||||
+ if (chunk == null || queuedChunk.provider.chunks.containsKey(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z))) { // Paper - also call original if it was already loaded
|
||||
// If the chunk loading failed just do it synchronously (may generate)
|
||||
- // queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
|
||||
+ queuedChunk.provider.getChunkAt(queuedChunk.x, queuedChunk.z, true, true); // Paper - actually call original if it was already loaded
|
||||
return;
|
||||
}
|
||||
try (Timing ignored = queuedChunk.provider.world.timings.chunkIOStage2.startTimingIfSync()) { // Paper
|
||||
--
|
|
@ -8,7 +8,7 @@ Adds lots of information about why this orb exists.
|
|||
Replaces isFromBottle() with logic that persists entity reloads too.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
||||
index 1dc13fcc30..c674aa13d8 100644
|
||||
index fd23d4534..69e65ea6c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block implements IMaterial {
|
||||
|
@ -27,11 +27,24 @@ index 1dc13fcc30..c674aa13d8 100644
|
|||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
index 2e4f81ebe..88b9655bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
@@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container {
|
||||
int k = EntityExperienceOrb.getOrbValue(j);
|
||||
|
||||
j -= k;
|
||||
- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k));
|
||||
+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper
|
||||
}
|
||||
|
||||
world.triggerEffect(1042, blockposition, 0);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index b3fbc8249e..79d8be8d46 100644
|
||||
index bfdb63094..3a6ae654c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
|
@ -41,7 +54,7 @@ index b3fbc8249e..79d8be8d46 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
index 3030dd9c31..404a222b45 100644
|
||||
index bfba08fb2..49668f2c2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
@ -67,7 +80,7 @@ index 3030dd9c31..404a222b45 100644
|
|||
+ if (comp.hasKey("reason")) {
|
||||
+ String reason = comp.getString("reason");
|
||||
+ try {
|
||||
+ spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
|
||||
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
|
||||
+ } catch (Exception e) {
|
||||
+ this.world.getServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
|
||||
+ }
|
||||
|
@ -75,14 +88,14 @@ index 3030dd9c31..404a222b45 100644
|
|||
+ }
|
||||
+ private void savePaperNBT(NBTTagCompound nbttagcompound) {
|
||||
+ NBTTagCompound comp = new NBTTagCompound();
|
||||
+ if (sourceEntityId != null) {
|
||||
+ comp.setUUID("source", sourceEntityId);
|
||||
+ if (this.sourceEntityId != null) {
|
||||
+ comp.setUUID("source", this.sourceEntityId);
|
||||
+ }
|
||||
+ if (triggerEntityId != null) {
|
||||
+ if (this.triggerEntityId != null) {
|
||||
+ comp.setUUID("trigger", triggerEntityId);
|
||||
+ }
|
||||
+ if (spawnReason != null && spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
||||
+ comp.setString("reason", spawnReason.name());
|
||||
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
||||
+ comp.setString("reason", this.spawnReason.name());
|
||||
+ }
|
||||
+ nbttagcompound.set("Paper.ExpData", comp);
|
||||
+ }
|
||||
|
@ -96,31 +109,32 @@ index 3030dd9c31..404a222b45 100644
|
|||
+ }
|
||||
+
|
||||
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId, Entity sourceId) {
|
||||
super(EntityTypes.EXPERIENCE_ORB, world);
|
||||
this(EntityTypes.EXPERIENCE_ORB, world);
|
||||
+ this.sourceEntityId = sourceId != null ? sourceId.getUniqueID() : null;
|
||||
+ this.triggerEntityId = triggerId != null ? triggerId.getUniqueID() : null;
|
||||
+ this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
||||
+ // Paper end
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.yaw = (float) (Math.random() * 360.0D);
|
||||
this.yaw = (float) (this.random.nextDouble() * 360.0D);
|
||||
this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
nbttagcompound.setShort("Health", (short) this.d);
|
||||
nbttagcompound.setShort("Age", (short) this.b);
|
||||
nbttagcompound.setShort("Health", (short) this.e);
|
||||
nbttagcompound.setShort("Age", (short) this.c);
|
||||
nbttagcompound.setShort("Value", (short) this.value);
|
||||
+ savePaperNBT(nbttagcompound); // Paper
|
||||
+ this.savePaperNBT(nbttagcompound); // Paper
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.d = nbttagcompound.getShort("Health");
|
||||
this.b = nbttagcompound.getShort("Age");
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.e = nbttagcompound.getShort("Health");
|
||||
this.c = nbttagcompound.getShort("Age");
|
||||
this.value = nbttagcompound.getShort("Value");
|
||||
+ loadPaperNBT(nbttagcompound); // Paper
|
||||
+ this.loadPaperNBT(nbttagcompound); // Paper
|
||||
}
|
||||
|
||||
public void d(EntityHuman entityhuman) {
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 202b8d2158..ee71c326ae 100644
|
||||
index 78527f350..03f782d4b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
|
@ -133,7 +147,7 @@ index 202b8d2158..ee71c326ae 100644
|
|||
// CraftBukkit end
|
||||
if (itemstack1.getItem().a(TagsItem.FISHES)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index c0ef0c51f1..3bc1f8f9b5 100644
|
||||
index 780287f91..014404ade 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -147,10 +161,10 @@ index c0ef0c51f1..3bc1f8f9b5 100644
|
|||
this.expToDrop = 0;
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
index a5e1939e05..e73dba09a6 100644
|
||||
index 77dd4c99a..398b499bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectile {
|
||||
@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
|
@ -159,21 +173,47 @@ index a5e1939e05..e73dba09a6 100644
|
|||
}
|
||||
|
||||
this.die();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
index 7c6506a91..1b4933c07 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
|
||||
Random random = this.animal.getRandom();
|
||||
|
||||
if (this.b.getGameRules().getBoolean("doMobLoot")) {
|
||||
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1));
|
||||
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index ebe397b15a..78acac4ca7 100644
|
||||
index c34868324..bc04086d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}
|
||||
|
||||
if (merchantrecipe.j()) {
|
||||
if (merchantrecipe.q()) {
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, tradingPlayer, this)); // Paper
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
||||
}
|
||||
|
||||
if (this.tradingPlayer instanceof EntityPlayer) {
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
index 1d612d828..002ff8880 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
if (merchantrecipe.q()) {
|
||||
int i = 3 + this.random.nextInt(4);
|
||||
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
index bf061cf064..55f9787680 100644
|
||||
index d25a05736..9d0b1ffef 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalBreed extends PathfinderGoal {
|
||||
|
@ -186,7 +226,7 @@ index bf061cf064..55f9787680 100644
|
|||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
index 0baf0100c9..6ae6afa339 100644
|
||||
index 6e90f21ea..a7411c75a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
|
@ -199,29 +239,33 @@ index 0baf0100c9..6ae6afa339 100644
|
|||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
index 5ac554d65e..d70c4dda5a 100644
|
||||
index d2698e847..edc4a5c34 100644
|
||||
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.event.inventory.FurnaceExtractEvent;
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
||||
public class SlotFurnaceResult extends Slot {
|
||||
|
||||
- private final EntityHuman a;
|
||||
+ private final EntityHuman a;public EntityHuman getPlayer() { return a; } // Paper OBFHELPER
|
||||
+ private final EntityHuman a; public final EntityHuman getPlayer() { return this.a; } // Paper OBFHELPER
|
||||
private int b;
|
||||
|
||||
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
|
||||
@@ -0,0 +0,0 @@ public class SlotFurnaceResult extends Slot {
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
- this.a.world.addEntity(new EntityExperienceOrb(this.a.world, this.a.locX, this.a.locY + 0.5D, this.a.locZ + 0.5D, j));
|
||||
+ this.a.world.addEntity(new EntityExperienceOrb(this.a.world, this.a.locX, this.a.locY + 0.5D, this.a.locZ + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, getPlayer())); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
index adb1a0913..be16fe9a9 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX, entityhuman.locY + 0.5D, entityhuman.locZ + 0.5D, j));
|
||||
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX, entityhuman.locY + 0.5D, entityhuman.locZ + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 6718028190..d72f393a75 100644
|
||||
index 3c7f62fc5..3fbc48150 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
@ -230,11 +274,11 @@ index 6718028190..d72f393a75 100644
|
|||
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
||||
- entity = new EntityExperienceOrb(world, x, y, z, 0);
|
||||
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
|
||||
} else if (Weather.class.isAssignableFrom(clazz)) {
|
||||
// not sure what this can do
|
||||
if (LightningStrike.class.isAssignableFrom(clazz)) {
|
||||
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityLightning(world, x, y, z, false);
|
||||
} else if (Firework.class.isAssignableFrom(clazz)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
index 3a09cab3d4..3302af0e45 100644
|
||||
index 3a09cab3d..3302af0e4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
|
|||
Only resize the the redstone torch list once, since resizing arrays / lists is costly
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
index d8a0b73c31..74b63fe1d1 100644
|
||||
index a99f979ef..a79484e3e 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
||||
@@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 9829b3b64b..104a3acf31 100644
|
||||
index eed454bf4..4892113a1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
|
@ -30,11 +30,11 @@ index 9829b3b64b..104a3acf31 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 489dd861d2..3eaee8d890 100644
|
||||
index 90becdfde..f54887e5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
|
||||
|
||||
@Override
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState"));
|
||||
+
|
||||
|
|
|
@ -5,76 +5,80 @@ Subject: [PATCH] Firework API's
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
index 9b6d217df8..9764c76fba 100644
|
||||
index d6bde129e..5cee161b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.OptionalInt;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class EntityFireworks extends Entity {
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.b);
|
||||
public class EntityFireworks extends Entity implements IProjectile {
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity implements IProjectile {
|
||||
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
|
||||
private int ticksFlown;
|
||||
public int expectedLifespan;
|
||||
- private EntityLiving e;
|
||||
- private EntityLiving ridingEntity;
|
||||
+ private EntityLiving ridingEntity; public final EntityLiving getBoostedEntity() { return this.ridingEntity; } // Paper - OBFHELPER
|
||||
+ public UUID spawningEntity; // Paper
|
||||
+ private EntityLiving e;public EntityLiving getBoostedEntity() { return e; } // Paper - OBFHELPER
|
||||
|
||||
public EntityFireworks(World world) {
|
||||
super(EntityTypes.FIREWORK_ROCKET, world);
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
|
||||
nbttagcompound.set("FireworksItem", itemstack.save(new NBTTagCompound()));
|
||||
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity implements IProjectile {
|
||||
}
|
||||
|
||||
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.d));
|
||||
+ // Paper start
|
||||
+ if (spawningEntity != null) {
|
||||
+ nbttagcompound.setUUID("SpawningEntity", spawningEntity);
|
||||
+ if (this.spawningEntity != null) {
|
||||
+ nbttagcompound.setUUID("SpawningEntity", this.spawningEntity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
|
||||
if (!itemstack.isEmpty()) {
|
||||
this.datawatcher.set(EntityFireworks.FIREWORK_ITEM, itemstack);
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity implements IProjectile {
|
||||
if (nbttagcompound.hasKey("ShotAtAngle")) {
|
||||
this.datawatcher.set(EntityFireworks.d, nbttagcompound.getBoolean("ShotAtAngle"));
|
||||
}
|
||||
-
|
||||
+ // Paper start
|
||||
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
|
||||
+ spawningEntity = nbttagcompound.getUUID("SpawningEntity");
|
||||
+ this.spawningEntity = nbttagcompound.getUUID("SpawningEntity");
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public boolean bk() {
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
index 68bd2af261..dbb422e9da 100644
|
||||
index 37caa79cb..aea46ffae 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
|
||||
BlockPosition blockposition = itemactioncontext.getClickPosition();
|
||||
ItemStack itemstack = itemactioncontext.getItemStack();
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, (double) ((float) blockposition.getX() + itemactioncontext.m()), (double) ((float) blockposition.getY() + itemactioncontext.n()), (double) ((float) blockposition.getZ() + itemactioncontext.o()), itemstack);
|
||||
+ entityfireworks.spawningEntity = itemactioncontext.b.getUniqueID(); // Paper
|
||||
Vec3D vec3d = itemactioncontext.j();
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, vec3d.x, vec3d.y, vec3d.z, itemstack);
|
||||
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
|
||||
|
||||
world.addEntity(entityfireworks);
|
||||
itemstack.subtract(1);
|
||||
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
if (!world.isClientSide) {
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
|
||||
+ entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper
|
||||
|
||||
world.addEntity(entityfireworks);
|
||||
- world.addEntity(new EntityFireworks(world, itemstack, entityhuman));
|
||||
+ // Paper start
|
||||
+ final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
|
||||
+ entityfireworks.spawningEntity = entityhuman.getUniqueID();
|
||||
+ world.addEntity(entityfireworks);
|
||||
+ // Paper end
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack.subtract(1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
index 8c5d6c1d38..d4165f7e44 100644
|
||||
index 3f6d2676e..b1fd18151 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase {
|
||||
|
@ -82,22 +86,22 @@ index 8c5d6c1d38..d4165f7e44 100644
|
|||
}
|
||||
|
||||
- public boolean b(String s) {
|
||||
+ public boolean hasUUID(String s) { return b(s); } public boolean b(String s) { // Paper - OBFHELPER
|
||||
+ public final boolean hasUUID(String s) { return this.b(s); } public boolean b(String s) { // Paper - OBFHELPER
|
||||
return this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index 7b3b206823..b39e33f4f0 100644
|
||||
index 6b69be742..37374ae5b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.server.EntityFireworks;
|
||||
+import net.minecraft.server.EntityLiving;
|
||||
import net.minecraft.server.ItemStack;
|
||||
import net.minecraft.server.Items;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -105,11 +109,11 @@ index 7b3b206823..b39e33f4f0 100644
|
|||
+import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
import java.util.Random;
|
||||
+import java.util.UUID;
|
||||
|
||||
+
|
||||
public class CraftFirework extends CraftEntity implements Firework {
|
||||
|
||||
private final Random random = new Random();
|
||||
@@ -0,0 +0,0 @@ public class CraftFirework extends CraftEntity implements Firework {
|
||||
public void detonate() {
|
||||
getHandle().expectedLifespan = 0;
|
||||
|
|
|
@ -7,29 +7,16 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added.
|
|||
|
||||
Also add debug if something else tries to, and abort before world gets bad state
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index 21ee154a57..a144118f66 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
}
|
||||
|
||||
public static void a(Entity entity, GeneratorAccess generatoraccess, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
- if (generatoraccess.addEntity(entity, reason) && entity.isVehicle()) {
|
||||
+ if (!entity.valid && generatoraccess.addEntity(entity, reason) && entity.isVehicle()) { // Paper
|
||||
// CraftBukkit end
|
||||
Iterator iterator = entity.bP().iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index dcff6c8d8a..336e6aeef6 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
|
||||
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 1e718e4db..464a132a3 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
// CraftBukkit start
|
||||
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
|
||||
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
|
||||
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
||||
if (entity.dead) {
|
||||
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
||||
}
|
||||
--
|
|
@ -9,38 +9,38 @@ Subject: [PATCH] Fix Old Sign Conversion
|
|||
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
|
||||
index 83db94c4ab..dd635292ec 100644
|
||||
index dabfb8067..f80ba567f 100644
|
||||
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
|
||||
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
|
||||
@@ -0,0 +0,0 @@ public class DefinedStructure {
|
||||
definedstructure_blockinfo1.c.setInt("x", blockposition1.getX());
|
||||
definedstructure_blockinfo1.c.setInt("y", blockposition1.getY());
|
||||
definedstructure_blockinfo1.c.setInt("z", blockposition1.getZ());
|
||||
+ tileentity.isLoadingStructure = true; // Paper
|
||||
tileentity.load(definedstructure_blockinfo1.c);
|
||||
tileentity.a(definedstructureinfo.b());
|
||||
tileentity.a(definedstructureinfo.c());
|
||||
+ tileentity.isLoadingStructure = false; // Paper
|
||||
}
|
||||
definedstructure_blockinfo.c.setInt("x", blockposition1.getX());
|
||||
definedstructure_blockinfo.c.setInt("y", blockposition1.getY());
|
||||
definedstructure_blockinfo.c.setInt("z", blockposition1.getZ());
|
||||
+ tileentity.isLoadingStructure = true; // Paper
|
||||
tileentity.load(definedstructure_blockinfo.c);
|
||||
tileentity.a(definedstructureinfo.c());
|
||||
tileentity.a(definedstructureinfo.d());
|
||||
+ tileentity.isLoadingStructure = false; // Paper
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index c5212417c6..b3c5766a27 100644
|
||||
index 85a1c5666..d8cc35352 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit
|
||||
public abstract class TileEntity implements KeyedObject { // Paper
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
||||
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
+ boolean isLoadingStructure = false; // Paper
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private final TileEntityTypes<?> e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER
|
||||
private final TileEntityTypes<?> b; public TileEntityTypes getTileEntityType() { return b; } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
protected World world;
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
index 31a9d45727..458d1561d0 100644
|
||||
index 86505f25c..9de03a24c 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener {
|
||||
@@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix block break desync
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 1c4842a263..05cc5afea6 100644
|
||||
index 6874563e4..37caa2a70 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 > 36.0D) {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Item#canEntityPickup
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index c530824596..98e214cdd6 100644
|
||||
index 5d830b245..f1621a9e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
@ -21,19 +21,19 @@ index c530824596..98e214cdd6 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 9b854d64fb..39a804b7cb 100644
|
||||
index fe70a3a8b..36b5fb537 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
private static final DataWatcherObject<ItemStack> b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g);
|
||||
public int age; // PAIL
|
||||
public int pickupDelay;
|
||||
private UUID owner;
|
||||
public final float b;
|
||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
+ public boolean canMobPickup = true; // Paper
|
||||
private int e;
|
||||
private UUID f;
|
||||
private UUID g;
|
||||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
index 55d6bacf77..6036592f76 100644
|
||||
index 0dbca8f00..65b23f511 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -0,0 +0,0 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
|
|
|
@ -4,17 +4,17 @@ Date: Tue, 7 Feb 2017 16:55:35 -0600
|
|||
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 2997767282..41926a361b 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
// Spigot start
|
||||
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
|
||||
activityAccountant.startActivity(0.5);
|
||||
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
|
||||
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
|
||||
// Spigot end
|
||||
Iterator<Long> iterator = this.unloadQueue.iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index be903252b..89a00ff8d 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
// Spigot start
|
||||
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
|
||||
activityAccountant.startActivity(0.5);
|
||||
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
|
||||
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
|
||||
// Spigot end
|
||||
while (longiterator.hasNext()) { // Spigot
|
||||
long j = longiterator.nextLong();
|
||||
--
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] More informative vehicle moved wrongly message
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 66aa3bde64..73907b4f0e 100644
|
||||
index 42eac6b71..57ef91a43 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
|
||||
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
|
||||
flag1 = true;
|
||||
|
|
|
@ -6,39 +6,37 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
|
|||
Also fix view distance lookup
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index 967aae838e..b3fbc8249e 100644
|
||||
index 245b1d100..bfdb63094 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
if (this.bO == 1) {
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
if (this.bL == 1) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.a(1028, new BlockPosition(this), 0);
|
||||
// this.world.b(1028, new BlockPosition(this), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ // Paper start
|
||||
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ for (EntityHuman human : world.players) {
|
||||
+ EntityPlayer player = (EntityPlayer) human;
|
||||
+ int viewDistance = player.getViewDistance();
|
||||
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // Paper end
|
||||
double deltaX = this.locX - player.locX;
|
||||
double deltaZ = this.locZ - player.locZ;
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
index c43a90333b..ed4ca8abb2 100644
|
||||
index f23f09430..48b22894a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.a(1023, new BlockPosition(this), 0);
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ // Paper start
|
||||
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ for (EntityHuman human : world.players) {
|
||||
+ EntityPlayer player = (EntityPlayer) human;
|
||||
+ int viewDistance = player.getViewDistance();
|
||||
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
+ // Paper end
|
||||
double deltaX = this.locX - player.locX;
|
||||
double deltaZ = this.locZ - player.locZ;
|
||||
|
|
|
@ -9,7 +9,7 @@ object identity checks safely.
|
|||
Use a simpler optimized hashcode
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockState.java b/src/main/java/net/minecraft/server/BlockState.java
|
||||
index d95c0955a9..ea0e0ff4fe 100644
|
||||
index 77b25317a..be7e10d85 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockState.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockState.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockState<T extends Comparable<T>> implements IBlockState
|
||||
|
@ -28,7 +28,7 @@ index d95c0955a9..ea0e0ff4fe 100644
|
|||
+ return this == object; // Paper - only one instance per configuration
|
||||
}
|
||||
|
||||
+ private static java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1);// Paper - only one instance per configuration
|
||||
+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration
|
||||
+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration
|
||||
public final int hashCode() {
|
||||
- if (this.c == null) {
|
||||
|
@ -36,44 +36,47 @@ index d95c0955a9..ea0e0ff4fe 100644
|
|||
- }
|
||||
-
|
||||
- return this.c;
|
||||
+ return hashCode; // Paper - only one instance per configuration
|
||||
+ return this.hashCode; // Paper - only one instance per configuration
|
||||
}
|
||||
|
||||
public int c() {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java
|
||||
index 4c1d39d67c..71d2ad9703 100644
|
||||
index 31cb8ac84..3f085c7d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockStateBoolean.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java
|
||||
@@ -0,0 +0,0 @@ public class BlockStateBoolean extends BlockState<Boolean> {
|
||||
return obool.toString();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
return true;
|
||||
} else if (object instanceof BlockStateBoolean && super.equals(object)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
||||
index 986b9ccea8..facbf30b4e 100644
|
||||
index 59d86fc66..82a1fac6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
||||
@@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
|
||||
return ((INamable) t0).getName();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
return true;
|
||||
} else if (object instanceof BlockStateEnum && super.equals(object)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java
|
||||
index 2f12e15e07..613cd0bce2 100644
|
||||
index 6861c2b05..74ef69952 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockStateInteger.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockStateInteger.java
|
||||
@@ -0,0 +0,0 @@ public class BlockStateInteger extends BlockState<Integer> {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
|
|
|
@ -5,28 +5,28 @@ Subject: [PATCH] Optimise removeQueue
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index fcb5f590df..6b9bbc77c0 100644
|
||||
index 5610c539a..ecdfd306b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import io.netty.util.concurrent.Future;
|
||||
+import java.util.ArrayDeque; // Paper
|
||||
import java.util.Collection;
|
||||
+import java.util.Deque; // Paper
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.OptionalInt;
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public PlayerConnection playerConnection;
|
||||
public final MinecraftServer server;
|
||||
public final PlayerInteractManager playerInteractManager;
|
||||
public double d;
|
||||
public double e;
|
||||
- public final List<Integer> removeQueue = Lists.newLinkedList();
|
||||
+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper
|
||||
private final AdvancementDataPlayer cf;
|
||||
private final ServerStatisticManager cg;
|
||||
private float ch = Float.MIN_VALUE;
|
||||
private final AdvancementDataPlayer advancementDataPlayer;
|
||||
private final ServerStatisticManager serverStatisticManager;
|
||||
private float lastHealthScored = Float.MIN_VALUE;
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
while (!this.removeQueue.isEmpty()) {
|
||||
int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE);
|
||||
|
@ -63,7 +63,7 @@ index fcb5f590df..6b9bbc77c0 100644
|
|||
+ this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.cx = entityplayer.cx;
|
||||
this.cC = entityplayer.cC;
|
||||
this.cp = entityplayer.cp;
|
||||
this.cu = entityplayer.cu;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
||||
--
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Optimize ItemStack.isEmpty()
|
|||
Remove hashMap lookup every check, simplify code to remove ternary
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index 37d37f1f64..927394333a 100644
|
||||
index b643a4123..b7d327211 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
|
|
|
@ -10,10 +10,10 @@ Additionally, move Saving of the User cache to be done async, incase
|
|||
the user never changed the default setting for Spigot's save on stop only.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 78b60d0e35..7ffb061414 100644
|
||||
index cddb4311a..c41adf441 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
// Spigot start
|
||||
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
||||
LOGGER.info("Saving usercache.json");
|
||||
|
@ -23,7 +23,7 @@ index 78b60d0e35..7ffb061414 100644
|
|||
// Spigot end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
||||
index f782ecb82f..65d230d45f 100644
|
||||
index 41be5bf64..cd8a652eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
||||
@@ -0,0 +0,0 @@ public class UserCache {
|
||||
|
|
|
@ -6,11 +6,11 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
|
|||
Reduce method invocations for World.isLoaded(BlockPosition)Z
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 282d6ae84c..5e1ab431dc 100644
|
||||
index 5637c3872..1286703bf 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
return this.getType(blockposition).isAir();
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
return i < 0 || i >= 256;
|
||||
}
|
||||
|
||||
+ public boolean isLoaded(BlockPosition blockposition) {
|
||||
|
|
|
@ -5,12 +5,12 @@ Subject: [PATCH] Option to remove corrupt tile entities
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 6e28410c37..7e847af00b 100644
|
||||
index 92ab55182..eed454bf4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void maxAutoSaveChunksPerTick() {
|
||||
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
|
||||
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
|
||||
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
|
||||
}
|
||||
+
|
||||
+ public boolean removeCorruptTEs = false;
|
||||
|
@ -19,11 +19,11 @@ index 6e28410c37..7e847af00b 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 0bf614ce57..a6cacd7da9 100644
|
||||
index a413dc73b..54bb7f551 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
"Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
|
||||
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
|
||||
e.printStackTrace();
|
||||
ServerInternalException.reportInternalException(e);
|
||||
+
|
||||
|
@ -35,12 +35,4 @@ index 0bf614ce57..a6cacd7da9 100644
|
|||
// Paper end
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
this.h.put(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), nbttagcompound);
|
||||
}
|
||||
|
||||
+ public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER
|
||||
public void d(BlockPosition blockposition) {
|
||||
if (this.i) {
|
||||
TileEntity tileentity = (TileEntity) this.tileEntities.remove(blockposition);
|
||||
--
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optional TNT doesn't move in water
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 720b87a5ec..bcc2ecaa3a 100644
|
||||
index 805aa5699..92ab55182 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
|
||||
|
@ -32,26 +32,27 @@ index 720b87a5ec..bcc2ecaa3a 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 462f94ed18..113264981e 100644
|
||||
index 3dcd93e5e..b68e2fc04 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
public boolean aq() {
|
||||
public boolean au() {
|
||||
+ // Paper start
|
||||
+ return this.doWaterMovement();
|
||||
+ }
|
||||
+
|
||||
+ public boolean doWaterMovement() {
|
||||
+ // Paper end
|
||||
return this.isInWater() || this.q();
|
||||
return this.isInWater() || this.l();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
public boolean bw() {
|
||||
public boolean bD() {
|
||||
+ // Paper start
|
||||
+ return this.pushedByWater();
|
||||
+ }
|
||||
+
|
||||
|
@ -61,12 +62,12 @@ index 462f94ed18..113264981e 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 7f4b68dcc0..7a8670323c 100644
|
||||
index e0535604b..91e332c3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
public int getFuseTicks() {
|
||||
return this.c;
|
||||
public Packet<?> N() {
|
||||
return new PacketPlayOutSpawnEntity(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start - Optional prevent TNT from moving in water
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 921a56c312..e9986420c2 100644
|
||||
index e02df8987..c582c6711 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 39a804b7cb..921a56c312 100644
|
||||
index 36b5fb537..e02df8987 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
|
@ -33,7 +33,7 @@ index 39a804b7cb..921a56c312 100644
|
|||
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
|
||||
if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
|
||||
- entityhuman.receive(this, i);
|
||||
+ // Paper Start
|
||||
+ if (flyAtPlayer) {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent
|
|||
Allows you to access the Gateway being used in a teleport event
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
index a7efe5664a..d2b29ecbe0 100644
|
||||
index bfc147059..5dd670615 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 3 Nov 2016 21:52:22 -0400
|
||||
Subject: [PATCH] Prevent Auto Save if Save Queue is full
|
||||
|
||||
If the save queue already has 50 (configurable) of chunks pending,
|
||||
then avoid processing auto save (which would add more)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7e847af00b..9829b3b64b 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
|
||||
}
|
||||
|
||||
+ public int queueSizeAutoSaveThreshold = 50;
|
||||
+ private void queueSizeAutoSaveThreshold() {
|
||||
+ queueSizeAutoSaveThreshold = getInt("save-queue-limit-for-auto-save", 50);
|
||||
+ }
|
||||
+
|
||||
public boolean removeCorruptTEs = false;
|
||||
private void removeCorruptTEs() {
|
||||
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index fbc69b5ba5..9b5908a5b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
synchronized (this.chunkLoader) {
|
||||
ObjectIterator objectiterator = this.chunks.values().iterator();
|
||||
|
||||
+ // Paper start
|
||||
+ final ChunkRegionLoader chunkLoader = (ChunkRegionLoader) world.getChunkProvider().chunkLoader;
|
||||
+ final int queueSize = chunkLoader.getQueueSize();
|
||||
+ if (!flag && queueSize > world.paperConfig.queueSizeAutoSaveThreshold){
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
while (objectiterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) objectiterator.next();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index a144118f66..adfb5d056f 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
}
|
||||
|
||||
+ public int getQueueSize() { return queue.size(); } // Paper
|
||||
+
|
||||
// CraftBukkit start - Add async variant, provide compatibility
|
||||
@Nullable
|
||||
public Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
|
||||
--
|
|
@ -6,28 +6,19 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
|
|||
This prevents Entities from trying to run outside of the World Border
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 716d00afb1..c55aadb536 100644
|
||||
index 2a391be28..0586597e7 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
|
||||
@Nullable
|
||||
public PathEntity b(BlockPosition blockposition) {
|
||||
protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
|
||||
// Paper end
|
||||
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
|
||||
if (!this.b()) {
|
||||
if (!this.a()) {
|
||||
return null;
|
||||
} else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
return null;
|
||||
} else {
|
||||
BlockPosition blockposition = new BlockPosition(entity);
|
||||
-
|
||||
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
|
||||
if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
|
||||
return this.c;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
index beac8ac0b9..86ada40a10 100644
|
||||
index 94d1c2be1..51739e254 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
@@ -0,0 +0,0 @@ public class WorldBorder {
|
||||
|
@ -35,8 +26,8 @@ index beac8ac0b9..86ada40a10 100644
|
|||
public WorldBorder() {}
|
||||
|
||||
- public boolean a(BlockPosition blockposition) {
|
||||
+ public boolean isInBounds(BlockPosition blockposition) { return a(blockposition); }public boolean a(BlockPosition blockposition) { // Paper - OBFHELPER
|
||||
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
|
||||
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } public boolean a(BlockPosition blockposition) { // Paper - OBFHELPER
|
||||
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
|
||||
}
|
||||
|
||||
--
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug
|
|||
Credit to prplz for figuring out the real issue
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 6b9bbc77c0..e4e1d999e9 100644
|
||||
index ecdfd306b..27ade8d7d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
@ -19,10 +19,10 @@ index 6b9bbc77c0..e4e1d999e9 100644
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 4a06527b6f..1c4842a263 100644
|
||||
index 982b15dec..6874563e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
|
||||
public final boolean isDisconnected() {
|
||||
|
@ -30,5 +30,5 @@ index 4a06527b6f..1c4842a263 100644
|
|||
+ return (!this.player.joining && !this.networkManager.isConnected()) || this.processedDisconnect; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
--
|
|
@ -30,45 +30,50 @@ will have plugins and worlds saving to the disk has a high potential to result
|
|||
in corruption/dataloss.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6283c774d6..db511c1fe8 100644
|
||||
index c41adf441..2d5e340ee 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
public final Map<DimensionManager, WorldServer> worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
private PlayerList playerList;
|
||||
private boolean isRunning = true;
|
||||
+ private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
|
||||
private volatile boolean isRunning = true;
|
||||
+ private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
|
||||
private boolean isStopped;
|
||||
private int ticks;
|
||||
protected final Proxy c;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
protected final Proxy proxy;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
if (this.playerList != null) {
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.savePlayers();
|
||||
- this.playerList.u();
|
||||
+ this.playerList.u(isRestarting); // Paper
|
||||
- this.playerList.shutdown();
|
||||
+ this.playerList.shutdown(this.isRestarting); // Paper
|
||||
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
return this.isRunning;
|
||||
}
|
||||
|
||||
+ // Paper start - allow passing of the intent to restart
|
||||
public void safeShutdown() {
|
||||
+ safeShutdown(false);
|
||||
public void safeShutdown(boolean flag) {
|
||||
+ this.safeShutdown(flag, false);
|
||||
+ }
|
||||
+
|
||||
+ public void safeShutdown(boolean isRestarting) {
|
||||
+ public void safeShutdown(boolean flag, boolean isRestarting) {
|
||||
this.isRunning = false;
|
||||
+ this.isRestarting = isRestarting;
|
||||
if (flag) {
|
||||
try {
|
||||
this.serverThread.join();
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
private boolean canSleepForTick() {
|
||||
return System.nanoTime() - lastTick + catchupTime < TICK_TIME; // Paper - improved "are we lagging" check to match our own
|
||||
// Spigot Start
|
||||
private static double calcTps(double avg, double exp, double tps)
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 9570a8800b..9d44dcb3b2 100644
|
||||
index a1659e6a2..46a3f0751 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
@ -76,11 +81,11 @@ index 9570a8800b..9d44dcb3b2 100644
|
|||
}
|
||||
|
||||
+ // Paper start - Extract method to allow for restarting flag
|
||||
public void u() {
|
||||
+ u(false);
|
||||
public void shutdown() {
|
||||
+ this.shutdown(false);
|
||||
+ }
|
||||
+
|
||||
+ public void u(boolean isRestarting) {
|
||||
+ public void shutdown(boolean isRestarting) {
|
||||
// CraftBukkit start - disconnect safely
|
||||
for (EntityPlayer player : this.players) {
|
||||
- player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
|
@ -97,7 +102,7 @@ index 9570a8800b..9d44dcb3b2 100644
|
|||
// CraftBukkit start
|
||||
public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
|
||||
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
index 944151d140..061cbe7fcf 100644
|
||||
index ccea803f5..aefea3a9a 100644
|
||||
--- a/src/main/java/org/spigotmc/RestartCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
@@ -0,0 +0,0 @@ public class RestartCommand extends Command
|
||||
|
@ -107,45 +112,27 @@ index 944151d140..061cbe7fcf 100644
|
|||
- String[] split = restartScript.split( " " );
|
||||
- if ( split.length > 0 && new File( split[0] ).isFile() )
|
||||
+ // Paper - extract method and cleanup
|
||||
+ boolean isRestarting = addShutdownHook(restartScript);
|
||||
+ if (isRestarting) {
|
||||
+ System.out.println("Attempting to restart with " + SpigotConfig.restartScript);
|
||||
+ } else {
|
||||
+ boolean isRestarting = addShutdownHook( restartScript );
|
||||
+ if ( isRestarting )
|
||||
{
|
||||
- System.out.println( "Attempting to restart with " + restartScript );
|
||||
+ System.out.println( "Attempting to restart with " + SpigotConfig.restartScript );
|
||||
+ } else
|
||||
+ {
|
||||
+ System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
|
||||
+ }
|
||||
+
|
||||
+ // Stop the watchdog
|
||||
+ WatchdogThread.doStop();
|
||||
+
|
||||
+ shutdownServer(isRestarting);
|
||||
|
||||
- // Disable Watchdog
|
||||
- WatchdogThread.doStop();
|
||||
+ shutdownServer( isRestarting );
|
||||
+ // Paper end
|
||||
+ } catch ( Exception ex )
|
||||
+ {
|
||||
+ ex.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - sync copied from above with minor changes, async added
|
||||
+ private static void shutdownServer(boolean isRestarting)
|
||||
+ {
|
||||
+ if (MinecraftServer.getServer().isMainThread())
|
||||
+ {
|
||||
+ // Kick all players
|
||||
+ for ( EntityPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
|
||||
{
|
||||
- System.out.println( "Attempting to restart with " + restartScript );
|
||||
+ p.playerConnection.disconnect(SpigotConfig.restartMessage);
|
||||
+ }
|
||||
+ // Give the socket a chance to send the packets
|
||||
+ try
|
||||
+ {
|
||||
+ Thread.sleep( 100 );
|
||||
+ } catch ( InterruptedException ex )
|
||||
+ {
|
||||
+ }
|
||||
|
||||
- // Disable Watchdog
|
||||
- WatchdogThread.doStop();
|
||||
+ closeSocket();
|
||||
|
||||
- // Kick all players
|
||||
- for ( EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players )
|
||||
|
@ -161,11 +148,21 @@ index 944151d140..061cbe7fcf 100644
|
|||
- }
|
||||
- // Close the socket so we can rebind with the new process
|
||||
- MinecraftServer.getServer().getServerConnection().b();
|
||||
+ // Actually shutdown
|
||||
+ // Paper start - sync copied from above with minor changes, async added
|
||||
+ private static void shutdownServer(boolean isRestarting)
|
||||
+ {
|
||||
+ if ( MinecraftServer.getServer().isMainThread() )
|
||||
+ {
|
||||
+ // Kick all players
|
||||
+ for ( EntityPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
|
||||
+ {
|
||||
+ p.playerConnection.disconnect(SpigotConfig.restartMessage);
|
||||
+ }
|
||||
+ // Give the socket a chance to send the packets
|
||||
+ try
|
||||
+ {
|
||||
+ MinecraftServer.getServer().stop();
|
||||
+ } catch ( Throwable t )
|
||||
+ Thread.sleep( 100 );
|
||||
+ } catch ( InterruptedException ex )
|
||||
+ {
|
||||
+ }
|
||||
|
||||
|
@ -176,29 +173,88 @@ index 944151d140..061cbe7fcf 100644
|
|||
- } catch ( InterruptedException ex )
|
||||
- {
|
||||
- }
|
||||
+ // Actually stop the JVM
|
||||
+ System.exit(0);
|
||||
+ closeSocket();
|
||||
|
||||
- // Actually shutdown
|
||||
- try
|
||||
- {
|
||||
- MinecraftServer.getServer().stop();
|
||||
- MinecraftServer.getServer().close();
|
||||
- } catch ( Throwable t )
|
||||
- {
|
||||
- }
|
||||
+ } else
|
||||
+ {
|
||||
+ // Mark the server to shutdown at the end of the tick
|
||||
+ MinecraftServer.getServer().safeShutdown(isRestarting);
|
||||
+ // Actually shutdown
|
||||
+ try
|
||||
+ {
|
||||
+ MinecraftServer.getServer().close(); // calls stop()
|
||||
+ } catch ( Throwable t )
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ // Actually stop the JVM
|
||||
+ System.exit( 0 );
|
||||
|
||||
- // This will be done AFTER the server has completely halted
|
||||
- Thread shutdownHook = new Thread()
|
||||
- {
|
||||
+ } else
|
||||
+ {
|
||||
+ // Mark the server to shutdown at the end of the tick
|
||||
+ MinecraftServer.getServer().safeShutdown( false, isRestarting );
|
||||
+
|
||||
+ // wait 10 seconds to see if we're actually going to try shutdown
|
||||
+ try
|
||||
+ {
|
||||
+ Thread.sleep( 10000 );
|
||||
+ }
|
||||
+ catch (InterruptedException ignored)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ // Check if we've actually hit a state where the server is going to safely shutdown
|
||||
+ // if we have, let the server stop as usual
|
||||
+ if (MinecraftServer.getServer().isStopped()) return;
|
||||
+
|
||||
+ // If the server hasn't stopped by now, assume worse case and kill
|
||||
+ closeSocket();
|
||||
+ System.exit( 0 );
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ // Paper - Split from moved code
|
||||
+ private static void closeSocket()
|
||||
+ {
|
||||
+ // Close the socket so we can rebind with the new process
|
||||
+ MinecraftServer.getServer().getServerConnection().b();
|
||||
+
|
||||
+ // Give time for it to kick in
|
||||
+ try
|
||||
+ {
|
||||
+ Thread.sleep( 100 );
|
||||
+ } catch ( InterruptedException ex )
|
||||
+ {
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ // Paper start - copied from above and modified to return if the hook registered
|
||||
+ private static boolean addShutdownHook(String restartScript)
|
||||
+ {
|
||||
+ String[] split = restartScript.split( " " );
|
||||
+ if ( split.length > 0 && new File( split[0] ).isFile() )
|
||||
+ {
|
||||
+ Thread shutdownHook = new Thread()
|
||||
+ {
|
||||
+ @Override
|
||||
+ public void run()
|
||||
{
|
||||
- @Override
|
||||
- public void run()
|
||||
- {
|
||||
+ try
|
||||
{
|
||||
- try
|
||||
- {
|
||||
+ String os = System.getProperty( "os.name" ).toLowerCase(java.util.Locale.ENGLISH);
|
||||
+ if ( os.contains( "win" ) )
|
||||
{
|
||||
- String os = System.getProperty( "os.name" ).toLowerCase(java.util.Locale.ENGLISH);
|
||||
- if ( os.contains( "win" ) )
|
||||
- {
|
||||
|
@ -208,89 +264,46 @@ index 944151d140..061cbe7fcf 100644
|
|||
- Runtime.getRuntime().exec( "sh " + restartScript );
|
||||
- }
|
||||
- } catch ( Exception e )
|
||||
- {
|
||||
+ Runtime.getRuntime().exec( "cmd /c start " + restartScript );
|
||||
+ } else
|
||||
{
|
||||
- e.printStackTrace();
|
||||
- }
|
||||
- }
|
||||
+ Runtime.getRuntime().exec( "sh " + restartScript );
|
||||
}
|
||||
+ } catch ( Exception e )
|
||||
+ {
|
||||
+ e.printStackTrace();
|
||||
}
|
||||
- };
|
||||
|
||||
-
|
||||
- shutdownHook.setDaemon( true );
|
||||
- Runtime.getRuntime().addShutdownHook( shutdownHook );
|
||||
- } else
|
||||
- {
|
||||
- System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
|
||||
|
||||
-
|
||||
- // Actually shutdown
|
||||
- try
|
||||
- {
|
||||
- MinecraftServer.getServer().stop();
|
||||
- MinecraftServer.getServer().close();
|
||||
- } catch ( Throwable t )
|
||||
- {
|
||||
- }
|
||||
+ // wait 10 seconds to see if we're actually going to try shutdown
|
||||
+ try
|
||||
+ {
|
||||
+ Thread.sleep(10000);
|
||||
+ }
|
||||
+ catch (InterruptedException ignored)
|
||||
+ {
|
||||
}
|
||||
+
|
||||
+ // Check if we've actually hit a state where the server is going to safely shutdown
|
||||
+ // if we have, let the server stop as usual
|
||||
+ if (MinecraftServer.getServer().isStopped()) return;
|
||||
+
|
||||
+ // If the server hasn't stopped by now, assume worse case and kill
|
||||
+ closeSocket();
|
||||
System.exit( 0 );
|
||||
}
|
||||
- }
|
||||
- System.exit( 0 );
|
||||
- } catch ( Exception ex )
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Paper - Split from moved code
|
||||
+ private static void closeSocket() {
|
||||
+ // Close the socket so we can rebind with the new process
|
||||
+ MinecraftServer.getServer().getServerConnection().b();
|
||||
+
|
||||
+ // Give time for it to kick in
|
||||
+ try
|
||||
{
|
||||
- ex.printStackTrace();
|
||||
+ Thread.sleep( 100 );
|
||||
+ } catch ( InterruptedException ex )
|
||||
+ {
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ // Paper - copied from above and modified to return if the hook registered
|
||||
+ private static boolean addShutdownHook(final String restartScript) {
|
||||
+
|
||||
+ String[] split = restartScript.split( " " );
|
||||
+ if ( split.length > 0 && new File( split[0] ).isFile() )
|
||||
+ {
|
||||
+ Thread shutdownHook = new Thread() {
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ try {
|
||||
+ String os = System.getProperty("os.name").toLowerCase(java.util.Locale.ENGLISH);
|
||||
+ if (os.contains("win")) {
|
||||
+ Runtime.getRuntime().exec("cmd /c start " + restartScript);
|
||||
+ } else {
|
||||
+ Runtime.getRuntime().exec( "sh " + restartScript );
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ shutdownHook.setDaemon(true);
|
||||
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||
+ shutdownHook.setDaemon( true );
|
||||
+ Runtime.getRuntime().addShutdownHook( shutdownHook );
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ } else
|
||||
{
|
||||
- ex.printStackTrace();
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
||||
--
|
|
@ -7,12 +7,12 @@ Provides counts without the ineffeciency of using .getEntities().size()
|
|||
which creates copy of the collections.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index f7883e7085..010c5fc731 100644
|
||||
index 90b87bb01..3c7f62fc5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
private int chunkLoadCount = 0;
|
||||
private int chunkGCTickCount;
|
||||
private int waterAnimalSpawn = -1;
|
||||
private int ambientSpawn = -1;
|
||||
|
||||
+ // Paper start - Provide fast information methods
|
||||
+ public int getEntityCount() {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Re-track players that dismount from other players
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 7ed9903a8c..621e79bc53 100644
|
||||
index 6b6c14567..c1ba294ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
|
|
@ -9,7 +9,7 @@ One report of a suspected memory leak with the system.
|
|||
This adds additional overhead to asynchronous task dispatching
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 0e9d5fe3a7..3ef79e3e94 100644
|
||||
index 86a5ee8aa..36eecb670 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
|
||||
index 8392b16b3b..752b56435d 100644
|
||||
index 75aae03b6..fea7ca9db 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
|
||||
@@ -0,0 +0,0 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 2 Jan 2017 16:32:56 -0500
|
||||
Subject: [PATCH] ShulkerBox Dupe Prevention
|
||||
|
||||
This ensures that Shulker Boxes can never drop their contents twice, and
|
||||
that the inventory is cleared incase it some how also got saved to the world.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockShulkerBox.java b/src/main/java/net/minecraft/server/BlockShulkerBox.java
|
||||
index ab0ece557c..997ed795b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockShulkerBox.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockShulkerBox.java
|
||||
@@ -0,0 +0,0 @@ public class BlockShulkerBox extends BlockTileEntity {
|
||||
}
|
||||
|
||||
a(world, blockposition, itemstack);
|
||||
+ tileentityshulkerbox.clear(); // Paper - This was intended to be called in Vanilla (is checked in the if statement above if has been called) - Fixes dupe issues
|
||||
}
|
||||
}
|
||||
world.updateAdjacentComparators(blockposition, iblockdata.getBlock());
|
||||
--
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] String based Action Bar API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index c97e116aaf..e1af5c4885 100644
|
||||
index c97e116aa..e1af5c488 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
@ -42,7 +42,7 @@ index c97e116aaf..e1af5c4885 100644
|
|||
public static boolean isMainThread() {
|
||||
return MinecraftServer.getServer().isMainThread();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 59bfcce68d..c5f2284553 100644
|
||||
index 4e12b6406..0b0053207 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
|
|
@ -19,7 +19,7 @@ Other changes:
|
|||
configuration
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 51cefc0a1b..2b73ec28a1 100644
|
||||
index 099d7218c..108c8c05e 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -75,7 +75,7 @@ index 51cefc0a1b..2b73ec28a1 100644
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
new file mode 100644
|
||||
index 0000000000..688b4715eb
|
||||
index 000000000..688b4715e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -121,7 +121,7 @@ index 0000000000..688b4715eb
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
||||
new file mode 100644
|
||||
index 0000000000..685deaa0e5
|
||||
index 000000000..685deaa0e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -143,7 +143,7 @@ index 0000000000..685deaa0e5
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 4e9ef43b45..5bb1ea880a 100644
|
||||
index 19e2df309..3d0cb874d 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
|
@ -178,14 +178,14 @@ index 4e9ef43b45..5bb1ea880a 100644
|
|||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
|
||||
new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
|
||||
new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start();
|
||||
+ */
|
||||
+ // Paper end
|
||||
|
||||
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index db511c1fe8..c6ecdf6e8e 100644
|
||||
index 2d5e340ee..dc6d7b3a2 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.commons.lang3.Validate;
|
||||
|
@ -193,20 +193,21 @@ index db511c1fe8..c6ecdf6e8e 100644
|
|||
import org.apache.logging.log4j.Logger;
|
||||
// CraftBukkit start
|
||||
-import jline.console.ConsoleReader;
|
||||
import joptsimple.OptionSet;
|
||||
+import joptsimple.OptionSet;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
import org.bukkit.craftbukkit.Main;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
public OptionSet options;
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
||||
- public ConsoleReader reader;
|
||||
+ //public ConsoleReader reader; // Paper
|
||||
public static int currentTick = 0; // Paper - Further improve tick loop
|
||||
public boolean serverAutoSave = false; // Paper
|
||||
public final Thread primaryThread;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
this.ac.a((IResourcePackListener) this.al);
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.K = s;
|
||||
// CraftBukkit start
|
||||
this.options = options;
|
||||
+ // Paper start - Handled by TerminalConsoleAppender
|
||||
|
@ -215,16 +216,16 @@ index db511c1fe8..c6ecdf6e8e 100644
|
|||
if (System.console() == null && System.getProperty("jline.terminal") == null) {
|
||||
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
|
||||
Main.useJline = false;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
LOGGER.warn((String) null, ex);
|
||||
}
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
||||
|
||||
this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
} finally {
|
||||
// CraftBukkit start - Restore terminal to original settings
|
||||
try {
|
||||
|
@ -233,23 +234,23 @@ index db511c1fe8..c6ecdf6e8e 100644
|
|||
} catch (Exception ignored) {
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
@Override
|
||||
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
|
||||
- MinecraftServer.LOGGER.info(ichatbasecomponent.getString());
|
||||
+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));// Paper - Log message with colors
|
||||
}
|
||||
|
||||
public KeyPair E() {
|
||||
public KeyPair getKeyPair() {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 9d44dcb3b2..8bb3fef21e 100644
|
||||
index 46a3f0751..52b2f4874 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
public PlayerList(MinecraftServer minecraftserver) {
|
||||
this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||
public PlayerList(MinecraftServer minecraftserver, int i) {
|
||||
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
|
||||
- minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
|
||||
- minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server));
|
||||
+ minecraftserver.console = new com.destroystokyo.paper.console.TerminalConsoleCommandSender(); // Paper
|
||||
|
@ -257,19 +258,17 @@ index 9d44dcb3b2..8bb3fef21e 100644
|
|||
|
||||
this.k = new GameProfileBanList(PlayerList.a);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 962170cd3f..7e4f42b3f4 100644
|
||||
index b2aee24e5..2bdbc939e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
@@ -0,0 +0,0 @@ import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
-import jline.console.ConsoleReader;
|
||||
import org.bukkit.Keyed;
|
||||
+import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import net.minecraft.server.Advancement;
|
||||
import net.minecraft.server.ArgumentEntity;
|
||||
import net.minecraft.server.Block;
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return logger;
|
||||
}
|
||||
|
@ -285,7 +284,7 @@ index 962170cd3f..7e4f42b3f4 100644
|
|||
@Override
|
||||
public PluginCommand getPluginCommand(String name) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 472a8070e7..4102e19700 100644
|
||||
index 5203e781e..e3d163ac4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ import java.util.logging.Logger;
|
||||
|
@ -324,10 +323,10 @@ index 472a8070e7..4102e19700 100644
|
|||
+ System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
|
||||
}
|
||||
|
||||
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
|
||||
deleted file mode 100644
|
||||
index 26a2fb8942..0000000000
|
||||
index fdf2f075e..000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
|
||||
+++ /dev/null
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -335,15 +334,13 @@ index 26a2fb8942..0000000000
|
|||
-
|
||||
-import java.util.EnumMap;
|
||||
-import java.util.Map;
|
||||
-
|
||||
-import org.fusesource.jansi.Ansi;
|
||||
-import org.fusesource.jansi.Ansi.Attribute;
|
||||
-import jline.Terminal;
|
||||
-
|
||||
-import org.bukkit.Bukkit;
|
||||
-import org.bukkit.ChatColor;
|
||||
-import org.bukkit.command.ConsoleCommandSender;
|
||||
-import org.bukkit.craftbukkit.CraftServer;
|
||||
-import org.fusesource.jansi.Ansi;
|
||||
-import org.fusesource.jansi.Ansi.Attribute;
|
||||
-
|
||||
-public class ColouredConsoleSender extends CraftConsoleCommandSender {
|
||||
- private final Terminal terminal;
|
||||
|
@ -406,14 +403,17 @@ index 26a2fb8942..0000000000
|
|||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
index 33e8ea02c4..1e3aae3b8f 100644
|
||||
index 48d4dc7e2..24f4a16a6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
@@ -0,0 +0,0 @@ import java.util.logging.Level;
|
||||
@@ -0,0 +0,0 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
-import jline.console.completer.Completer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
|
||||
-import jline.console.completer.Completer;
|
||||
+
|
||||
+// Paper start - JLine update
|
||||
+import net.minecraft.server.DedicatedServer; // Paper
|
||||
+import org.jline.reader.Candidate;
|
||||
|
@ -452,9 +452,8 @@ index 33e8ea02c4..1e3aae3b8f 100644
|
|||
if (offers == null) {
|
||||
- return cursor;
|
||||
+ return; // Paper - Method returns void
|
||||
}
|
||||
- candidates.addAll(offers);
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - JLine update
|
||||
+ for (String completion : offers) {
|
||||
+ if (completion.isEmpty()) {
|
||||
|
@ -462,9 +461,10 @@ index 33e8ea02c4..1e3aae3b8f 100644
|
|||
+ }
|
||||
+
|
||||
+ candidates.add(new Candidate(completion));
|
||||
+ }
|
||||
}
|
||||
- candidates.addAll(offers);
|
||||
+ // Paper end
|
||||
+
|
||||
|
||||
+ // Paper start - JLine handles cursor now
|
||||
+ /*
|
||||
final int lastSpace = buffer.lastIndexOf(' ');
|
||||
|
@ -485,11 +485,11 @@ index 33e8ea02c4..1e3aae3b8f 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
index 984df4083d..bbb5a84f36 100644
|
||||
index 70f8d4299..449e99d1b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
@@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread {
|
||||
ex.printStackTrace();
|
||||
server.close();
|
||||
} finally {
|
||||
try {
|
||||
- server.reader.getTerminal().restore();
|
||||
|
@ -499,29 +499,31 @@ index 984df4083d..bbb5a84f36 100644
|
|||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
|
||||
deleted file mode 100644
|
||||
index b640971130..0000000000
|
||||
index f239cd623..000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
|
||||
+++ /dev/null
|
||||
@@ -0,0 +0,0 @@
|
||||
-package org.bukkit.craftbukkit.util;
|
||||
-
|
||||
-import com.mojang.util.QueueLogAppender;
|
||||
-import java.io.IOException;
|
||||
-import java.io.OutputStream;
|
||||
-import java.util.logging.Level;
|
||||
-import java.util.logging.Logger;
|
||||
-import jline.console.ConsoleReader;
|
||||
-import com.mojang.util.QueueLogAppender;
|
||||
-import org.bukkit.craftbukkit.Main;
|
||||
-import org.fusesource.jansi.Ansi;
|
||||
-import org.fusesource.jansi.Ansi.Erase;
|
||||
-
|
||||
-public class TerminalConsoleWriterThread implements Runnable {
|
||||
- final private ConsoleReader reader;
|
||||
- final private OutputStream output;
|
||||
-public class TerminalConsoleWriterThread extends Thread {
|
||||
- private final ConsoleReader reader;
|
||||
- private final OutputStream output;
|
||||
-
|
||||
- public TerminalConsoleWriterThread(OutputStream output, ConsoleReader reader) {
|
||||
- this.output = output;
|
||||
- this.reader = reader;
|
||||
-
|
||||
- this.setDaemon(true);
|
||||
- }
|
||||
-
|
||||
- public void run() {
|
||||
|
@ -558,7 +560,7 @@ index b640971130..0000000000
|
|||
- }
|
||||
-}
|
||||
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
||||
index 5cee8f00ef..08b6bb7f97 100644
|
||||
index 490a9acc7..08b6bb7f9 100644
|
||||
--- a/src/main/resources/log4j2.xml
|
||||
+++ b/src/main/resources/log4j2.xml
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -568,7 +570,7 @@ index 5cee8f00ef..08b6bb7f97 100644
|
|||
<Appenders>
|
||||
- <Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
|
||||
- <Queue name="TerminalConsole">
|
||||
- <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
|
||||
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||
- </Queue>
|
||||
+ <TerminalConsole name="TerminalConsole">
|
||||
+ <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %minecraftFormatting{%msg}%n%xEx}" />
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 8ff454e259..3baf0380c0 100644
|
||||
index a34121495..abc967d3f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -21,7 +21,7 @@ index 8ff454e259..3baf0380c0 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
index 81e602d1b9..b6af429044 100644
|
||||
index 13ddc00d6..9f03d0337 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
|
||||
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
|
||||
|
|
Loading…
Add table
Reference in a new issue