Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 35 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,101 +1,51 @@
# ⚔️ BattlePass - Ultimate Progression Plugin for Minecraft (1.21+)
# BattlePass Fork (Paper 1.16.5 + Java 17)

> **The most advanced, feature-rich Battle Pass system for Spigot & Paper servers.**
> Engage your players with Daily Missions, Tiered Rewards, and a custom Currency Shop.
> **No config editing required** — manage everything via In-Game GUI!
Fork of BattlePass prepared for legacy Paper servers with cleaner config/gui structure.

![Java](https://img.shields.io/badge/Java-21-orange) ![Spigot](https://img.shields.io/badge/API-1.21-yellow) ![License](https://img.shields.io/badge/License-MIT-blue)
## Compatibility

---
- Java: `17`
- Server API: `Paper 1.16.5` (`paper-api:1.16.5-R0.1-SNAPSHOT`)
- Plugin `api-version`: `1.16`

## 🌟 Why Choose BattlePass?
Unlike other plugins, **BattlePass** focuses on ease of use for admins and engagement for players. It includes a powerful **In-Game Editor**, robust **MySQL Database** support for networks, and deep integrations with popular plugins like **MythicMobs**.
## What Is Included

### 🔥 Key Features
- Player GUI cleanup and localization split by language.
- Language switch in `config.yml`: `language: RU` or `language: ENG` (`EN` also works).
- Separate files:
- `messages_ru.yml` / `messages_en.yml`
- `gui_ru.yml` / `gui_en.yml`
- HEX color support:
- `&#RRGGBB`
- `<#RRGGBB>`
- Cleaner custom items config in GUI language files.
- Material display names localized by language (RU or readable EN).
- Config validation on startup/reload for common material/command mistakes.

* **🏆 Seasonal Progression System**
* Fully customizable tier system (default 54 levels).
* **Dual Reward Tracks**: Free Pass (for everyone) and Premium Pass (VIP/Paid).
* Automatic season reset options (Monthly or Duration-based).
## Build

* **🛠️ In-Game GUI Editor (No YAML needed!)**
* **Mission Editor**: Create, edit, or delete daily missions directly inside the game.
* **Rewards Editor**: Drag-and-drop items from your inventory to set rewards for any level.
```bash
mvn -DskipTests package
```

* **💾 Database & Sync Support**
* **SQLite** (Default): Plug and play for single servers.
* **MySQL**: Full support for syncing player progress, XP, and rewards across a BungeeCord/Velocity network.
Output jar:

* **📜 Dynamic Missions**
* **7 Daily Missions** generated randomly every day.
* **Mission Types**: Mining, Crafting, Fishing, Farming, Killing Mobs, Playtime, Walking Distance, and more!.
- `target/BattlePass-1.0.jar`

* **💰 Battle Coins & Shop**
* Players earn **Battle Coins** by ranking in the daily leaderboard.
* Spend coins in the customizable **Shop GUI** for exclusive items, XP boosts, or commands.
## Language Setup

* **🔌 Powerful Integrations**
* **PlaceholderAPI**: Full support for scoreboards, tabs, and chat.
* **MythicMobs**: Create missions to kill specific custom bosses or mobs.
In `config.yml`:

---
```yml
language: RU
```

## 📥 Installation
Available values:

1. Download `BattlePass.jar`.
2. Drop it into your server's `/plugins/` folder.
3. (Optional) Install **PlaceholderAPI** for placeholders.
4. Restart your server.
5. Enjoy! Config files (`config.yml`, `missions.yml`, `shop.yml`) will generate automatically.
- `RU`
- `ENG` (or `EN`)

---
## Notes

## 🎮 Commands & Permissions

| Command | Permission | Description |
| :--- | :--- | :--- |
| `/bp` or `/battlepass` | `battlepass.use` | Opens the main Battle Pass menu. |
| `/bp help` | `battlepass.use` | Shows the help menu. |
| `/bp giveitem <type> <player> <amount>` | `battlepass.admin` | Give special items (Premium Voucher, Coins, XP Boosts). |
| `/bp addpremium <player>` | `battlepass.admin` | Force unlock Premium Pass for a player. |
| `/bp addxp <player> <amount>` | `battlepass.admin` | Give XP to a player. |
| `/bp reset season` | `battlepass.admin` | Force reset the entire season progress. |
| `/bp reset missions` | `battlepass.admin` | Force generate new daily missions. |
| `/bp resetplayer <name>` | `battlepass.admin` | Reset battle pass progress for a player. |
| `/bp reload` | `battlepass.admin` | Reloads all configuration files. |

---

## 🧩 Placeholders (PAPI)

Add these to your scoreboard or tablist!

* `%battlepass_level%` - Player's current tier.
* `%battlepass_xp_progress%` - Formatted XP (e.g., 50/200).
* `%battlepass_premium_status%` - Returns "Active" or "Inactive".
* `%battlepass_season_time%` - Time remaining in the current season.
* `%battlepass_coins%` - Current Battle Coins balance.
* `%battlepass_daily_reward_available%` - Check if daily reward is ready ("Yes"/"No").

*(See `Placeholders.md` for the full list)*

---

## 📸 Screenshots

<img width="927" height="352" alt="image" src="https://github.com/user-attachments/assets/1ed73a90-6776-4746-a52a-7c57d4389cf9" />


---

<div align="center">
<p>I've just launched https://www.hytaleservers.it/</p>
<p>Are you working on a server? List it now for free and build your audience before launch.​</p>
</div>

---

<div align="center">
<p>Made with ❤️ by Lino</p>
<p>Found a bug? Report it in the Issues tab!</p>
</div>
- If your data folder already exists, new language files are auto-created only when missing.
- After language/config edits, use `/bp reload`.
28 changes: 14 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>BattlePass</name>

<properties>
<java.version>21</java.version>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -32,6 +32,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -52,8 +55,8 @@

<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
Expand All @@ -72,9 +75,9 @@

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -95,25 +98,22 @@
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
<scope>provided</scope>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.45.3.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
</project>
24 changes: 18 additions & 6 deletions src/main/java/com/Lino/battlePass/BattlePass.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.Lino.battlePass.listeners.EventManager;
import com.Lino.battlePass.tasks.BattlePassTask;
import com.Lino.battlePass.tasks.CoinsDistributionTask;
import com.Lino.battlePass.utils.GradientColorParser;
import org.bukkit.scheduler.BukkitRunnable;

import java.io.BufferedReader;
Expand Down Expand Up @@ -39,6 +40,7 @@ public class BattlePass extends JavaPlugin {
private BattlePassExpansion placeholderExpansion;
private MissionEditorManager missionEditorManager;
private SeasonRotationManager seasonRotationManager;
private ConfigValidator configValidator;

private boolean updateAvailable = false;
private String latestVersion = "";
Expand All @@ -49,6 +51,10 @@ public void onEnable() {
saveDefaultConfig();
saveResourceIfNotExists("missions.yml");
saveResourceIfNotExists("messages.yml");
saveResourceIfNotExists("messages_ru.yml");
saveResourceIfNotExists("messages_en.yml");
saveResourceIfNotExists("gui_ru.yml");
saveResourceIfNotExists("gui_en.yml");
saveResourceIfNotExists("BattlePassFREE.yml");
saveResourceIfNotExists("BattlePassPREMIUM.yml");
saveResourceIfNotExists("shop.yml");
Expand All @@ -60,6 +66,7 @@ public void onEnable() {
seasonRotationManager.createDefaultSeasonFolders();

configManager.reload();
GradientColorParser.setCleanMode(configManager.isCleanUiMode());

databaseManager = new DatabaseManager(this);
playerDataManager = new PlayerDataManager(this, databaseManager);
Expand All @@ -71,7 +78,8 @@ public void onEnable() {
guiManager = new GuiManager(this, playerDataManager, missionManager, rewardManager, messageManager, configManager);
rewardEditorManager = new RewardEditorManager(this);
missionEditorManager = new MissionEditorManager(this);
rewardEditorManager = new RewardEditorManager(this);
configValidator = new ConfigValidator(this);
configValidator.validateAll();

databaseManager.initialize().thenRun(() -> {
getServer().getScheduler().runTask(this, () -> {
Expand Down Expand Up @@ -212,9 +220,13 @@ public void reload() {
reloadConfig();
seasonRotationManager.reload();
configManager.reload();
GradientColorParser.setCleanMode(configManager.isCleanUiMode());
messageManager.reload();
rewardManager.loadRewards();
shopManager.reload();
if (configValidator != null) {
configValidator.validateAll();
}
guiManager.clearCache();
missionManager.recalculateResetTimeOnReload();

Expand All @@ -225,7 +237,7 @@ public void reload() {
int currentPage = 1;

for (int i = 1; i <= 6; i++) {
if (title.equals(messageManager.getMessage("gui.battlepass", "%page%", String.valueOf(i)))) {
if (title.equals(messageManager.getGuiMessage("gui.battlepass", "%page%", String.valueOf(i)))) {
isBattlePassGUI = true;
currentPage = i;
break;
Expand All @@ -238,17 +250,17 @@ public void reload() {
Bukkit.getScheduler().runTaskLater(this, () -> {
guiManager.openBattlePassGUI(player, page);
}, 1L);
} else if (title.equals(messageManager.getMessage("gui.leaderboard"))) {
} else if (title.equals(messageManager.getGuiMessage("gui.leaderboard"))) {
player.closeInventory();
Bukkit.getScheduler().runTaskLater(this, () -> {
guiManager.openLeaderboardGUI(player);
}, 1L);
} else if (title.equals(messageManager.getMessage("gui.missions"))) {
} else if (title.equals(messageManager.getGuiMessage("gui.missions"))) {
player.closeInventory();
Bukkit.getScheduler().runTaskLater(this, () -> {
guiManager.openMissionsGUI(player);
}, 1L);
} else if (title.equals(messageManager.getMessage("gui.shop"))) {
} else if (title.equals(messageManager.getGuiMessage("gui.shop"))) {
player.closeInventory();
Bukkit.getScheduler().runTaskLater(this, () -> {
guiManager.openShopGUI(player);
Expand Down Expand Up @@ -336,4 +348,4 @@ public RewardEditorManager getRewardEditorManager() {
public SeasonRotationManager getSeasonRotationManager() {
return seasonRotationManager;
}
}
}
21 changes: 14 additions & 7 deletions src/main/java/com/Lino/battlePass/commands/BattlePassCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ private boolean handleExcludeTopCommand(CommandSender sender, String[] args, boo
}

if (args.length < 2) {
sender.sendMessage(plugin.getMessageManager().getPrefix() + "Usage: /battlepass " + (exclude ? "excludefromtop" : "includetop") + " <player>");
String commandName = exclude ? "excludefromtop" : "includetop";
sender.sendMessage(plugin.getMessageManager().getPrefix() +
plugin.getMessageManager().getMessage("messages.top.usage", "%command%", commandName));
return true;
}

Expand All @@ -485,8 +487,13 @@ private boolean handleExcludeTopCommand(CommandSender sender, String[] args, boo
plugin.getPlayerDataManager().markForSave(target.getUniqueId());
plugin.getPlayerDataManager().savePlayer(target.getUniqueId());

String status = exclude ? "excluded from" : "included in";
sender.sendMessage(plugin.getMessageManager().getPrefix() + "Player " + target.getName() + " is now " + status + " the top leaderboard.");
String status = exclude
? plugin.getMessageManager().getMessage("messages.top.excluded-status")
: plugin.getMessageManager().getMessage("messages.top.included-status");
sender.sendMessage(plugin.getMessageManager().getPrefix() +
plugin.getMessageManager().getMessage("messages.top.updated",
"%player%", target.getName(),
"%status%", status));

return true;
}
Expand Down Expand Up @@ -527,15 +534,15 @@ private boolean handleGiveItemCommand(CommandSender sender, String[] args) {
switch (itemType) {
case "premium":
item = plugin.getCustomItemManager().createPremiumPassItem(amount);
itemName = "Premium Pass Voucher";
itemName = plugin.getMessageManager().getMessage("messages.items.names.premium-pass");
break;
case "coins":
item = plugin.getCustomItemManager().createBattleCoinsItem(amount);
itemName = "Battle Coin Token";
itemName = plugin.getMessageManager().getMessage("messages.items.names.battle-coin");
break;
case "levelboost":
item = plugin.getCustomItemManager().createLevelBoostItem(amount);
itemName = "Experience Boost Elixir";
itemName = plugin.getMessageManager().getMessage("messages.items.names.level-boost");
break;
default:
sender.sendMessage(plugin.getMessageManager().getPrefix() +
Expand Down Expand Up @@ -602,4 +609,4 @@ private void checkLevelUp(Player player, PlayerData data, int xpPerLevel) {
plugin.getPlayerDataManager().markForSave(player.getUniqueId());
}
}
}
}
8 changes: 3 additions & 5 deletions src/main/java/com/Lino/battlePass/gui/BaseGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ protected ItemStack createItem(Material material, String displayName, List<Strin
protected ItemStack createBackButton() {
ItemStack back = new ItemStack(Material.BARRIER);
ItemMeta meta = back.getItemMeta();
meta.setDisplayName(plugin.getMessageManager().getMessage("items.back-button.name"));
meta.setDisplayName(plugin.getMessageManager().getGuiMessage("items.back-button.name"));

List<String> lore = new ArrayList<>();
for (String line : plugin.getMessageManager().getMessagesConfig().getStringList("items.back-button.lore")) {
lore.add(GradientColorParser.parse(line));
}
lore.addAll(plugin.getMessageManager().getGuiMessages("items.back-button.lore"));
meta.setLore(lore);
back.setItemMeta(meta);

Expand All @@ -61,4 +59,4 @@ protected ItemStack createBackButton() {
protected String formatMaterial(Material material) {
return material.name().toLowerCase().replace("_", " ");
}
}
}
Loading