Skip to content

Commit

Permalink
Merge branch 'master' into mv-teleport-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterman1001 authored Jun 26, 2024
2 parents 1d6a457 + d81d753 commit 501c180
Show file tree
Hide file tree
Showing 126 changed files with 1,883 additions and 1,079 deletions.
5 changes: 5 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 1.3.9 Release (18.06.2024)
* Major API Revamp for exposing methods that were not exposed previously to external plugins
* Fixed move false not working
* Added support for 1.20.5, 1.20.6, 1.21

### 1.3.8 Release (24.04.2024)
* Relocated NashornScriptEngine to not conflict with other plugins with ScriptEngine
* Fixed Arena stops if arena players are less than defined min players (developers: if needed plugin should call stopGame)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,26 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* All arena in-game related events.
*/
plugins {
id("plugily.projects.java-conventions")
id("com.github.johnrengelman.shadow") version "8.1.1"
java
}

dependencies {
implementation("me.tigerhix.lib:scoreboard:1.4.4") { isTransitive = false }
compileOnly(project(":MiniGamesBox-Database", "shadow"))
compileOnly("com.github.cryptomorin:XSeries:9.10.0") { isTransitive = false }
}

tasks{
build {
dependsOn(shadowJar)
}

shadowJar {
archiveClassifier.set("")
}
}

package plugily.projects.minigamesbox.classic.api.event.game;
description = "MiniGamesBox-API"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package plugily.projects.minigamesbox.api;

