mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-15 07:05:53 +01:00
Fix persistent brush scroll action
This commit is contained in:
parent
8f2bfabc1a
commit
b9d267a908
@ -1,5 +1,6 @@
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.brush.MovableTool;
|
||||
import com.boydti.fawe.object.brush.ResettableTool;
|
||||
@ -46,12 +47,16 @@ public class BrushListener implements Listener {
|
||||
}
|
||||
ScrollTool scrollable = (ScrollTool) tool;
|
||||
if (scrollable.increment(player, ri)) {
|
||||
final PlayerInventory inv = bukkitPlayer.getInventory();
|
||||
final ItemStack item = inv.getItem(slot);
|
||||
final ItemStack newItem = inv.getItem(oldSlot);
|
||||
inv.setItem(slot, newItem);
|
||||
inv.setItem(oldSlot, item);
|
||||
bukkitPlayer.updateInventory();
|
||||
if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES) {
|
||||
bukkitPlayer.getInventory().setHeldItemSlot(oldSlot);
|
||||
} else {
|
||||
final PlayerInventory inv = bukkitPlayer.getInventory();
|
||||
final ItemStack item = inv.getItem(slot);
|
||||
final ItemStack newItem = inv.getItem(oldSlot);
|
||||
inv.setItem(slot, newItem);
|
||||
inv.setItem(oldSlot, item);
|
||||
bukkitPlayer.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,6 +580,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
if (mode == VisualMode.NONE) {
|
||||
return;
|
||||
}
|
||||
BrushSettings current = getContext();
|
||||
Brush brush = current.getBrush();
|
||||
if (brush == null) return;
|
||||
FawePlayer<Object> fp = FawePlayer.wrap(player);
|
||||
EditSession editSession = new EditSessionBuilder(player.getWorld())
|
||||
.player(fp)
|
||||
@ -599,9 +602,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
break;
|
||||
}
|
||||
case OUTLINE: {
|
||||
BrushSettings current = getContext();
|
||||
new PatternTraverser(current).reset(editSession);
|
||||
current.getBrush().build(editSession, position, current.getMaterial(), current.getSize());
|
||||
brush.build(editSession, position, current.getMaterial(), current.getSize());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user