testserver/Spigot-Server-Patches/0004-Vanished-players-don-t...

98 lines
5.5 KiB
Diff
Raw Normal View History

From 4c8e5bf4bb19ffc86e578b04deaa1ec1746a0201 Mon Sep 17 00:00:00 2001
2015-01-29 21:25:50 +00:00
From: Zach Brown <zach.brown@destroystokyo.com>
2015-03-08 01:16:09 +00:00
Date: Sat, 7 Mar 2015 19:50:01 -0600
Subject: [PATCH] Vanished players don't have rights
2014-06-22 20:30:53 +00:00
2014-06-22 20:30:53 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 3a80776..eac0363 100644
2014-06-22 20:30:53 +00:00
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
2015-03-08 01:16:09 +00:00
@@ -220,6 +220,14 @@ public class EntityArrow extends Entity implements IProjectile {
float f2;
2014-06-22 20:30:53 +00:00
float f3;
+ // 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())) {
2014-06-22 20:30:53 +00:00
+ movingobjectposition = null;
+ }
+ }
+ // PaperSpigot end
+
if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
2015-03-08 01:16:09 +00:00
if (movingobjectposition.entity != null) {
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 503e78a..00ffff0 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -187,6 +187,14 @@ public class EntityFishingHook extends Entity {
movingobjectposition = new MovingObjectPosition(entity);
}
+ // PaperSpigot start - Allow fishing hooks to fly through vanished players the shooter can't see
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) {
+ if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
+ movingobjectposition = null;
+ }
+ }
+ // PaperSpigot end
+
if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
if (movingobjectposition.entity != null) {
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 72478be..e7cca3c 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
2015-03-08 01:16:09 +00:00
@@ -147,6 +147,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) {
2015-03-08 01:16:09 +00:00
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
this.d(movingobjectposition.a());
2015-01-07 04:13:40 +00:00
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 57b3d9d..0cd4175 100644
2015-01-07 04:13:40 +00:00
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
2015-03-08 01:16:09 +00:00
@@ -25,7 +25,7 @@ public class ItemBlock extends Item {
2015-01-07 04:13:40 +00:00
return false;
2015-03-08 01:16:09 +00:00
} else if (!entityhuman.a(blockposition, enumdirection, itemstack)) {
2015-01-07 04:13:40 +00:00
return false;
- } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ } else if (world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // PaperSpigot - Pass entityhuman instead of null
int i = this.filterData(itemstack.getData());
IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
2014-06-22 20:30:53 +00:00
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bb46799..d184f8a 100644
2014-06-22 20:30:53 +00:00
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2015-05-11 00:24:52 +00:00
@@ -1673,6 +1673,13 @@ public abstract class World implements IBlockAccess {
2014-06-22 20:30:53 +00:00
for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
2014-11-28 01:17:45 +00:00
+ // 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())) {
2014-06-22 20:30:53 +00:00
+ continue;
+ }
+ }
2014-11-28 01:17:45 +00:00
+
if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) {
2014-06-22 20:30:53 +00:00
return false;
2014-11-28 01:17:45 +00:00
}
2014-06-22 20:30:53 +00:00
--
2.6.3.windows.1
2014-06-22 20:30:53 +00:00