@@ -60,12 +60,9 @@ public void disable() {
6060 @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
6161 private void onInteract (PlayerInteractEvent event ) {
6262 if (!event .getAction ().isRightClick ()) return ;
63- Block clicked = event .getClickedBlock ();
64- if (clicked .getType () != XMaterial .LEVER .parseMaterial ()) return ;
63+ if (event .getClickedBlock ().getType () != XMaterial .LEVER .get ()) return ;
6564
66- final Player player = event .getPlayer ();
67-
68- final Location leverLoc = clicked .getLocation ();
65+ final Location leverLoc = event .getClickedBlock ().getLocation ();
6966 Integer activationCount = leverLocationCooldowns .getIfPresent (leverLoc );
7067 if (activationCount == null ) activationCount = 0 ;
7168
@@ -75,30 +72,29 @@ private void onInteract(PlayerInteractEvent event) {
7572 if (activationCount > leverUsageLimit ) {
7673 event .setCancelled (true );
7774 if (shouldKickPlayer ) {
78- player . kick (AnarchyExploitFixes .getLang (player .locale ()).lagpreventions_stopSpammingLevers );
75+ event . getPlayer (). kick (AnarchyExploitFixes .getLang (event . getPlayer () .locale ()).lagpreventions_stopSpammingLevers );
7976 return ;
8077 }
8178 if (sendActionBar ) {
82- player . sendActionBar (AnarchyExploitFixes .getLang (player .locale ()).lagpreventions_stopSpammingLevers );
79+ event . getPlayer (). sendActionBar (AnarchyExploitFixes .getLang (event . getPlayer () .locale ()).lagpreventions_stopSpammingLevers );
8380 }
8481 return ;
8582 }
8683
87- final UUID playerUniqueId = player .getUniqueId ();
88- Integer leverFlickCount = playersUsingLeversCooldowns .getIfPresent (playerUniqueId );
84+ Integer leverFlickCount = playersUsingLeversCooldowns .getIfPresent (event .getPlayer ().getUniqueId ());
8985 if (leverFlickCount == null ) leverFlickCount = 0 ;
9086
9187 leverFlickCount ++;
92- playersUsingLeversCooldowns .put (playerUniqueId , leverFlickCount );
88+ playersUsingLeversCooldowns .put (event . getPlayer (). getUniqueId () , leverFlickCount );
9389
9490 if (leverFlickCount > leverUsageLimit ) {
9591 event .setCancelled (true );
9692 if (shouldKickPlayer ) {
97- player . kick (AnarchyExploitFixes .getLang (player .locale ()).lagpreventions_stopSpammingLevers );
93+ event . getPlayer (). kick (AnarchyExploitFixes .getLang (event . getPlayer () .locale ()).lagpreventions_stopSpammingLevers );
9894 return ;
9995 }
10096 if (sendActionBar ) {
101- player . sendActionBar (AnarchyExploitFixes .getLang (player .locale ()).lagpreventions_stopSpammingLevers );
97+ event . getPlayer (). sendActionBar (AnarchyExploitFixes .getLang (event . getPlayer () .locale ()).lagpreventions_stopSpammingLevers );
10298 }
10399 }
104100 }
0 commit comments