Skip to content

Commit

Permalink
Play is ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindgamesnl committed Apr 28, 2020
1 parent 5d375dd commit 81503ac
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 8 deletions.
24 changes: 23 additions & 1 deletion plugin/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.craftmend.openaudiomc</groupId>
<artifactId>OpenAudioMc</artifactId>
<name>OpenAudioMc</name>
<version>6.2.2</version>
<version>6.2.3</version>
<description>The OpenAudioMc Java plugin and Api</description>
<url>https://craftmend.com/</url>
<build>
Expand Down Expand Up @@ -66,6 +66,10 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>MG-Dev Jenkins CI Maven Repository</id>
<url>https://ci.mg-dev.eu/plugin/repository/everything</url>
</repository>
</repositories>
<dependencies>
<dependency>
Expand Down Expand Up @@ -244,6 +248,24 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.bergerkiller.bukkit</groupId>
<artifactId>TrainCarts</artifactId>
<version>1.15.2-v2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bergerkiller.bukkit</groupId>
<artifactId>BKCommonLib</artifactId>
<version>1.15.2-v2-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>Mountiplex</artifactId>
<groupId>com.bergerkiller.mountiplex</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public OpenAudioMc(OpenAudioInvoker invoker) throws Exception {

public void disable() {
isDisabled = true;
this.plusService.shutdown();
redisService.shutdown();
configurationImplementation.saveAll();
this.plusService.shutdown();
if (stateService.getCurrentState().isConnected()) {
networkingService.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void onEnable() {
}

if (getServer().getPluginManager().isPluginEnabled("Train_Carts")) {
this.regionModule = new RegionModule(this);
this.trainCartsModule = new TrainCartsModule(this);
}

// set state to idle, to allow connections and such, but only if not a node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void onExecute(GenericExecutor sender, String[] args) {
String aliasSource = args[1];
OpenAudioMcSpigot.getInstance().getAliasModule().getAliasMap().put(aliasName, aliasSource);
OpenAudioMc.getInstance().getConfigurationImplementation().setString(StorageLocation.DATA_FILE, "aliases." + aliasName, aliasSource);
message(sender, "Success! the alias " + ChatColor.YELLOW + "c:" + aliasName.toLowerCase() + ChatColor.GRAY + " will be read as " + ChatColor.YELLOW + aliasSource);
message(sender, "Success! the alias " + ChatColor.YELLOW + "a:" + aliasName.toLowerCase() + ChatColor.GRAY + " will be read as " + ChatColor.YELLOW + aliasSource);
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.craftmend.openaudiomc.spigot.modules.players.objects;

import com.bergerkiller.bukkit.tc.controller.MinecartMember;
import com.bergerkiller.bukkit.tc.controller.MinecartMemberStore;
import com.craftmend.openaudiomc.generic.networking.client.objects.ClientConnection;
import com.craftmend.openaudiomc.spigot.OpenAudioMcSpigot;
import com.craftmend.openaudiomc.generic.media.objects.Media;
Expand All @@ -10,12 +12,15 @@
import com.craftmend.openaudiomc.spigot.modules.speakers.objects.ApplicableSpeaker;

import com.craftmend.openaudiomc.spigot.modules.speakers.objects.SpeakerSettings;
import com.craftmend.openaudiomc.spigot.modules.traincarts.TrainCartsModule;
import com.craftmend.openaudiomc.spigot.modules.traincarts.models.TrainMedia;
import com.craftmend.openaudiomc.spigot.services.server.enums.ServerVersion;
import com.craftmend.openaudiomc.spigot.services.utils.DataWatcher;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

import java.util.*;
Expand Down Expand Up @@ -75,6 +80,26 @@ public SpigotConnection(Player player, ClientConnection clientConnection) {
});


clientConnection.addOnConnectHandler(() -> {
// if traincarts is enabled, check for that
TrainCartsModule trainCartsModule = OpenAudioMcSpigot.getInstance().getTrainCartsModule();
if (trainCartsModule == null) return;

Entity vehicle = player.getVehicle();
if (vehicle == null) return;

MinecartMember<?> member = MinecartMemberStore.getFromEntity(vehicle);
if (member == null)
return;

String trainName = member.getGroup().getProperties().getTrainName();

TrainMedia media = trainCartsModule.getMediaFromTrain(trainName);
if (media == null) return;

SpigotConnection spigotConnection = OpenAudioMcSpigot.getInstance().getPlayerModule().getClient(player);
spigotConnection.getClientConnection().sendMedia(media.toMedia());
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void stopStrain(String trainName, SignActionEvent event) {
}

public void registerTrain(String trainName, String source, SignActionEvent event) {
if (trainMediaMap.containsKey(trainName)) stopStrain(trainName, event);

TrainMedia media = new TrainMedia(source);
trainMediaMap.put(trainName, media);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ public class TrainMedia {
private UUID mediaId = UUID.randomUUID();
private Instant startedAt = OpenAudioMc.getInstance().getTimeService().getSyncedInstant();
private String source;
private Media media;

public TrainMedia(String source) {
this.source = source;
this.media = new Media(this.source);
this.media.setDoPickup(true);
this.media.setMediaId(this.mediaId.toString());
this.media.setLoop(false);
}

public Media toMedia() {
Media media = new Media(this.source);
media.setDoPickup(true);
media.setMediaId(this.mediaId.toString());
media.setLoop(false);
return media;
}

Expand Down

0 comments on commit 81503ac

Please sign in to comment.