4
4
import me .adrigamer2950 .adriapi .api .APIPlugin ;
5
5
import me .adrigamer2950 .adriapi .api .command .Command ;
6
6
import me .adrigamer2950 .adriapi .api .event .command .CommandLoadedEvent ;
7
- import me .adrigamer2950 .adriapi .api .exceptions .DuplicatedManagerException ;
8
7
import me .adrigamer2950 .adriapi .api .exceptions .command .CommandNotInPluginYMLException ;
9
8
import me .adrigamer2950 .adriapi .api .logger .APILogger ;
10
9
import org .bukkit .Bukkit ;
11
10
import org .bukkit .command .CommandMap ;
12
11
import org .bukkit .command .PluginCommand ;
13
- import org .bukkit .plugin .Plugin ;
14
- import org .jetbrains .annotations .ApiStatus ;
15
12
16
13
import java .util .ArrayList ;
17
14
import java .util .List ;
@@ -29,20 +26,6 @@ public final class CommandManager<T extends APIPlugin> {
29
26
30
27
public final APILogger LOGGER ;
31
28
private final List <Command <? extends APIPlugin >> cmds = new ArrayList <>();
32
- @ ApiStatus .Internal
33
- public static final List <CommandManager <? extends APIPlugin >> COMMAND_MANAGERS = new ArrayList <>();
34
-
35
- /**
36
- * @param plugin The plugin
37
- * @return The plugin if it has a Command Manager, null otherwise
38
- */
39
- public static CommandManager <? extends APIPlugin > getManager (Plugin plugin ) {
40
- for (CommandManager <? extends APIPlugin > cmdM : COMMAND_MANAGERS )
41
- if (cmdM .getPlugin ().equals (plugin ))
42
- return cmdM ;
43
-
44
- return null ;
45
- }
46
29
47
30
@ Getter
48
31
private final T plugin ;
@@ -51,20 +34,9 @@ public static CommandManager<? extends APIPlugin> getManager(Plugin plugin) {
51
34
* @param pl The plugin
52
35
*/
53
36
public CommandManager (T pl ) {
54
- if (getManager (pl ) != null ) {
55
- throw new DuplicatedManagerException (
56
- String .format ("Command Manager for plugin %s v%s has already been created and cannot be duplicated" ,
57
- pl .getName (),
58
- pl .getDescription ().getVersion ()
59
- )
60
- );
61
- }
62
-
63
37
this .plugin = pl ;
64
38
65
39
this .LOGGER = this .plugin .getLogger ();
66
-
67
- COMMAND_MANAGERS .add (this );
68
40
}
69
41
70
42
/**
0 commit comments