made certain messages visible in tutorial that are actually required to be seen

This commit is contained in:
NewGarbo 2015-12-01 13:37:34 +00:00
parent f536bf23e5
commit fbf9c8eb0c
6 changed files with 161 additions and 150 deletions

View File

@ -402,6 +402,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
return _disguiseManager;
}
public TutorialManager getTutorials()
{
return _tutorialManager;
}
public NpcManager getNPCManager()
{
return _npcManager;

View File

@ -25,6 +25,7 @@ import mineplex.game.clans.clans.ClansBlacklist;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClientClan;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.tutorials.Tutorial;
import mineplex.game.clans.tutorials.TutorialManager;
import net.minecraft.server.v1_8_R3.EnumDirection;
@ -126,7 +127,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length == 0)
{
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
return;
}
@ -135,7 +136,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
if (clan == null)
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
else
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
}
@ -146,7 +147,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length == 0)
{
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
return;
}
@ -155,7 +156,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
if (clan == null)
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
else
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
}
@ -171,30 +172,30 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
UtilPlayer.message(caller, F.main("Clans", "Commands List;"));
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;"));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
UtilPlayer.message(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
UtilPlayer.message(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
UtilPlayer.message(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
UtilPlayer.message(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
UtilPlayer.message(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
}
public void create(final Player caller, final String[] args)
@ -205,12 +206,12 @@ public class ClansCommand extends CommandBase<ClansManager>
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
return;
}
/*
* TODO if (!client.canJoin()) { UtilPlayer.message(caller,
* TODO if (!client.canJoin()) { _manager.getTutorials().sendTutorialMsg(caller,
* F.main("Clans", "You cannot join a Clan for " + C.mTime +
* UtilTime.convertString(System.currentTimeMillis() -
* client.getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); return; }
@ -218,37 +219,37 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
return;
}
if (!UtilInput.valid(args[1]))
{
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
return;
}
if (args[1].length() < Plugin.getNameMin())
{
UtilPlayer.message(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
return;
}
if (args[1].length() > Plugin.getNameMax())
{
UtilPlayer.message(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
return;
}
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
{
UtilPlayer.message(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
return;
}
if (!ClansBlacklist.isValidClanName(args[1]))
{
UtilPlayer.message(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
return;
}
@ -259,7 +260,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{
if (clanExists)
{
UtilPlayer.message(caller, F.main("Clans", "Clan name is already in use by another Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan."));
}
else
{
@ -271,11 +272,11 @@ public class ClansCommand extends CommandBase<ClansManager>
if (data == null)
{
// Hopefully shouldn't happen!
UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
}
else
{
UtilPlayer.message(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
}
}
});
@ -295,13 +296,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input an invitee."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee."));
return;
}
@ -315,25 +316,25 @@ public class ClansCommand extends CommandBase<ClansManager>
{
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
return;
}
if (!Plugin.Get(caller).canJoin())
{
UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
return;
}
if (!UtilInput.valid(args[1]))
{
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
return;
}
@ -342,13 +343,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!clan.isInvited(caller.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
return;
}
if (clan.getSize() >= clan.getMaxSize())
{
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
return;
}
@ -361,12 +362,12 @@ public class ClansCommand extends CommandBase<ClansManager>
if (data)
{
// Inform
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
}
else
{
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
}
}
});
@ -379,13 +380,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
{
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
return;
}
@ -399,7 +400,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public void run(Boolean data)
{
// Inform
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
}
});
@ -416,13 +417,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Player to kick."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick."));
return;
}
@ -437,13 +438,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote."));
return;
}
@ -458,13 +459,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input player to demote."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote."));
return;
}
@ -479,19 +480,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to ally."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally."));
return;
}
@ -501,31 +502,31 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA.isSelf(cB.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot ally with yourself."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself."));
return;
}
if (cA.isAlly(cB.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
return;
}
if (cA.getAllies() >= cA.getAlliesMax())
{
UtilPlayer.message(caller, F.main("Clans", "You cannot have any more allies."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies."));
return;
}
if (cB.getAllies() >= cB.getAlliesMax())
{
UtilPlayer.message(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
return;
}
if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "Please do not spam alliance requests."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests."));
return;
}
@ -535,7 +536,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
// Inform
UtilPlayer.message(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " accepted alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
cB.inform("Clan " + F.elem(cA.getName()) + " has accepted alliance with you.", null);
}
@ -545,7 +546,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
// Inform
UtilPlayer.message(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " has requested alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
cB.inform("Clan " + F.elem(cA.getName()) + " has requested alliance with you.", null);
@ -559,19 +560,19 @@ public class ClansCommand extends CommandBase<ClansManager>
//
// if (cA == null)
// {
// UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
// return;
// }
//
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
// {
// UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
// return;
// }
//
// if (args.length < 2)
// {
// UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy."));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to enemy."));
// return;
// }
//
@ -581,7 +582,7 @@ public class ClansCommand extends CommandBase<ClansManager>
//
// if (!cA.isAlly(cB.getName()))
// {
// UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be allied to trust a clan!"));
// return;
// }
//
@ -589,14 +590,14 @@ public class ClansCommand extends CommandBase<ClansManager>
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
// {
// // Inform
// UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
// cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
// cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
// }
// else
// {
// // Inform
// UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
// cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
// cB.inform(F.elem("Clan " + cA.getName()) + " has revoked trust to you.", null);
// }
@ -608,19 +609,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
return;
}
@ -630,11 +631,11 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cB.isSelf(cA.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively..."));
}
else if (cB.isNeutral(cA.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
}
else if (cB.isAlly(cA.getName()))
{
@ -642,7 +643,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
// Inform
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
}
@ -683,7 +684,7 @@ public class ClansCommand extends CommandBase<ClansManager>
}
// Change Inform
UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
// Inform
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
@ -719,31 +720,31 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (clan.getHome() == null)
{
UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home"));
return;
}
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
{
UtilPlayer.message(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
return;
}
if (!Plugin.getClanUtility().isSafe(caller.getLocation()))
{
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
return;
}
if (!Plugin.getClanUtility().isSpecial(caller.getLocation(), "Spawn"))
{
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
return;
}
@ -751,7 +752,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
{
UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
return;
}
@ -760,7 +761,7 @@ public class ClansCommand extends CommandBase<ClansManager>
* (Player cur : clan.GetHome().getWorld().getPlayers()) if
* (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) if
* (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().
* getChunk()))) { UtilPlayer.message(caller, F.main("Clans",
* getChunk()))) { _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans",
* "You cannot use Clan Home with enemies in your Territory.")); return;
* }
*/
@ -772,7 +773,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
// Inform
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
}
public void homeSet(Player caller)
@ -790,31 +791,31 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
return;
}
if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null)
{
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
return;
}
if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
return;
}
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
{
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
return;
}
@ -823,7 +824,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!bedPlaced)
{
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
return;
}
@ -839,7 +840,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
// Inform
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
clan.inform(caller.getName() + " set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".", caller.getName());
}
@ -847,7 +848,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{System.out.println(search);
if (search == null)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
return;
}
@ -869,13 +870,13 @@ public class ClansCommand extends CommandBase<ClansManager>
{
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
{
UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
return;
}
if (search == null)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
return;
}
@ -904,7 +905,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
}
@ -914,6 +915,6 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) return;
UtilPlayer.message(caller, clan.mTerritory());
_manager.getTutorials().sendTutorialMsg(caller, clan.mTerritory());
}
}

