File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
src/main/java/me/minoneer/bukkit/bookexploit Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import net .md_5 .bungee .api .chat .BaseComponent ;
4
4
import net .md_5 .bungee .api .chat .ClickEvent ;
5
+ import org .bukkit .Material ;
5
6
import org .bukkit .inventory .ItemStack ;
6
7
import org .bukkit .inventory .meta .BookMeta ;
7
8
import org .bukkit .inventory .meta .ItemMeta ;
@@ -30,6 +31,10 @@ public ItemStack filterBook(@Nullable final ItemStack originalItem) {
30
31
return null ;
31
32
}
32
33
34
+ if (originalItem .getType () != Material .WRITTEN_BOOK && originalItem .getType () != Material .WRITABLE_BOOK ) {
35
+ return null ;
36
+ }
37
+
33
38
ItemStack newItem = originalItem .clone ();
34
39
35
40
ItemMeta itemMeta = newItem .getItemMeta ();
Original file line number Diff line number Diff line change 1
1
package me .minoneer .bukkit .bookexploit ;
2
2
3
- import org .bukkit .Material ;
4
3
import org .bukkit .entity .HumanEntity ;
5
4
import org .bukkit .entity .Player ;
6
5
import org .bukkit .event .EventHandler ;
@@ -52,9 +51,6 @@ public void onBookRead(@NotNull final PlayerInteractEvent event) {
52
51
if (event .getAction () != Action .RIGHT_CLICK_AIR && event .getAction () != Action .RIGHT_CLICK_BLOCK ) {
53
52
return ;
54
53
}
55
- if (event .getItem () == null || event .getItem ().getType () != Material .WRITTEN_BOOK ) {
56
- return ;
57
- }
58
54
if (player .hasPermission ("bookfilter.overridefilter" )) {
59
55
return ;
60
56
}
You can’t perform that action at this time.
0 commit comments