mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 21:15:57 +01:00
Sponge now removes water and obeys new 'sponge-radius' configuration variable.
This commit is contained in:
parent
8983d7bc84
commit
6d0d2ee538
@ -1,4 +1,9 @@
|
|||||||
1.2
|
1.2
|
||||||
|
- Sponge updated to remove water when the sponge block is set. Sponge radius
|
||||||
|
can now be controlled using the 'sponge-radius' parameter and the
|
||||||
|
default is now set to simulate Classic.
|
||||||
|
- Updated for a newer build of "b126," meaning that lava spread control
|
||||||
|
now works well!
|
||||||
- A new summary of the status of some core protections is now printed
|
- A new summary of the status of some core protections is now printed
|
||||||
on start. Disable this with 'summary-on-start'.
|
on start. Disable this with 'summary-on-start'.
|
||||||
- Blacklist system has been overhauled. Check README.txt for changed
|
- Blacklist system has been overhauled. Check README.txt for changed
|
||||||
|
11
README.txt
11
README.txt
@ -43,10 +43,13 @@ WorldGuard on your server. You can either restart your server or use
|
|||||||
spread (preventing waterfalls from becoming tsunamis).
|
spread (preventing waterfalls from becoming tsunamis).
|
||||||
|
|
||||||
- simulate-sponge (def. false)
|
- simulate-sponge (def. false)
|
||||||
Toggle simulation of the sponge. The sponge only prevents water
|
Toggle simulation of the sponge from Classic. It blocks water from
|
||||||
from spreading. It will not take away existing water. Simulation of
|
flowing near the sponge.
|
||||||
the sponge requires iterating over a 9x9x9 cuboid around the water
|
|
||||||
block and the resource impact of this has not been quantified.
|
- sponge-radius (def. 3)
|
||||||
|
The radius of the sponge's effect. The default is that of Classic,
|
||||||
|
creating a 5x5x5 cuboid free of water. Increasing the number will
|
||||||
|
increase server load exponentially, although 3-5 has fairly low impact.
|
||||||
|
|
||||||
- enforce-single-session (def. true)
|
- enforce-single-session (def. true)
|
||||||
Enforce single sessions. If the player is already found to be on
|
Enforce single sessions. If the player is already found to be on
|
||||||
|
@ -70,6 +70,7 @@ public class WorldGuardListener extends PluginListener {
|
|||||||
private boolean preventLavaFire;
|
private boolean preventLavaFire;
|
||||||
private boolean disableAllFire;
|
private boolean disableAllFire;
|
||||||
private boolean simulateSponge;
|
private boolean simulateSponge;
|
||||||
|
private int spongeRadius;
|
||||||
private boolean blockLagFix;
|
private boolean blockLagFix;
|
||||||
private Set<Integer> fireNoSpreadBlocks;
|
private Set<Integer> fireNoSpreadBlocks;
|
||||||
private Set<Integer> allowedLavaSpreadOver;
|
private Set<Integer> allowedLavaSpreadOver;
|
||||||
@ -135,6 +136,7 @@ public void loadConfiguration() {
|
|||||||
allowedLavaSpreadOver = toBlockIDSet(properties.getString("allowed-lava-spread-blocks", ""));
|
allowedLavaSpreadOver = toBlockIDSet(properties.getString("allowed-lava-spread-blocks", ""));
|
||||||
classicWater = properties.getBoolean("classic-water", false);
|
classicWater = properties.getBoolean("classic-water", false);
|
||||||
simulateSponge = properties.getBoolean("simulate-sponge", false);
|
simulateSponge = properties.getBoolean("simulate-sponge", false);
|
||||||
|
spongeRadius = Math.max(1, properties.getInt("sponge-radius", 3)) - 1;
|
||||||
blockLagFix = properties.getBoolean("block-lag-fix", false);
|
blockLagFix = properties.getBoolean("block-lag-fix", false);
|
||||||
|
|
||||||
// Console log configuration
|
// Console log configuration
|
||||||
@ -303,6 +305,25 @@ public void run() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (simulateSponge && blockPlaced.getType() == 19) {
|
||||||
|
int ox = blockPlaced.getX();
|
||||||
|
int oy = blockPlaced.getY();
|
||||||
|
int oz = blockPlaced.getZ();
|
||||||
|
|
||||||
|
Server server = etc.getServer();
|
||||||
|
|
||||||
|
for (int cx = -spongeRadius; cx <= spongeRadius; cx++) {
|
||||||
|
for (int cy = -spongeRadius; cy <= spongeRadius; cy++) {
|
||||||
|
for (int cz = -spongeRadius; cz <= spongeRadius; cz++) {
|
||||||
|
int id = server.getBlockIdAt(ox + cx, oy + cy, oz + cz);
|
||||||
|
if (id == 8 || id == 9) {
|
||||||
|
server.setBlockAt(0, ox + cx, oy + cy, oz + cz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -582,15 +603,15 @@ public boolean onFlow(Block blockFrom, Block blockTo) {
|
|||||||
boolean isLava = blockFrom.getType() == 10 || blockFrom.getType() == 11;
|
boolean isLava = blockFrom.getType() == 10 || blockFrom.getType() == 11;
|
||||||
|
|
||||||
if (simulateSponge && isWater) {
|
if (simulateSponge && isWater) {
|
||||||
int ox = blockFrom.getX();
|
int ox = blockTo.getX();
|
||||||
int oy = blockFrom.getY() + 1;
|
int oy = blockTo.getY();
|
||||||
int oz = blockFrom.getZ();
|
int oz = blockTo.getZ();
|
||||||
|
|
||||||
Server server = etc.getServer();
|
Server server = etc.getServer();
|
||||||
|
|
||||||
for (int cx = -4; cx <= 4; cx++) {
|
for (int cx = -spongeRadius; cx <= spongeRadius; cx++) {
|
||||||
for (int cy = -4; cy <= 4; cy++) {
|
for (int cy = -spongeRadius; cy <= spongeRadius; cy++) {
|
||||||
for (int cz = -4; cz <= 4; cz++) {
|
for (int cz = -spongeRadius; cz <= spongeRadius; cz++) {
|
||||||
if (server.getBlockIdAt(ox + cx, oy + cy, oz + cz) == 19) {
|
if (server.getBlockIdAt(ox + cx, oy + cy, oz + cz) == 19) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user