1818
1919@ Slf4j
2020@ PluginDescriptor (
21- name = "Compass Camera Control" ,
22- description = "Expands compass functionality" ,
23- tags = {"camera, compass, control, navigation, usability, convenience" }
21+ name = "Compass Camera Control" ,
22+ description = "Expands compass functionality" ,
23+ tags = {"camera, compass, control, navigation, usability, convenience" }
2424)
2525public class CompassCameraControlPlugin extends Plugin
2626{
@@ -35,8 +35,8 @@ public class CompassCameraControlPlugin extends Plugin
3535 private static final int EAST_YAW = 512 ;
3636 private static final int WEST_YAW = 1536 ;
3737
38- private static final String OPTION_SNAP_CARDINAL = "Snap Cardinal" ;
39- private static final String OPTION_CYCLE = "Cycle" ;
38+ private static final String SNAP_CARDINAL = "Snap Cardinal" ;
39+ private static final String CYCLE_CARDINAL = "Cycle Cardinal " ;
4040
4141 @ Subscribe
4242 public void onMenuEntryAdded (MenuEntryAdded event )
@@ -47,21 +47,18 @@ public void onMenuEntryAdded(MenuEntryAdded event)
4747 switch (config .controlMode ())
4848 {
4949 case SNAP_TO_CLOSEST :
50- newOption = OPTION_SNAP_CARDINAL ;
50+ newOption = SNAP_CARDINAL ;
5151 break ;
5252
5353 case CYCLE :
5454 default :
55- newOption = OPTION_CYCLE ;
55+ newOption = CYCLE_CARDINAL ;
5656 break ;
5757 }
5858
5959 MenuEntry [] menuEntries = client .getMenu ().getMenuEntries ();
6060 MenuEntry newEntry = client .getMenu ().createMenuEntry (menuEntries .length - 1 )
6161 .setOption (newOption )
62- .setIdentifier (event .getIdentifier ())
63- .setParam0 (event .getActionParam0 ())
64- .setParam1 (event .getActionParam1 ())
6562 .setType (MenuAction .CC_OP );
6663
6764 menuEntries = ArrayUtils .add (menuEntries , newEntry );
@@ -74,18 +71,20 @@ public void onMenuOptionClicked(MenuOptionClicked event)
7471 {
7572 if (event .getMenuAction () == MenuAction .CC_OP )
7673 {
77- String selectedOption = event .getMenuOption ();
78- if (selectedOption .equals (OPTION_SNAP_CARDINAL ))
74+ switch (event .getMenuOption ())
7975 {
80- alignYaw ();
81- event .consume ();
82- }
83- else if (selectedOption .equals (OPTION_CYCLE ))
84- {
85- cycleYaw ();
86- event .consume ();
76+ case SNAP_CARDINAL :
77+ alignYaw ();
78+ event .consume ();
79+ client .playSoundEffect (SoundEffectID .UI_BOOP );
80+ break ;
81+
82+ case CYCLE_CARDINAL :
83+ cycleYaw ();
84+ event .consume ();
85+ client .playSoundEffect (SoundEffectID .UI_BOOP );
86+ break ;
8787 }
88- client .playSoundEffect (SoundEffectID .UI_BOOP );
8988 }
9089 }
9190
0 commit comments