public boolean canReceive(AMChatRadio radio, Player player) { if (player.hasPermission("amchat.radio.hearall") || player.isOp()) { return true; } if (!isRadioOn(player)) { // The player doesn't even have his radio on return false; } if (!radio.getLoc().getWorld().equals(player.getWorld())) { // we can't talk to the other side. return false; } if (radio.getChan() < (playerRadioChannel.get(player) - playerRadioCutoff.get(player))) { // Radio chat is below cutoff limit return false; } else if (radio.getChan() > (playerRadioChannel.get(player) + playerRadioCutoff.get(player))) { // Radio channel is above the cutoff limit return false; } if ((!playerRadioChannel.get(player).equals(radio.getChan())) && (!playerRadioCode.get(player).equals(radio.getCode())) && (playerRadioFilter.get(player))) { // message is encrypted and we don't want to hear that. return false; } if (varLimitRadioChat) { if (!radio.isAdmin() && (amcTools.getDistance(radio.getLoc(), player.getLocation()) > radio.getMaxDistance())) { return false; } } return true; }
public boolean canLink(AMChatRadio radio, Player player) { if (player.hasPermission("amchat.radio.override.link") || player.isOp()) { return true; } if (!isRadioOn(player)) { // The player doesn't even have his radio on return false; } if (!radio.getLoc().getWorld().equals(player.getWorld())) { // we can't talk to the other side. return false; } if (varLimitRadioChat) { if (!radio.isAdmin() && (amcTools.getDistance(radio.getLoc(), player.getLocation()) > radio.getMaxDistance())) { return false; } } return true; }