View File

@ -41,8 +41,6 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClanTipEvent;
import mineplex.game.clans.economy.GoldManager;
import net.md_5.bungee.api.chat.BaseComponent;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
/**
@ -59,7 +57,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
public static String SKIPPED_TASK = "tatatatata%sSkip";
public static String ALLOWED_MESSAGE_CODE = "-TUTORIALMESSAGE-";
public static String AllowedMessage = C.cGold + "-=%TutorialAllowedMessage%=-" + C.Reset;
protected final TutorialManager _manager;
protected final GoldManager _goldManager;
@ -97,21 +95,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
packetHandler.addPacketHandler(new IPacketHandler() {
public void handle(PacketInfo packet)
{
if (!isInTutorial(packet.getPlayer()))
{
return;
}
if (packet.getPacket() instanceof PacketPlayOutChat)
{
PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket();
if (chat.b == 1)
{
if (!chat.a.a().get(0).c().equals(ALLOWED_MESSAGE_CODE))
if (!chat.a.a().get(0).c().equals(AllowedMessage))
{
if (isInTutorial(packet.getPlayer()))
{
packet.setCancelled(true);
}
}
else
{
chat.a.a().remove(0);
@ -286,7 +282,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
if (_goldReward != -1)
{
_goldManager.addGold(player, _goldReward);
msg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
}
if (_gemReward != -1)
@ -294,7 +290,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_donationManager.RewardGems(new Callback<Boolean>() {
public void run(Boolean data)
{
msg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
}
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
}
@ -304,7 +300,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_donationManager.RewardCoins(new Callback<Boolean>() {
public void run(Boolean data)
{
msg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
}
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
}
@ -422,7 +418,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void skip(final Player player)
{
new JsonMessage(
ALLOWED_MESSAGE_CODE +
AllowedMessage +
F.main(
"Tutorial",
"Are you sure you want to skip the tutorial? We "
@ -544,9 +540,4 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_inTutorial.remove(player.getName());
}
protected void msg(Player player, String msg)
{
UtilPlayer.message(player, ALLOWED_MESSAGE_CODE + msg);
}
}

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.tutorials;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.bukkit.entity.Player;
@ -79,7 +80,7 @@ public class TutorialManager extends MiniPlugin
getTutorial(player).cancelFor(player);
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
sendTutorialMsg(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
_playerTutorials.remove(player.getName());
}
}
@ -96,7 +97,7 @@ public class TutorialManager extends MiniPlugin
{
if (isInTutorial(player))
{
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
sendTutorialMsg(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
getTutorial(player).doSkip(player);
}
}
@ -110,6 +111,19 @@ public class TutorialManager extends MiniPlugin
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
}
public void sendTutorialMsg(Player player, String message)
{
player.sendMessage(Tutorial.AllowedMessage + message);
}
public void sendTutorialMsg(Player player, LinkedList<String> messages)
{
for (String message : messages)
{
sendTutorialMsg(player, message);
}
}
public Tutorial getTutorial(final Player player)
{
return _playerTutorials.get(player.getName());

View File

@ -5,7 +5,6 @@ import org.bukkit.event.Listener;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautArrayList;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
public class TutorialTask<T extends Tutorial> implements Listener
@ -81,15 +80,16 @@ public class TutorialTask<T extends Tutorial> implements Listener
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
{
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + " ");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + " ");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + " ");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + C.cDGreenB + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + " ");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + C.cYellowB + "Part " + _id + ": " + _displayName);
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + " ");
UtilPlayer.message(player, Tutorial.ALLOWED_MESSAGE_CODE + C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName);
_tutorial._manager.sendTutorialMsg(player, C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
client.LastDescriptionSentTime = System.currentTimeMillis();
}
}
@ -137,14 +137,14 @@ public class TutorialTask<T extends Tutorial> implements Listener
if (_finishMessage != null)
{
UtilPlayer.message(player, " ");
UtilPlayer.message(player, " ");
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
}
}

View File

@ -51,12 +51,12 @@ public class TutorialGettingStarted extends Tutorial
@Override
public void onFinished(final Player player)
{
msg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
msg(player, C.cYellowB + "CONGRATULATIONS");
msg(player, " ");
msg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
msg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
msg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
_manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
player.resetPlayerTime();
player.teleport(Spawn.getEastSpawn());
@ -65,17 +65,17 @@ public class TutorialGettingStarted extends Tutorial
@Override
public void onBegin(final Player player)
{
msg(player, " ");
msg(player, " ");
msg(player, " ");
msg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
msg(player, " ");
msg(player, C.cYellowB + "Getting Started");
msg(player, C.cWhite + "Welcome to Clans! "
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, C.cYellowB + "Getting Started");
_manager.sendTutorialMsg(player, C.cWhite + "Welcome to Clans! "
+ "In this game mode you are able to create a clan, invite your friends to play with you, build a base, and wage war against others! "
+ "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold");
msg(player, " ");
msg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_manager.sendTutorialMsg(player, " ");
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
}