Skip to content

Commit

Permalink
Fix errors thrown if config lists are being cleared
Browse files Browse the repository at this point in the history
MetallicGoat committed Apr 29, 2024
1 parent b5aaf01 commit 697225d
Showing 2 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import de.marcely.bedwars.api.arena.Team;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
@@ -27,15 +28,15 @@ public static void loadTweaksConfigs(MBedwarsTweaksPlugin plugin) {

// Replace with these values if we know defaults are still setup
if (defaultDropTypesExist) {
MainConfig.gen_tiers_start_spawners = Arrays.asList(
MainConfig.gen_tiers_start_spawners = new ArrayList<>(Arrays.asList(
Util.getDropType("emerald"),
Util.getDropType("diamond")
);
));

MainConfig.disable_empty_generators_spawners = Arrays.asList(
MainConfig.disable_empty_generators_spawners = new ArrayList<>(Arrays.asList(
Util.getDropType("iron"),
Util.getDropType("gold")
);
));
}

GenTiersConfig.gen_tier_levels = getDefaultGenTiers();
36 changes: 18 additions & 18 deletions src/main/java/me/metallicgoat/tweaksaddon/config/MainConfig.java
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
public class MainConfig {

@Getter
private static final List<Material> defaultMaterials = Arrays.asList(
private static final List<Material> defaultMaterials = new ArrayList<>(Arrays.asList(
Helper.get().getMaterialByName("WOODEN_SWORD"),
Helper.get().getMaterialByName("SHEARS"),
Helper.get().getMaterialByName("WOODEN_PICKAXE"),
@@ -35,7 +35,7 @@ public class MainConfig {
Helper.get().getMaterialByName("IRON_AXE"),
Helper.get().getMaterialByName("GOLDEN_AXE"),
Helper.get().getMaterialByName("DIAMOND_AXE")
);
));

// ===== GENERAL
@SectionTitle(title = "GENERAL")
@@ -64,11 +64,11 @@ public class MainConfig {
}
)
public static boolean gen_tiers_custom_holo_enabled = false;
@Config public static List<String> gen_tiers_custom_holo_titles = Arrays.asList(
@Config public static List<String> gen_tiers_custom_holo_titles = new ArrayList<>(Arrays.asList(
"{spawner-color}{spawner}",
"{tier}",
"&eSpawning in &c{time} &eseconds!"
);
));

@Config(
description = {
@@ -201,11 +201,11 @@ public class MainConfig {
"Placeholders: {team-color} {team-name}"
})
public static boolean team_eliminate_message_enabled = true;
@Config public static List<String> team_eliminate_message = Arrays.asList(
@Config public static List<String> team_eliminate_message = new ArrayList<>(Arrays.asList(
" ",
"&f&lTEAM ELIMINATED > {team-color}{team-name} Team &chas been eliminated!",
" "
);
));

@Config(
description = {
@@ -227,55 +227,55 @@ public class MainConfig {
"Top killer message displayed at the end of a round"
})
public static boolean top_killer_message_enabled = true;
@Config public static List<String> top_killer_pre_lines = Arrays.asList(
@Config public static List<String> top_killer_pre_lines = new ArrayList<>(Arrays.asList(
"&a&l-------------------------------",
" &lBedWars",
" "
);
));
@Config public static HashMap<Integer, String> top_killer_lines = new HashMap<Integer, String>() {{
put(1, " &e&l1st Killer &7- {killer-name} - {kill-amount}");
put(2, " &6&l2nd Killer &7- {killer-name} - {kill-amount}");
put(3, " &c&l3rd Killer &7- {killer-name} - {kill-amount}");
}};
@Config public static List<String> top_killer_sub_lines = Arrays.asList(
@Config public static List<String> top_killer_sub_lines = new ArrayList<>(Arrays.asList(
" ",
"&a&l-------------------------------"
);
));

@Config(
description = {
"Displayed if Top-Killer-Message IS enabled, but there are no top killers"
}
)
public static boolean no_top_killer_message_enabled = false;
@Config public static List<String> no_top_killer_message = Arrays.asList(
@Config public static List<String> no_top_killer_message = new ArrayList<>(Arrays.asList(
" ",
"&eNo Top Killers This Round",
" "
);
));

@Config(
description = {
"Message displayed when any bed is broken (to everyone in the arena)"
}
)
public static boolean custom_bed_break_message_enabled = false;
@Config public static List<String> custom_bed_break_message = Arrays.asList(
@Config public static List<String> custom_bed_break_message = new ArrayList<>(Arrays.asList(
" ",
"&f&lBED DESTRUCTION > {team-color}{team-name} Bed &7was destroyed by {destroyer-color}{destroyer-name}",
" "
);
));

@Config(
description = {
"Message displayed when all beds are broken by the gen tiers system"
})
public static boolean auto_bed_break_message_enabled = false;
@Config public static List<String> auto_bed_break_message = Arrays.asList(
@Config public static List<String> auto_bed_break_message = new ArrayList<>(Arrays.asList(
" ",
"&c&lALL BEDS HAVE BEEN DESTROYED",
" "
);
));

@Config(
description = {
@@ -367,11 +367,11 @@ public class MainConfig {
"Removes invisibility on specified damage causes"
})
public static boolean remove_invis_ondamage_enabled = true;
@Config public static List<EntityDamageEvent.DamageCause> remove_invis_damge_causes = Arrays.asList(
@Config public static List<EntityDamageEvent.DamageCause> remove_invis_damge_causes = new ArrayList<>(Arrays.asList(
EntityDamageEvent.DamageCause.ENTITY_ATTACK,
EntityDamageEvent.DamageCause.BLOCK_EXPLOSION,
EntityDamageEvent.DamageCause.ENTITY_EXPLOSION
);
));

@Config(
description = {

0 comments on commit 697225d

Please sign in to comment.