public void add(UUID playerUUID, String effectName, Boolean checkIfPlayerIsConnected)
      throws IllegalArgumentException {
    OfflinePlayer player = getPlayer(playerUUID, true);
    checkEffect(effectName);
    // verifie que ce type d'effet n'est pas deja attribue au joueur.
    AbstractEffect effect = (AbstractEffect) plugin.getEffectManager().get(effectName);
    checkEffectTypeDuplication(player.getPlayer(), effect, false);
    // recupere et si necessaire cree le(s) eventListener(s) appropries
    try {
      effect = effect.applyToPlayer(playerUUID);
    } catch (CloneNotSupportedException e) {
      throw new IllegalArgumentException(
          "An error occured during the player's effect creation " + e.getClass().toString() + ".");
    }
    for (Class<? extends AbstractEventListener<?>> eventListenerClass : effect.getNeededEvents()) {
      AbstractEventListener<?> eventListener = null;
      try {
        eventListener = EventListenerManager.getInstance().getEventListener(eventListenerClass);
        if (eventListener == null) {
          throw new IllegalArgumentException("An error occured during the EventListener creation.");
        }
      } catch (InstantiationException
          | IllegalAccessException
          | InvocationTargetException
          | SecurityException e) {
        e.printStackTrace();
        throw new IllegalArgumentException(
            "An error occured during the EventListener creation: " + e.getClass().toString() + ".");
      }

      // associe le(s) eventListener(s) approprie(s) a l effet
      eventListener.addObserver(effect);
    }

    // On rempli la map des effets du joueur avec le nouvel effet.
    if (this.playersEffects.get(playerUUID) == null) {
      this.playersEffects.put(playerUUID, new ArrayList<AbstractEffect>());
    }
    this.playersEffects.get(playerUUID).add(effect);
    effect.onEnable();
  }
 private PlayerEffectManager() {
   this.plugin = EffectManagerPlugin.getPlugin(EffectManagerPlugin.class);
   this.playersEffects = new TreeMap<UUID, List<AbstractEffect>>();
 }
 private void checkEffect(String effectName) {
   if (!plugin.getEffectManager().contains(effectName)) {
     throw new IllegalArgumentException("effect " + effectName + " doesn't exist");
   }
 }