Skip to content

Commit

Permalink
Release 3.2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioDP committed Sep 27, 2023
1 parent 5a8772b commit dc47e3f
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 42 deletions.
4 changes: 0 additions & 4 deletions bukkit/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
</plugins>
</build>
<repositories>
<repository>
<id>confuser-repo</id>
<url>https://ci.frostcast.net/plugin/repository/everything/</url>
</repository>
<repository>
<id>mikeprimm-repo</id>
<url>https://repo.mikeprimm.com/</url>
Expand Down
5 changes: 0 additions & 5 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
</build>

<repositories>
<repository>
<!-- BanManager repo -->
<id>confuser-repo</id>
<url>https://ci.frostcast.net/plugin/repository/everything/</url>
</repository>
<repository>
<!-- Dynmap repo -->
<id>mikeprimm-repo</id>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<dev.junit>5.9.1</dev.junit>

<libs.adpcore>1.8.10</libs.adpcore>
<libs.api.spigot>1.19.3-R0.1-SNAPSHOT</libs.api.spigot>
<libs.api.bungeecord>1.19-R0.1-SNAPSHOT</libs.api.bungeecord>
<libs.api.spigot>1.20.2-R0.1-SNAPSHOT</libs.api.spigot>
<libs.api.bungeecord>1.20-R0.1-SNAPSHOT</libs.api.bungeecord>
<libs.api.velocity>3.1.1</libs.api.velocity>
<!-- ADP Core Test Libraries -->
<libs.h2>1.4.200</libs.h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;

import javax.inject.Inject;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.Set;

