Made all channels configurable

Removed Vault repo, was unused and errors now
Removed all channel fields from main class
This commit is contained in:
Norbi Peti 2019-02-13 15:21:57 +01:00
parent 9ba57fd989
commit 13b168d238
7 changed files with 415 additions and 409 deletions

View file

@ -124,10 +124,10 @@
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
</repository> </repository>
<repository> <!-- <repository>
<id>vault-repo</id> <id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url> <url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository> </repository> -->
<repository> <repository>
<id>Essentials</id> <id>Essentials</id>
<url>http://repo.ess3.net/content/repositories/essrel/</url> <url>http://repo.ess3.net/content/repositories/essrel/</url>

View file

@ -5,6 +5,7 @@ import buttondevteam.discordplugin.commands.Command2DC;
import buttondevteam.discordplugin.commands.DiscordCommandBase; import buttondevteam.discordplugin.commands.DiscordCommandBase;
import buttondevteam.discordplugin.commands.VersionCommand; import buttondevteam.discordplugin.commands.VersionCommand;
import buttondevteam.discordplugin.exceptions.ExceptionListenerModule; import buttondevteam.discordplugin.exceptions.ExceptionListenerModule;
import buttondevteam.discordplugin.fun.FunModule;
import buttondevteam.discordplugin.listeners.CommonListeners; import buttondevteam.discordplugin.listeners.CommonListeners;
import buttondevteam.discordplugin.listeners.MCListener; import buttondevteam.discordplugin.listeners.MCListener;
import buttondevteam.discordplugin.mcchat.MCChatPrivate; import buttondevteam.discordplugin.mcchat.MCChatPrivate;
@ -89,18 +90,6 @@ public class DiscordPlugin extends ButtonPlugin implements IListener<ReadyEvent>
} }
} }
public static IChannel botchannel; //Can be removed
public static IChannel annchannel;
public static IChannel genchannel;
public static IChannel chatchannel;
public static IChannel botroomchannel;
public static IChannel modlogchannel;
/**
* Don't send messages, just receive, the same channel is used when testing
*/
public static IChannel officechannel;
public static IChannel updatechannel;
public static IChannel devofficechannel;
public static IGuild mainServer; public static IGuild mainServer;
public static IGuild devServer; public static IGuild devServer;
@ -119,31 +108,10 @@ public class DiscordPlugin extends ButtonPlugin implements IListener<ReadyEvent>
if (mainServer == null || devServer == null) if (mainServer == null || devServer == null)
return; // Retry return; // Retry
if (!TBMCCoreAPI.IsTestServer()) { //Don't change conditions here, see mainServer=devServer=null in onDisable() if (!TBMCCoreAPI.IsTestServer()) { //Don't change conditions here, see mainServer=devServer=null in onDisable()
botchannel = mainServer.getChannelByID(209720707188260864L); // bot
annchannel = mainServer.getChannelByID(126795071927353344L); // announcements
genchannel = mainServer.getChannelByID(125813020357165056L); // general
chatchannel = mainServer.getChannelByID(249663564057411596L); // minecraft_chat
botroomchannel = devServer.getChannelByID(239519012529111040L); // bot-room
officechannel = devServer.getChannelByID(219626707458457603L); // developers-office
updatechannel = devServer.getChannelByID(233724163519414272L); // server-updates
devofficechannel = officechannel; // developers-office
modlogchannel = mainServer.getChannelByID(283840717275791360L); // modlog
dc.changePresence(StatusType.ONLINE, ActivityType.PLAYING, "Chromacraft"); dc.changePresence(StatusType.ONLINE, ActivityType.PLAYING, "Chromacraft");
} else { } else {
botchannel = devServer.getChannelByID(239519012529111040L); // bot-room
annchannel = botchannel; // bot-room
genchannel = botchannel; // bot-room
botroomchannel = botchannel;// bot-room
chatchannel = botchannel;// bot-room
officechannel = devServer.getChannelByID(219626707458457603L); // developers-office
updatechannel = botchannel;
devofficechannel = botchannel;// bot-room
modlogchannel = botchannel; // bot-room
dc.changePresence(StatusType.ONLINE, ActivityType.PLAYING, "testing"); dc.changePresence(StatusType.ONLINE, ActivityType.PLAYING, "testing");
} }
if (botchannel == null || annchannel == null || genchannel == null || botroomchannel == null
|| chatchannel == null || officechannel == null || updatechannel == null)
return; // Retry
SafeMode = false; SafeMode = false;
if (task != null) if (task != null)
task.cancel(); task.cancel();
@ -153,6 +121,7 @@ public class DiscordPlugin extends ButtonPlugin implements IListener<ReadyEvent>
Component.registerComponent(this, new ExceptionListenerModule()); Component.registerComponent(this, new ExceptionListenerModule());
Component.registerComponent(this, new GameRoleModule()); //Needs the mainServer to be set Component.registerComponent(this, new GameRoleModule()); //Needs the mainServer to be set
Component.registerComponent(this, new AnnouncerModule()); Component.registerComponent(this, new AnnouncerModule());
Component.registerComponent(this, new FunModule());
new ChromaBot(this).updatePlayerList(); //Initialize ChromaBot - The MCCHatModule is tested to be enabled new ChromaBot(this).updatePlayerList(); //Initialize ChromaBot - The MCCHatModule is tested to be enabled
DiscordCommandBase.registerCommands(); DiscordCommandBase.registerCommands();

