Example #1
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerJoinGroup(PlayerJoinGroupEvent event) {
   if (event.allow) {
     // see if the new group has teleporting set...
     Player player = Bukkit.getPlayer(event.playerName);
     GroupRecord groupRecord;
     try {
       groupRecord = GroupAPI.getGroup(event.groupName);
       if (groupRecord.teleportOnJoin)
         if (groupRecord.teleportLocation != null)
           // teleport the player
           player.teleport(groupRecord.teleportLocation);
     } catch (PluginNotEnabled e) {
     }
   }
 }
 @Override
 public String takeAction(Interaction interaction, String bonusName)
     throws GeneralInteractionError {
   // if a valid skill has been selected, create a default bonus based on that skill,
   // put the skill in the 'currentSkill' context, and
   // then user gets passed onto 'groupModifyBonus'
   SkillType selected = SkillType.valueOf(bonusName);
   if (selected == null)
     throw new GeneralInteractionError(
         "Unable to determine a skill type based on \"" + bonusName + "\"");
   GroupHelper helper = new GroupHelper(interaction);
   try {
     GroupAPI.addBonus(
         helper.record, selected, MMOGroup.instance.config.defaultSkillBonusMultiplier);
     interaction.context.put(Constants.SELECTED_GROUP_SKILL, bonusName);
   } catch (PluginNotEnabled error) {
   }
   return "New bonus to " + bonusName.toLowerCase() + " created for " + helper.record.getName();
 }