@Plugin(
id = PartiesConstants.PLUGIN_FALLBACK,
Expand Down Expand Up @@ -48,4 +51,13 @@ protected ADPPlugin initializePlugin() {
public @NotNull String getVersion() {
return VelocityConstants.VERSION;
}

/**
* Returns the list of registered servers of this network
*
* @return a set of registered servers
*/
public @NotNull Set<RegisteredServer> getServersList() {
return new HashSet<>(getServer().getAllServers());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

import com.alessiodp.parties.common.PartiesPlugin;
import com.alessiodp.parties.common.commands.main.CommandParty;
import com.alessiodp.parties.common.commands.sub.CommandDebug;
import com.alessiodp.parties.common.configuration.data.ConfigMain;
import com.alessiodp.parties.velocity.commands.sub.VelocityCommandDebug;
import com.alessiodp.parties.velocity.commands.sub.VelocityCommandHome;
import com.alessiodp.parties.velocity.commands.sub.VelocityCommandSetHome;
import com.alessiodp.parties.velocity.commands.sub.VelocityCommandTeleport;
import com.alessiodp.parties.velocity.configuration.data.VelocityConfigParties;

public class VelocityCommandParty extends CommandParty {

public VelocityCommandParty(PartiesPlugin instance) {
super(instance);

// Debug
if (ConfigMain.PARTIES_DEBUG_COMMAND)
super.register(new CommandDebug(plugin, this));
super.register(new VelocityCommandDebug(plugin, this));

// Home
if (VelocityConfigParties.ADDITIONAL_HOME_ENABLE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.alessiodp.parties.velocity.commands.sub;

import com.alessiodp.core.common.ADPPlugin;
import com.alessiodp.core.common.commands.utils.ADPMainCommand;
import com.alessiodp.core.common.user.User;
import com.alessiodp.parties.common.PartiesPlugin;
import com.alessiodp.parties.common.commands.sub.CommandDebug;
import com.alessiodp.parties.common.players.objects.PartyPlayerImpl;
import com.alessiodp.parties.velocity.configuration.data.VelocityMessages;
import com.alessiodp.parties.velocity.messaging.VelocityPartiesMessageDispatcher;

import java.util.UUID;

public class VelocityCommandDebug extends CommandDebug {
public VelocityCommandDebug(ADPPlugin plugin, ADPMainCommand mainCommand) {
super(plugin, mainCommand);
}

public static void handleDebugBungeecord(PartiesPlugin plugin, UUID temporaryUuid, UUID receiver, boolean replyToPlayer, String sourceServer) {
PartyPlayerImpl player = plugin.getDatabaseManager().getPlayer(temporaryUuid);
User userReceiver = receiver != null ? plugin.getPlayer(receiver) : null;

if (player != null) {
TemporaryPartyPlayer temporaryPlayer = new TemporaryPartyPlayer(plugin, player.getPlayerUUID());
temporaryPlayer.setPersistent(false);
plugin.getDatabaseManager().updatePlayer(temporaryPlayer); // Remove the player

if (userReceiver != null)
((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher()).sendDebugBungeecordReply(userReceiver, true, replyToPlayer);

if (userReceiver != null && replyToPlayer)
userReceiver.sendMessage(VelocityMessages.ADDCMD_DEBUG_BUNGEECORD_SYNC
.replace("%server%", sourceServer), true);
else
plugin.getLoggerManager().log(VelocityMessages.ADDCMD_DEBUG_BUNGEECORD_SYNC
.replace("%server%", sourceServer));
} else {
if (userReceiver != null)
((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher()).sendDebugBungeecordReply(userReceiver, false, replyToPlayer);

if (userReceiver != null && replyToPlayer)
userReceiver.sendMessage(VelocityMessages.ADDCMD_DEBUG_BUNGEECORD_NOT_SYNC
.replace("%server%", sourceServer), true);
else
plugin.getLoggerManager().log(VelocityMessages.ADDCMD_DEBUG_BUNGEECORD_NOT_SYNC
.replace("%server%", sourceServer));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,31 @@ public static void teleportToPartyHome(PartiesPlugin plugin, User player, PartyP
boolean serverChange = false;
RegisteredServer server = ((ADPVelocityBootstrap) plugin.getBootstrap()).getServer().getServer(home.getServer()).orElse(null);

if (server == null) {
plugin.getLoggerManager().logError(String.format(PartiesConstants.DEBUG_CMD_HOME_NO_SERVER, home));
return;
}

IPlayerPreHomeEvent partiesPreHomeEvent = plugin.getEventManager().preparePlayerPreHomeEvent(partyPlayer, party, home);
plugin.getEventManager().callEvent(partiesPreHomeEvent);
if (!partiesPreHomeEvent.isCancelled()) {
if (((VelocityUser) player).getServer() == null)
return; // Cannot get player server

if (VelocityConfigParties.ADDITIONAL_HOME_CROSS_SERVER && !((VelocityUser) player).getServerName().equalsIgnoreCase(home.getServer())) {
if (server == null) {
plugin.getLoggerManager().logError(String.format(PartiesConstants.DEBUG_CMD_HOME_NO_SERVER, home));
return;
}

((VelocityUser) player).connectTo(server);

serverChange = true;
}

String message = plugin.getMessageUtils().convertPlaceholders(Messages.ADDCMD_HOME_TELEPORTED, partyPlayer, party);

if (serverChange) {
plugin.getScheduler().scheduleAsyncLater(() -> ((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher())
.sendHomeTeleport(player, home, message),
.sendHomeTeleport(player, home, message, server),
VelocityConfigParties.ADDITIONAL_HOME_CROSS_SERVER_DELAY, TimeUnit.MILLISECONDS);
} else {
((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher())
.sendHomeTeleport(player, home, message);
.sendHomeTeleport(player, home, message, server);
}

IPlayerPostHomeEvent partiesPostHomeEvent = plugin.getEventManager().preparePlayerPostHomeEvent(partyPlayer, party, home);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alessiodp.core.common.ADPPlugin;
import com.alessiodp.core.common.commands.utils.ADPMainCommand;
import com.alessiodp.core.common.user.User;
import com.alessiodp.parties.common.commands.sub.CommandSetHome;
import com.alessiodp.parties.common.parties.objects.PartyImpl;
import com.alessiodp.parties.common.players.objects.PartyPlayerImpl;
Expand All @@ -19,13 +20,14 @@ public VelocityCommandSetHome(ADPPlugin plugin, ADPMainCommand mainCommand) {

@Override
protected void getLocationAndSave(@NotNull PartyPlayerImpl sender, @NotNull PartyImpl party, @NotNull String name) {
User user = plugin.getPlayer(sender.getPlayerUUID());
Player player = ((VelocityPartiesBootstrap) plugin.getBootstrap()).getServer().getPlayer(sender.getPlayerUUID()).orElse(null);
if (player != null) {
if (user != null && player != null) {
ServerConnection serverConnection = player.getCurrentServer().orElse(null);
if (serverConnection != null) {
String serverName = serverConnection.getServerInfo().getName();

((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher()).sendAddHome(party, sender, name, serverName);
((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher()).sendAddHome(user, party, name, serverName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ public static void teleportSinglePlayer(PartiesPlugin plugin, PartyPlayerImpl pl
if (!partiesPreTeleportEvent.isCancelled()) {
velocityPlayer.getCurrentServer().ifPresent(serverConnection1 -> {
boolean serverChange = false;

if (!serverConnection1.getServer().equals(server)) {
serverChange = true;
velocityPlayer.createConnectionRequest(server);
velocityPlayer.createConnectionRequest(server).connect();
}

if (VelocityConfigParties.ADDITIONAL_TELEPORT_EXACT_LOCATION || serverChange) {
Expand All @@ -105,12 +104,12 @@ public static void teleportSinglePlayer(PartiesPlugin plugin, PartyPlayerImpl pl
// Teleports to the same location only if enabled
if (serverChange) {
plugin.getScheduler().scheduleAsyncLater(() -> ((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher())
.sendTeleport(velocityUser, targetPlayer),
.sendTeleport(velocityUser, targetPlayer, server),
VelocityConfigParties.ADDITIONAL_TELEPORT_EXACT_LOCATION_DELAY, TimeUnit.MILLISECONDS);

} else {
((VelocityPartiesMessageDispatcher) plugin.getMessenger().getMessageDispatcher())
.sendTeleport(velocityUser, targetPlayer);
.sendTeleport(velocityUser, targetPlayer, server);
}
}

Expand Down
Loading

0 comments on commit dc47e3f

Please sign in to comment.