Package com.github.iaccidentally.ecm

Examples of com.github.iaccidentally.ecm.Chat


public class Commandadduser extends JavaPlugin {

  public void addUser(Player sender, String user)
      throws IOException {

    Chat chat = new Chat();
    FileConfiguration userName = getConfig();
    File configFile = new File("plugins" + File.pathSeparator + "EMC"
        + "users.yml");
    boolean configExists = configFile.exists() && configFile.canRead()
        && configFile.canWrite();
    boolean userIsNotAdded = userName.getString("EMC.Users", user) == null;

    if (userIsNotAdded && sender.hasPermission("ECM.adduser")
        || sender.hasPermission("ECM.*")) {
      if (configExists) {
        userName.set("EMC.Users", user);
        userName.save("plugins" + File.pathSeparator + "ECM"
            + File.pathSeparator + "users.yml");
        chat.finishMessage(sender, "You have let " + user.toLowerCase()
            + " use ECM correctly!");
      } else {
        FileWriter outFile = new FileWriter(configFile, true);
        PrintWriter out = new PrintWriter(outFile);
        out.println("#Users For ECM go in here! Do not touch this! Use the ingame command!");
        out.close();
        userName.set("EMC.Users", user);
        userName.save("plugins" + File.pathSeparator + "ECM"
            + File.pathSeparator + "users.yml");
        chat.finishMessage(
            sender,
            "You have let "
                + user.toLowerCase()
                + " use ECM correctly, there was no 'user' file so I made one!");
      }
View Full Code Here

TOP

Related Classes of com.github.iaccidentally.ecm.Chat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.