mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Added a bucket block fix, but not a great one.
This commit is contained in:
parent
f8a63b372d
commit
0a8dd85224
@ -17,6 +17,8 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
@ -30,8 +32,8 @@
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import com.sk89q.worldguard.*;
|
|
||||||
import java.util.logging.FileHandler;
|
import java.util.logging.FileHandler;
|
||||||
|
import com.sk89q.worldguard.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event listener for Hey0's server mod.
|
* Event listener for Hey0's server mod.
|
||||||
@ -43,6 +45,10 @@ public class WorldGuardListener extends PluginListener {
|
|||||||
* Logger.
|
* Logger.
|
||||||
*/
|
*/
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||||
|
/**
|
||||||
|
* Timer for threading.
|
||||||
|
*/
|
||||||
|
private static final Timer timer = new Timer();
|
||||||
/**
|
/**
|
||||||
* Random number generator.
|
* Random number generator.
|
||||||
*/
|
*/
|
||||||
@ -227,8 +233,19 @@ public boolean onBlockCreate(Player player, Block blockPlaced, Block blockClicke
|
|||||||
if (!entry.onRightClick(itemInHand, player)) {
|
if (!entry.onRightClick(itemInHand, player)) {
|
||||||
// Water/lava bucket fix
|
// Water/lava bucket fix
|
||||||
if (itemInHand == 326 || itemInHand == 327) {
|
if (itemInHand == 326 || itemInHand == 327) {
|
||||||
blockPlaced.setType(0);
|
final int x = blockPlaced.getX();
|
||||||
blockPlaced.update();
|
final int y = blockPlaced.getY();
|
||||||
|
final int z = blockPlaced.getZ();
|
||||||
|
|
||||||
|
// This is REALLY BAD, but there's no other choice
|
||||||
|
// at the moment that is as reliable
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
etc.getServer().setBlockAt(0, x, y, z);
|
||||||
|
} catch (Throwable t) {}
|
||||||
|
}
|
||||||
|
}, 200); // Just in case
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -313,7 +330,7 @@ else if (type == 18) { // Leaves
|
|||||||
else if (type == 78) { dropped = 0; } // Snow
|
else if (type == 78) { dropped = 0; } // Snow
|
||||||
else if (type == 79) { dropped = 0; count = 4; } // Ice
|
else if (type == 79) { dropped = 0; count = 4; } // Ice
|
||||||
else if (type == 82) { dropped = 337; count = 4; } // Clay
|
else if (type == 82) { dropped = 337; count = 4; } // Clay
|
||||||
else if (type == 83) { dropped = 338; count = 4; } // Reed
|
else if (type == 83) { dropped = 338; } // Reed
|
||||||
else if (type == 89) { dropped = 348; } // Lightstone
|
else if (type == 89) { dropped = 348; } // Lightstone
|
||||||
|
|
||||||
etc.getServer().setBlockAt(0, block.getX(), block.getY(), block.getZ());
|
etc.getServer().setBlockAt(0, block.getX(), block.getY(), block.getZ());
|
||||||
@ -423,6 +440,10 @@ public boolean onExplode(Block block) {
|
|||||||
* @return true if you dont want the substance to flow.
|
* @return true if you dont want the substance to flow.
|
||||||
*/
|
*/
|
||||||
public boolean onFlow(Block block) {
|
public boolean onFlow(Block block) {
|
||||||
|
int x = block.getX();
|
||||||
|
int y = block.getY();
|
||||||
|
int z = block.getZ();
|
||||||
|
|
||||||
if (simulateSponge && (block.getStatus() == 8 || block.getStatus() == 9)) {
|
if (simulateSponge && (block.getStatus() == 8 || block.getStatus() == 9)) {
|
||||||
int ox = block.getX();
|
int ox = block.getX();
|
||||||
int oy = block.getY() + 1;
|
int oy = block.getY() + 1;
|
||||||
@ -430,10 +451,10 @@ public boolean onFlow(Block block) {
|
|||||||
|
|
||||||
Server server = etc.getServer();
|
Server server = etc.getServer();
|
||||||
|
|
||||||
for (int x = -4; x <= 4; x++) {
|
for (int cx = -4; cx <= 4; cx++) {
|
||||||
for (int y = -4; y <= 4; y++) {
|
for (int cy = -4; cy <= 4; cy++) {
|
||||||
for (int z = -4; z <= 4; z++) {
|
for (int cz = -4; cz <= 4; cz++) {
|
||||||
if (server.getBlockIdAt(ox + x, oy + y, oz + z) == 19) {
|
if (server.getBlockIdAt(ox + cx, oy + cy, oz + cz) == 19) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user