mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
Fix some api function not being static.
This commit is contained in:
parent
091fb23aac
commit
0761c70286
3 changed files with 20 additions and 17 deletions
|
|
@ -22,6 +22,8 @@ import java.util.Set;
|
|||
@SuppressWarnings("unused")
|
||||
public class ConflictAPI {
|
||||
|
||||
private ConflictAPI() {}
|
||||
|
||||
private static int saveChangeTask = -1;
|
||||
private static int reloadChangeTask = -1;
|
||||
|
||||
|
|
@ -32,7 +34,7 @@ public class ConflictAPI {
|
|||
* @param builder The conflict builder to base on
|
||||
* @return True if successful.
|
||||
*/
|
||||
public boolean addConflict(@NotNull ConflictBuilder builder){
|
||||
public static boolean addConflict(@NotNull ConflictBuilder builder){
|
||||
FileConfiguration config = ConfigHolder.CONFLICT_HOLDER.getConfig();
|
||||
if(config.contains(builder.getName())) return false;
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ public class ConflictAPI {
|
|||
* @param builder The builder source
|
||||
* @param conflict The conflict target
|
||||
*/
|
||||
protected void appendEnchantments(@NotNull ConflictBuilder builder, @NotNull EnchantConflictGroup conflict){
|
||||
protected static void appendEnchantments(@NotNull ConflictBuilder builder, @NotNull EnchantConflictGroup conflict){
|
||||
for (String enchantmentName : builder.getEnchantmentNames()){
|
||||
if(appendEnchantment(conflict, EnchantmentApi.getByName(enchantmentName))){
|
||||
CustomAnvil.instance.getLogger().warning("Could not find enchantment " + enchantmentName + " for conflict " + builder.getName());
|
||||
|
|
@ -75,7 +77,7 @@ public class ConflictAPI {
|
|||
* @param enchantment The enchantment
|
||||
* @return True if successful.
|
||||
*/
|
||||
protected boolean appendEnchantment(@NotNull EnchantConflictGroup conflict, @Nullable CAEnchantment enchantment){
|
||||
protected static boolean appendEnchantment(@NotNull EnchantConflictGroup conflict, @Nullable CAEnchantment enchantment){
|
||||
if(enchantment == null)
|
||||
return false;
|
||||
conflict.addEnchantment(enchantment);
|
||||
|
|
@ -88,7 +90,7 @@ public class ConflictAPI {
|
|||
* @param builder The builder source
|
||||
* @return The abstract material group from the builder.
|
||||
*/
|
||||
protected AbstractMaterialGroup extractGroup(@NotNull ConflictBuilder builder){
|
||||
protected static AbstractMaterialGroup extractGroup(@NotNull ConflictBuilder builder){
|
||||
ItemGroupManager itemGroupManager = ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager();
|
||||
IncludeGroup group = new IncludeGroup(EnchantConflictManager.DEFAULT_GROUP_NAME);
|
||||
|
||||
|
|
@ -115,7 +117,7 @@ public class ConflictAPI {
|
|||
* @param builder The builder
|
||||
* @return True if successful.
|
||||
*/
|
||||
public boolean writeConflict(@NotNull ConflictBuilder builder){
|
||||
public static boolean writeConflict(@NotNull ConflictBuilder builder){
|
||||
return writeConflict(builder, true);
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +130,7 @@ public class ConflictAPI {
|
|||
* @param updatePlanned If we should plan a global update for conflicts
|
||||
* @return True if successful.
|
||||
*/
|
||||
public boolean writeConflict(@NotNull ConflictBuilder builder, boolean updatePlanned){
|
||||
public static boolean writeConflict(@NotNull ConflictBuilder builder, boolean updatePlanned){
|
||||
FileConfiguration config = ConfigHolder.CONFLICT_HOLDER.getConfig();
|
||||
|
||||
String name = builder.getName();
|
||||
|
|
@ -159,7 +161,7 @@ public class ConflictAPI {
|
|||
* @return Builder's stored enchantment.
|
||||
*/
|
||||
@NotNull
|
||||
private Set<String> extractEnchantments(@NotNull ConflictBuilder builder){
|
||||
private static Set<String> extractEnchantments(@NotNull ConflictBuilder builder){
|
||||
Set<String> result = new HashSet<>(builder.getEnchantmentNames());
|
||||
for (NamespacedKey enchantmentKey : builder.getEnchantmentKeys()) {
|
||||
result.add(enchantmentKey.getKey());
|
||||
|
|
@ -194,7 +196,7 @@ public class ConflictAPI {
|
|||
|
||||
}
|
||||
|
||||
private void logConflictOrigin(@NotNull ConflictBuilder builder){
|
||||
private static void logConflictOrigin(@NotNull ConflictBuilder builder){
|
||||
CustomAnvil.instance.getLogger().warning("Conflict " + builder.getName() +" came from " + builder.getSourceName() + ".");
|
||||
}
|
||||
|
||||
|
|
@ -203,10 +205,9 @@ public class ConflictAPI {
|
|||
* @return An immutable collection of conflict.
|
||||
*/
|
||||
@NotNull
|
||||
public List<EnchantConflictGroup> getRegisteredConflict(){
|
||||
public static List<EnchantConflictGroup> getRegisteredConflict(){
|
||||
List<EnchantConflictGroup> mutableList = ConfigHolder.CONFLICT_HOLDER.getConflictManager().getConflictList();
|
||||
return Collections.unmodifiableList(mutableList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class EnchantmentApi {
|
|||
* @return An immutable map of enchantment key as map key and custom anvil enchantment as value.
|
||||
*/
|
||||
@NotNull
|
||||
public Map<NamespacedKey, CAEnchantment> getRegisteredEnchantments(){
|
||||
public static Map<NamespacedKey, CAEnchantment> getRegisteredEnchantments(){
|
||||
return Collections.unmodifiableMap(CAEnchantmentRegistry.getInstance().registeredEnchantments());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import java.util.Set;
|
|||
@SuppressWarnings("unused")
|
||||
public class MaterialGroupApi {
|
||||
|
||||
private MaterialGroupApi(){}
|
||||
|
||||
private static int saveChangeTask = -1;
|
||||
private static int reloadChangeTask = -1;
|
||||
|
||||
|
|
@ -34,7 +36,7 @@ public class MaterialGroupApi {
|
|||
* @param group the group to add
|
||||
* @return true if successful.
|
||||
*/
|
||||
public boolean addMaterialGroup(@NotNull AbstractMaterialGroup group){
|
||||
public static boolean addMaterialGroup(@NotNull AbstractMaterialGroup group){
|
||||
ItemGroupManager itemGroupManager = ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager();
|
||||
if(itemGroupManager.get(group.getName()) != null) return false;
|
||||
|
||||
|
|
@ -55,7 +57,7 @@ public class MaterialGroupApi {
|
|||
* @param group the group to write
|
||||
* @return true if successful.
|
||||
*/
|
||||
public boolean writeMaterialGroup(@NotNull AbstractMaterialGroup group){
|
||||
public static boolean writeMaterialGroup(@NotNull AbstractMaterialGroup group){
|
||||
return writeMaterialGroup(group, true);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +70,7 @@ public class MaterialGroupApi {
|
|||
* @param updatePlanned if we should plan a global update for material groups
|
||||
* @return true if successful.
|
||||
*/
|
||||
public boolean writeMaterialGroup(@NotNull AbstractMaterialGroup group, boolean updatePlanned){
|
||||
public static boolean writeMaterialGroup(@NotNull AbstractMaterialGroup group, boolean updatePlanned){
|
||||
String name = group.getName();
|
||||
if(name.contains(".")) {
|
||||
CustomAnvil.instance.getLogger().warning("Group " + name +" contain . in its name but should not. this material group is ignored.");
|
||||
|
|
@ -89,7 +91,7 @@ public class MaterialGroupApi {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void writeKnownGroup(@NotNull String groupType, @NotNull AbstractMaterialGroup group){
|
||||
private static void writeKnownGroup(@NotNull String groupType, @NotNull AbstractMaterialGroup group){
|
||||
FileConfiguration config = ConfigHolder.ITEM_GROUP_HOLDER.getConfig();
|
||||
|
||||
String basePath = group.getName() + ".";
|
||||
|
|
@ -106,7 +108,7 @@ public class MaterialGroupApi {
|
|||
|
||||
}
|
||||
|
||||
private void writeUnknownGroup(@NotNull AbstractMaterialGroup group) {
|
||||
private static void writeUnknownGroup(@NotNull AbstractMaterialGroup group) {
|
||||
FileConfiguration config = ConfigHolder.ITEM_GROUP_HOLDER.getConfig();
|
||||
|
||||
String basePath = group.getName() + ".";
|
||||
|
|
@ -161,7 +163,7 @@ public class MaterialGroupApi {
|
|||
* @return An immutable map of group name as its key and group as mapped value.
|
||||
*/
|
||||
@NotNull
|
||||
public Map<String, AbstractMaterialGroup> getRegisteredGroups(){
|
||||
public static Map<String, AbstractMaterialGroup> getRegisteredGroups(){
|
||||
return Collections.unmodifiableMap(ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager().getGroupMap());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue