Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 10:30:04 +01:00
Fixed handling of double chests and cleaned WorldEditListener up a bit
Dieser Commit ist enthalten in:
Ursprung
79f2d68e60
Commit
86011a0d0d
@ -27,6 +27,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.Sign;
|
||||
@ -388,6 +389,9 @@ public class BukkitWorld extends LocalWorld {
|
||||
|
||||
org.bukkit.inventory.InventoryHolder chest = (org.bukkit.inventory.InventoryHolder) state;
|
||||
Inventory inven = chest.getInventory();
|
||||
if (chest instanceof Chest) {
|
||||
inven = ((Chest) chest).getBlockInventory();
|
||||
}
|
||||
inven.clear();
|
||||
return true;
|
||||
}
|
||||
@ -697,6 +701,9 @@ public class BukkitWorld extends LocalWorld {
|
||||
|
||||
org.bukkit.inventory.InventoryHolder container = (org.bukkit.inventory.InventoryHolder) state;
|
||||
Inventory inven = container.getInventory();
|
||||
if (container instanceof Chest) {
|
||||
inven = ((Chest) container).getBlockInventory();
|
||||
}
|
||||
int size = inven.getSize();
|
||||
BaseItemStack[] contents = new BaseItemStack[size];
|
||||
|
||||
@ -737,6 +744,9 @@ public class BukkitWorld extends LocalWorld {
|
||||
|
||||
org.bukkit.inventory.InventoryHolder chest = (org.bukkit.inventory.InventoryHolder) state;
|
||||
Inventory inven = chest.getInventory();
|
||||
if (chest instanceof Chest) {
|
||||
inven = ((Chest) chest).getBlockInventory();
|
||||
}
|
||||
int size = inven.getSize();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
|
@ -84,12 +84,8 @@ public class WorldEditListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] split = event.getMessage().split(" ");
|
||||
|
||||
if (split.length > 0) {
|
||||
@ -181,12 +177,8 @@ public class WorldEditListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matcher matcher = cuipattern.matcher(event.getMessage());
|
||||
if (matcher.find()) {
|
||||
String type = matcher.group(1);
|
||||
@ -196,7 +188,7 @@ public class WorldEditListener implements Listener {
|
||||
try {
|
||||
plugin.getSession(event.getPlayer()).setCUIVersion(Integer.parseInt(args));
|
||||
event.setCancelled(true);
|
||||
} catch( NumberFormatException e ) {
|
||||
} catch(NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren