mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-20 07:19:16 +00:00
Fix event priorities in config, bump to 2.1.3
This commit is contained in:
@@ -126,12 +126,16 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@YamlKey("synchronization.event_priorities")
|
@YamlKey("synchronization.event_priorities")
|
||||||
public Map<String, EventPriority> synchronizationEventPriorities = EventType.getDefaults();
|
public Map<String, String> synchronizationEventPriorities = EventType.getDefaults();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public EventPriority getEventPriority(@NotNull Settings.EventType eventType) {
|
public EventPriority getEventPriority(@NotNull Settings.EventType eventType) {
|
||||||
return Optional.ofNullable(synchronizationEventPriorities.get(eventType.name().toLowerCase()))
|
try {
|
||||||
.orElse(EventPriority.NORMAL);
|
return EventPriority.valueOf(synchronizationEventPriorities.get(eventType.name().toLowerCase()));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return EventPriority.NORMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -211,13 +215,13 @@ public class Settings {
|
|||||||
this.defaultPriority = defaultPriority;
|
this.defaultPriority = defaultPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map.Entry<String, EventPriority> toEntry() {
|
private Map.Entry<String, String> toEntry() {
|
||||||
return Map.entry(name(), defaultPriority);
|
return Map.entry(name().toLowerCase(), defaultPriority.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static Map<String, EventPriority> getDefaults() {
|
private static Map<String, String> getDefaults() {
|
||||||
return Map.ofEntries(Arrays.stream(values())
|
return Map.ofEntries(Arrays.stream(values())
|
||||||
.map(EventType::toEntry)
|
.map(EventType::toEntry)
|
||||||
.toArray(Map.Entry[]::new));
|
.toArray(Map.Entry[]::new));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
javaVersion=16
|
javaVersion=16
|
||||||
|
|
||||||
plugin_version=2.1.2
|
plugin_version=2.1.3
|
||||||
plugin_archive=husksync
|
plugin_archive=husksync
|
||||||
|
|
||||||
jedis_version=4.2.3
|
jedis_version=4.2.3
|
||||||
|
|||||||
Reference in New Issue
Block a user