Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import net.md_5.bungee.api.CommandSender;
- import net.md_5.bungee.api.ProxyServer;
- import net.md_5.bungee.api.chat.TextComponent;
- import net.md_5.bungee.api.plugin.Command;
- import net.md_5.bungee.config.ConfigurationProvider;
- import net.md_5.bungee.config.YamlConfiguration;
- import java.io.File;
- import java.io.IOException;
- /**
- * The MIT License (MIT)
- * Created on 06/07/2016.
- * Copyright (c) 2016 @author Vinetos
- */
- public class TestCommand extends Command {
- public TestCommand() {
- super("test");
- }
- private final File file = new File(ProxyServer.getInstance().getPluginManager().getPlugin("EP08").getDataFolder(), "messages.yml");
- @Override
- public void execute(CommandSender sender, String[] args) {
- try {
- sender.sendMessage(new TextComponent(BungeeMain.getConfiguration().getString("message")));
- sender.sendMessage(new TextComponent(BungeeMain.getConfiguration().getString("test.message")));
- if(args.length == 1 && args[0].equalsIgnoreCase("reload"))
- BungeeMain.reloadConfig(file);
- else if (args.length == 2) {
- BungeeMain.getConfiguration().set("message", "Changement de message");
- ConfigurationProvider.getProvider(YamlConfiguration.class).save(BungeeMain.getConfiguration(), file);
- BungeeMain.reloadConfig(file);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment