1313
1414public class Votifier extends BukkitBaseFeature <Meta > {
1515
16- private static final String CHANNEL = "vote" ; // must match proxy publisher
16+ private static final String DEFAULT_CHANNEL = "proxy.votifier. vote" ;
1717 private static final String CONNECTION = "hauntedmc" ;
1818
1919 private EventBusHandler eventBusHandler ;
@@ -26,6 +26,7 @@ public Votifier(ServerFeatures plugin) {
2626 public ConfigMap getDefaultConfig () {
2727 ConfigMap cfg = new ConfigMap ();
2828 cfg .put ("enabled" , false );
29+ cfg .put ("channel" , DEFAULT_CHANNEL );
2930 return cfg ;
3031 }
3132
@@ -47,9 +48,15 @@ public void initialize() {
4748 throw new IllegalStateException ("Redis messaging provider is not available for feature '" + getFeatureName () + "'." );
4849 }
4950
50- // Subscribe to the vote channel
51+ String configuredChannel = getConfigHandler ().get ("channel" , String .class , DEFAULT_CHANNEL );
52+ String channel = resolveChannel (configuredChannel );
53+
54+ if (configuredChannel == null || configuredChannel .isBlank ()) {
55+ getLogger ().warning ("Configured Votifier channel is blank; falling back to \" " + DEFAULT_CHANNEL + "\" ." );
56+ }
57+
5158 this .eventBusHandler = new EventBusHandler (this , redisBus .get ());
52- this .eventBusHandler .subscribe (CHANNEL );
59+ this .eventBusHandler .subscribe (channel );
5360 }
5461
5562 @ Override
@@ -59,4 +66,13 @@ public void disable() {
5966 eventBusHandler = null ;
6067 }
6168 }
69+
70+ static String resolveChannel (String configuredChannel ) {
71+ if (configuredChannel == null ) {
72+ return DEFAULT_CHANNEL ;
73+ }
74+
75+ String channel = configuredChannel .trim ();
76+ return channel .isEmpty () ? DEFAULT_CHANNEL : channel ;
77+ }
6278}
0 commit comments