From d4264a1c26d73f7d25cbbb2e80a2d27370c1f1ba Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Sat, 16 Jun 2018 15:15:15 +0200 Subject: [PATCH] Fixed the click sound being also played to players nearby --- .../bskyblock/listeners/flags/clicklisteners/CycleClick.java | 4 ++-- .../flags/clicklisteners/IslandToggleClickListener.java | 2 +- .../flags/clicklisteners/WorldToggleClickListener.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/CycleClick.java b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/CycleClick.java index 922241eaa..ab13c1823 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/CycleClick.java +++ b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/CycleClick.java @@ -44,14 +44,14 @@ public class CycleClick implements PanelItem.ClickHandler { } else { island.setFlag(flag, rm.getRankUpValue(currentRank)); } - user.getWorld().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); + user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); } else if (click.equals(ClickType.RIGHT)) { if (currentRank == RanksManager.VISITOR_RANK) { island.setFlag(flag, RanksManager.OWNER_RANK); } else { island.setFlag(flag, rm.getRankDownValue(currentRank)); } - user.getWorld().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); + user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); } // Apply change to panel panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/IslandToggleClickListener.java b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/IslandToggleClickListener.java index ff6ad3330..f14e6ff1e 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/IslandToggleClickListener.java +++ b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/IslandToggleClickListener.java @@ -42,7 +42,7 @@ public class IslandToggleClickListener implements ClickHandler { Flag flag = plugin.getFlagsManager().getFlagByID(id); // Toggle flag island.toggleFlag(flag); - user.getWorld().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); + user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); // Apply change to panel panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/WorldToggleClickListener.java b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/WorldToggleClickListener.java index f53026beb..d57b44656 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/WorldToggleClickListener.java +++ b/src/main/java/us/tastybento/bskyblock/listeners/flags/clicklisteners/WorldToggleClickListener.java @@ -51,7 +51,7 @@ public class WorldToggleClickListener implements ClickHandler { Flag flag = plugin.getFlagsManager().getFlagByID(id); // Toggle flag flag.setSetting(user.getWorld(), !flag.isSetForWorld(user.getWorld())); - user.getWorld().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); + user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F); // Apply change to panel panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); return true;