@@ -31,7 +31,9 @@ public TridentDupe() {
3131 this .dupePreventedMaterial = config .getList (configPath + ".materials" ,
3232 Stream .of (XMaterial .TRIDENT , XMaterial .ARROW , XMaterial .TIPPED_ARROW ,
3333 XMaterial .SPECTRAL_ARROW , XMaterial .EGG , XMaterial .WIND_CHARGE )
34- .filter (XMaterial ::isSupported ).map (XMaterial ::get ).map (Enum ::name ).collect (Collectors .toList ()))
34+ .filter (XMaterial ::isSupported ).map (XMaterial ::get ).map (Enum ::name ).collect (Collectors .toList ()),
35+ "Apply the check for relevant materials only to not break features like alt silent swap.\n " +
36+ "If you do not wish to check for specific materials, leave this list empty." )
3537 .stream ()
3638 .map (configuredMaterial -> {
3739 try {
@@ -57,8 +59,13 @@ public void disable() {
5759
5860 @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
5961 private void onInventoryClick (InventoryClickEvent event ) {
60- if (event .getWhoClicked ().getActiveItem () != null
61- && dupePreventedMaterial .contains (event .getWhoClicked ().getActiveItem ().getType ())) {
62+ if (event .getWhoClicked ().getActiveItem () == null ) return ;
63+
64+ if (dupePreventedMaterial .contains (event .getWhoClicked ().getActiveItem ().getType ())) {
65+ event .setCancelled (true );
66+ }
67+
68+ else if (dupePreventedMaterial .isEmpty () && event .getWhoClicked ().getActiveItem ().getType () != XMaterial .AIR .get ()) {
6269 event .setCancelled (true );
6370 }
6471 }
0 commit comments