ContainerRegistry.java
2.73 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
package com.mumfrey.liteloader.api;
import java.io.File;
import java.util.Collection;
import com.mumfrey.liteloader.core.ModInfo;
import com.mumfrey.liteloader.interfaces.Loadable;
import com.mumfrey.liteloader.interfaces.LoadableMod;
import com.mumfrey.liteloader.interfaces.TweakContainer;
/**
* Registry for enabled, disabled, injected and bad containers
*
* @author Adam Mummery-Smith
*/
public interface ContainerRegistry
{
public enum DisabledReason
{
UNKNOWN("Container %s is could not be loaded for UNKNOWN reason"),
USER_DISABLED("Container %s is disabled"),
MISSING_DEPENDENCY("Container %s is missing one or more dependencies"),
MISSING_API("Container %s is missing one or more required APIs");
private final String message;
private DisabledReason(String message)
{
this.message = message;
}
public String getMessage(LoadableMod<?> container)
{
return String.format(this.message, container);
}
}
/**
* Register an enabled container, removes the container from the disabled
* containers list if present.
*/
public abstract void registerEnabledContainer(LoadableMod<?> container);
/**
* Get all enabled containers
*/
public abstract Collection<? extends LoadableMod<?>> getEnabledContainers();
/**
* Get a specific enabled container by id
*/
public abstract LoadableMod<?> getEnabledContainer(String identifier);
/**
* Register a disabled container
*/
public abstract void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason);
/**
* Get all disabled containers
*/
public abstract Collection<? extends ModInfo<Loadable<?>>> getDisabledContainers();
/**
* Check whether a specific container is registered as disabled
*/
public abstract boolean isDisabledContainer(LoadableMod<?> container);
/**
* Register a bad container
*/
public abstract void registerBadContainer(Loadable<?> container, String reason);
/**
* Get all bad containers
*/
public abstract Collection<? extends ModInfo<Loadable<?>>> getBadContainers();
/**
* Register a candidate tweak container
*/
public abstract void registerTweakContainer(TweakContainer<File> container);
/**
* Get all registered tweak containers
*/
public abstract Collection<TweakContainer<File>> getTweakContainers();
/**
* Register an injected tweak container
*/
public abstract void registerInjectedTweak(TweakContainer<File> container);
/**
* Get all injected tweak containers
*/
public abstract Collection<? extends ModInfo<Loadable<?>>> getInjectedTweaks();
}