7373
7474@ SuppressWarnings ({"deprecation" , "ConstantConditions" })
7575public class WorldProtect extends Module {
76- private boolean hungerLoss ;
77- private boolean fallDamage ;
78- private boolean weatherChange ;
79- private boolean deathMessage ;
80- private boolean fireSpread ;
81- private boolean leafDecay ;
82- private boolean mobSpawning ;
83- private boolean blockBurn ;
84- private boolean voidDeath ;
85- private boolean itemDrop ;
86- private boolean itemPickup ;
87- private boolean blockBreak ;
88- private boolean blockPlace ;
89- private boolean blockInteract ;
90- private boolean playerPvP ;
91- private boolean playerDrowning ;
92- private boolean fireDamage ;
93- private boolean contactDamage ;
94- private boolean inventoryDrop ;
76+ private boolean disableHungerLoss ;
77+ private boolean disableFallDamage ;
78+ private boolean disableWeatherChange ;
79+ private boolean disableDeathMessage ;
80+ private boolean disableFireSpread ;
81+ private boolean disableLeafDecay ;
82+ private boolean disableMobSpawning ;
83+ private boolean disableBlockBurn ;
84+ private boolean disableVoidDeath ;
85+ private boolean disableItemDrop ;
86+ private boolean disableItemPickup ;
87+ private boolean disableBlockBreak ;
88+ private boolean disableBlockPlace ;
89+ private boolean disableBlockInteract ;
90+ private boolean disablePlayerPvP ;
91+ private boolean disableDrowning ;
92+ private boolean disableFireDamage ;
93+ private boolean disableContactDamage ;
94+ private boolean disableInventoryDrop ;
9595
9696 private static final Set <Material > INTERACTABLE ;
9797
@@ -188,25 +188,25 @@ public WorldProtect(AkropolisPlugin plugin) {
188188 @ Override
189189 public void onEnable () {
190190 FileConfiguration config = getConfig (ConfigType .SETTINGS );
191- hungerLoss = config .getBoolean ("world_settings.disable_hunger_loss" );
192- fallDamage = config .getBoolean ("world_settings.disable_fall_damage" );
193- playerPvP = config .getBoolean ("world_settings.disable_player_pvp" );
194- voidDeath = config .getBoolean ("world_settings.disable_void_death" );
195- weatherChange = config .getBoolean ("world_settings.disable_weather_change" );
196- deathMessage = config .getBoolean ("world_settings.disable_death_message" );
197- mobSpawning = config .getBoolean ("world_settings.disable_mob_spawning" );
198- itemDrop = config .getBoolean ("world_settings.disable_item_drop" );
199- itemPickup = config .getBoolean ("world_settings.disable_item_pickup" );
200- blockBreak = config .getBoolean ("world_settings.disable_block_break" );
201- blockPlace = config .getBoolean ("world_settings.disable_block_place" );
202- blockInteract = config .getBoolean ("world_settings.disable_block_interact" );
203- blockBurn = config .getBoolean ("world_settings.disable_block_burn" );
204- fireSpread = config .getBoolean ("world_settings.disable_block_fire_spread" );
205- leafDecay = config .getBoolean ("world_settings.disable_block_leaf_decay" );
206- playerDrowning = config .getBoolean ("world_settings.disable_drowning" );
207- fireDamage = config .getBoolean ("world_settings.disable_fire_damage" );
208- contactDamage = config .getBoolean ("world_settings.disable_contact_damage" , true );
209- inventoryDrop = config .getBoolean ("world_settings.disable_inventory_drop" , true );
191+ disableHungerLoss = config .getBoolean ("world_settings.disable_hunger_loss" );
192+ disableFallDamage = config .getBoolean ("world_settings.disable_fall_damage" );
193+ disablePlayerPvP = config .getBoolean ("world_settings.disable_player_pvp" );
194+ disableVoidDeath = config .getBoolean ("world_settings.disable_void_death" );
195+ disableWeatherChange = config .getBoolean ("world_settings.disable_weather_change" );
196+ disableDeathMessage = config .getBoolean ("world_settings.disable_death_message" );
197+ disableMobSpawning = config .getBoolean ("world_settings.disable_mob_spawning" );
198+ disableItemDrop = config .getBoolean ("world_settings.disable_item_drop" );
199+ disableItemPickup = config .getBoolean ("world_settings.disable_item_pickup" );
200+ disableBlockBreak = config .getBoolean ("world_settings.disable_block_break" );
201+ disableBlockPlace = config .getBoolean ("world_settings.disable_block_place" );
202+ disableBlockInteract = config .getBoolean ("world_settings.disable_block_interact" );
203+ disableBlockBurn = config .getBoolean ("world_settings.disable_block_burn" );
204+ disableFireSpread = config .getBoolean ("world_settings.disable_block_fire_spread" );
205+ disableLeafDecay = config .getBoolean ("world_settings.disable_block_leaf_decay" );
206+ disableDrowning = config .getBoolean ("world_settings.disable_drowning" );
207+ disableFireDamage = config .getBoolean ("world_settings.disable_fire_damage" );
208+ disableContactDamage = config .getBoolean ("world_settings.disable_contact_damage" , true );
209+ disableInventoryDrop = config .getBoolean ("world_settings.disable_inventory_drop" , true );
210210 }
211211
212212 @ Override
@@ -228,7 +228,7 @@ public void onArmorStandInteract(PlayerArmorStandManipulateEvent event) {
228228
229229 @ EventHandler (priority = EventPriority .HIGH )
230230 public void onBlockBreak (BlockBreakEvent event ) {
231- if (!blockBreak || event .isCancelled ())
231+ if (!disableBlockBreak || event .isCancelled ())
232232 return ;
233233
234234 Player player = event .getPlayer ();
@@ -250,7 +250,7 @@ public void onBlockBreak(BlockBreakEvent event) {
250250 public void onBlockPlace (PlayerInteractEvent event ) {
251251 if (event .getAction () != Action .RIGHT_CLICK_BLOCK ) return ;
252252
253- if (!blockPlace || event .isCancelled ())
253+ if (!disableBlockPlace || event .isCancelled ())
254254 return ;
255255
256256 Player player = event .getPlayer ();
@@ -283,7 +283,7 @@ public void onBlockPlace(PlayerInteractEvent event) {
283283
284284 @ EventHandler
285285 public void onBlockBurn (BlockBurnEvent event ) {
286- if (!blockBurn )
286+ if (!disableBlockBurn )
287287 return ;
288288
289289 if (inDisabledWorld (event .getBlock ().getLocation ()))
@@ -295,7 +295,7 @@ public void onBlockBurn(BlockBurnEvent event) {
295295 // Prevent destroying of item frame/paintings
296296 @ EventHandler (priority = EventPriority .HIGH )
297297 public void onEntityDestroy (HangingBreakByEntityEvent event ) {
298- if (!blockBreak || inDisabledWorld (event .getEntity ().getLocation ()))
298+ if (!disableBlockBreak || inDisabledWorld (event .getEntity ().getLocation ()))
299299 return ;
300300
301301 Entity entity = event .getEntity ();
@@ -318,7 +318,7 @@ public void onEntityDestroy(HangingBreakByEntityEvent event) {
318318 // Prevent items being rotated in item frame
319319 @ EventHandler (priority = EventPriority .HIGH )
320320 public void onEntityInteract (PlayerInteractEntityEvent event ) {
321- if (!blockInteract || inDisabledWorld (event .getRightClicked ().getLocation ()))
321+ if (!disableBlockInteract || inDisabledWorld (event .getRightClicked ().getLocation ()))
322322 return ;
323323
324324 Entity entity = event .getRightClicked ();
@@ -341,7 +341,7 @@ public void onEntityInteract(PlayerInteractEntityEvent event) {
341341 // Prevent items being taken from item frames
342342 @ EventHandler
343343 public void onEntityDamageByEntity (EntityDamageByEntityEvent event ) {
344- if (!blockInteract || inDisabledWorld (event .getEntity ().getLocation ()))
344+ if (!disableBlockInteract || inDisabledWorld (event .getEntity ().getLocation ()))
345345 return ;
346346
347347 Entity entity = event .getEntity ();
@@ -364,7 +364,7 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
364364
365365 @ EventHandler (priority = EventPriority .HIGH )
366366 public void onBlockInteract (PlayerInteractEvent event ) {
367- if (!blockInteract || inDisabledWorld (event .getPlayer ().getLocation ()))
367+ if (!disableBlockInteract || inDisabledWorld (event .getPlayer ().getLocation ()))
368368 return ;
369369
370370 Player player = event .getPlayer ();
@@ -399,17 +399,17 @@ public void onEntityDamage(EntityDamageEvent event) {
399399 if (inDisabledWorld (player .getLocation ()))
400400 return ;
401401
402- if (fallDamage && event .getCause () == EntityDamageEvent .DamageCause .FALL ) {
402+ if (disableFallDamage && event .getCause () == EntityDamageEvent .DamageCause .FALL ) {
403403 event .setCancelled (true );
404- } else if (contactDamage && event .getCause () == EntityDamageEvent .DamageCause .CONTACT ) {
404+ } else if (disableContactDamage && event .getCause () == EntityDamageEvent .DamageCause .CONTACT ) {
405405 event .setCancelled (true );
406- } else if (playerDrowning && event .getCause () == EntityDamageEvent .DamageCause .DROWNING ) {
406+ } else if (disableDrowning && event .getCause () == EntityDamageEvent .DamageCause .DROWNING ) {
407407 event .setCancelled (true );
408- } else if (fireDamage && (event .getCause () == EntityDamageEvent .DamageCause .FIRE
408+ } else if (disableFireDamage && (event .getCause () == EntityDamageEvent .DamageCause .FIRE
409409 || event .getCause () == EntityDamageEvent .DamageCause .FIRE_TICK
410410 || event .getCause () == EntityDamageEvent .DamageCause .LAVA )) {
411411 event .setCancelled (true );
412- } else if (voidDeath && event .getCause () == EntityDamageEvent .DamageCause .VOID ) {
412+ } else if (disableVoidDeath && event .getCause () == EntityDamageEvent .DamageCause .VOID ) {
413413 player .setFallDistance (0.0F );
414414
415415 Location location = ((LobbySpawn ) getPlugin ().getModuleManager ().getModule (ModuleType .LOBBY )).getLocation ();
@@ -424,7 +424,7 @@ public void onEntityDamage(EntityDamageEvent event) {
424424
425425 @ EventHandler
426426 public void onFireSpread (BlockIgniteEvent event ) {
427- if (!fireSpread )
427+ if (!disableFireSpread )
428428 return ;
429429
430430 if (inDisabledWorld (event .getBlock ().getLocation ()))
@@ -436,7 +436,7 @@ public void onFireSpread(BlockIgniteEvent event) {
436436
437437 @ EventHandler (priority = EventPriority .MONITOR )
438438 public void onFoodChange (FoodLevelChangeEvent event ) {
439- if (!hungerLoss )
439+ if (!disableHungerLoss )
440440 return ;
441441
442442 if (!(event .getEntity () instanceof Player player ))
@@ -450,7 +450,7 @@ public void onFoodChange(FoodLevelChangeEvent event) {
450450
451451 @ EventHandler (priority = EventPriority .MONITOR )
452452 public void onPlayerDropEvent (PlayerDropItemEvent event ) {
453- if (!itemDrop )
453+ if (!disableItemDrop )
454454 return ;
455455
456456 Player player = event .getPlayer ();
@@ -472,7 +472,7 @@ public void onPlayerDropEvent(PlayerDropItemEvent event) {
472472
473473 @ EventHandler (priority = EventPriority .MONITOR )
474474 public void onPlayerPickupEvent (PlayerPickupItemEvent event ) {
475- if (!itemPickup )
475+ if (!disableItemPickup )
476476 return ;
477477
478478 Player player = event .getPlayer ();
@@ -494,7 +494,7 @@ public void onPlayerPickupEvent(PlayerPickupItemEvent event) {
494494
495495 @ EventHandler (priority = EventPriority .MONITOR )
496496 public void onLeafDecay (LeavesDecayEvent event ) {
497- if (!leafDecay )
497+ if (!disableLeafDecay )
498498 return ;
499499
500500 if (inDisabledWorld (event .getBlock ().getLocation ()))
@@ -505,7 +505,7 @@ public void onLeafDecay(LeavesDecayEvent event) {
505505
506506 @ EventHandler (priority = EventPriority .MONITOR )
507507 public void onCreatureSpawn (CreatureSpawnEvent event ) {
508- if (!mobSpawning )
508+ if (!disableMobSpawning )
509509 return ;
510510
511511 if (inDisabledWorld (event .getEntity ().getLocation ()))
@@ -522,7 +522,7 @@ public void onWeatherChange(WeatherChangeEvent event) {
522522 if (inDisabledWorld (event .getWorld ()))
523523 return ;
524524
525- if (!weatherChange )
525+ if (!disableWeatherChange )
526526 return ;
527527
528528 event .setCancelled (event .toWeatherState ());
@@ -533,18 +533,18 @@ public void onPlayerDeath(PlayerDeathEvent event) {
533533 if (inDisabledWorld (event .getEntity ().getLocation ()))
534534 return ;
535535
536- if (deathMessage )
536+ if (disableDeathMessage )
537537 event .setDeathMessage (null );
538538
539- if (!inventoryDrop )
539+ if (!disableInventoryDrop )
540540 return ;
541541
542542 event .getDrops ().clear ();
543543 }
544544
545545 @ EventHandler (priority = EventPriority .MONITOR )
546546 public void onEntityDamage (EntityDamageByEntityEvent event ) {
547- if (!playerPvP )
547+ if (!disablePlayerPvP )
548548 return ;
549549
550550 if (!(event .getEntity () instanceof Player player ))
0 commit comments