// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/AchievementEvents.java
// public enum AchievementEvents {
//   buildUnpinned,
//   buildTagged,
//   testBombed,
//   testDisarmed,
//   compilationBroken,
//   investigationDelegated,
//   investigationTaken,
//   issueMentioned,
//   changeAdded,
//   userAction // with 5 minutes resolution
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


import jetbrains.buildServer.BuildProblemTypes;
import jetbrains.buildServer.issueTracker.Issue;
import jetbrains.buildServer.responsibility.ResponsibilityEntry;
import jetbrains.buildServer.serverSide.*;
import jetbrains.buildServer.serverSide.mute.MuteInfo;
import jetbrains.buildServer.serverSide.problems.BuildProblem;
import jetbrains.buildServer.serverSide.problems.BuildProblemInfo;
import jetbrains.buildServer.tests.TestName;
import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.users.User;
import jetbrains.buildServer.util.EventDispatcher;
import jetbrains.buildServer.vcs.SVcsModification;
import jetbrains.buildServer.vcs.VcsModification;
import jetbrains.buildServer.vcs.VcsRoot;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.AchievementEvents;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.buildserver.achievements.impl;



public class ServerEventsAdapter extends BuildServerAdapter {
  private final UserEventsRegistry myUserEventsRegistry;

  public ServerEventsAdapter(@NotNull UserEventsRegistry userEventsRegistry,
                             @NotNull EventDispatcher<BuildServerListener> serverDispatcher) {
    myUserEventsRegistry = userEventsRegistry;
    serverDispatcher.addListener(this);
  }

  @Override
  public void buildUnpinned(@NotNull SBuild build, @Nullable User user, @Nullable String comment) {
    super.buildUnpinned(build, user, comment);

    if (user != null) {
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/AchievementEvents.java
// public enum AchievementEvents {
//   buildUnpinned,
//   buildTagged,
//   testBombed,
//   testDisarmed,
//   compilationBroken,
//   investigationDelegated,
//   investigationTaken,
//   issueMentioned,
//   changeAdded,
//   userAction // with 5 minutes resolution
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/ServerEventsAdapter.java
import jetbrains.buildServer.BuildProblemTypes;
import jetbrains.buildServer.issueTracker.Issue;
import jetbrains.buildServer.responsibility.ResponsibilityEntry;
import jetbrains.buildServer.serverSide.*;
import jetbrains.buildServer.serverSide.mute.MuteInfo;
import jetbrains.buildServer.serverSide.problems.BuildProblem;
import jetbrains.buildServer.serverSide.problems.BuildProblemInfo;
import jetbrains.buildServer.tests.TestName;
import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.users.User;
import jetbrains.buildServer.util.EventDispatcher;
import jetbrains.buildServer.vcs.SVcsModification;
import jetbrains.buildServer.vcs.VcsModification;
import jetbrains.buildServer.vcs.VcsRoot;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.AchievementEvents;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.buildserver.achievements.impl;



public class ServerEventsAdapter extends BuildServerAdapter {
  private final UserEventsRegistry myUserEventsRegistry;

  public ServerEventsAdapter(@NotNull UserEventsRegistry userEventsRegistry,
                             @NotNull EventDispatcher<BuildServerListener> serverDispatcher) {
    myUserEventsRegistry = userEventsRegistry;
    serverDispatcher.addListener(this);
  }

  @Override
  public void buildUnpinned(@NotNull SBuild build, @Nullable User user, @Nullable String comment) {
    super.buildUnpinned(build, user, comment);

    if (user != null) {
      registerUserEvent(user, AchievementEvents.buildUnpinned.name());