2014-07-23 05:04:05 +02:00
|
|
|
From 4a4dbdc85d1ba862ac43f5ab115bd4be3a2957ee Mon Sep 17 00:00:00 2001
|
2014-06-22 22:30:53 +02:00
|
|
|
From: Zach Brown <Zbob750@live.com>
|
2014-07-22 01:52:19 +02:00
|
|
|
Date: Mon, 21 Jul 2014 18:46:53 -0500
|
2014-06-22 22:30:53 +02:00
|
|
|
Subject: [PATCH] Invisible players don't have rights
|
|
|
|
|
2014-07-22 01:52:19 +02:00
|
|
|
Adapted from CraftBukkit PR #1319 https://github.com/Bukkit/CraftBukkit/pull/1319
|
2014-06-22 22:30:53 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
2014-07-22 01:52:19 +02:00
|
|
|
index de8dda7..dbb420b 100644
|
2014-06-22 22:30:53 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
2014-07-22 01:52:19 +02:00
|
|
|
@@ -220,6 +220,14 @@ public class EntityArrow extends Entity implements IProjectile {
|
2014-06-22 22:30:53 +02:00
|
|
|
float f2;
|
|
|
|
float f3;
|
|
|
|
|
2014-07-22 01:52:19 +02:00
|
|
|
+ // PaperSpigot start - Allow arrows to fly through players
|
|
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
|
|
|
|
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
2014-06-22 22:30:53 +02:00
|
|
|
+ movingobjectposition = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
+
|
|
|
|
if (movingobjectposition != null) {
|
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
|
|
|
|
2014-07-22 01:52:19 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
|
|
index 7f8a33b..73f52ac 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
|
|
@@ -148,6 +148,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // PaperSpigot start - Allow projectiles to fly through 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.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) {
|
|
|
|
this.ah();
|
2014-06-22 22:30:53 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2014-07-23 05:04:05 +02:00
|
|
|
index 744d942..a204966 100644
|
2014-06-22 22:30:53 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2014-07-22 01:52:19 +02:00
|
|
|
@@ -1666,6 +1666,13 @@ public abstract class World implements IBlockAccess {
|
2014-06-22 22:30:53 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
Entity entity1 = (Entity) list.get(i);
|
2014-07-22 01:52:19 +02:00
|
|
|
+ // PaperSpigot start - Allow block placement if the placer cannot see the blocker
|
|
|
|
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
|
|
|
|
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
|
2014-06-22 22:30:53 +02:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
|
|
|
|
if (!entity1.dead && entity1.k && entity1 != entity) {
|
|
|
|
return false;
|
|
|
|
--
|
|
|
|
1.9.1
|
|
|
|
|