View file

@ -1,5 +1,6 @@
package buttondevteam.discordplugin.exceptions; package buttondevteam.discordplugin.exceptions;
import buttondevteam.core.ComponentManager;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCDebugMessageEvent; import buttondevteam.lib.TBMCDebugMessageEvent;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -13,7 +14,7 @@ public class DebugMessageListener implements Listener{
} }
private static void SendMessage(String message) { private static void SendMessage(String message) {
if (DiscordPlugin.SafeMode) if (DiscordPlugin.SafeMode || !ComponentManager.isEnabled(ExceptionListenerModule.class))
return; return;
try { try {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -22,7 +23,7 @@ public class DebugMessageListener implements Listener{
message = message.substring(0, 2000); message = message.substring(0, 2000);
sb.append(message).append("\n"); sb.append(message).append("\n");
sb.append("```"); sb.append("```");
DiscordPlugin.sendMessageToChannel(DiscordPlugin.botroomchannel, sb.toString()); DiscordPlugin.sendMessageToChannel(ExceptionListenerModule.getChannel(), sb.toString());
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }

View file

@ -1,14 +1,17 @@
package buttondevteam.discordplugin.exceptions; package buttondevteam.discordplugin.exceptions;
import buttondevteam.core.ComponentManager; import buttondevteam.core.ComponentManager;
import buttondevteam.discordplugin.DPUtils;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.TBMCExceptionEvent; import buttondevteam.lib.TBMCExceptionEvent;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ConfigData;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IRole; import sx.blah.discord.handle.obj.IRole;
import java.util.ArrayList; import java.util.ArrayList;
@ -43,6 +46,7 @@ public class ExceptionListenerModule extends Component implements Listener {
private static IRole coderRole; private static IRole coderRole;
private static void SendException(Throwable e, String sourcemessage) { private static void SendException(Throwable e, String sourcemessage) {
if (instance == null) return;
try { try {
if (coderRole == null) if (coderRole == null)
coderRole = DiscordPlugin.devServer.getRolesByName("Coder").get(0); coderRole = DiscordPlugin.devServer.getRolesByName("Coder").get(0);
@ -57,20 +61,32 @@ public class ExceptionListenerModule extends Component implements Listener {
stackTrace = stackTrace.substring(0, 1800); stackTrace = stackTrace.substring(0, 1800);
sb.append(stackTrace).append("\n"); sb.append(stackTrace).append("\n");
sb.append("```"); sb.append("```");
DiscordPlugin.sendMessageToChannel(DiscordPlugin.botroomchannel, sb.toString()); DiscordPlugin.sendMessageToChannel(getChannel(), sb.toString()); //Instance isn't null here
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
private static ExceptionListenerModule instance;
public static IChannel getChannel() {
if (instance != null) return instance.channel().get();
return null;
}
private ConfigData<IChannel> channel() {
return DPUtils.channelData(getConfig(), "channel", 239519012529111040L);
}
@Override @Override
protected void enable() { protected void enable() {
instance = this;
Bukkit.getPluginManager().registerEvents(new ExceptionListenerModule(), getPlugin()); Bukkit.getPluginManager().registerEvents(new ExceptionListenerModule(), getPlugin());
TBMCCoreAPI.RegisterEventsForExceptions(new DebugMessageListener(), getPlugin()); TBMCCoreAPI.RegisterEventsForExceptions(new DebugMessageListener(), getPlugin());
} }
@Override @Override
protected void disable() { protected void disable() {
instance = null;
} }
} }

View file

@ -1,6 +1,7 @@
package buttondevteam.discordplugin.fun; package buttondevteam.discordplugin.fun;
import buttondevteam.core.ComponentManager; import buttondevteam.core.ComponentManager;
import buttondevteam.discordplugin.DPUtils;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
@ -12,6 +13,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import sx.blah.discord.handle.impl.events.user.PresenceUpdateEvent; import sx.blah.discord.handle.impl.events.user.PresenceUpdateEvent;
import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IMessage; import sx.blah.discord.handle.obj.IMessage;
import sx.blah.discord.handle.obj.IRole; import sx.blah.discord.handle.obj.IRole;
import sx.blah.discord.handle.obj.StatusType; import sx.blah.discord.handle.obj.StatusType;
@ -123,6 +125,11 @@ public class FunModule extends Component implements Listener {
}, IRole::getName); }, IRole::getName);
} }
private ConfigData<IChannel> fullHouseChannel() {
return DPUtils.channelData(getConfig(), "fullHouseChannel", 219626707458457603L);
}
private static long lasttime = 0; private static long lasttime = 0;
public static void handleFullHouse(PresenceUpdateEvent event) { public static void handleFullHouse(PresenceUpdateEvent event) {
@ -138,7 +145,7 @@ public class FunModule extends Component implements Listener {
.noneMatch(u -> u.getPresence().getStatus().equals(StatusType.OFFLINE)) .noneMatch(u -> u.getPresence().getStatus().equals(StatusType.OFFLINE))
&& lasttime + 10 < TimeUnit.NANOSECONDS.toHours(System.nanoTime()) && lasttime + 10 < TimeUnit.NANOSECONDS.toHours(System.nanoTime())
&& Calendar.getInstance().get(Calendar.DAY_OF_MONTH) % 5 == 0) { && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) % 5 == 0) {
DiscordPlugin.sendMessageToChannel(DiscordPlugin.devofficechannel, "Full house!", DiscordPlugin.sendMessageToChannel(mod.fullHouseChannel().get(), "Full house!",
new EmbedBuilder() new EmbedBuilder()
.withImage( .withImage(
"https://cdn.discordapp.com/attachments/249295547263877121/249687682618359808/poker-hand-full-house-aces-kings-playing-cards-15553791.png") "https://cdn.discordapp.com/attachments/249295547263877121/249687682618359808/poker-hand-full-house-aces-kings-playing-cards-15553791.png")

View file

@ -3,8 +3,10 @@ package buttondevteam.discordplugin.mcchat;
import buttondevteam.discordplugin.*; import buttondevteam.discordplugin.*;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.TBMCSystemChatEvent; import buttondevteam.lib.TBMCSystemChatEvent;
import buttondevteam.lib.architecture.ConfigData;
import buttondevteam.lib.player.*; import buttondevteam.lib.player.*;
import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.CommandSource;
import lombok.RequiredArgsConstructor;
import lombok.val; import lombok.val;
import net.ess3.api.events.AfkStatusChangeEvent; import net.ess3.api.events.AfkStatusChangeEvent;
import net.ess3.api.events.MuteStatusChangeEvent; import net.ess3.api.events.MuteStatusChangeEvent;
@ -26,14 +28,17 @@ import sx.blah.discord.handle.obj.IUser;
import sx.blah.discord.util.DiscordException; import sx.blah.discord.util.DiscordException;
import sx.blah.discord.util.MissingPermissionsException; import sx.blah.discord.util.MissingPermissionsException;
@RequiredArgsConstructor
class MCListener implements Listener { class MCListener implements Listener {
private final MinecraftChatModule module;
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerLogin(PlayerLoginEvent e) { public void onPlayerLogin(PlayerLoginEvent e) {
if (e.getResult() != Result.ALLOWED) if (e.getResult() != Result.ALLOWED)
return; return;
MCChatUtils.ConnectedSenders.values().stream().flatMap(v -> v.values().stream()) //Only private mcchat should be in ConnectedSenders MCChatUtils.ConnectedSenders.values().stream().flatMap(v -> v.values().stream()) //Only private mcchat should be in ConnectedSenders
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny() .filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
.ifPresent(dcp -> buttondevteam.discordplugin.listeners.MCListener.callEventExcludingSome(new PlayerQuitEvent(dcp, ""))); .ifPresent(dcp -> buttondevteam.discordplugin.listeners.MCListener.callEventExcludingSome(new PlayerQuitEvent(dcp, "")));
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
@ -46,9 +51,9 @@ class MCListener implements Listener {
if (dp != null) { if (dp != null) {
val user = DiscordPlugin.dc.getUserByID(Long.parseLong(dp.getDiscordID())); val user = DiscordPlugin.dc.getUserByID(Long.parseLong(dp.getDiscordID()));
MCChatUtils.addSender(MCChatUtils.OnlineSenders, dp.getDiscordID(), MCChatUtils.addSender(MCChatUtils.OnlineSenders, dp.getDiscordID(),
new DiscordPlayerSender(user, user.getOrCreatePMChannel(), p)); new DiscordPlayerSender(user, user.getOrCreatePMChannel(), p));
MCChatUtils.addSender(MCChatUtils.OnlineSenders, dp.getDiscordID(), MCChatUtils.addSender(MCChatUtils.OnlineSenders, dp.getDiscordID(),
new DiscordPlayerSender(user, DiscordPlugin.chatchannel, p)); //Stored per-channel new DiscordPlayerSender(user, module.chatChannel().get(), p)); //Stored per-channel
} }
final String message = e.GetPlayer().PlayerName().get() + " joined the game"; final String message = e.GetPlayer().PlayerName().get() + " joined the game";
MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(message), e.getPlayer(), ChannelconBroadcast.JOINLEAVE, true); MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(message), e.getPlayer(), ChannelconBroadcast.JOINLEAVE, true);
@ -61,13 +66,13 @@ class MCListener implements Listener {
if (e.getPlayer() instanceof DiscordConnectedPlayer) if (e.getPlayer() instanceof DiscordConnectedPlayer)
return; // Only care about real users return; // Only care about real users
MCChatUtils.OnlineSenders.entrySet() MCChatUtils.OnlineSenders.entrySet()
.removeIf(entry -> entry.getValue().entrySet().stream().anyMatch(p -> p.getValue().getUniqueId().equals(e.getPlayer().getUniqueId()))); .removeIf(entry -> entry.getValue().entrySet().stream().anyMatch(p -> p.getValue().getUniqueId().equals(e.getPlayer().getUniqueId())));
Bukkit.getScheduler().runTask(DiscordPlugin.plugin, Bukkit.getScheduler().runTask(DiscordPlugin.plugin,
() -> MCChatUtils.ConnectedSenders.values().stream().flatMap(v -> v.values().stream()) () -> MCChatUtils.ConnectedSenders.values().stream().flatMap(v -> v.values().stream())
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny() .filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
.ifPresent(dcp -> buttondevteam.discordplugin.listeners.MCListener.callEventExcludingSome(new PlayerJoinEvent(dcp, "")))); .ifPresent(dcp -> buttondevteam.discordplugin.listeners.MCListener.callEventExcludingSome(new PlayerJoinEvent(dcp, ""))));
Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin, Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin,
ChromaBot.getInstance()::updatePlayerList, 5); ChromaBot.getInstance()::updatePlayerList, 5);
final String message = e.GetPlayer().PlayerName().get() + " left the game"; final String message = e.GetPlayer().PlayerName().get() + " left the game";
MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(message), e.getPlayer(), ChannelconBroadcast.JOINLEAVE, true); MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(message), e.getPlayer(), ChannelconBroadcast.JOINLEAVE, true);
} }
@ -90,32 +95,36 @@ class MCListener implements Listener {
if (e.isCancelled() || !base.isOnline()) if (e.isCancelled() || !base.isOnline())
return; return;
final String msg = base.getDisplayName() final String msg = base.getDisplayName()
+ " is " + (e.getValue() ? "now" : "no longer") + " AFK."; + " is " + (e.getValue() ? "now" : "no longer") + " AFK.";
MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(msg), base, ChannelconBroadcast.AFK, false); MCChatUtils.forAllowedCustomAndAllMCChat(MCChatUtils.send(msg), base, ChannelconBroadcast.AFK, false);
} }
private ConfigData<IRole> muteRole() {
return DPUtils.roleData(module.getConfig(), "muteRole", "Muted");
}
@EventHandler @EventHandler
public void onPlayerMute(MuteStatusChangeEvent e) { public void onPlayerMute(MuteStatusChangeEvent e) {
try { try {
DPUtils.performNoWait(() -> { DPUtils.performNoWait(() -> {
final IRole role = DiscordPlugin.dc.getRoleByID(164090010461667328L); //TODO: Config final IRole role = muteRole().get();
final CommandSource source = e.getAffected().getSource(); final CommandSource source = e.getAffected().getSource();
if (!source.isPlayer()) if (!source.isPlayer())
return; return;
final DiscordPlayer p = TBMCPlayerBase.getPlayer(source.getPlayer().getUniqueId(), TBMCPlayer.class) final DiscordPlayer p = TBMCPlayerBase.getPlayer(source.getPlayer().getUniqueId(), TBMCPlayer.class)
.getAs(DiscordPlayer.class); .getAs(DiscordPlayer.class);
if (p == null) return; if (p == null) return;
final IUser user = DiscordPlugin.dc.getUserByID( final IUser user = DiscordPlugin.dc.getUserByID(
Long.parseLong(p.getDiscordID())); Long.parseLong(p.getDiscordID()));
if (e.getValue()) if (e.getValue())
user.addRole(role); user.addRole(role);
else else
user.removeRole(role); user.removeRole(role);
DiscordPlugin.sendMessageToChannel(DiscordPlugin.modlogchannel, (e.getValue() ? "M" : "Unm") + "uted user: " + user.getName()); DiscordPlugin.sendMessageToChannel(module.modlogChannel().get(), (e.getValue() ? "M" : "Unm") + "uted user: " + user.getName());
}); });
} catch (DiscordException | MissingPermissionsException ex) { } catch (DiscordException | MissingPermissionsException ex) {
TBMCCoreAPI.SendException("Failed to give/take Muted role to player " + e.getAffected().getName() + "!", TBMCCoreAPI.SendException("Failed to give/take Muted role to player " + e.getAffected().getName() + "!",
ex); ex);
} }
} }
@ -132,7 +141,7 @@ class MCListener implements Listener {
@EventHandler @EventHandler
public void onYEEHAW(TBMCYEEHAWEvent event) { //TODO: Inherit from the chat event base to have channel support public void onYEEHAW(TBMCYEEHAWEvent event) { //TODO: Inherit from the chat event base to have channel support
String name = event.getSender() instanceof Player ? ((Player) event.getSender()).getDisplayName() String name = event.getSender() instanceof Player ? ((Player) event.getSender()).getDisplayName()
: event.getSender().getName(); : event.getSender().getName();
//Channel channel = ChromaGamerBase.getFromSender(event.getSender()).channel().get(); - TODO //Channel channel = ChromaGamerBase.getFromSender(event.getSender()).channel().get(); - TODO
MCChatUtils.forAllMCChat(MCChatUtils.send(name + " <:YEEHAW:" + DiscordPlugin.mainServer.getEmojiByName("YEEHAW").getStringID() + ">s")); MCChatUtils.forAllMCChat(MCChatUtils.send(name + " <:YEEHAW:" + DiscordPlugin.mainServer.getEmojiByName("YEEHAW").getStringID() + ">s"));
} }

View file

@ -32,12 +32,16 @@ public class MinecraftChatModule extends Component {
return DPUtils.channelData(getConfig(), "chatChannel", 239519012529111040L); return DPUtils.channelData(getConfig(), "chatChannel", 239519012529111040L);
} }
public ConfigData<IChannel> modlogChannel() {
return DPUtils.channelData(getConfig(), "modlogChannel", 283840717275791360L);
}
@Override @Override
protected void enable() { protected void enable() {
listener = new MCChatListener(this); listener = new MCChatListener(this);
DiscordPlugin.dc.getDispatcher().registerListener(listener); DiscordPlugin.dc.getDispatcher().registerListener(listener);
TBMCCoreAPI.RegisterEventsForExceptions(listener, getPlugin()); TBMCCoreAPI.RegisterEventsForExceptions(listener, getPlugin());
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), getPlugin());//These get undone if restarting/resetting - it will ignore events if disabled TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(this), getPlugin());//These get undone if restarting/resetting - it will ignore events if disabled
val chcons = getConfig().getConfig().getConfigurationSection("chcons"); val chcons = getConfig().getConfig().getConfigurationSection("chcons");
if (chcons == null) //Fallback to old place if (chcons == null) //Fallback to old place