@@ -60,34 +60,34 @@ public boolean execute(Player player, String[] args) {
6060 return false ;
6161 }
6262
63- final List <Plot > plots ;
64- if ((plots = plotManager .getPlotsByOwner (targetId )).size () != 0 ) {
65- if (plotId < plots .size ()) {
66- final Plot plot = plots .get (plotId );
67- final boolean canPerform = (!plot .isDenied (player .getUniqueId ()) && !plot .isDenied (Utils .UUID_EVERYONE )) || player .hasPermission ("plot.admin.bypass.deny" );
68- if (targetName .equalsIgnoreCase (player .getName ())) {
69- player .sendMessage (this .translate (player , TranslationKey .HOME_SUCCESS_OWN ));
70- plotManager .teleportPlayerToPlot (player , plots .get (plotId ));
71- } else if (canPerform ) {
72- player .sendMessage (this .translate (player , TranslationKey .HOME_SUCCESS , this .plugin .getCorrectName (targetId )));
73- plotManager .teleportPlayerToPlot (player , plots .get (plotId ));
74- } else
75- player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_DENIED ));
76- return true ;
77- } else {
78- if (targetName .equalsIgnoreCase (player .getName ()))
79- player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_OWN_ID , plotId + 1 ));
80- else
81- player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_ID , this .plugin .getCorrectName (targetId ), plotId + 1 ));
82- return false ;
83- }
84- } else {
63+ final List <Plot > plots = plotManager .getPlotsByOwner (targetId );
64+ if (plots .isEmpty ()) {
8565 if (targetName .equalsIgnoreCase (player .getName ()))
8666 player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_OWN ));
8767 else
8868 player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE , this .plugin .getCorrectName (targetId )));
8969 return false ;
9070 }
71+
72+ if (plotId >= plots .size ()) {
73+ if (targetName .equalsIgnoreCase (player .getName ()))
74+ player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_OWN_ID , plotId + 1 ));
75+ else
76+ player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_ID , this .plugin .getCorrectName (targetId ), plotId + 1 ));
77+ return false ;
78+ }
79+
80+ final Plot plot = plots .get (plotId );
81+ final boolean canPerform = (!plot .isDenied (player .getUniqueId ()) && !plot .isDenied (Utils .UUID_EVERYONE )) || player .hasPermission ("plot.admin.bypass.deny" );
82+ if (targetName .equalsIgnoreCase (player .getName ())) {
83+ player .sendMessage (this .translate (player , TranslationKey .HOME_SUCCESS_OWN ));
84+ plotManager .teleportPlayerToPlot (player , plots .get (plotId ));
85+ } else if (canPerform ) {
86+ player .sendMessage (this .translate (player , TranslationKey .HOME_SUCCESS , this .plugin .getCorrectName (targetId )));
87+ plotManager .teleportPlayerToPlot (player , plots .get (plotId ));
88+ } else
89+ player .sendMessage (this .translate (player , TranslationKey .HOME_FAILURE_DENIED ));
90+ return true ;
9191 }
9292
9393}
0 commit comments