-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBitsAndBobs.java
More file actions
109 lines (83 loc) · 3.55 KB
/
BitsAndBobs.java
File metadata and controls
109 lines (83 loc) · 3.55 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package parallelmc.parallelutils.modules.bitsandbobs;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
import parallelmc.parallelutils.Constants;
import parallelmc.parallelutils.ParallelClassLoader;
import parallelmc.parallelutils.ParallelModule;
import parallelmc.parallelutils.ParallelUtils;
import parallelmc.parallelutils.modules.bitsandbobs.commands.Hat;
import parallelmc.parallelutils.modules.bitsandbobs.minimodules.*;
import parallelmc.parallelutils.modules.bitsandbobs.minimodules.togglepvp.OnPvp;
import parallelmc.parallelutils.modules.bitsandbobs.minimodules.togglepvp.TogglePvpCommand;
import parallelmc.parallelutils.modules.bitsandbobs.minimodules.togglepvp.TogglePvpManager;
import java.util.List;
import java.util.logging.Level;
public class BitsAndBobs extends ParallelModule {
private TogglePvpManager pvpManager;
public BitsAndBobs(ParallelClassLoader classLoader, List<String> dependents) {
super(classLoader, dependents);
}
@Override
public void onLoad() {
}
@Override
public void onEnable() {
PluginManager manager = Bukkit.getPluginManager();
Plugin plugin = manager.getPlugin(Constants.PLUGIN_NAME);
if (plugin == null) {
ParallelUtils.log(Level.SEVERE, "Unable to enable BitsAndBobs. Plugin " + Constants.PLUGIN_NAME + " does not exist!");
return;
}
ParallelUtils puPlugin = (ParallelUtils) plugin;
if (!puPlugin.registerModule(this)) {
ParallelUtils.log(Level.SEVERE, "Unable to register module BitsAndBobs! Module may already be registered. Quitting...");
return;
}
this.pvpManager = new TogglePvpManager(puPlugin);
pvpManager.init();
FileConfiguration config = puPlugin.getConfig();
puPlugin.getCommand("togglepvp").setExecutor(new TogglePvpCommand());
puPlugin.getCommand("hat").setExecutor(new Hat());
manager.registerEvents(new DoorKnocker(), plugin);
manager.registerEvents(new SpecialItems(), plugin);
manager.registerEvents(new OnPvp(), plugin);
manager.registerEvents(new ShardLotto(), plugin);
manager.registerEvents(new ChickenFeatherDrops(), plugin);
manager.registerEvents(new EntityTweaks(), plugin);
manager.registerEvents(new HatSlotStuff(), plugin);
manager.registerEvents(new SilenceMobs(), plugin);
if (config.getBoolean("speedy-minecarts", false)) {
manager.registerEvents(new SpeedyMinecarts(), plugin);
}
if (config.getBoolean("disable-ender-chests", false)) {
manager.registerEvents(new DisableEnderChest(), plugin);
}
if (config.getBoolean("prevent-spawner-mining", false)) {
manager.registerEvents(new PreventSpawnerMining(), plugin);
}
if (config.getBoolean("enable-ziprails", true)) {
manager.registerEvents(new Ziprails(), plugin);
}
if (config.getBoolean("enable-calling-bell", true)) {
manager.registerEvents(new CallingBell(), plugin);
}
if (config.getBoolean("enable-sweethearts", true)) {
manager.registerEvents(new Sweethearts(), plugin);
}
}
@Override
public void onDisable() {
this.pvpManager.unload();
}
@Override
public void onUnload() {
}
@NotNull
@Override
public String getName() {
return "BitsAndBobs";
}
}