File tree Expand file tree Collapse file tree
java/de/varilx/sit/listener Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ players:
4646 enabled : true
4747blocks :
4848 enabled : true
49+ require-empty-hand : false # a player's main hand must be empty to sit
4950 right-click : true # allow sitting with right click
5051 left-click : false # allow sitting with left click
5152 blocks :
Original file line number Diff line number Diff line change @@ -29,16 +29,16 @@ public BlockSitListener(VSit plugin) {
2929
3030 @ EventHandler (priority = EventPriority .LOWEST )
3131 public void onPlayerInteract (PlayerInteractEvent event ) {
32- if (event .getClickedBlock () == null ) return ;
32+ Block block = event .getClickedBlock ();
33+ if (block == null ) return ;
3334 VaxConfiguration configuration = BaseAPI .get ().getConfiguration ();
3435 if (!configuration .getBoolean ("blocks.enabled" )) return ;
3536 if (!configuration .getBoolean ("enabled" )) return ;
36-
37- Block block = event .getClickedBlock ();
3837 if (configuration .getStringList ("blocks.blocked-worlds" ).contains (block .getWorld ().getName ())) return ;
3938 Player player = event .getPlayer ();
4039 if (player .isSneaking ()) return ;
41-
40+ if (configuration .getBoolean ("blocks.require-empty-hand" ) && !player .getInventory ().getItemInMainHand ().isEmpty ()) return ;
41+
4242 for (String blockStr : configuration .getStringList ("blocks.blocks" )) {
4343 if (block .getType ().name ().toLowerCase ().contains (blockStr .toLowerCase ())) {
4444 if (!configuration .getBoolean ("blocks.right-click" ) && event .getAction () == Action .RIGHT_CLICK_BLOCK ) return ;
Original file line number Diff line number Diff line change 88
99blocks :
1010 enabled : true
11+ require-empty-hand : false
1112 right-click : true
1213 left-click : false
1314 blocked-worlds :
You can’t perform that action at this time.
0 commit comments