Browse Source

added fix for lava -> water

linus122 6 năm trước cách đây
mục cha
commit
a12bacdef6
2 tập tin đã thay đổi với 19 bổ sung3 xóa
  1. 18 2
      src/de/Linus122/customoregen/Events.java
  2. 1 1
      src/plugin.yml

+ 18 - 2
src/de/Linus122/customoregen/Events.java

@@ -2,6 +2,7 @@ package de.Linus122.customoregen;
 
 import java.util.Random;
 
+import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.OfflinePlayer;
 import org.bukkit.block.Block;
@@ -18,11 +19,26 @@ public class Events implements Listener {
 		if (Main.disabledWorlds.contains(event.getBlock().getLocation().getWorld().getName())) {
 			return;
 		}
-		
+
 		int id = event.getBlock().getTypeId();
-		if ((id >= 8) && (id <= 11) && id != 9) {
+
+		if ((id >= 8) && (id <= 11) && id != 9 && event.getFace() != BlockFace.DOWN) {
 			Block b = event.getToBlock();
 			int toid = b.getTypeId();
+			Location fromLoc = b.getLocation();
+			// fix for (lava -> water)
+			if(id == 10 || id == 11){
+				Block b2 = b.getWorld().getBlockAt(fromLoc.getBlockX() + 1, fromLoc.getBlockY(), fromLoc.getBlockZ());
+				Block b3 = b.getWorld().getBlockAt(fromLoc.getBlockX() - 1, fromLoc.getBlockY(), fromLoc.getBlockZ());
+				Block b4 = b.getWorld().getBlockAt(fromLoc.getBlockX(), fromLoc.getBlockY(), fromLoc.getBlockZ() + 1);
+				Block b5 = b.getWorld().getBlockAt(fromLoc.getBlockX(), fromLoc.getBlockY(), fromLoc.getBlockZ() - 1);
+
+				if(b2.getType().getId() != 9  && b3.getType().getId() != 9  && b4.getType().getId() != 9  && b5.getType().getId() != 9){
+					return;
+				}
+			}
+
+			
 			if ((toid == 0) && (generatesCobble(id, b))) {
 				OfflinePlayer p = Main.getOwner(b.getLocation());
 				if (p == null)

+ 1 - 1
src/plugin.yml

@@ -1,5 +1,5 @@
 name: CustomOreGen
-version: 1.2.40
+version: 1.2.41
 description: Controls the Ore-Generator
 author: Linus122
 softdepend: [ASkyBlock, AcidIsland, uSkyBlock]