Exemplo n.º 1
0
 @Override
 public boolean execute() {
   try {
     plugin.getConfigs().loadConfig(false);
   } catch (Exception ex) {
     log.warning(logPrefix + "an error occured while trying to load the config file.");
     ex.printStackTrace();
     return true;
   }
   Actions.message(sender, null, "&aConfiguration reloaded!");
   return true;
 }
Exemplo n.º 2
0
  private boolean canBuild(Location loc, Player player, boolean sendError) {
    boolean inRegion = false;

    // すべてのプロジェクトをチェック
    for (Project project : plugin.projects.values()) {
      // エリア未設定のプロジェクトは次を確認
      if (project.getArea() == null) continue;

      Cuboid region = project.getArea();
      // エリア外のプロジェクトは次を確認
      if (!region.isIn(loc)) continue;

      // エリア内 + プロジェクトメンバー なら次を確認
      if (project.isJoined(player.getName())) {
        inRegion = true;
        continue;
      }

      // エリア内 + メンバー外 なら建築禁止
      else {
        if (sendError)
          Actions.message(null, player, "&cここはプロジェクト'&6" + project.getTitle() + "&c'の保護エリアです");
        return false;
      }
    }

    // プロジェクトエリア内なら既に建築可能か確定済み
    if (!inRegion) {
      // 保護ワールドかチェック
      if (plugin.getConfigs().protectedWorlds.contains(loc.getWorld().getName())) {
        if (sendError) Actions.message(null, player, msgPrefix + "&cこのワールドは保護されています!");
        return false;
      }
    }

    // 建築可能
    return true;
  }