Created
May 25, 2025 12:45
-
-
Save Jikoo/1ed0998f356d89d84b4cad488750d9fe to your computer and use it in GitHub Desktop.
Bukkit multiline YAML test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test: | |
message_normal: | | |
This is a | |
string with newlines | |
message_chomped: |- | |
This is a | |
string with newlines | |
message_raw: |+ | |
This is a | |
string with newlines | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.jikoo; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.event.Listener; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import org.jetbrains.annotations.NotNull; | |
public class TestPlugin extends JavaPlugin implements Listener { | |
@Override | |
public void onEnable() { | |
saveDefaultConfig(); | |
} | |
@Override | |
public boolean onCommand( | |
@NotNull CommandSender sender, | |
@NotNull Command command, | |
@NotNull String label, | |
@NotNull String[] args | |
) { | |
sender.sendMessage("---------"); | |
for (int i = 0; i < 3; ++i) { | |
sender.sendMessage(getMessage(i)); | |
sender.sendMessage("---------"); | |
} | |
return true; | |
} | |
private String getMessage(int index) { | |
return switch (index) { | |
case 0 -> getConfig().getString("test.message_normal", "test.message_normal"); | |
case 1 -> getConfig().getString("test.message_chomped", "test.message_chomped"); | |
case 2 -> getConfig().getString("test.message_raw", "test.message_raw"); | |
default -> ""; | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment