Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Added spawn-protection property to server.properties
Dieser Commit ist enthalten in:
Ursprung
814c9d444f
Commit
fbe54b05f4
@ -100,7 +100,7 @@ public class ItemBlock extends Item {
|
|||||||
|
|
||||||
// CraftBukkit hardcoded Spawn distance for now
|
// CraftBukkit hardcoded Spawn distance for now
|
||||||
// TODO make spawn size configurable
|
// TODO make spawn size configurable
|
||||||
boolean canBuild = distanceFromSpawn > 16 || thePlayer.isOp();
|
boolean canBuild = distanceFromSpawn > ((WorldServer) world).minecraftServer.spawnProtection || thePlayer.isOp();
|
||||||
|
|
||||||
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
|
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
@ -41,6 +41,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
|||||||
public boolean l;
|
public boolean l;
|
||||||
public boolean m;
|
public boolean m;
|
||||||
public boolean n;
|
public boolean n;
|
||||||
|
public int spawnProtection;
|
||||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||||
|
|
||||||
// Craftbukkit start - adds argument OptionSet
|
// Craftbukkit start - adds argument OptionSet
|
||||||
@ -73,6 +74,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
|||||||
this.l = this.d.a("online-mode", true);
|
this.l = this.d.a("online-mode", true);
|
||||||
this.m = this.d.a("spawn-animals", true);
|
this.m = this.d.a("spawn-animals", true);
|
||||||
this.n = this.d.a("pvp", true);
|
this.n = this.d.a("pvp", true);
|
||||||
|
this.spawnProtection = this.d.a("spawn-protection", 16);
|
||||||
InetAddress inetaddress = null;
|
InetAddress inetaddress = null;
|
||||||
|
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
|
@ -325,7 +325,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (packet14blockdig.e == 0) {
|
if (packet14blockdig.e == 0) {
|
||||||
if (j1 > 16 || flag) {
|
if (j1 > this.d.spawnProtection || flag) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if(blockId > 0) {
|
if(blockId > 0) {
|
||||||
BlockDamageEvent event;
|
BlockDamageEvent event;
|
||||||
@ -354,7 +354,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 1) {
|
} else if (packet14blockdig.e == 1) {
|
||||||
if (j1 > 16 || flag) {
|
if (j1 > this.d.spawnProtection || flag) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
BlockDamageEvent event;
|
BlockDamageEvent event;
|
||||||
// If the amount of damage going to the block plus the current amount
|
// If the amount of damage going to the block plus the current amount
|
||||||
|
@ -16,13 +16,13 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
public ChunkProviderServer A;
|
public ChunkProviderServer A;
|
||||||
public boolean B = false;
|
public boolean B = false;
|
||||||
public boolean C;
|
public boolean C;
|
||||||
private MinecraftServer D;
|
public final MinecraftServer minecraftServer;
|
||||||
private EntityList E = new EntityList();
|
private EntityList E = new EntityList();
|
||||||
public PlayerManager manager; // Craftbukkit
|
public PlayerManager manager; // Craftbukkit
|
||||||
|
|
||||||
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) {
|
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) {
|
||||||
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i));
|
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i));
|
||||||
this.D = minecraftserver;
|
this.minecraftServer = minecraftserver;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
this.server = minecraftserver.server;
|
this.server = minecraftserver.server;
|
||||||
@ -47,7 +47,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Entity entity, boolean flag) {
|
public void a(Entity entity, boolean flag) {
|
||||||
if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
if (!this.minecraftServer.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||||
entity.q();
|
entity.q();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
i1 = l;
|
i1 = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i1 > 16 || this.D.f.g(entityhuman.name);
|
return i1 > this.minecraftServer.spawnProtection || this.minecraftServer.f.g(entityhuman.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void b(Entity entity) {
|
protected void b(Entity entity) {
|
||||||
@ -107,7 +107,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
public void a(Entity entity, byte b0) {
|
public void a(Entity entity, byte b0) {
|
||||||
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
|
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
|
||||||
|
|
||||||
this.D.k.b(entity, packet38entitystatus);
|
this.minecraftServer.k.b(entity, packet38entitystatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
||||||
@ -119,12 +119,12 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
}
|
}
|
||||||
// Craftbukkit end
|
// Craftbukkit end
|
||||||
|
|
||||||
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
this.minecraftServer.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
||||||
return explosion;
|
return explosion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void c(int i, int j, int k, int l, int i1) {
|
public void c(int i, int j, int k, int l, int i1) {
|
||||||
super.c(i, j, k, l, i1);
|
super.c(i, j, k, l, i1);
|
||||||
this.D.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
|
this.minecraftServer.f.a((double) i, (double) j, (double) k, 64.0D, new Packet54PlayNoteBlock(i, j, k, l, i1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren