示例#1
0
 public void saveArenas() {
   Config config = new Config("Arena/arenas");
   for (Arena ar : arenas) {
     config.getConfig().set(ar.getId() + ".location", serializeLoc(ar.spawn));
     config.getConfig().set(ar.getId() + ".type", ar.getType());
     config.getConfig().set(ar.getId() + ".size", ar.getSize());
     config.save();
   }
 }
  @Exposed(method = "POST", url = "stream/fallback")
  public void setFallback(String name) {
    /* disable if an empty string is passed */
    if (name.isEmpty()) {
      name = null;
    }

    config.settings.StreamSwitcher_fallbackStream = name;
    config.save();
  }
示例#3
0
 @Mod.EventHandler
 public void load(FMLInitializationEvent event) {
   config.load();
   this.worldType = new NewDawnWorldType();
   this.thaumcraftSupportEnabled =
       config.getMiscBoolean("Enable internal Thaumcraft support", true);
   if (thaumcraftSupportEnabled) {
     ThaumcraftBiomeProvider.prepareThaumcraftSupport(config);
   }
   config.save();
 }
示例#4
0
  public void saveStreams() throws IOException {
    Config config = Config.getConfiguration("manager.streams");

    config.setArray("streams", streams.toArray());

    Iterator it = streams.iterator();
    while (it.hasNext()) {
      DataSource ds = (DataSource) it.next();
      ds.save();
    }

    config.save();
  }
  public static void configCheck(ConfigType type) {
    FileConfiguration config;
    switch (type) {
      case linkConfig:
        config = linkConfig.get();

        config.addDefault("Links.YouTube", "http://youtube.com");
        config.addDefault("Links.Twitter", "http://twitter.com");
        config.addDefault("Links.Website", "http://www.elementum.me");
        config.addDefault("Links.Donate", "http://www.elementum.me/donate");
        config.addDefault("Links.Vote", "http://");

        linkConfig.save();

      case opConfig:
        config = opConfig.get();

        config.addDefault("Ops.KickMessage", "&cHa, you thought. Go watch space jam kid.");
        config.addDefault("Ops.Names", Arrays.asList("Loonyy"));

        opConfig.save();

      case commandsConfig:
        config = commandConfig.get();

        config.addDefault("CommandMessage", "&c&lNot in my house! :)");
        config.addDefault("Commands", Arrays.asList("fly"));

        commandConfig.save();

      case respawnConfig:
        config = respawnConfig.get();

        config.addDefault("RespawnLocation.FallbackSpawn", "null");

        respawnConfig.save();
    }
  }
  @Exposed(method = "POST", url = "recording")
  public void toggleRecording(boolean state) {
    /* idempotence */
    if (this.config.settings.StreamSwitcher_autoRecord == state) {
      return;
    }

    config.settings.StreamSwitcher_autoRecord = state;
    config.save();

    if (state) {
      startRecording();
    } else {
      stopRecording();
    }
  }
