From f342db744ad9367417c6fc85439d8c22410f15a5 Mon Sep 17 00:00:00 2001 From: Rigby Date: Fri, 29 Apr 2011 23:34:37 +0100 Subject: [PATCH] Added per world PVP setting support. --- src/main/java/net/minecraft/server/EntityPlayer.java | 2 +- src/main/java/net/minecraft/server/World.java | 1 + src/main/java/net/minecraft/server/WorldServer.java | 1 + src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index eb8d9d32d4..e04fa6e1a6 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -132,7 +132,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (this.bG > 0) { return false; } else { - if (!this.b.pvpMode) { + if (!this.world.pvpMode) { // CraftBukkit this.b.pvpMode -> this.world.pvpMode if (entity instanceof EntityHuman) { return false; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index ed7a56365b..7a2c67fad3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -57,6 +57,7 @@ public class World implements IBlockAccess { private int J = 0; public boolean allowMonsters = true; // CraftBukkit private->public public boolean allowAnimals = true; // CraftBukkit private->public + public boolean pvpMode; // CraftBukkit static int u = 0; private Set M = new HashSet(); private int N; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index e0c73c2804..852c89d7b3 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -26,6 +26,7 @@ public class WorldServer extends World implements BlockChangeDelegate { this.cserver = minecraftserver.server; this.world = new CraftWorld(this); this.manager = new PlayerManager(minecraftserver, this); + this.pvpMode = minecraftserver.pvpMode; } public PlayerManager manager; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 4c5fa33f9f..40f395966e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -612,4 +612,12 @@ public class CraftWorld implements World { public long getSeed() { return world.worldData.b(); } + + public boolean getPVP() { + return world.pvpMode; + } + + public void setPVP(boolean pvp) { + world.pvpMode = pvp; + } }