Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Added item dropping to the super pickaxe.
Dieser Commit ist enthalten in:
Ursprung
f103824ec1
Commit
255bea4416
@ -267,6 +267,94 @@ public class ServerInterface {
|
||||
pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item.
|
||||
*
|
||||
* @param pt
|
||||
* @param type
|
||||
* @param count
|
||||
* @param times
|
||||
*/
|
||||
public static void dropItem(Vector pt, int type, int count, int times) {
|
||||
for (int i = 0; i < times; i++) {
|
||||
etc.getServer().dropItem(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(),
|
||||
type, count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item.
|
||||
*
|
||||
* @param pt
|
||||
* @param type
|
||||
* @param count
|
||||
* @param times
|
||||
*/
|
||||
public static void dropItem(Vector pt, int type, int count) {
|
||||
etc.getServer().dropItem(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(),
|
||||
type, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item.
|
||||
*
|
||||
* @param pt
|
||||
* @param type
|
||||
* @param count
|
||||
* @param times
|
||||
*/
|
||||
public static void dropItem(Vector pt, int type) {
|
||||
etc.getServer().dropItem(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(),
|
||||
type, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate a block being mined.
|
||||
*
|
||||
* @param pt
|
||||
*/
|
||||
public static void simulateBlockMine(Vector pt) {
|
||||
int type = getBlockType(pt);
|
||||
setBlockType(pt, 0);
|
||||
|
||||
if (type == 1) { dropItem(pt, 4); } // Stone
|
||||
else if (type == 2) { dropItem(pt, 3); } // Grass
|
||||
else if (type == 13) { // Gravel
|
||||
dropItem(pt, type);
|
||||
|
||||
if (random.nextDouble() >= 0.9) {
|
||||
dropItem(pt, 318);
|
||||
}
|
||||
}
|
||||
else if (type == 16) { dropItem(pt, 263); } // Coal ore
|
||||
else if (type == 18) { // Leaves
|
||||
if (random.nextDouble() > 0.95) {
|
||||
dropItem(pt, 6);
|
||||
}
|
||||
}
|
||||
else if (type == 20) { } // Glass
|
||||
else if (type == 43) { dropItem(pt, 44); } // Double step
|
||||
else if (type == 47) { } // Bookshelves
|
||||
else if (type == 52) { } // Mob spawner
|
||||
else if (type == 53) { dropItem(pt, 5); } // Wooden stairs
|
||||
else if (type == 55) { dropItem(pt, 331); } // Redstone wire
|
||||
else if (type == 56) { dropItem(pt, 264); } // Diamond ore
|
||||
else if (type == 60) { dropItem(pt, 3); } // Soil
|
||||
else if (type == 63) { dropItem(pt, 323); } // Sign post
|
||||
else if (type == 67) { dropItem(pt, 4); } // Cobblestone stairs
|
||||
else if (type == 68) { dropItem(pt, 323); } // Wall sign
|
||||
else if (type == 73) { dropItem(pt, 331, 1, 4); } // Redstone ore
|
||||
else if (type == 74) { dropItem(pt, 331, 1, 4); } // Glowing redstone ore
|
||||
else if (type == 78) { } // Snow
|
||||
else if (type == 79) { } // Ice
|
||||
else if (type == 82) { dropItem(pt, 337, 1, 4); } // Clay
|
||||
else if (type == 83) { dropItem(pt, 338); } // Reed
|
||||
else if (type == 89) { dropItem(pt, 348); } // Lightstone
|
||||
else if (type != 0) {
|
||||
dropItem(pt, type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate a class without calling its constructor.
|
||||
*
|
||||
|
@ -90,6 +90,8 @@ public class WorldEditListener extends PluginListener {
|
||||
private boolean logComands = false;
|
||||
private boolean registerHelp = true;
|
||||
private int wandItem = 271;
|
||||
private boolean superPickaxeDrop = true;
|
||||
private boolean superPickaxeManyDrop = true;
|
||||
|
||||
/**
|
||||
* Construct an instance of the plugin.
|
||||
@ -1779,7 +1781,11 @@ public class WorldEditListener extends PluginListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
if (superPickaxeDrop) {
|
||||
ServerInterface.simulateBlockMine(pos);
|
||||
} else {
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
}
|
||||
|
||||
// Area super pickaxe
|
||||
} else if (session.getSuperPickaxeMode() ==
|
||||
@ -1801,7 +1807,11 @@ public class WorldEditListener extends PluginListener {
|
||||
for (int z = oz - size; z <= oz + size; z++) {
|
||||
Vector pos = new Vector(x, y, z);
|
||||
if (ServerInterface.getBlockType(pos) == initialType) {
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
if (superPickaxeManyDrop) {
|
||||
ServerInterface.simulateBlockMine(pos);
|
||||
} else {
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1853,7 +1863,11 @@ public class WorldEditListener extends PluginListener {
|
||||
visited.add(pos);
|
||||
|
||||
if (ServerInterface.getBlockType(pos) == initialType) {
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
if (superPickaxeManyDrop) {
|
||||
ServerInterface.simulateBlockMine(pos);
|
||||
} else {
|
||||
ServerInterface.setBlockType(pos, 0);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -1992,9 +2006,15 @@ public class WorldEditListener extends PluginListener {
|
||||
}
|
||||
|
||||
profile = properties.getBoolean("debug-profile", false);
|
||||
|
||||
wandItem = properties.getInt("wand-item", 271);
|
||||
|
||||
defaultChangeLimit = Math.max(-1, properties.getInt("max-blocks-changed", -1));
|
||||
maxRadius = Math.max(-1, properties.getInt("max-radius", -1));
|
||||
maxSuperPickaxeSize = Math.max(1, properties.getInt("max-super-pickaxe-size", 5));
|
||||
registerHelp = properties.getBoolean("register-help", true);
|
||||
logComands = properties.getBoolean("log-commands", false);
|
||||
superPickaxeDrop = properties.getBoolean("super-pickaxe-drop-items", true);
|
||||
superPickaxeManyDrop = properties.getBoolean("super-pickaxe-many-drop-items", false);
|
||||
|
||||
// Get allowed blocks
|
||||
allowedBlocks = new HashSet<Integer>();
|
||||
for (String b : properties.getString("allowed-blocks",
|
||||
@ -2005,11 +2025,6 @@ public class WorldEditListener extends PluginListener {
|
||||
}
|
||||
}
|
||||
|
||||
defaultChangeLimit = Math.max(-1, properties.getInt("max-blocks-changed", -1));
|
||||
|
||||
maxRadius = Math.max(-1, properties.getInt("max-radius", -1));
|
||||
|
||||
maxSuperPickaxeSize = Math.max(1, properties.getInt("max-super-pickaxe-size", 5));
|
||||
|
||||
String snapshotsDir = properties.getString("snapshots-dir", "");
|
||||
if (!snapshotsDir.trim().equals("")) {
|
||||
@ -2021,10 +2036,6 @@ public class WorldEditListener extends PluginListener {
|
||||
String type = properties.getString("shell-save-type", "").trim();
|
||||
shellSaveType = type.equals("") ? null : type;
|
||||
|
||||
registerHelp = properties.getBoolean("register-help", true);
|
||||
|
||||
logComands = properties.getBoolean("log-commands", false);
|
||||
|
||||
String logFile = properties.getString("log-file", "");
|
||||
if (!logFile.equals("")) {
|
||||
try {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren