Skip to content

Commit 3a5e511

Browse files
committed
fix view interface
1 parent 54fb259 commit 3a5e511

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/main/java/t/me/p1azmer/plugin/protectionblocks/region/editor/RGBlockMainEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public RGBlockMainEditor(@NotNull RegionBlock regionBlock) {
5050
if (!cursor.getType().isAir()) {
5151
regionBlock.setItem(cursor);
5252
PlayerUtil.addItem(viewer.getPlayer(), cursor);
53-
event.getView().setCursor(null);
53+
viewer.getPlayer().setItemOnCursor(null);
5454
this.save(viewer);
5555
}
5656
})

src/main/java/t/me/p1azmer/plugin/protectionblocks/region/listener/RegionListener.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ public void onBlockIgnite(BlockIgniteEvent event) {
131131

132132
@EventHandler
133133
public void onPiston(BlockPistonExtendEvent event) {
134-
boolean result = this.handlePiston(event.getBlocks(), event.getBlock(), event.getDirection());
135-
if (result)
134+
boolean cancelled = this.handlePiston(event.getBlocks(), event.getBlock(), event.getDirection());
135+
if (cancelled)
136136
event.setCancelled(true);
137137
}
138138

139139
@EventHandler
140140
public void onPiston(BlockPistonRetractEvent event) {
141-
boolean result = this.handlePiston(event.getBlocks(), event.getBlock(), event.getDirection());
142-
if (result)
141+
boolean cancelled = this.handlePiston(event.getBlocks(), event.getBlock(), event.getDirection());
142+
if (cancelled)
143143
event.setCancelled(true);
144144
}
145145

@@ -156,8 +156,9 @@ private void handleRegionExplode(@NotNull List<Block> blockList, @Nullable Block
156156
}
157157

158158
private boolean handlePiston(@NotNull List<Block> blockList, @NotNull Block pistonBlock, @NotNull BlockFace direction) {
159-
Location retractLocation = pistonBlock.getRelative(direction, blockList.size()).getLocation();
160-
Region region = this.manager.getRegionByLocation(retractLocation);
159+
int distance = blockList.size();
160+
Location location = pistonBlock.getRelative(direction, distance).getLocation();
161+
Region region = this.manager.getRegionByLocation(location);
161162
if (region != null) return true;
162163

163164
for (Block block : blockList) {

0 commit comments

Comments
 (0)