From ea099d7a82607d9d2ead068c8d50fa2783d2da55 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Tue, 1 Dec 2015 18:41:33 +0000 Subject: [PATCH] fixed some annoying bugs and fixed certain messages not showing in tutorial --- .../game/clans/clans/ClansUtility.java | 122 +++++++++--------- .../game/clans/tutorials/Tutorial.java | 27 +--- .../game/clans/tutorials/TutorialManager.java | 32 ++++- .../tutorials/gettingstarted/TaskClaim.java | 2 +- .../gettingstarted/TaskCreateClan.java | 2 +- 5 files changed, 95 insertions(+), 90 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java index 4031496a1..f01423118 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -157,10 +157,10 @@ public class ClansUtility if (inform) { - UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); - UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false); - UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);; + Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString)); + Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString)); } return null; @@ -183,7 +183,7 @@ public class ClansUtility if (!inform) return null; // Inform - UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); if (matchList.size() > 0) { @@ -191,7 +191,7 @@ public class ClansUtility for (ClanInfo cur : matchList) matchString += cur.getName() + " "; - UtilPlayer.message(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."), false); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "].")); } return null; @@ -554,31 +554,31 @@ public class ClansUtility { if (Clans.getClanMemberUuidMap().containsKey(caller.getUniqueId())) { - UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); return; } if (!Clans.Get(caller).canJoin()) { - UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + ".")); return; } if (clanInfo == null) { - UtilPlayer.message(caller, F.main("Clans", "Error: Clan does not exist")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist")); return; } if (!clanInfo.isInvited(caller.getName())) { - UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + ".")); return; } if (clanInfo.getSize() >= clanInfo.getMaxSize()) { - UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!")); return; } @@ -591,12 +591,12 @@ public class ClansUtility if (data) { // Inform - UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + ".")); clanInfo.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")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request")); } } }); @@ -609,13 +609,13 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.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.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); return; } @@ -629,7 +629,7 @@ public class ClansUtility public void run(Boolean data) { // Inform - UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); clan.inform(F.name(caller.getName()) + " has left your Clan.", null); } }); @@ -646,13 +646,13 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return; } if (getRole(caller) != ClanRole.LEADER) { - UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); return; } @@ -673,7 +673,7 @@ public class ClansUtility { if (!data) { - UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later")); }else { @@ -689,25 +689,25 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return false; } 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 claim Territory.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory.")); return false; } if (!ClansManager.isClaimable(caller.getLocation())) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim territory at this location!")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!")); return false; } // if (clan.getEnergy() == 0) // { -// UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); +// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); // return false; // } @@ -723,14 +723,14 @@ public class ClansUtility } else { - UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + ".")); return false; } } // if (clan.getClaims() >= clan.getClaimsMax()) // { -// UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); +// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); // return false; // } @@ -756,8 +756,8 @@ public class ClansUtility if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3)) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); - UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); return false; } @@ -767,7 +767,7 @@ public class ClansUtility } else if (rel(clan, adjClan) != ClanRelation.SELF) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + ".")); return false; } } @@ -776,21 +776,21 @@ public class ClansUtility // Boxed if (checkBox(caller.getLocation().getChunk(), 4)) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); - UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); return false; } if (isNearAdminClaim(caller.getLocation())) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!")); return false; } // Not Next to Self if (!selfAdj && !clan.getClaimSet().isEmpty()) { - UtilPlayer.message(caller, F.main("Clans", "You must claim next to your other Territory.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory.")); return false; } @@ -799,7 +799,7 @@ public class ClansUtility { if (!UtilTime.elapsed(Clans.getUnclaimMap().get(chunk), Clans.getReclaimTime())) { - UtilPlayer.message(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + ".")); return false; } @@ -814,7 +814,7 @@ public class ClansUtility { if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur)) { - UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); return false; } } @@ -836,7 +836,7 @@ public class ClansUtility Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false); // Inform - UtilPlayer.message(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); return true; @@ -873,7 +873,7 @@ public class ClansUtility } // 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!")); + Clans.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())) + ".")); @@ -890,7 +890,7 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -901,13 +901,13 @@ public class ClansUtility if (target.equals(caller.getName())) { - UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself.")); return; } if (self.getRole().ordinal() <= target.getRole().ordinal()) { - UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } @@ -942,7 +942,7 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -953,19 +953,19 @@ public class ClansUtility if (target.equals(caller.getName())) { - UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself.")); return; } if (self.getRole().ordinal() <= target.getRole().ordinal()) { - UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } if (target.getRole() == ClanRole.RECRUIT) { - UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further.")); return; } @@ -992,7 +992,7 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -1003,20 +1003,20 @@ public class ClansUtility if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN) { - UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); return; } if (clansPlayer.getRole() == ClanRole.LEADER) { - UtilPlayer.message(caller, F.main("Clans", "Clan leaders cannot be kicked.")); - UtilPlayer.message(caller, F.main("Clans", "To disband a clan, use /c disband")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband")); return; } if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN)) { - UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } @@ -1028,8 +1028,8 @@ public class ClansUtility public void run(Boolean data) { // Inform - if (player != null) UtilPlayer.message(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + ".")); - UtilPlayer.message(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan.")); + if (player != null) Clans.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan.")); clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName()); } }; @@ -1047,7 +1047,7 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return false; } @@ -1060,14 +1060,14 @@ public class ClansUtility // Role 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 unclaim Territory.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory.")); return false; } // Not Claimed if (ownerClan == null || !ownerClan.equals(clan)) { - UtilPlayer.message(caller, F.main("Clans", "This Territory is not owned by you.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you.")); return false; } @@ -1085,7 +1085,7 @@ public class ClansUtility Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true); // Inform - UtilPlayer.message(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); return true; @@ -1097,13 +1097,13 @@ public class ClansUtility if (clan == null) { - UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); return false; } if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER) { - UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); return false; } @@ -1121,7 +1121,7 @@ public class ClansUtility } // Inform - UtilPlayer.message(caller, F.main("Clans", "You unclaimed all your Clans Territory.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory.")); clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName()); return true; @@ -1131,21 +1131,21 @@ public class ClansUtility { 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 send invites.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites.")); return; } if (target.getName().equals(caller.getName())) { - UtilPlayer.message(caller, F.main("Clans", "You cannot invite yourself.")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself.")); return; } // Inform clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName()); - UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan.")); - UtilPlayer.message(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + ".")); - UtilPlayer.message(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!")); + Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan.")); + Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + ".")); + Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!")); // Task Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java index bff3c7c76..cefd2bdc1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java @@ -57,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 AllowedMessage = C.cGold + "-=%TutorialAllowedMessage%=-" + C.Reset; + public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset; protected final TutorialManager _manager; protected final GoldManager _goldManager; @@ -92,31 +92,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener _inTutorial = new LinkedHashMap<>(); _nameToTask = new LinkedHashMap<>(); - packetHandler.addPacketHandler(new IPacketHandler() { - public void handle(PacketInfo packet) - { - if (packet.getPacket() instanceof PacketPlayOutChat) - { - PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket(); - - if (chat.b == 1) - { - if (!chat.a.a().get(0).c().equals(AllowedMessage)) - { - if (isInTutorial(packet.getPlayer())) - { - packet.setCancelled(true); - } - } - else - { - chat.a.a().remove(0); - } - } - } - } - }, PacketPlayOutChat.class); - _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java index eaec8bece..a65ec948a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java @@ -13,7 +13,9 @@ import mineplex.core.MiniPlugin; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.preferences.PreferencesManager; import mineplex.core.task.TaskManager; import mineplex.game.clans.clans.ClansManager; @@ -22,6 +24,8 @@ import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand; import mineplex.game.clans.tutorials.commands.SkipTutorialCommand; import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted; +import net.md_5.bungee.api.ChatColor; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; public class TutorialManager extends MiniPlugin { @@ -41,6 +45,33 @@ public class TutorialManager extends MiniPlugin _taskManager = taskManager; _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager, taskManager, packetHandler)); + + packetHandler.addPacketHandler(new IPacketHandler() { + public void handle(PacketInfo packet) + { + if (packet.getPacket() instanceof PacketPlayOutChat) + { + PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket(); + + if (chat.b == 1) + { + if (chat.a.a().get(0).c().equals(ChatColor.stripColor(Tutorial.AllowedMessage))) + { + System.out.println("Modifying message"); + chat.a.a().remove(0); + } + else + { + if (isInTutorial(packet.getPlayer())) + { + System.out.println("Disallow message"); + packet.setCancelled(true); + } + } + } + } + } + }, PacketPlayOutChat.class); } public void addCommands() @@ -60,7 +91,6 @@ public class TutorialManager extends MiniPlugin if (_tutorials.containsKey(tutorial)) { _tutorials.get(tutorial).startFor(player); - _playerTutorials.put(player.getName(), _tutorials.get(tutorial)); return isInTutorial(player); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java index 802777151..1dee7b5c4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java @@ -26,7 +26,7 @@ public class TaskClaim extends TutorialTask @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onClansCommand(ClansCommandExecutedEvent event) { - if (isDoing(event.getPlayer())) + if (!isDoing(event.getPlayer())) { return; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCreateClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCreateClan.java index 40847ce70..134eec3a8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCreateClan.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCreateClan.java @@ -21,7 +21,7 @@ public class TaskCreateClan extends TutorialTask @EventHandler(priority = EventPriority.MONITOR) public void onClanCreated(ClanCreatedEvent event) { - if (isDoing(event.getFounder())) + if (!isDoing(event.getFounder())) { return; }