2626
2727public final class SettingsListener implements Listener {
2828
29- private static final Set <Material > necessaryPhysicsBlockTypes = new HashSet <>();
30- private static final Set <Material > redstonePhysicsBlockTypes = new HashSet <>();
29+ private static final Set <Material > NECESSARY_PHYSICS_BLOCK_TYPES = new HashSet <>();
30+ private static final Set <Material > REDSTONE_PHYSICS_BLOCK_TYPES = new HashSet <>();
31+
3132 private final ConfigConfig configConfig ;
3233 private final Logger logger ;
3334
@@ -41,77 +42,77 @@ public SettingsListener(
4142 }
4243
4344 public boolean isBlockTypeNecessaryPhysics (final Material material ) {
44- if (necessaryPhysicsBlockTypes .isEmpty ()) {
45- necessaryPhysicsBlockTypes .add (Material .CHEST );
46- necessaryPhysicsBlockTypes .add (Material .TRAPPED_CHEST );
47- necessaryPhysicsBlockTypes .add (Material .ENDER_CHEST );
48- necessaryPhysicsBlockTypes .addAll (Tag .COPPER_CHESTS .getValues ());
49- necessaryPhysicsBlockTypes .addAll (Tag .STAIRS .getValues ());
50- necessaryPhysicsBlockTypes .addAll (Tag .FENCES .getValues ());
51- necessaryPhysicsBlockTypes .addAll (Tag .FENCE_GATES .getValues ());
52- necessaryPhysicsBlockTypes .add (Material .GLASS_PANE );
53- necessaryPhysicsBlockTypes .add (Material .BLACK_STAINED_GLASS_PANE );
54- necessaryPhysicsBlockTypes .add (Material .BLUE_STAINED_GLASS_PANE );
55- necessaryPhysicsBlockTypes .add (Material .BROWN_STAINED_GLASS_PANE );
56- necessaryPhysicsBlockTypes .add (Material .CYAN_STAINED_GLASS_PANE );
57- necessaryPhysicsBlockTypes .add (Material .GRAY_STAINED_GLASS_PANE );
58- necessaryPhysicsBlockTypes .add (Material .GREEN_STAINED_GLASS_PANE );
59- necessaryPhysicsBlockTypes .add (Material .LIGHT_BLUE_STAINED_GLASS_PANE );
60- necessaryPhysicsBlockTypes .add (Material .LIGHT_GRAY_STAINED_GLASS_PANE );
61- necessaryPhysicsBlockTypes .add (Material .LIME_STAINED_GLASS_PANE );
62- necessaryPhysicsBlockTypes .add (Material .MAGENTA_STAINED_GLASS_PANE );
63- necessaryPhysicsBlockTypes .add (Material .ORANGE_STAINED_GLASS_PANE );
64- necessaryPhysicsBlockTypes .add (Material .PINK_STAINED_GLASS_PANE );
65- necessaryPhysicsBlockTypes .add (Material .PURPLE_STAINED_GLASS_PANE );
66- necessaryPhysicsBlockTypes .add (Material .RED_STAINED_GLASS_PANE );
67- necessaryPhysicsBlockTypes .add (Material .WHITE_STAINED_GLASS_PANE );
68- necessaryPhysicsBlockTypes .add (Material .YELLOW_STAINED_GLASS_PANE );
69- necessaryPhysicsBlockTypes .addAll (Tag .WALLS .getValues ());
70- necessaryPhysicsBlockTypes .addAll (Tag .BARS .getValues ());
71- necessaryPhysicsBlockTypes .addAll (Tag .DOORS .getValues ());
45+ if (NECESSARY_PHYSICS_BLOCK_TYPES .isEmpty ()) {
46+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .CHEST );
47+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .TRAPPED_CHEST );
48+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .ENDER_CHEST );
49+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .COPPER_CHESTS .getValues ());
50+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .STAIRS .getValues ());
51+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .FENCES .getValues ());
52+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .FENCE_GATES .getValues ());
53+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .GLASS_PANE );
54+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .BLACK_STAINED_GLASS_PANE );
55+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .BLUE_STAINED_GLASS_PANE );
56+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .BROWN_STAINED_GLASS_PANE );
57+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .CYAN_STAINED_GLASS_PANE );
58+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .GRAY_STAINED_GLASS_PANE );
59+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .GREEN_STAINED_GLASS_PANE );
60+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .LIGHT_BLUE_STAINED_GLASS_PANE );
61+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .LIGHT_GRAY_STAINED_GLASS_PANE );
62+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .LIME_STAINED_GLASS_PANE );
63+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .MAGENTA_STAINED_GLASS_PANE );
64+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .ORANGE_STAINED_GLASS_PANE );
65+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .PINK_STAINED_GLASS_PANE );
66+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .PURPLE_STAINED_GLASS_PANE );
67+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .RED_STAINED_GLASS_PANE );
68+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .WHITE_STAINED_GLASS_PANE );
69+ NECESSARY_PHYSICS_BLOCK_TYPES .add (Material .YELLOW_STAINED_GLASS_PANE );
70+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .WALLS .getValues ());
71+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .BARS .getValues ());
72+ NECESSARY_PHYSICS_BLOCK_TYPES .addAll (Tag .DOORS .getValues ());
7273 }
7374
74- return necessaryPhysicsBlockTypes .contains (material );
75+ return NECESSARY_PHYSICS_BLOCK_TYPES .contains (material );
7576 }
7677
7778 public boolean isBlockTypeRedstonePhysics (final Material material ) {
78- if (redstonePhysicsBlockTypes .isEmpty ()) {
79- redstonePhysicsBlockTypes .addAll (Tag .REDSTONE_ORES .getValues ());
80- redstonePhysicsBlockTypes .add (Material .REDSTONE_BLOCK );
81- redstonePhysicsBlockTypes .add (Material .REDSTONE_WIRE );
82- redstonePhysicsBlockTypes .add (Material .REDSTONE_LAMP );
83- redstonePhysicsBlockTypes .add (Material .REDSTONE_TORCH );
84- redstonePhysicsBlockTypes .add (Material .REDSTONE_WALL_TORCH );
85- redstonePhysicsBlockTypes .add (Material .DAYLIGHT_DETECTOR );
86- redstonePhysicsBlockTypes .add (Material .REPEATER );
87- redstonePhysicsBlockTypes .add (Material .COMPARATOR );
88- redstonePhysicsBlockTypes .addAll (Tag .DOORS .getValues ());
89- redstonePhysicsBlockTypes .add (Material .TARGET );
90- redstonePhysicsBlockTypes .add (Material .STRUCTURE_BLOCK );
91- redstonePhysicsBlockTypes .add (Material .JUKEBOX );
92- redstonePhysicsBlockTypes .add (Material .CRAFTER );
93- redstonePhysicsBlockTypes .add (Material .POWERED_RAIL );
94- redstonePhysicsBlockTypes .add (Material .DETECTOR_RAIL );
95- redstonePhysicsBlockTypes .add (Material .ACTIVATOR_RAIL );
96- redstonePhysicsBlockTypes .add (Material .HOPPER );
97- redstonePhysicsBlockTypes .add (Material .NOTE_BLOCK );
98- redstonePhysicsBlockTypes .add (Material .LEVER );
99- redstonePhysicsBlockTypes .addAll (Tag .BUTTONS .getValues ());
100- redstonePhysicsBlockTypes .add (Material .COMMAND_BLOCK );
101- redstonePhysicsBlockTypes .add (Material .CHAIN_COMMAND_BLOCK );
102- redstonePhysicsBlockTypes .add (Material .REPEATING_COMMAND_BLOCK );
103- redstonePhysicsBlockTypes .add (Material .TRIPWIRE );
104- redstonePhysicsBlockTypes .add (Material .TRIPWIRE_HOOK );
105- redstonePhysicsBlockTypes .addAll (Tag .PRESSURE_PLATES .getValues ());
106- redstonePhysicsBlockTypes .add (Material .STRING );
107- redstonePhysicsBlockTypes .add (Material .PISTON );
108- redstonePhysicsBlockTypes .add (Material .STICKY_PISTON );
109- redstonePhysicsBlockTypes .add (Material .MOVING_PISTON );
110- redstonePhysicsBlockTypes .add (Material .PISTON_HEAD );
111- redstonePhysicsBlockTypes .add (Material .OBSERVER );
79+ if (REDSTONE_PHYSICS_BLOCK_TYPES .isEmpty ()) {
80+ REDSTONE_PHYSICS_BLOCK_TYPES .addAll (Tag .REDSTONE_ORES .getValues ());
81+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REDSTONE_BLOCK );
82+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REDSTONE_WIRE );
83+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REDSTONE_LAMP );
84+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REDSTONE_TORCH );
85+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REDSTONE_WALL_TORCH );
86+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .DAYLIGHT_DETECTOR );
87+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REPEATER );
88+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .COMPARATOR );
89+ REDSTONE_PHYSICS_BLOCK_TYPES .addAll (Tag .DOORS .getValues ());
90+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .TARGET );
91+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .STRUCTURE_BLOCK );
92+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .JUKEBOX );
93+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .CRAFTER );
94+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .POWERED_RAIL );
95+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .DETECTOR_RAIL );
96+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .ACTIVATOR_RAIL );
97+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .HOPPER );
98+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .NOTE_BLOCK );
99+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .LEVER );
100+ REDSTONE_PHYSICS_BLOCK_TYPES .addAll (Tag .BUTTONS .getValues ());
101+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .COMMAND_BLOCK );
102+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .CHAIN_COMMAND_BLOCK );
103+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .REPEATING_COMMAND_BLOCK );
104+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .TRIPWIRE );
105+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .TRIPWIRE_HOOK );
106+ REDSTONE_PHYSICS_BLOCK_TYPES .addAll (Tag .PRESSURE_PLATES .getValues ());
107+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .STRING );
108+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .PISTON );
109+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .STICKY_PISTON );
110+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .MOVING_PISTON );
111+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .PISTON_HEAD );
112+ REDSTONE_PHYSICS_BLOCK_TYPES .add (Material .OBSERVER );
112113 }
113114
114- return redstonePhysicsBlockTypes .contains (material );
115+ return REDSTONE_PHYSICS_BLOCK_TYPES .contains (material );
115116 }
116117
117118 @ EventHandler
@@ -157,11 +158,11 @@ public void onBlockPhysics(final BlockPhysicsEvent event) {
157158 return ;
158159 }
159160
160- if (isBlockTypeNecessaryPhysics (blockType )) {
161+ if (this . isBlockTypeNecessaryPhysics (blockType )) {
161162 return ;
162163 }
163164
164- if (isBlockTypeRedstonePhysics (blockType )) {
165+ if (this . isBlockTypeRedstonePhysics (blockType )) {
165166 if (this .configConfig .data ().settings ().disableRedstone ()) {
166167 event .setCancelled (true );
167168 this .logger .debug ("Physics were cancelled because disable-redstone: true" );
0 commit comments