Skip to content

Commit

Permalink
Merge pull request #16 from JT122406/development
Browse files Browse the repository at this point in the history
Party and Friends Support and Build fixes
  • Loading branch information
andrei1058 committed Feb 19, 2022
2 parents 712be08 + bb71027 commit acd759d
Show file tree
Hide file tree
Showing 10 changed files with 317 additions and 36 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ development ]
pull_request:
branches: [ development ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17.0.2
uses: actions/setup-java@v2
with:
java-version: '17.0.2'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
8 changes: 2 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>alessioDP-releases</id>
<url>https://repo.alessiodp.com/releases/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -48,7 +44,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.9.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -105,4 +101,4 @@
<url>ftp://andrei1058.com/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>
78 changes: 57 additions & 21 deletions proxy-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,76 @@

<repositories>
<repository>
<id>andrei1058-repo</id>
<url>http://repo.andrei1058.com/releases</url>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>simonsators-repo</id>
<url>https://simonsator.de/repo/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
<id>bungee-chat</id>
<url>https://oss.sonatype.org/content/repositories/public/</url>
</repository>
<repository>
<id>andrei1058-repo2</id>
<url>https://repo.andrei1058.com/snapshots/</url>
<id>alessiodp-repo</id>
<url>https://repo.alessiodp.com/releases/</url>
</repository>
<repository>
<id>bungee-chat</id>
<url>https://oss.sonatype.org/content/repositories/public/</url>
<id>andrei1058-repo</id>
<url>https://repo.andrei1058.com/releases</url>
</repository>
<repository>
<id>andrei1058-repo2</id>
<url>https://repo.andrei1058.com/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.simonsator</groupId>
<artifactId>Party-and-Friends-MySQL-Edition-Spigot-API</artifactId>
<version>1.5.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>be.maximvdw</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.simonsator</groupId>
<artifactId>Spigot-Party-API-For-RedisBungee</artifactId>
<version>1.0.2-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>be.maximvdw</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alessiodp.parties</groupId>
<artifactId>parties-api</artifactId>
<version>3.1.12</version>
<version>3.1.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.simonsator</groupId>
<artifactId>DevelopmentPAFSpigot</artifactId>
<version>1.0.65</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -99,7 +137,7 @@
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -144,27 +182,25 @@
<version>16.0.2</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.common/google-collect -->
<!--<dependency>
<groupId>com.google.common</groupId>
<artifactId>google-collect</artifactId>
<version>0.5</version>
</dependency>-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- hubmc.ro parties -->
<dependency>
<groupId>me.gamer.party</groupId>
<artifactId>party</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<build>
<resources>
<resource>
Expand Down Expand Up @@ -195,7 +231,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.3.0-SNAPSHOT</version>
<configuration>
<relocations>
<relocation>
Expand All @@ -219,4 +255,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@
import com.andrei1058.bedwars.proxy.configuration.BedWarsConfig;
import com.andrei1058.bedwars.proxy.configuration.ConfigPath;
import com.andrei1058.bedwars.proxy.configuration.SoundsConfig;
import com.andrei1058.bedwars.proxy.database.*;
import com.andrei1058.bedwars.proxy.language.LangListeners;
import com.andrei1058.bedwars.proxy.language.LanguageManager;
import com.andrei1058.bedwars.proxy.levels.Level;
import com.andrei1058.bedwars.proxy.levels.internal.InternalLevel;
import com.andrei1058.bedwars.proxy.levels.internal.LevelListeners;
import com.andrei1058.bedwars.proxy.party.Internal;
import com.andrei1058.bedwars.proxy.party.Parties;
import com.andrei1058.bedwars.proxy.party.Party;
import com.andrei1058.bedwars.proxy.party.Partys;
import com.andrei1058.bedwars.proxy.party.*;
import com.andrei1058.bedwars.proxy.socketmanager.ServerSocketTask;
import com.andrei1058.bedwars.proxy.socketmanager.TimeOutTask;
import com.andrei1058.bedwars.proxy.support.papi.SupportPAPI;
import com.andrei1058.bedwars.proxy.database.*;
import com.andrei1058.spigot.updater.SpigotUpdater;
import com.andrei1058.spigot.versionsupport.BlockSupport;
import com.andrei1058.spigot.versionsupport.ItemStackSupport;
Expand Down Expand Up @@ -97,12 +94,18 @@ public void onEnable() {

//Party support
if (config.getYml().getBoolean(ConfigPath.GENERAL_CONFIGURATION_ALLOW_PARTIES)) {
if (Bukkit.getPluginManager().getPlugin("Parties") != null) {
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Parties")) {
getLogger().info("Hook into Parties (by AlessioDP) support!");
party = new Parties();
} else if (Bukkit.getPluginManager().getPlugin("Partys") != null) {
} else if (Bukkit.getServer().getPluginManager().isPluginEnabled("Partys")) {
getLogger().info("Hook into Parties (by Retr0) support!");
party = new Partys();
} else if (Bukkit.getServer().getPluginManager().isPluginEnabled("Spigot-Party-API-PAF")) {
getLogger().info("Hook into Party and Friends Extended Edition for BungeeCord (by Simonsator) support!");
party = new PAFBungeeCordParty();
} else if (Bukkit.getServer().getPluginManager().isPluginEnabled("PartyAndFriends")) {
getLogger().info("Hook into Party and Friends for Spigot (by Simonsator) support!");
party = new PAF();
}
}
if (party == null) {
Expand Down Expand Up @@ -215,7 +218,7 @@ public ArenaUtil getArenaUtil() {
return ArenaManager.getInstance();
}

public static BedWars getAPI(){
public static BedWars getAPI() {
return BedWarsProxy.plugin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import com.andrei1058.bedwars.proxy.api.*;
import com.andrei1058.bedwars.proxy.api.event.ArenaCacheRemoveEvent;
import com.andrei1058.bedwars.proxy.BedWarsProxy;
import com.andrei1058.bedwars.proxy.configuration.ConfigPath;
import com.andrei1058.bedwars.proxy.language.LanguageManager;
import com.andrei1058.bedwars.proxy.socketmanager.ArenaSocketTask;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.bukkit.configuration.file.YamlConfiguration;

import java.util.*;

import static com.andrei1058.bedwars.proxy.BedWarsProxy.config;
import static com.andrei1058.bedwars.proxy.BedWarsProxy.getParty;

public class ArenaManager implements BedWars.ArenaUtil {
Expand Down Expand Up @@ -43,7 +46,9 @@ public void registerArena(@NotNull CachedArena arena) {
}

public CachedArena getArena(String server, String remoteIdentifier) {

List<CachedArena> arenaList = getArenas();

for (int i=0; i<arenaList.size(); i++) {
if (i >= arenaList.size()) break;
CachedArena ca = arenaList.get(i);
Expand Down Expand Up @@ -115,12 +120,19 @@ public boolean joinRandomFromGroup(@NotNull Player p, String group) {
p.sendMessage(LanguageManager.get().getMsg(p, Messages.COMMAND_JOIN_DENIED_NOT_PARTY_LEADER));
return false;
}

List<CachedArena> arenaList = new ArrayList<>();
getArenas().forEach(a -> {
if (a.getArenaGroup().equalsIgnoreCase(group)) arenaList.add(a);
});
arenaList.sort(getComparator());

//shuffle if determined in config
if (config.getYml().getBoolean(ConfigPath.GENERAL_CONFIGURATION_RANDOMARENAS)){
Collections.shuffle(arenaList);
}


int amount = BedWarsProxy.getParty().hasParty(p.getUniqueId()) ? BedWarsProxy.getParty().getMembers(p.getUniqueId()).size() : 1;
for (CachedArena a : arenaList) {
if (a.getCurrentPlayers() >= a.getMaxPlayers()) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public BedWarsConfig() {
yml.addDefault(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP, "yourServer.com");
yml.addDefault("storeLink", "https://www.spigotmc.org/resources/authors/39904/");
yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_ALLOW_PARTIES, true);
yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RANDOMARENAS, true);
yml.addDefault("database.enable", false);
yml.addDefault("database.host", "localhost");
yml.addDefault("database.database", "bedWars");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class ConfigPath {

public static final String GENERAL_CONFIGURATION_ALLOW_PARTIES = "allow-parties";
public static final String GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP = "server-ip";
public static final String GENERAL_CONFIGURATION_RANDOMARENAS = "random-selection";

public static final String GENERAL_CONFIGURATION_ARENA_SELECTOR_PATH = "arena-gui";
public static final String GENERAL_CONFIGURATION_ARENA_SELECTOR_SETTINGS_SIZE = GENERAL_CONFIGURATION_ARENA_SELECTOR_PATH + ".settings.inv-size";
Expand Down

0 comments on commit acd759d

Please sign in to comment.