Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
Fixed valid block check to not include items
Dieser Commit ist enthalten in:
Ursprung
a690d5782f
Commit
2221eae36a
@ -82,11 +82,12 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
|
||||
public class BukkitWorld extends LocalWorld {
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(BukkitWorld.class.getCanonicalName());
|
||||
private World world;
|
||||
private boolean skipNmsAccess = false;
|
||||
private boolean skipNmsSafeSet = false;
|
||||
private boolean skipNmsValidBlockCheck = false;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@ -866,7 +867,15 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidBlockType(int type) {
|
||||
return type <= 4095 && Material.getMaterial(type) != null;
|
||||
if (!skipNmsValidBlockCheck) {
|
||||
try {
|
||||
return type >=0 && type < net.minecraft.server.Block.byId.length
|
||||
&& net.minecraft.server.Block.byId[type] != null;
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Error checking NMS valid block type", e);
|
||||
}
|
||||
}
|
||||
return Material.getMaterial(type) != null && Material.getMaterial(type).isBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -987,10 +996,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return super.getBlock(pt);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector pt, com.sk89q.worldedit.foundation.Block block, boolean notifyAdjacent) {
|
||||
if (!skipNmsSafeSet) {
|
||||
@ -1002,7 +1011,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
skipNmsSafeSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return super.setBlock(pt, block, notifyAdjacent);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren