mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 03:32:46 +01:00
4b79813cf3
Remove unused torch placement config option Remove ambiguity in invisible players patch
66 lines
3.4 KiB
Diff
66 lines
3.4 KiB
Diff
From e2925f8aaa6f2597fdea35baa1a7c2de9db2598c Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <Zbob750@live.com>
|
|
Date: Fri, 28 Nov 2014 00:35:56 -0600
|
|
Subject: [PATCH] Vanished players don't have rights
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
index 7d1727d..1d8b138 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
@@ -221,6 +221,14 @@ public class EntityArrow extends Entity implements IProjectile {
|
|
float f3;
|
|
float f4;
|
|
|
|
+ // PaperSpigot start - Allow arrows to fly through vanished players the shooter can't see
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
|
+ movingobjectposition = null;
|
|
+ }
|
|
+ }
|
|
+ // PaperSpigot end
|
|
+
|
|
if (movingobjectposition != null) {
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
index ce3e628..005e995 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
@@ -146,6 +146,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|
}
|
|
}
|
|
|
|
+ // PaperSpigot start - Allow projectiles to fly through vanished players the shooter can't see
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
|
+ movingobjectposition = null;
|
|
+ }
|
|
+ }
|
|
+ // PaperSpigot end
|
|
+
|
|
if (movingobjectposition != null) {
|
|
if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
|
|
this.aq();
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 7a41398..1b895e3 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1654,6 +1654,14 @@ public abstract class World implements IBlockAccess {
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
Entity entity1 = (Entity) list.get(i);
|
|
|
|
+ // PaperSpigot start - Allow block placement if the placer cannot see the vanished blocker
|
|
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ // PaperSpigot end
|
|
+
|
|
if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) {
|
|
return false;
|
|
}
|
|
--
|
|
1.9.1
|
|
|