import org.bukkit.configuration.file.FileConfiguration;
import plugily.projects.minigamesbox.api.arena.IPluginArenaRegistry;
import plugily.projects.minigamesbox.api.handlers.language.ILanguageManager;
import plugily.projects.minigamesbox.api.kit.IKitRegistry;
import plugily.projects.minigamesbox.api.preferences.IConfigPreferences;
import plugily.projects.minigamesbox.api.user.IUserManager;
import plugily.projects.minigamesbox.api.utils.misc.IDebugger;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public interface IPluginMain {

FileConfiguration getConfig();

String getName();

IDebugger getDebugger();

IConfigPreferences getConfigPreferences();

IUserManager getUserManager();

String getPluginNamePrefix();

String getPluginNamePrefixLong();

String getCommandAdminPrefix();

String getCommandAdminPrefixLong();

IPluginArenaRegistry getArenaRegistry();

IKitRegistry getKitRegistry();

ILanguageManager getLanguageManager();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package plugily.projects.minigamesbox.api.arena;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public enum IArenaState {

WAITING_FOR_PLAYERS("Waiting"),
STARTING("Starting"),
FULL_GAME("Full-Game"),
IN_GAME("In-Game"),
ENDING("Ending"),
RESTARTING("Restarting");

private final String formattedName;

IArenaState(String formattedName) {
this.formattedName = formattedName;
}

public String getFormattedName() {
return formattedName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
package plugily.projects.minigamesbox.api.arena;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import plugily.projects.minigamesbox.api.IPluginMain;
import plugily.projects.minigamesbox.api.arena.managers.IBossbarManager;
import plugily.projects.minigamesbox.api.arena.managers.IPluginMapRestorerManager;
import plugily.projects.minigamesbox.api.arena.managers.IPluginScoreboardManager;
import plugily.projects.minigamesbox.api.events.game.PlugilyGameStateChangeEvent;

import java.util.List;
import java.util.Set;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public interface IPluginArena {

/**
* Returns whether option value is true or false
*
* @param name option to get value from
* @return true or false based on user configuration
*/
Integer getArenaOption(String name);

boolean isReady();

void setReady(boolean ready);

void setForceStart(boolean forceStart);

/**
* Returns boss bar of the game.
* Please use doBarAction if possible
*
* @return game boss bar manager
* @see IBossbarManager
*/
IBossbarManager getBossbarManager();

/**
* Get arena identifier used to get arenas by string.
*
* @return arena name
* @see IPluginArenaRegistry#getArena(String)
*/
String getId();

int getMinimumPlayers();

/**
* Get arena map name.
*
* @return arena map name, <b>it's not arena id</b>
* @see #getId()
*/
String getMapName();

/**
* Set arena map name.
*
* @param mapName new map name, [b]it's not arena id[/b]
*/
void setMapName(String mapName);

/**
* Get timer of arena.
*
* @return timer of lobby time / time to next wave
*/
int getTimer();

/**
* Modify game timer.
*
* @param timer timer of lobby / time to next wave
*/
void setTimer(int timer);

/**
* Modify game timer.
*
* @param timer timer of lobby / time to next wave
* @param forceArenaTimer should the timer be forced
*/
void setTimer(int timer, boolean forceArenaTimer);

int getMaximumPlayers();

IPluginMapRestorerManager getMapRestorerManager();

/**
* Gets the current arena state
* @return The current arena state
*/
@NotNull IArenaState getArenaState();

/**
* Set game state of arena.
* Calls VillageGameStateChangeEvent
*
* @param ArenaState new game state of arena
* @param forceArenaState should it force the arenaState?
* @see IArenaState
* @see PlugilyGameStateChangeEvent
*/
void setArenaState(@NotNull IArenaState ArenaState, boolean forceArenaState);

/**
* Set game state of arena.
* Calls VillageGameStateChangeEvent
*
* @param ArenaState new game state of arena
* @see IArenaState
* @see PlugilyGameStateChangeEvent
*/
void setArenaState(@NotNull IArenaState ArenaState);


/**
* Gets all the players in the arena
* @return a set containing all the players
*/
@NotNull Set<Player> getPlayers();

/**
* Get spectator location of arena.
*
* @return end location of arena
*/
@Nullable Location getSpectatorLocation();

/**
* Set spectator location of arena.
*
* @param spectatorLoc new end location of arena
*/
void setSpectatorLocation(Location spectatorLoc);

Location getLobbyLocation();

void setLobbyLocation(Location loc);

Location getStartLocation();

void setStartLocation(Location location);

void teleportToEndLocation(Player player);

Location getEndLocation();

Location getLocation(GameLocation gameLocation);

IPluginScoreboardManager getScoreboardManager();

@NotNull List<Player> getPlayersLeft();

/**
* Returns the plugin main class
* @return plugin main
*/
IPluginMain getPlugin();

enum IBarAction {
ADD, REMOVE;
}

enum GameLocation {
START, LOBBY, END, SPECTATOR
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package plugily.projects.minigamesbox.api.arena;

import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public interface IPluginArenaRegistry {
/**
* Checks if player is in any arena
*
* @param player player to check
* @return true when player is in arena, false if otherwise
*/
boolean isInArena(@NotNull Player player);

/**
* Returns arena where the player is
*
* @param player target player
* @return Arena or null if not playing
* @see #isInArena(Player) to check if player is playing
*/
@Nullable IPluginArena getArena(Player player);

/**
* Returns arena based by ID
*
* @param id name of arena
* @return Arena or null if not found
*/
@Nullable IPluginArena getArena(String id);

int getArenaPlayersOnline();

void registerArena(IPluginArena arena);

void unregisterArena(IPluginArena arena);

void registerArenas();

void registerArena(String key);

@NotNull List<IPluginArena> getArenas();

List<World> getArenaIngameWorlds();

List<World> getArenaWorlds();

void shuffleBungeeArena();

int getBungeeArena();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package plugily.projects.minigamesbox.api.arena.managers;

import org.bukkit.entity.Player;
import plugily.projects.minigamesbox.api.arena.IPluginArena;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public interface IBossbarManager {
void bossBarUpdate();

/**
* Executes boss bar action for arena
*
* @param action add or remove a player from boss bar
* @param player player
*/
void doBarAction(IPluginArena.IBarAction action, Player player);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package plugily.projects.minigamesbox.api.arena.managers;

/**
* @author Lagggpixel
* @since April 24, 2024
*/
public interface IPluginMapRestorerManager {
void fullyRestoreArena();
}
Loading

0 comments on commit 501c180

Please sign in to comment.