Skip to content

Commit

Permalink
fixed inconsistency in listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
GhastCraftHD committed Mar 29, 2024
1 parent 8014af6 commit bd61676
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.leghast.miniaturise.handler;

import de.leghast.miniaturise.Miniaturise;
import de.leghast.miniaturise.constant.Message;
import de.leghast.miniaturise.miniature.PlacedMiniature;
import de.leghast.miniaturise.settings.AdjusterSettings;
import de.leghast.miniaturise.ui.UserInterface;
Expand All @@ -15,6 +16,11 @@ public AdjusterInteractionHandler(Miniaturise main, Player player, Action action
main.getSettingsManager().addAdjusterSettings(player.getUniqueId());
}

if(!main.getMiniatureManager().hasPlacedMiniature(player.getUniqueId())){
player.sendMessage(Message.SELECT_PLACED_MINIATURE_FIRST);
return;
}

if(action.isLeftClick()){
PlacedMiniature placedMiniature = main.getMiniatureManager().getPlacedMiniature(player.getUniqueId());
AdjusterSettings settings = main.getSettingsManager().getAdjusterSettings(player.getUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@ public void onPlayerInteract(PlayerInteractEvent e){
if(!player.hasPermission(Miniaturise.PERMISSION)) return;

if(material == ConfigManager.SELECTOR_TOOL){
e.setCancelled(true);
new SelectorInteractionHandler(main, player, e.getAction(), e.getClickedBlock(), e.getHand());
e.setCancelled(true);
}else if(material == ConfigManager.ADJUSTER_TOOL){
if(main.getMiniatureManager().hasPlacedMiniature(player.getUniqueId())){
e.setCancelled(true);
new AdjusterInteractionHandler(main, player, e.getAction(), e.getHand());
}else{
player.sendMessage(Message.SELECT_PLACED_MINIATURE_FIRST);
}
new AdjusterInteractionHandler(main, player, e.getAction(), e.getHand());
e.setCancelled(true);
}

}
Expand Down

0 comments on commit bd61676

Please sign in to comment.