Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CONSOLE LOG (NOTHING UNUSUAL BEFORE)
- [16:05:48] [Server thread/INFO] [minecraft/DedicatedServer]: REDACTED_LAMBDA joined the game
- [16:05:55] [Server thread/INFO] [STDOUT]: [pl.ytskagamer.ytskascpcore.sponge.commands.Test2Cmd:execute:26]: null
- //COMMAND CODE:
- public class Test2Cmd implements CommandExecutor
- {
- @Override
- public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
- Player p = (Player) src;
- ClassAPI.createClass("reee", "re", "a", "12345678", 1);
- if(ClassAPI.getClassUUIDByDiscord("12345678") == null)
- {
- System.out.println(ClassAPI.getClassUUIDByDiscord("12345678"));
- p.sendMessage(Text.of("not working"));
- }
- else
- {
- System.out.println(ClassAPI.getClassUUIDByDiscord("12345678"));
- p.sendMessage(Text.of(ClassAPI.getClassUUIDByDiscord("12345678")));
- }
- return CommandResult.success();
- }
- public static CommandSpec spec = CommandSpec.builder()
- .executor(new Test2Cmd())
- .build();
- }
- //FUNCTION
- public static String getClassUUIDByDiscord(String discordid)
- {
- ClassAPI api = new ClassAPI();
- ConfigurationNode root = api.node; //the root node of the file
- String discordId = discordid; //the discord id you wish to search for
- ConfigurationNode classesNode = root.getNode("classes"); //the first child node
- Optional<? extends ConfigurationNode> opNode = classesNode.getChildrenList().stream().filter(c -> c.getNode("discordid").getString().equals(discordId)).findFirst();
- //Above searches every class node and checks the discord id of that class, if it matches then it uses it
- if(!opNode.isPresent()){
- return null;
- }
- ConfigurationNode classNode = opNode.get();
- String classId = (String)classNode.getKey();
- return classId;
- }
- //CHAT DISPLAY: not working
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement