Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Verifies if player is mentee and if his current level should reward his mentor and if so sends a mail with reward.
- * @param player
- */
- private void checkLevelForReward(PlayerInstance player)
- {
- if (!MENTEE_COINS.containsKey(player.getLevel()))
- {
- return;
- }
- final Mentee mentor = MentorManager.getInstance().getMentor(player.getObjectId());
- if (mentor == null)
- {
- return;
- }
- final int amount = MENTEE_COINS.get(player.getLevel());
- if (amount > 0)
- {
- sendMail(mentor.getObjectId(), LEVEL_UP_TITLE, String.format(LEVEL_UP_BODY, player.getName(), player.getLevel()), MENTEE_MARK, amount);
- }
- }
- private void sendMail(int objectId, String title, String body, int itemId, long amount)
- {
- final Message msg = new Message(MENTOR_GUIDE, objectId, title, body, MailType.MENTOR_NPC);
- final Mail attachments = msg.createAttachments();
- attachments.addItem(getName(), itemId, amount, null, null);
- MailManager.getInstance().sendMessage(msg);
- }
- public static void main(String[] args)
- {
- new MentorGuide();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement