Skip to content

Commit fbaa408

Browse files
committed
More cleanup
1 parent 5afeb91 commit fbaa408

File tree

8 files changed

+352
-540
lines changed

8 files changed

+352
-540
lines changed

src/main/java/com/shanebeestudios/survival/SurvivalPlugin.java

Lines changed: 250 additions & 249 deletions
Large diffs are not rendered by default.

src/main/java/com/shanebeestudios/survival/config/Config.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class Config {
7676

7777
public boolean mechanics_slow_armor;
7878
public boolean mechanics_reinforced_armor;
79-
public boolean MECHANICS_BOW;
79+
public boolean mechanics_bow;
8080
public boolean mechanics_recurved_bow;
8181
public boolean mechanics_grappling_hook;
8282
public boolean mechanics_medic_kit;
@@ -146,7 +146,6 @@ public class Config {
146146
public boolean mechanics_fermented_skin;
147147
public boolean mechanics_living_slime;
148148
public boolean mechanics_snowball_revamp;
149-
public boolean MECHANICS_SNOW_GEN_REVAMP;
150149

151150
public boolean mechanics_farming_products_cookie;
152151
public boolean mechanics_farming_products_bread;
@@ -309,7 +308,7 @@ private void loadSettings() {
309308
// MECHANICS
310309
this.mechanics_slow_armor = this.settings.getBoolean("mechanics.slow-armor");
311310
this.mechanics_reinforced_armor = this.settings.getBoolean("mechanics.reinforced-leather-armor");
312-
this.MECHANICS_BOW = this.settings.getBoolean("mechanics.bow");
311+
this.mechanics_bow = this.settings.getBoolean("mechanics.bow");
313312
this.mechanics_recurved_bow = this.settings.getBoolean("mechanics.recurve-bow");
314313
this.mechanics_grappling_hook = this.settings.getBoolean("mechanics.grappling-hook");
315314
this.mechanics_medic_kit = this.settings.getBoolean("mechanics.medical-kit");
@@ -398,7 +397,6 @@ private void loadSettings() {
398397
this.mechanics_living_slime = this.settings.getBoolean("mechanics.living-slime");
399398

400399
this.mechanics_snowball_revamp = this.settings.getBoolean("mechanics.snowball-revamp");
401-
this.MECHANICS_SNOW_GEN_REVAMP = this.settings.getBoolean("mechanics.SnowGenerationRevamp");
402400

403401
this.mechanics_farming_products_cookie = this.settings.getBoolean("mechanics.farming-products.cookie");
404402
this.mechanics_farming_products_bread = this.settings.getBoolean("mechanics.farming-products.bread");

src/main/java/com/shanebeestudios/survival/data/PlayerData.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,7 @@ public Location getCompassWaypoint(World world) {
373373
}
374374

375375
/**
376-
* Internal serializer for yaml config
377-
*
378-
* @return Map for config
376+
* @hidden
379377
*/
380378
@SuppressWarnings("NullableProblems")
381379
@Override
@@ -397,10 +395,7 @@ public Map<String, Object> serialize() {
397395
}
398396

399397
/**
400-
* Internal deserializer for yaml config
401-
*
402-
* @param args Args from yaml config
403-
* @return New PlayerData loaded from config
398+
* @hidden
404399
*/
405400
public static PlayerData deserialize(Map<String, Object> args) {
406401
UUID uuid = UUID.fromString(args.get("uuid").toString());
Lines changed: 85 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package com.shanebeestudios.survival.listeners;
22

3-
import com.shanebeestudios.survival.listeners.block.LootTableListener;
4-
import org.bukkit.Bukkit;
5-
import org.bukkit.plugin.PluginManager;
63
import com.shanebeestudios.survival.SurvivalPlugin;
74
import com.shanebeestudios.survival.config.Config;
85
import com.shanebeestudios.survival.listeners.block.BlockBreakListener;
96
import com.shanebeestudios.survival.listeners.block.BlockPlaceListener;
107
import com.shanebeestudios.survival.listeners.block.Campfire;
118
import com.shanebeestudios.survival.listeners.block.Chairs;
12-
import com.shanebeestudios.survival.listeners.block.SnowGeneration;
9+
import com.shanebeestudios.survival.listeners.block.LootTableListener;
1310
import com.shanebeestudios.survival.listeners.block.SnowballThrow;
1411
import com.shanebeestudios.survival.listeners.block.WorkbenchShare;
1512
import com.shanebeestudios.survival.listeners.entity.BeeKeeperSuit;
@@ -47,115 +44,112 @@
4744
import com.shanebeestudios.survival.listeners.server.LocalChat;
4845
import com.shanebeestudios.survival.listeners.server.RecipeDiscovery;
4946
import com.shanebeestudios.survival.listeners.server.ResourcePackListener;
47+
import org.bukkit.Bukkit;
48+
import org.bukkit.plugin.PluginManager;
5049

5150
/**
5251
* Internal use only
5352
*/
5453
public class EventManager {
5554

56-
private final SurvivalPlugin plugin;
57-
private final int LOCAL_CHAT;
58-
private final Config config;
55+
private final SurvivalPlugin plugin;
56+
private final Config config;
5957

60-
public EventManager(SurvivalPlugin plugin) {
61-
this.plugin = plugin;
62-
this.config = plugin.getSurvivalConfig();
63-
this.LOCAL_CHAT = config.settings_local_chat_distance;
64-
}
58+
public EventManager(SurvivalPlugin plugin) {
59+
this.plugin = plugin;
60+
this.config = plugin.getSurvivalConfig();
61+
}
6562

66-
public void registerEvents() {
67-
PluginManager pm = plugin.getServer().getPluginManager();
68-
pm.registerEvents(this.plugin, this.plugin);
69-
pm.registerEvents(new RecipeDiscovery(plugin), this.plugin);
63+
public void registerEvents() {
64+
PluginManager pluginManager = plugin.getServer().getPluginManager();
65+
pluginManager.registerEvents(this.plugin, this.plugin);
66+
pluginManager.registerEvents(new RecipeDiscovery(this.plugin), this.plugin);
7067
Bukkit.getPluginManager().registerEvents(new PlayerDataListener(this.plugin), this.plugin);
7168

72-
if (config.survival_enabled) {
73-
pm.registerEvents(new BlockBreakListener(plugin), this.plugin);
74-
pm.registerEvents(new BlockPlaceListener(plugin), this.plugin);
75-
pm.registerEvents(new FirestrikerListener(plugin), this.plugin);
76-
pm.registerEvents(new ShivPoison(this.plugin), this.plugin);
77-
pm.registerEvents(new WaterBowlListener(plugin), this.plugin);
78-
pm.registerEvents(new Campfire(plugin), this.plugin);
79-
//pm.registerEvents(new Backpack(), this.plugin); needs to be reworked
80-
}
81-
if (config.MECHANICS_BOW)
82-
pm.registerEvents(new BowListener(plugin), this.plugin);
83-
if (config.mechanics_grappling_hook)
84-
pm.registerEvents(new GrapplingHookListener(plugin), this.plugin);
85-
if (config.legendary_obsidian_mace)
86-
pm.registerEvents(new ObsidianMaceWeakness(plugin), this.plugin);
87-
if (config.legendary_valkyrie)
88-
pm.registerEvents(new Valkyrie(plugin), this.plugin);
89-
if (config.legendary_giant_blade)
90-
pm.registerEvents(new GiantBlade(plugin), this.plugin);
91-
if (config.legendary_blaze_sword)
92-
pm.registerEvents(new BlazeSword(), this.plugin);
93-
if (LOCAL_CHAT > -1)
94-
pm.registerEvents(new LocalChat(plugin), this.plugin);
95-
if (config.mechanics_compass_waypoint)
96-
pm.registerEvents(new CompassWaypoint(this.plugin), this.plugin);
97-
if (config.mechanics_medic_kit)
98-
pm.registerEvents(new MedicKit(plugin), this.plugin);
69+
if (this.config.survival_enabled) {
70+
pluginManager.registerEvents(new BlockBreakListener(this.plugin), this.plugin);
71+
pluginManager.registerEvents(new BlockPlaceListener(this.plugin), this.plugin);
72+
pluginManager.registerEvents(new FirestrikerListener(this.plugin), this.plugin);
73+
pluginManager.registerEvents(new ShivPoison(this.plugin), this.plugin);
74+
pluginManager.registerEvents(new WaterBowlListener(this.plugin), this.plugin);
75+
pluginManager.registerEvents(new Campfire(this.plugin), this.plugin);
76+
}
77+
if (this.config.mechanics_bow)
78+
pluginManager.registerEvents(new BowListener(this.plugin), this.plugin);
79+
if (this.config.mechanics_grappling_hook)
80+
pluginManager.registerEvents(new GrapplingHookListener(this.plugin), this.plugin);
81+
if (this.config.legendary_obsidian_mace)
82+
pluginManager.registerEvents(new ObsidianMaceWeakness(this.plugin), this.plugin);
83+
if (this.config.legendary_valkyrie)
84+
pluginManager.registerEvents(new Valkyrie(this.plugin), this.plugin);
85+
if (this.config.legendary_giant_blade)
86+
pluginManager.registerEvents(new GiantBlade(this.plugin), this.plugin);
87+
if (this.config.legendary_blaze_sword)
88+
pluginManager.registerEvents(new BlazeSword(), this.plugin);
89+
if (this.config.settings_local_chat_distance > -1)
90+
pluginManager.registerEvents(new LocalChat(this.plugin), this.plugin);
91+
if (this.config.mechanics_compass_waypoint)
92+
pluginManager.registerEvents(new CompassWaypoint(this.plugin), this.plugin);
93+
if (this.config.mechanics_medic_kit)
94+
pluginManager.registerEvents(new MedicKit(this.plugin), this.plugin);
9995

100-
pm.registerEvents(new WaterBottleListener(plugin), this.plugin);
96+
pluginManager.registerEvents(new WaterBottleListener(this.plugin), this.plugin);
10197

102-
if (config.settings_resource_pack_enabled) {
103-
pm.registerEvents(new ResourcePackListener(plugin), this.plugin);
98+
if (this.config.settings_resource_pack_enabled) {
99+
pluginManager.registerEvents(new ResourcePackListener(this.plugin), this.plugin);
104100
}
105101

106-
if (config.mechanics_raw_meat_hunger)
107-
pm.registerEvents(new RawMeatHunger(), this.plugin);
108-
if (config.mechanics_thirst_enabled) {
109-
pm.registerEvents(new ThirstListener(this.plugin), this.plugin);
110-
if (config.mechanics_thirst_purify_water)
111-
pm.registerEvents(new CauldronWaterBottle(), this.plugin);
112-
}
113-
if (config.mechanics_poison_potato)
114-
pm.registerEvents(new PoisonousPotato(), this.plugin);
115-
if (config.mechanics_shared_workbench)
116-
pm.registerEvents(new WorkbenchShare(plugin), this.plugin);
117-
if (config.mechanics_chairs_enabled)
118-
pm.registerEvents(new Chairs(plugin), this.plugin);
119-
if (config.mechanics_cookie_boost)
120-
pm.registerEvents(new CookieHealthBoost(), this.plugin);
121-
if (config.mechanics_beet_strength)
122-
pm.registerEvents(new BeetrootStrength(), this.plugin);
123-
if (config.mechanics_tropical_fish)
124-
pm.registerEvents(new TropicalFish(this.plugin), this.plugin);
125-
if (config.mechanics_living_slime)
126-
pm.registerEvents(new LivingSlime(plugin), this.plugin);
127-
if (config.mechanics_energy_enabled)
128-
pm.registerEvents(new EnergyChange(plugin), this.plugin);
129-
if (config.mechanics_food_diversity_enabled)
130-
pm.registerEvents(new FoodDiversityConsume(plugin), this.plugin);
131-
if (config.mechanics_recurved_bow)
132-
pm.registerEvents(new RecurvedBowListener(plugin), this.plugin);
133-
if (config.mechanics_snowball_revamp)
134-
pm.registerEvents(new SnowballThrow(), this.plugin);
135-
if (config.MECHANICS_SNOW_GEN_REVAMP)
136-
pm.registerEvents(new SnowGeneration(plugin), this.plugin);
137-
if (config.entity_mechanics_chicken_breeding_enabled)
138-
pm.registerEvents(new ChickenSpawn(this.plugin), this.plugin);
139-
if (config.welcome_guide_enabled)
140-
pm.registerEvents(new Guide(plugin), this.plugin);
102+
if (this.config.mechanics_raw_meat_hunger)
103+
pluginManager.registerEvents(new RawMeatHunger(), this.plugin);
104+
if (this.config.mechanics_thirst_enabled) {
105+
pluginManager.registerEvents(new ThirstListener(this.plugin), this.plugin);
106+
if (this.config.mechanics_thirst_purify_water)
107+
pluginManager.registerEvents(new CauldronWaterBottle(), this.plugin);
108+
}
109+
if (this.config.mechanics_poison_potato)
110+
pluginManager.registerEvents(new PoisonousPotato(), this.plugin);
111+
if (this.config.mechanics_shared_workbench)
112+
pluginManager.registerEvents(new WorkbenchShare(this.plugin), this.plugin);
113+
if (this.config.mechanics_chairs_enabled)
114+
pluginManager.registerEvents(new Chairs(this.plugin), this.plugin);
115+
if (this.config.mechanics_cookie_boost)
116+
pluginManager.registerEvents(new CookieHealthBoost(), this.plugin);
117+
if (this.config.mechanics_beet_strength)
118+
pluginManager.registerEvents(new BeetrootStrength(), this.plugin);
119+
if (this.config.mechanics_tropical_fish)
120+
pluginManager.registerEvents(new TropicalFish(this.plugin), this.plugin);
121+
if (this.config.mechanics_living_slime)
122+
pluginManager.registerEvents(new LivingSlime(this.plugin), this.plugin);
123+
if (this.config.mechanics_energy_enabled)
124+
pluginManager.registerEvents(new EnergyChange(this.plugin), this.plugin);
125+
if (this.config.mechanics_food_diversity_enabled)
126+
pluginManager.registerEvents(new FoodDiversityConsume(this.plugin), this.plugin);
127+
if (this.config.mechanics_recurved_bow)
128+
pluginManager.registerEvents(new RecurvedBowListener(this.plugin), this.plugin);
129+
if (this.config.mechanics_snowball_revamp)
130+
pluginManager.registerEvents(new SnowballThrow(), this.plugin);
131+
if (this.config.entity_mechanics_chicken_breeding_enabled)
132+
pluginManager.registerEvents(new ChickenSpawn(this.plugin), this.plugin);
133+
if (this.config.welcome_guide_enabled)
134+
pluginManager.registerEvents(new Guide(this.plugin), this.plugin);
141135

142-
if (config.entity_mechanics_pigmen_chest_enabled)
143-
pm.registerEvents(new ChestPigmen(this.plugin), this.plugin);
136+
if (this.config.entity_mechanics_pigmen_chest_enabled)
137+
pluginManager.registerEvents(new ChestPigmen(this.plugin), this.plugin);
144138

145-
if (config.entity_mechanics_beekeeper_suit_enabled) {
139+
if (this.config.entity_mechanics_beekeeper_suit_enabled) {
146140
Bukkit.getPluginManager().registerEvents(new BeeKeeperSuit(), this.plugin);
147141
}
148-
if (config.survival_update_merchant_trades) {
149-
pm.registerEvents(new MerchantTrades(this.plugin), this.plugin);
142+
if (this.config.survival_update_merchant_trades) {
143+
pluginManager.registerEvents(new MerchantTrades(this.plugin), this.plugin);
150144
}
151145
if (this.config.survival_update_loot_tables) {
152-
pm.registerEvents(new LootTableListener(plugin), this.plugin);
146+
pluginManager.registerEvents(new LootTableListener(this.plugin), this.plugin);
153147
}
154-
pm.registerEvents(new PiglinBarter(this.plugin), this.plugin);
148+
pluginManager.registerEvents(new PiglinBarter(this.plugin), this.plugin);
155149
// Config handled within this event
156-
pm.registerEvents(new EntityDeath(this.plugin), this.plugin);
157-
pm.registerEvents(new RepairCrafting(), this.plugin);
150+
pluginManager.registerEvents(new EntityDeath(this.plugin), this.plugin);
151+
pluginManager.registerEvents(new RepairCrafting(), this.plugin);
158152

159-
}
153+
}
160154

161155
}

0 commit comments

Comments
 (0)