Skip to content

Commit

Permalink
Fixed new kits integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigerpanzer02 committed Oct 15, 2023
1 parent df02ef9 commit 7e2882c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 121 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 2.0.2 Release
* Fixed block breakage on bridge
* Fixed blindness after choosing base if arena border isn't inside spawn
* Added new kits.yml where you can edit all kits file based (patreon: in-game gui based)

### 2.0.0 Release (07.08.2023)
* Added up to 1.20 compatibility
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
implementation("plugily.projects:MiniGamesBox-Classic:1.3.2-SNAPSHOT13") { isTransitive = false }
implementation("plugily.projects:MiniGamesBox-Classic:1.3.2-SNAPSHOT16") { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
Expand Down
29 changes: 2 additions & 27 deletions src/main/java/plugily/projects/thebridge/Main.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package plugily.projects.thebridge;

import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.jetbrains.annotations.TestOnly;
import plugily.projects.minigamesbox.classic.PluginMain;
import plugily.projects.minigamesbox.classic.handlers.setup.SetupInventory;
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginSetupCategoryManager;
import plugily.projects.minigamesbox.classic.kits.KitRegistry;
import plugily.projects.minigamesbox.classic.utils.configuration.ConfigUtils;
import plugily.projects.minigamesbox.classic.utils.services.metrics.Metrics;
import plugily.projects.thebridge.arena.*;
import plugily.projects.thebridge.arena.base.BaseMenuHandler;
Expand All @@ -23,8 +20,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;

/**
* Created by Tigerpanzer_02 on 13.03.2022
Expand All @@ -35,7 +30,6 @@ public class Main extends PluginMain {
private ArenaManager arenaManager;
private ArgumentsRegistry argumentsRegistry;
private BaseMenuHandler baseMenuHandler;
private KitRegistry kitRegistry;

@TestOnly
public Main() {
Expand Down Expand Up @@ -88,22 +82,8 @@ public void addKits() {
List<String> optionalConfigurations = new ArrayList<>();
optionalConfigurations.add("bow-cooldown");

FileConfiguration kitsConfig = ConfigUtils.getConfig(this, "kits");

if (!Objects.equals(kitsConfig.getString("Do-Not-Edit.File-Version"), "2")) {
getLogger().log(Level.SEVERE, "Your kits.yml config is outdated. Please update it.");
getLogger().log(Level.SEVERE, "Cause: File-Version is not 2");
return;
}
if (!Objects.equals(kitsConfig.getString("Do-Not-Edit.Core-Version"), "1")) {
getLogger().log(Level.SEVERE, "Your kits.yml config is outdated. Please update it.");
getLogger().log(Level.SEVERE, "Cause: Core-Version is not 1");
return;
}

KitRegistry.setHandleItem((player, item) -> KitUtils.handleItem(this, player, item));
kitRegistry = new KitRegistry(this);
kitRegistry.registerKits(optionalConfigurations);
getKitRegistry().setHandleItem((player, item) -> KitUtils.handleItem(this, player, item));
getKitRegistry().registerKits(optionalConfigurations);
getDebugger().debug("Kit adding finished took {0}ms", System.currentTimeMillis() - start);
}

Expand Down Expand Up @@ -141,9 +121,4 @@ public BaseMenuHandler getBaseMenuHandler() {
public PluginSetupCategoryManager getSetupCategoryManager(SetupInventory setupInventory) {
return new SetupCategoryManager(setupInventory);
}

@Override
public plugily.projects.minigamesbox.classic.kits.KitRegistry getKitRegistry() {
return kitRegistry;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,53 +51,6 @@ public void registerMessages() {
getMessageManager().registerMessage("BASES_TEAM_CHOOSE", new Message("Bases.Team.Choose", ""));
getMessageManager().registerMessage("BASES_TEAM_MEMBER", new Message("Bases.Team.Member", ""));
getMessageManager().registerMessage("BASES_COLORS", new Message("Bases.Colors", ""));
//BRIDGE

getMessageManager().registerMessage("KIT_CONTENT_BRIDGE_NAME", new Message("Kit.Content.Bridge.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_BRIDGE_DESCRIPTION", new Message("Kit.Content.Bridge.Description", ""));

//KNIGHT

getMessageManager().registerMessage("KIT_CONTENT_KNIGHT_NAME", new Message("Kit.Content.Knight.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_KNIGHT_DESCRIPTION", new Message("Kit.Content.Knight.Description", ""));

//LIGHT_TANK

getMessageManager().registerMessage("KIT_CONTENT_LIGHT_TANK_NAME", new Message("Kit.Content.Light-Tank.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_LIGHT_TANK_DESCRIPTION", new Message("Kit.Content.Light-Tank.Description", ""));
//ARCHER

getMessageManager().registerMessage("KIT_CONTENT_ARCHER_NAME", new Message("Kit.Content.Archer.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_ARCHER_DESCRIPTION", new Message("Kit.Content.Archer.Description", ""));
//HARDCORE

getMessageManager().registerMessage("KIT_CONTENT_HARDCORE_NAME", new Message("Kit.Content.Hardcore.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_HARDCORE_DESCRIPTION", new Message("Kit.Content.Hardcore.Description", ""));
//HEALER

getMessageManager().registerMessage("KIT_CONTENT_HEALER_NAME", new Message("Kit.Content.Healer.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_HEALER_DESCRIPTION", new Message("Kit.Content.Healer.Description", ""));
//MEDIUM_TANK

getMessageManager().registerMessage("KIT_CONTENT_MEDIUM_TANK_NAME", new Message("Kit.Content.Medium-Tank.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_MEDIUM_TANK_DESCRIPTION", new Message("Kit.Content.Medium-Tank.Description", ""));
//TERMINATOR

getMessageManager().registerMessage("KIT_CONTENT_TERMINATOR_NAME", new Message("Kit.Content.Terminator.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_TERMINATOR_DESCRIPTION", new Message("Kit.Content.Terminator.Description", ""));
//HEAVY_TANK

getMessageManager().registerMessage("KIT_CONTENT_HEAVY_TANK_NAME", new Message("Kit.Content.Heavy-Tank.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_HEAVY_TANK_DESCRIPTION", new Message("Kit.Content.Heavy-Tank.Description", ""));
//WILD_NAKED

getMessageManager().registerMessage("KIT_CONTENT_WILD_NAKED_NAME", new Message("Kit.Content.Wild-Naked.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_WILD_NAKED_DESCRIPTION", new Message("Kit.Content.Wild-Naked.Description", ""));
getMessageManager().registerMessage("KIT_CONTENT_WILD_NAKED_CANNOT_WEAR_ARMOR", new Message("Kit.Content.Wild-Naked.Cannot-Wear-Armor", ""));
//PREMIUM_HARDCORE

getMessageManager().registerMessage("KIT_CONTENT_PREMIUM_HARDCORE_NAME", new Message("Kit.Content.Premium-Hardcore.Name", ""));
getMessageManager().registerMessage("KIT_CONTENT_PREMIUM_HARDCORE_DESCRIPTION", new Message("Kit.Content.Premium-Hardcore.Description", ""));

getMessageManager().registerMessage("LEADERBOARD_STATISTICS_KILLS", new Message("Leaderboard.Statistics.Kills", ""));
getMessageManager().registerMessage("LEADERBOARD_STATISTICS_DEATHS", new Message("Leaderboard.Statistics.Deaths", ""));
Expand Down
51 changes: 40 additions & 11 deletions src/main/resources/kits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# ---------------------------------- Free kits ---------------------------------
# ------------------------------------------------------------------------------
Bridge:
name: §7§2Bridge
name: "§7§2Bridge"
description:
- "&7Basic bridge kit like the one you know!"
display_item:
material: GOLDEN_APPLE
enabled: true
Expand Down Expand Up @@ -64,7 +66,11 @@ Bridge:
color: 160, 101, 64

Knight:
name: §7§2Knight
name: "§7§2Knight"
description:
- "&7This is the one and only knight kit!"
- "Many people think this is the worst kit!"
- "I must admit they are totally wrong!"
display_item:
material: WOODEN_SWORD
enabled: true
Expand Down Expand Up @@ -109,7 +115,9 @@ Knight:
color: 160, 101, 64

LightTank:
name: §7§2Light Tank
name: "§7§2Light Tank"
description:
- "&7You are Junior tank!"
display_item:
material: LEATHER_CHESTPLATE
color: 160, 101, 64
Expand Down Expand Up @@ -158,7 +166,10 @@ LightTank:
# --------------------------------- Level kits ---------------------------------
# ------------------------------------------------------------------------------
Archer:
name: §7§6Archer
name: "§7§6Archer"
description:
- "&7Start with a extra amount of arrows, leather armor and a wooden sword."
- "Archers are loved by the villagers, know that!"
display_item:
material: BOW
enabled: true
Expand Down Expand Up @@ -215,7 +226,9 @@ Archer:
color: 160, 101, 64

Healer:
name: §7§6Healer
name: "§7§6Healer"
description:
- "&7Being a healer is the same as being loved. You are able to heal your teammates."
display_item:
material: POPPY
enabled: true
Expand Down Expand Up @@ -273,7 +286,9 @@ Healer:
color: 160, 101, 64

MediumTank:
name: §7§6Medium Tank
name: "§7§6Medium Tank"
description:
- "&7Start off with 6 more hearts! Don't be afraid! You have plenty hearts left to lose!"
display_item:
material: IRON_CHESTPLATE
enabled: true
Expand Down Expand Up @@ -315,7 +330,9 @@ MediumTank:
material: IRON_BOOTS

Terminator:
name: §7§6Terminator
name: "§7§6Terminator"
description:
- "&7Easily kill other players with your strength powers!"
display_item:
material: ANVIL
enabled: true
Expand Down Expand Up @@ -380,7 +397,9 @@ Terminator:
color: 160, 101, 64

Hardcore:
name: §7§6Hardcore
name: "§7§6Hardcore"
description:
- "&7You'll see yourself why this is hardcore"
display_item:
material: PLAYER_HEAD
enabled: true
Expand Down Expand Up @@ -435,7 +454,10 @@ Hardcore:
# -------------------------------- Premium kits --------------------------------
# ------------------------------------------------------------------------------
PremiumHardcore:
name: §7§bPremium Hardcore Master
name: "§7§bPremium Hardcore Master"
description:
- "&7One hit most players with your OP sword! However be careful."
- "this kit is only for the pros! Do not use it if you aren't a pro!"
display_item:
material: DIAMOND_SWORD
enabled: true
Expand Down Expand Up @@ -463,7 +485,9 @@ PremiumHardcore:
armour: { }

Naked:
name: §7§bWild Naked
name: "§7§bWild Naked"
description:
- "&7You are the ultimate master! You start off with a better iron sword!"
display_item:
material: IRON_SWORD
enabled: true
Expand Down Expand Up @@ -491,9 +515,14 @@ Naked:
DURABILITY: 10
slot: 0
armour: { }
actions:
- "NO_ARMOUR"

HeavyTank:
name: §7§bHeavy Tank
name: "§7§bHeavy Tank"
description:
- "&7Start off with iron armor and a double amount of hearts!"
- "Yup, that's right, you'll be the last man standing!"
display_item:
material: DIAMOND_CHESTPLATE
enabled: true
Expand Down
36 changes: 1 addition & 35 deletions src/main/resources/language.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,48 +330,14 @@ Kit:
Not-Unlocked: "%color_chat_issue%%plugin_prefix% You haven't unlocked %value% yet!"
Choose: "%plugin_prefix% You have chosen: %value%!"
Cooldown: "%color_chat_issue%%plugin_prefix% Kit ability still on cooldown (%number%)!"
No-Armor: "%color_chat_issue%%plugin_prefix% You can't wear armor with your kit!"
Menu:
Title: "Kit Menu"
Lore:
Unlocked: "&aUNLOCKED!"
Locked: "&cLOCKED!"
Unlock-At-Level: "Unlocks at level %number%"
Unlock-In-Store: "&bUnlock this in the store!"
Content:
Bridge:
Name: "&2Bridge"
Description: "&7Basic bridge kit like the one you know!"
Knight:
Name: "&2Knight"
Description: "&7This is the one and only knight kit! Many people think this is the worst kit! I must admit they are totally wrong!"
Light-Tank:
Name: "&2Light Tank"
Description: "&7You are Junior tank!"
Archer:
Name: "&6Archer"
Description: "&7Start with a extra amount of arrows, leather armor and a wooden sword. Archers are loved by the villagers, know that!"
Hardcore:
Name: "&6Hardcore"
Description: "&7You'll see yourself why this is hardcore"
Healer:
Name: "&6Healer"
Description: "&7Being a healer is the same as being loved. You are able to heal your teammates."
Medium-Tank:
Name: "&6Medium Tank"
Description: "&7Start off with 6 more hearts! Don't be afraid! You have plenty hearts left to lose!"
Terminator:
Name: "&6Terminator"
Description: "&7Easily kill other players with your strength powers!"
Heavy-Tank:
Name: "&bHeavy Tank"
Description: "&7Start off with iron armor and a double amount of hearts! Yup, that's right, you'll be the last man standing!"
Wild-Naked:
Name: "&bWild Naked"
Description: "&7You are the ultimate master! You start off with a better iron sword!"
Cannot-Wear-Armor: "&cYou can't wear armor with the Wild Naked kit!"
Premium-Hardcore:
Name: "&bPremium Hardcore Master"
Description: "&7One hit most players with your OP sword! However be careful. this kit is only for the pros! Do not use it if you aren't a pro!"


#
Expand Down

0 comments on commit 7e2882c

Please sign in to comment.