Coder Social home page Coder Social logo

abcm's People

Contributors

justred23 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

abcm's Issues

Feature Request lol

Support for Lists inside a config field so This is what a normal Sring field looks like

    @ConfigField(defaultValue = "#user# has joined!",description = "Formats the discord to minecraft (you can change chat colors here to using default minecraft color codes,THIS IS NOT CURRENTLY WORKING.")
    public static String playerjoinformat;

This would be how i would implement it,but you might need to make a @listconfigfield but that is up to you

    @ConfigField(defaultValue = "a1","a2","a3","ETC...")
    public static List listtest;

List Issue

Description of issue
Was implementing a list but found when i edit away from the default value for the list it causes issues/not loading config files, i did DM you on Discord About it this is just a reminder I am to lazy to dig up all the info again As i have not slept

ERROR:

Caused by: dev.JustRed23.abcm.exception.ConfigInitException: Could not initialize configurables, check your terminal for more information
        at dev.JustRed23.abcm.Config.apply(Config.java:528)
        at dev.JustRed23.abcm.Config.init(Config.java:179)
        at me.djjewl.Main.main(Main.java:34)
        Suppressed: dev.JustRed23.abcm.exception.ConfigInitException: Could not parse value of field ips
                at dev.JustRed23.abcm.Config.lambda$null$8(Config.java:518)
                at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
                at dev.JustRed23.abcm.Config.lambda$apply$9(Config.java:486)
                at java.base/java.util.HashMap$KeySet.forEach(HashMap.java:1008)
                at dev.JustRed23.abcm.Config.apply(Config.java:474)
                ... 2 more

Improvement/question lol

Ability to make ABCM put Areas of description on what each config in the config file does so instead of

token=
channelid=
debug=

it would be

//Please Provide Discord Bot token, tutorial on how to get it (link)
token=BotToken
//please Provide a channelid to send messages from minecraft to.
channelid=ChannelID
//Do not touch this part 
debug=false

Create Config Config (Thingy???? )

So basicly you would type

//make a config save location so you can save it to a directory/have it make a directory to store the configs if you are making more then one, so if you did Config.savelocation(configs\UwU\(configfilename)
config.savelocation()
Config.create(),
//So it would be like nerd.cfg if you add a name otherwise errors out or make random name.
Config.name(NERD)
//Could be done with annotations
//(name of field),Type,content of field,description or whatever after)
Config.add((wahterver),String,"WHATEVER BLABLAH")
Config.add((number),Int,1)

Could not use param ''?

Config class
import dev.JustRed23.abcm.ConfigField;
import dev.JustRed23.abcm.Configurable;

@configurable
public class BotConfig {
@ConfigField(defaultValue = "true")
public static boolean enabled;

@ConfigField(defaultValue = "BotToken")
public static String token;

@ConfigField(defaultValue = "Foxy")
public static String name;

@ConfigField(defaultValue = "Knox-TestBot",description = "Is the Status default is Watching Minecraft")
public static String Watching;
@ConfigField(defaultValue = "hub.reforgednetwork.com",description = "The Minecraft Server Ip")
public static String IP;

}

Main

public static void main(String[] args) {
Config.addScannable(BotConfig.class);
Config.setDebug(true);
try {
Config.init();
} catch (ConfigInitException e) {
throw new RuntimeException(e);
}
LOGGER = Logger.getLogger(BotConfig.name);
if (!BotConfig.enabled) {
LOGGER.log(Level.INFO, "Bot is disabled, make sure all the values in magma.cfg are set!");
BotCommons.shutdown(instance);
return;
}
builder = JDABuilder.createDefault(BotConfig.token)
.setBulkDeleteSplittingEnabled(false)
.setEnableShutdownHook(false)
.setEnabledIntents(
GatewayIntent.DIRECT_MESSAGES,
GatewayIntent.GUILD_MESSAGES,
GatewayIntent.GUILD_MESSAGE_REACTIONS,
GatewayIntent.GUILD_MEMBERS,
GatewayIntent.MESSAGE_CONTENT
)
.disableCache(
CacheFlag.ACTIVITY,
CacheFlag.VOICE_STATE,
CacheFlag.SCHEDULED_EVENTS,
CacheFlag.EMOJI,
CacheFlag.STICKER
)
.setChunkingFilter(ChunkingFilter.ALL)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.setStatus(getStatus())
.setActivity(getActivity());
instance = builder.build();
try {
getInstance().awaitReady();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

    // Minecraft server status checking code
    String serverAddress = BotConfig.IP; // replace with your server address
    ServerStatusChecker checker = new ServerStatusChecker(serverAddress);
    checker.startChecking();

    // Example usage:
    while (true) {
        System.out.println("Server is " + (checker.isOnline() ? "online" : "offline"));
        System.out.println("Online players: " + checker.getOnlinePlayers());
        System.out.println("Max players: " + checker.getMaxPlayers());
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            System.out.println("Interrupted while sleeping: " + e.getMessage());
            return;
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.