Fixed the click sound being also played to players nearby

This commit is contained in:
Florian CUNY 2018-06-16 15:15:15 +02:00
parent c68c8d26cb
commit d4264a1c26
3 changed files with 4 additions and 4 deletions

View File

@ -44,14 +44,14 @@ public class CycleClick implements PanelItem.ClickHandler {
} else { } else {
island.setFlag(flag, rm.getRankUpValue(currentRank)); 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)) { } else if (click.equals(ClickType.RIGHT)) {
if (currentRank == RanksManager.VISITOR_RANK) { if (currentRank == RanksManager.VISITOR_RANK) {
island.setFlag(flag, RanksManager.OWNER_RANK); island.setFlag(flag, RanksManager.OWNER_RANK);
} else { } else {
island.setFlag(flag, rm.getRankDownValue(currentRank)); 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 // Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());

View File

@ -42,7 +42,7 @@ public class IslandToggleClickListener implements ClickHandler {
Flag flag = plugin.getFlagsManager().getFlagByID(id); Flag flag = plugin.getFlagsManager().getFlagByID(id);
// Toggle flag // Toggle flag
island.toggleFlag(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 // Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());
} }

View File

@ -51,7 +51,7 @@ public class WorldToggleClickListener implements ClickHandler {
Flag flag = plugin.getFlagsManager().getFlagByID(id); Flag flag = plugin.getFlagsManager().getFlagByID(id);
// Toggle flag // Toggle flag
flag.setSetting(user.getWorld(), !flag.isSetForWorld(user.getWorld())); 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 // Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem()); panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());
return true; return true;