-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFasterPathways.java
More file actions
51 lines (44 loc) · 1.51 KB
/
FasterPathways.java
File metadata and controls
51 lines (44 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gemesil.fasterpathways;
import gemesil.fasterpathways.core.BoostService;
import gemesil.fasterpathways.core.ConfigManager;
import gemesil.fasterpathways.core.MovementListener;
import org.bukkit.Bukkit;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Entry point for the FasterPathways plugin.
* Keeps lifecycle minimal and delegates to the core package.
*/
public final class FasterPathways extends JavaPlugin {
private ConfigManager configManager;
private BoostService boostService;
@Override
public void onEnable() {
saveDefaultConfig();
reloadAll();
// Register movement listener
Bukkit.getPluginManager().registerEvents(
new MovementListener(configManager, boostService),
this
);
}
@Override
public void onDisable() {
// Ensure no one remains boosted after disable/reload
for (Player onlinePlayer : getServer().getOnlinePlayers()) {
if (onlinePlayer.getAttribute(Attribute.MOVEMENT_SPEED) != null) {
boostService.removeSpeedMultiplier(onlinePlayer);
}
}
}
/**
* Reloads configuration and re-initializes services.
* Call this if you later add a /reload command.
*/
public void reloadAll() {
reloadConfig();
this.configManager = new ConfigManager(getConfig(), getLogger(), getServer());
this.boostService = new BoostService();
}
}