示例#7
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (cmd.getName().equalsIgnoreCase("uuidban")) {
     if (sender instanceof Player) {
       Player player = (Player) sender;
       if (player.hasPermission("uuidban.ban")) {
         String UUID = "";
         JSONObject json = JsonReader.readJsonFromUrl("https://us.mc-api.net/v3/uuid/" + args[0]);
         try {
           UUID = json.getString("uuid");
         } catch (Exception ex) {
           UUID = "";
           ex.printStackTrace();
         }
         if (config.getConfig().contains(UUID)) {
           if (config.getConfig().getString(UUID).equalsIgnoreCase(args[1])) {
             sender.sendMessage(
                 ChatColor.BLUE
                     + "UUIDBan> "
                     + ChatColor.GREEN
                     + args[0]
                     + " is already uuid banned!");
             if (Bukkit.getServer().getPlayer(args[0]) != null) {
               Bukkit.getServer()
                   .getPlayer(args[0])
                   .kickPlayer(
                       "Your account, "
                           + Bukkit.getServer().getPlayer(args[0]).getName()
                           + ", is banned from this server!");
             }
           } else {
             config.getConfig().set(UUID, args[1]);
             config.save();
             sender.sendMessage(
                 ChatColor.BLUE
                     + "UUIDBan> "
                     + ChatColor.GREEN
                     + args[0]
                     + " updated after uuid change. Player is still banned.");
             if (Bukkit.getServer().getPlayer(args[0]) != null) {
               Bukkit.getServer()
                   .getPlayer(args[0])
                   .kickPlayer(
                       "Your account, "
                           + Bukkit.getServer().getPlayer(args[0]).getName()
                           + ", is banned from this server!");
             }
           }
         } else {
           config.getConfig().set(UUID, args[1]);
           config.save();
           if (Bukkit.getServer().getPlayer(args[0]) != null) {
             Bukkit.getServer()
                 .getPlayer(args[0])
                 .kickPlayer(
                     "Your account, "
                         + Bukkit.getServer().getPlayer(args[0]).getName()
                         + ", is banned from this server!");
           }
           sender.sendMessage(
               ChatColor.BLUE + "UUIDBan> " + ChatColor.GREEN + args[0] + " is now uuid banned!");
         }
       } else {
         sender.sendMessage(
             ChatColor.BLUE
                 + "UUIDBan> "
                 + ChatColor.GREEN
                 + "You do not have permission to use this command!");
       }
     } else {
       String UUID = "";
       JSONObject json = JsonReader.readJsonFromUrl("https://us.mc-api.net/v3/uuid/" + args[0]);
       try {
         UUID = json.getString("uuid");
       } catch (Exception ex) {
         UUID = "";
         ex.printStackTrace();
       }
       if (config.getConfig().contains(UUID)) {
         if (config.getConfig().getString(UUID).equalsIgnoreCase(args[1])) {
           log.info(args[0] + " is already banned!");
           if (Bukkit.getServer().getPlayer(args[0]) != null) {
             Bukkit.getServer()
                 .getPlayer(args[0])
                 .kickPlayer(
                     "Your account, "
                         + Bukkit.getServer().getPlayer(args[0]).getName()
                         + ", is banned from this server!");
           }
         } else {
           config.getConfig().set(UUID, args[1]);
           config.save();
           log.info(args[0] + " updated after uuid change. Player is still banned.");
           if (Bukkit.getServer().getPlayer(args[0]) != null) {
             Bukkit.getServer()
                 .getPlayer(args[0])
                 .kickPlayer(
                     "Your account, "
                         + Bukkit.getServer().getPlayer(args[0]).getName()
                         + ", is banned from this server!");
           }
         }
       } else {
         config.getConfig().set(UUID, args[1]);
         config.save();
         if (Bukkit.getServer().getPlayer(args[0]) != null) {
           Bukkit.getServer()
               .getPlayer(args[0])
               .kickPlayer(
                   "Your account, "
                       + Bukkit.getServer().getPlayer(args[0]).getName()
                       + ", is banned from this server!");
         }
         log.info(args[0] + " is now uuid banned!");
       }
     }
   } else if (cmd.getName().equalsIgnoreCase("uuidunban")) {
     if (sender instanceof Player) {
       Player player = (Player) sender;
       if (player.hasPermission("uuidban.unban")) {
         String UUID = "";
         JSONObject json = JsonReader.readJsonFromUrl("https://us.mc-api.net/v3/uuid/" + args[0]);
         try {
           UUID = json.getString("uuid");
         } catch (Exception ex) {
           UUID = "";
           ex.printStackTrace();
         }
         if (config.getConfig().contains(UUID)) {
           config.getConfig().set(UUID, null);
           config.save();
           sender.sendMessage(
               ChatColor.BLUE + "UUIDBan> " + ChatColor.GREEN + args[0] + " is now unbanned!");
         } else {
           sender.sendMessage(
               ChatColor.BLUE
                   + "UUIDBan> "
                   + ChatColor.GREEN
                   + args[0]
                   + " is not already uuid bannned!");
         }
       } else {
         sender.sendMessage(
             ChatColor.BLUE
                 + "UUIDBan> "
                 + ChatColor.GREEN
                 + "You do not have permission to use this command!");
       }
     } else {
       String UUID = "";
       JSONObject json = JsonReader.readJsonFromUrl("https://us.mc-api.net/v3/uuid/" + args[0]);
       try {
         UUID = json.getString("uuid");
       } catch (Exception ex) {
         UUID = "";
         ex.printStackTrace();
       }
       if (config.getConfig().contains(UUID)) {
         config.getConfig().set(UUID, null);
         config.save();
         log.info(args[0] + " is now unbanned!");
       } else {
         log.info(args[0] + " is not already uuid banned!");
       }
     }
   }
   return false;
 }