mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add log-villager-deaths option
By: md_5 <git@md-5.net>
This commit is contained in:
parent
9ef9823b3b
commit
76c24a1454
3 changed files with 42 additions and 17 deletions
|
@ -703,6 +703,15 @@
|
|||
ServerPlayer entityplayer = (ServerPlayer) this;
|
||||
|
||||
entityplayer.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
||||
@@ -1477,7 +1742,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.hasCustomName()) {
|
||||
- LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
|
||||
+ if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
|
||||
}
|
||||
|
||||
this.dead = true;
|
||||
@@ -1512,14 +1777,22 @@
|
||||
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
|
@ -894,7 +903,7 @@
|
|||
+ };
|
||||
+ float freezingModifier = freezing.apply((double) f).floatValue();
|
||||
+ f += freezingModifier;
|
||||
+
|
||||
|
||||
+ com.google.common.base.Function<Double, Double> hardHat = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
|
@ -924,7 +933,7 @@
|
|||
+ };
|
||||
+ float armorModifier = armor.apply((double) f).floatValue();
|
||||
+ f += armorModifier;
|
||||
|
||||
+
|
||||
+ com.google.common.base.Function<Double, Double> resistance = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
|
@ -1103,19 +1112,19 @@
|
|||
this.setHealth(0.0F);
|
||||
this.die(this.damageSources().generic());
|
||||
}
|
||||
@@ -2181,6 +2672,12 @@
|
||||
public abstract Iterable<ItemStack> getArmorSlots();
|
||||
@@ -2182,6 +2673,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||
+ this.setItemSlot(enumitemslot, itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2494,7 +2991,7 @@
|
||||
|
||||
}
|
||||
|
@ -1301,7 +1310,7 @@
|
|||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
|
||||
|
@ -1312,7 +1321,7 @@
|
|||
+ entityPlayer.getBukkitEntity().updateScaledHealth();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this);
|
||||
+ } else {
|
||||
+ itemstack = this.useItem.finishUsingItem(this.level(), this);
|
||||
|
|
|
@ -24,25 +24,25 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -216,7 +224,18 @@
|
||||
return this.assignProfessionWhenSpawned;
|
||||
}
|
||||
@@ -214,7 +222,18 @@
|
||||
|
||||
public boolean assignProfessionWhenSpawned() {
|
||||
return this.assignProfessionWhenSpawned;
|
||||
+ }
|
||||
+
|
||||
+ // Spigot Start
|
||||
@Override
|
||||
+ @Override
|
||||
+ public void inactiveTick() {
|
||||
+ // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
|
||||
+ if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
|
||||
+ this.customServerAiStep((ServerLevel) this.level());
|
||||
+ }
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
}
|
||||
+ // Spigot End
|
||||
+
|
||||
+ @Override
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
@Override
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
@@ -235,7 +254,7 @@
|
||||
this.increaseProfessionLevelOnUpdate = false;
|
||||
}
|
||||
|
@ -100,6 +100,15 @@
|
|||
Logger logger = Villager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -618,7 +649,7 @@
|
||||
|
||||
@Override
|
||||
public void die(DamageSource damageSource) {
|
||||
- Villager.LOGGER.info("Villager {} died, message: '{}'", this, damageSource.getLocalizedDeathMessage(this).getString());
|
||||
+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} died, message: '{}'", this, damageSource.getLocalizedDeathMessage(this).getString()); // Spigot
|
||||
Entity entity = damageSource.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
@@ -808,7 +839,7 @@
|
||||
entitywitch1.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch1.blockPosition()), EntitySpawnReason.CONVERSION, (SpawnGroupData) null);
|
||||
entitywitch1.setPersistenceRequired();
|
||||
|
|
|
@ -389,4 +389,11 @@ public class SpigotConfig
|
|||
SpigotConfig.disableAdvancementSaving = SpigotConfig.getBoolean("advancements.disable-saving", false);
|
||||
SpigotConfig.disabledAdvancements = SpigotConfig.getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"}));
|
||||
}
|
||||
|
||||
public static boolean logVillagerDeaths;
|
||||
public static boolean logNamedDeaths;
|
||||
private static void logDeaths() {
|
||||
SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true);
|
||||
SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue