mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
listen to sponge refresh event
This commit is contained in:
3 files changed
+50
-2
No files matched your search
@@ -30,7 +30,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
// TODO: listen to sponge reload stuff
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class ReloadCommand {
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.draycia.carbon.common.util.PlayerUtils;
|
||||
import net.draycia.carbon.sponge.listeners.SpongeChatListener;
|
||||
import net.draycia.carbon.sponge.listeners.SpongePlayerDeathListener;
|
||||
import net.draycia.carbon.sponge.listeners.SpongePlayerJoinListener;
|
||||
import net.draycia.carbon.sponge.listeners.SpongeReloadListener;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.moonshine.message.IMessageRenderer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -63,7 +64,7 @@ import org.spongepowered.plugin.builtin.jvm.Plugin;
|
||||
public final class CarbonChatSponge implements CarbonChat {
|
||||
|
||||
private static final Set<Class<?>> LISTENER_CLASSES = Set.of(SpongeChatListener.class,
|
||||
SpongePlayerDeathListener.class, SpongePlayerJoinListener.class);
|
||||
SpongePlayerDeathListener.class, SpongePlayerJoinListener.class, SpongeReloadListener.class);
|
||||
|
||||
private static final int BSTATS_PLUGIN_ID = 11279;
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.sponge.listeners;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import net.draycia.carbon.common.channels.CarbonChannelRegistry;
|
||||
import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.lifecycle.RefreshGameEvent;
|
||||
|
||||
public class SpongeReloadListener {
|
||||
|
||||
final ConfigFactory configFactory;
|
||||
final CarbonChannelRegistry channelRegistry;
|
||||
|
||||
@Inject
|
||||
public SpongeReloadListener(
|
||||
final ConfigFactory configFactory,
|
||||
final CarbonChannelRegistry channelRegistry
|
||||
) {
|
||||
this.configFactory = configFactory;
|
||||
this.channelRegistry = channelRegistry;
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onReload(final RefreshGameEvent event) {
|
||||
this.channelRegistry.reloadRegisteredConfigChannels();
|
||||
this.configFactory.reloadPrimaryConfig();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user