From 92067f137a4f4411c8bb6f91ada71064489ee729 Mon Sep 17 00:00:00 2001 From: Simonsator <00pflaume@gmail.com> Date: Sat, 20 Aug 2022 01:54:15 +0200 Subject: [PATCH 1/5] Added Party and Friends Extended for Bungee/Velocity Support This commit adds Party and Friends Extended for Bungee/Velocity support using the [Party-API for Spigot-Plugins](https://www.spigotmc.org/resources/spigot-party-api-for-party-and-friends-extended-redisbungee-required.39751/) --- MMOCore-API/pom.xml | 15 +++++- .../mmocore/party/PartyModuleType.java | 6 +-- .../compat/PAFProxyExtendedPartyModule.java | 52 +++++++++++++++++++ MMOCore-Dist/src/main/resources/config.yml | 1 + 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java diff --git a/MMOCore-API/pom.xml b/MMOCore-API/pom.xml index 3e361016..14e1cc33 100644 --- a/MMOCore-API/pom.xml +++ b/MMOCore-API/pom.xml @@ -204,7 +204,13 @@ - + + de.simonsator + Party-and-Friends-MySQL-Edition-Spigot-API + 1.5.3 + provided + + de.simonsator DevelopmentPAFSpigot @@ -212,6 +218,13 @@ provided + + de.simonsator + Spigot-Party-API-For-RedisBungee + 1.0.3-SNAPSHOT + provided + + com.alessiodp Parties diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java index d6a10708..088a867a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java @@ -1,10 +1,7 @@ package net.Indyuce.mmocore.party; -import net.Indyuce.mmocore.party.compat.DungeonsXLPartyModule; -import net.Indyuce.mmocore.party.compat.McMMOPartyModule; -import net.Indyuce.mmocore.party.compat.PAFPartyModule; +import net.Indyuce.mmocore.party.compat.*; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; -import net.Indyuce.mmocore.party.compat.PartiesPartyModule; import org.bukkit.Bukkit; import javax.inject.Provider; @@ -16,6 +13,7 @@ public enum PartyModuleType { MMOCORE("MMOCore", MMOCorePartyModule::new), PARTIES("Parties", PartiesPartyModule::new), PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new), + PARTY_AND_FRIENDS_EXTENDED_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyExtendedPartyModule::new), ; private final String pluginName; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java new file mode 100644 index 00000000..c943c2f8 --- /dev/null +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java @@ -0,0 +1,52 @@ +package net.Indyuce.mmocore.party.compat; + +import de.simonsator.partyandfriends.spigot.api.pafplayers.PAFPlayer; +import de.simonsator.partyandfriends.spigot.api.pafplayers.PAFPlayerManager; +import de.simonsator.partyandfriends.spigot.api.party.PartyManager; +import de.simonsator.partyandfriends.spigot.api.party.PlayerParty; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.party.AbstractParty; +import net.Indyuce.mmocore.party.PartyModule; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class PAFProxyExtendedPartyModule implements PartyModule { + + @Nullable + @Override + public AbstractParty getParty(PlayerData playerData) { + PlayerParty party = PartyManager.getInstance().getParty(PAFPlayerManager.getInstance().getPlayer(playerData.getUniqueId())); + return party == null ? null : new CustomParty(party); + } + + class CustomParty implements AbstractParty { + private final PlayerParty party; + + public CustomParty(PlayerParty party) { + this.party = party; + } + + @Override + public boolean hasMember(Player player) { + return party.isInParty(PAFPlayerManager.getInstance().getPlayer(player.getUniqueId())); + } + + @Override + public List getOnlineMembers() { + List list = new ArrayList<>(); + + for (PAFPlayer online : party.getAllPlayers()) + list.add(PlayerData.get(online.getUniqueId())); + + return list; + } + + @Override + public int countMembers() { + return party.getAllPlayers().size(); + } + } +} diff --git a/MMOCore-Dist/src/main/resources/config.yml b/MMOCore-Dist/src/main/resources/config.yml index cb4e59a4..c05749b2 100644 --- a/MMOCore-Dist/src/main/resources/config.yml +++ b/MMOCore-Dist/src/main/resources/config.yml @@ -58,6 +58,7 @@ protect-custom-mine: false # - dungeonsxl # - parties # - party_and_friends +# - party_and_friends_extended_bungeecord_velocity # - mcmmo party-plugin: mmocore From 9bfc5b4ccd75b01df60e4a9b3c9706b63d59805c Mon Sep 17 00:00:00 2001 From: Simonsator <00pflaume@gmail.com> Date: Mon, 29 Aug 2022 13:13:03 +0200 Subject: [PATCH 2/5] Fixed folders in gitignore These folders should not only be ignored in the top directory, but also in all sub directories --- .gitignore | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 15a72642..e769c860 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -/bin/ -/.m2/ -/target/ -/.settings/ -/.idea/ +bin/ +.m2/ +target/ +.settings/ +.idea/ .classpath .project MMOCore.eml From 357d41b61787e5699fb0efc404ffa9813789119d Mon Sep 17 00:00:00 2001 From: Simonsator <00pflaume@gmail.com> Date: Mon, 29 Aug 2022 13:14:19 +0200 Subject: [PATCH 3/5] Updated Party and Friends dependencies --- MMOCore-API/pom.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MMOCore-API/pom.xml b/MMOCore-API/pom.xml index 14e1cc33..352fa758 100644 --- a/MMOCore-API/pom.xml +++ b/MMOCore-API/pom.xml @@ -204,13 +204,6 @@ - - de.simonsator - Party-and-Friends-MySQL-Edition-Spigot-API - 1.5.3 - provided - - de.simonsator DevelopmentPAFSpigot @@ -220,8 +213,15 @@ de.simonsator - Spigot-Party-API-For-RedisBungee - 1.0.3-SNAPSHOT + Party-and-Friends-MySQL-Edition-Spigot-API + 1.5.4-RELEASE + provided + + + + de.simonsator + spigot-party-api-for-party-and-friends + 1.0.4-RELEASE provided From c112e921fe881e49bb4b8f602c6df0f75bb42980 Mon Sep 17 00:00:00 2001 From: Simonsator <00pflaume@gmail.com> Date: Mon, 29 Aug 2022 13:35:32 +0200 Subject: [PATCH 4/5] More understandable party-plugin Added instructions on what party plugin to use in the config.yml --- .../main/java/net/Indyuce/mmocore/party/PartyModuleType.java | 2 +- MMOCore-Dist/src/main/resources/config.yml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java index 088a867a..1a76eae8 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java @@ -13,7 +13,7 @@ public enum PartyModuleType { MMOCORE("MMOCore", MMOCorePartyModule::new), PARTIES("Parties", PartiesPartyModule::new), PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new), - PARTY_AND_FRIENDS_EXTENDED_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyExtendedPartyModule::new), + PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyExtendedPartyModule::new), ; private final String pluginName; diff --git a/MMOCore-Dist/src/main/resources/config.yml b/MMOCore-Dist/src/main/resources/config.yml index c05749b2..1c928261 100644 --- a/MMOCore-Dist/src/main/resources/config.yml +++ b/MMOCore-Dist/src/main/resources/config.yml @@ -1,4 +1,3 @@ - # DO NOT TOUCH config-version: 9 @@ -57,8 +56,8 @@ protect-custom-mine: false # - mmocore # - dungeonsxl # - parties -# - party_and_friends -# - party_and_friends_extended_bungeecord_velocity +# - party_and_friends (Use this one if you are using Party and Friends Extended for Spigot) +# - party_and_friends_bungeecord_velocity (Use this one if you are using Party and Friends For Bungeecord, Party and Friends For Velocity or Party and Friends Extended Edition for Bungeecord/Velocity. This one requires https://www.spigotmc.org/resources/spigot-party-api-for-party-and-friends.39751/ to be installed) # - mcmmo party-plugin: mmocore From ecde331aba52218af3aed6b4f4079dd9f472e18c Mon Sep 17 00:00:00 2001 From: Simonsator <00pflaume@gmail.com> Date: Mon, 29 Aug 2022 13:41:14 +0200 Subject: [PATCH 5/5] Renamed PAF proxy party module --- .../main/java/net/Indyuce/mmocore/party/PartyModuleType.java | 2 +- ...AFProxyExtendedPartyModule.java => PAFProxyPartyModule.java} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/{PAFProxyExtendedPartyModule.java => PAFProxyPartyModule.java} (95%) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java index 1a76eae8..ee001aac 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java @@ -13,7 +13,7 @@ public enum PartyModuleType { MMOCORE("MMOCore", MMOCorePartyModule::new), PARTIES("Parties", PartiesPartyModule::new), PARTY_AND_FRIENDS("PartyAndFriends", PAFPartyModule::new), - PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyExtendedPartyModule::new), + PARTY_AND_FRIENDS_BUNGEECORD_VELOCITY("Spigot-Party-API-PAF", PAFProxyPartyModule::new), ; private final String pluginName; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyPartyModule.java similarity index 95% rename from MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java rename to MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyPartyModule.java index c943c2f8..db9a3cbd 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyExtendedPartyModule.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PAFProxyPartyModule.java @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class PAFProxyExtendedPartyModule implements PartyModule { +public class PAFProxyPartyModule implements PartyModule { @Nullable @Override