Compare commits
2 commits
1ff00557bb
...
dda73e3ccc
Author | SHA1 | Date | |
---|---|---|---|
dda73e3ccc | |||
4b28838194 |
3 changed files with 73 additions and 1 deletions
|
@ -195,4 +195,44 @@ public class TPAudioCMD extends BaseCommand {
|
|||
|
||||
sender.sendMessage(ChatColor.GRAY + "Playback stopped!");
|
||||
}
|
||||
|
||||
@Subcommand("stopchannel")
|
||||
@Description("")
|
||||
public void onStopChannel(CommandSender sender, String selector, AudioType type) {
|
||||
List<Player> players = new ArrayList<>();
|
||||
Player target = Bukkit.getPlayer(selector);
|
||||
if (target != null) {
|
||||
if (!PinManager.hasPin(target.getUniqueId())) {
|
||||
sender.sendMessage(ChatColor.GRAY + "The player is not connected to the client.");
|
||||
return;
|
||||
}
|
||||
|
||||
players.add(target);
|
||||
} else {
|
||||
SpigotPlayerSelector sel = new SpigotPlayerSelector(selector);
|
||||
|
||||
if (sel.getArgument("region").length() != 0) {
|
||||
if (!ThemeParkAudio.isRegionSupport()) {
|
||||
sender.sendMessage(ChatColor.GRAY + "Region support is not available.");
|
||||
return;
|
||||
}
|
||||
String regionID = sel.getArgument("region");
|
||||
new PlayInRegionHandler(regionID, "", sel.getPlayers(sender).stream().map(Entity::getUniqueId).collect(Collectors.toList()));
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Playback stopped in region " + regionID + "!");
|
||||
return;
|
||||
} else {
|
||||
players.addAll(sel.getPlayers(sender));
|
||||
}
|
||||
}
|
||||
|
||||
if (type == AudioType.RADIO && !ThemeParkAudio.getInstance().getConfig().getBoolean("radio")) {
|
||||
sender.sendMessage(ChatColor.GRAY + "The radio is disabled, so it can't be played on.");
|
||||
return;
|
||||
}
|
||||
|
||||
AudioMessage.of(type, "").broadcastSelection(players, PinManager::hasPin);
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Playback stopped!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package tech.sbdevelopment.themeparkaudio.socket.messages;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@Getter
|
||||
public class ActionFotoMessage extends AbstractMessage {
|
||||
private final String attractionId;
|
||||
private final String image;
|
||||
private final ZonedDateTime timestamp = ZonedDateTime.now();
|
||||
|
||||
protected ActionFotoMessage(String attractionId, String image) {
|
||||
super(MessageTask.ACTIONFOTO);
|
||||
this.attractionId = attractionId;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public static ActionFotoMessage of(String attractionId, String image) {
|
||||
return new ActionFotoMessage(attractionId, image);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject extendJson() {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("attractionId", attractionId);
|
||||
data.put("image", image);
|
||||
data.put("timestamp", timestamp.toInstant().toString());
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package tech.sbdevelopment.themeparkaudio.socket.messages;
|
||||
|
||||
public enum MessageTask {
|
||||
AUTHENTICATION, LOGOUT, LIGHT, MUSIC, SFX, RADIO, PING, STOP
|
||||
AUTHENTICATION, LOGOUT, LIGHT, MUSIC, SFX, RADIO, PING, STOP, ACTIONFOTO
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue