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
1da852265a
Commit
96794e15db
@ -98,9 +98,7 @@ public class ItemBlock extends Item {
|
|||||||
|
|
||||||
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ));
|
int distanceFromSpawn = (int) Math.max(Math.abs(i - world.spawnX), Math.abs(k - world.spawnZ));
|
||||||
|
|
||||||
// CraftBukkit hardcoded Spawn distance for now
|
boolean canBuild = distanceFromSpawn > ((WorldServer) world).D.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start
|
||||||
// TODO make spawn size configurable
|
|
||||||
boolean canBuild = distanceFromSpawn > ((WorldServer) world).D.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,7 +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 int spawnProtection; // CraftBukkit Configurable spawn protection start
|
||||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||||
|
|
||||||
// Craftbukkit start - adds argument OptionSet
|
// Craftbukkit start - adds argument OptionSet
|
||||||
@ -74,7 +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);
|
this.spawnProtection = this.d.a("spawn-protection", 16); // CraftBukkit Configurable spawn protection start
|
||||||
InetAddress inetaddress = null;
|
InetAddress inetaddress = null;
|
||||||
|
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
|
@ -325,8 +325,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (packet14blockdig.e == 0) {
|
if (packet14blockdig.e == 0) {
|
||||||
|
// CraftBukkit start
|
||||||
if (j1 > this.d.spawnProtection || flag) {
|
if (j1 > this.d.spawnProtection || flag) {
|
||||||
// CraftBukkit start
|
|
||||||
if(blockId > 0) {
|
if(blockId > 0) {
|
||||||
BlockDamageEvent event;
|
BlockDamageEvent event;
|
||||||
// If the amount of damage that the player is going to do to the block
|
// If the amount of damage that the player is going to do to the block
|
||||||
@ -341,8 +341,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.e.c.a(i, j, k);
|
this.e.c.a(i, j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 2) {
|
} else if (packet14blockdig.e == 2) {
|
||||||
// CraftBukkit start - Get last block that the player hit
|
// CraftBukkit start - Get last block that the player hit
|
||||||
// Otherwise the block is a Bedrock @(0,0,0)
|
// Otherwise the block is a Bedrock @(0,0,0)
|
||||||
@ -354,8 +354,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 1) {
|
} else if (packet14blockdig.e == 1) {
|
||||||
|
// CraftBukkit start
|
||||||
if (j1 > this.d.spawnProtection || flag) {
|
if (j1 > this.d.spawnProtection || flag) {
|
||||||
// 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
|
||||||
// of damage is greater than 1, the block is going to break.
|
// of damage is greater than 1, the block is going to break.
|
||||||
@ -370,8 +370,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
} else {
|
} else {
|
||||||
e.c.d = 0; // Reset the amount of damage if stopping break.
|
e.c.d = 0; // Reset the amount of damage if stopping break.
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 3) {
|
} else if (packet14blockdig.e == 3) {
|
||||||
double d5 = this.e.locX - ((double) i + 0.5D);
|
double d5 = this.e.locX - ((double) i + 0.5D);
|
||||||
double d6 = this.e.locY - ((double) j + 0.5D);
|
double d6 = this.e.locY - ((double) j + 0.5D);
|
||||||
|
@ -87,7 +87,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
i1 = l;
|
i1 = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i1 > this.D.spawnProtection || this.D.f.g(entityhuman.name);
|
return i1 > this.D.spawnProtection || this.D.f.g(entityhuman.name); // CraftBukkit Configurable spawn protection start
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void b(Entity entity) {
|
protected void b(Entity entity) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren