From 93767b7a903a485e9b4586c852d94e5284853823 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 16 Mar 2016 22:46:18 +0000 Subject: [PATCH] tutorial changes, chat filter system, commented out all web stuff for analytics. --- .../mineplex/core/common/util/UtilServer.java | 71 +++++++ .../src/mineplex/core/chat/Chat.java | 21 ++ .../game/clans/analytics/AnalyticQueuer.java | 109 +++++----- .../game/clans/analytics/Profiler.java | 70 ++++--- .../game/clans/clans/ClansManager.java | 2 +- .../game/clans/clans/ClansUtility.java | 124 +++++------ .../clans/clans/commands/ClansCommand.java | 196 +++++++++--------- .../clans/commands/RestartTutCommand.java | 2 +- .../game/clans/clans/pvptimer/PvpTimer.java | 2 +- .../pvptimer/command/PvPTimerCommand.java | 2 +- .../game/clans/legacytutorial/Tutorial.java | 10 +- .../clans/legacytutorial/TutorialManager.java | 49 +---- .../clans/legacytutorial/TutorialTask.java | 35 ++-- .../commands/SkipTutorialCommand.java | 3 +- .../TutorialGettingStarted.java | 33 +-- .../game/clans/tutorial/TutorialManager.java | 30 ++- 16 files changed, 422 insertions(+), 337 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index ba1a01c68..abcd0d772 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -1,5 +1,6 @@ package mineplex.core.common.util; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -19,8 +20,17 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.scheduler.BukkitRunnable; +import com.google.common.collect.Lists; + public class UtilServer { + // Quite hacky. would be nice if we could have a "MineplexPlugin" interface + // which would define a getServerName() method and then implement it in + // whatever way needed. + // MineplexPlugin plugin = (MineplexPlugin) plugin.getClass().getDeclaredMethod("getMineplexPlugin").invoke(plugin); + // plugin.getServerName(); + private static String _serverName; + public static Player[] getPlayers() { return getServer().getOnlinePlayers().toArray(new Player[0]); @@ -138,4 +148,65 @@ public class UtilServer { return getServer().getOfflinePlayer(player); } + + public static String getServerName() + { + if (_serverName == null) + { + try + { + Class Portal = Class.forName("mineplex.core.portal.Portal"); + + Object instance = null; + + List stringFields = Lists.newArrayList(); + + for (Field field : Portal.getDeclaredFields()) + { + if (field.getType().equals(Portal)) + { + field.setAccessible(true); + instance = field.get(null); + } + + if (field.getType().equals(String.class)) + { + stringFields.add(field); + } + } + + for (Field field : stringFields) + { + field.setAccessible(true); + String value = (String) field.get(instance); + + if (stringFields.size() > 1) + { + if (value.contains("-")) + { + _serverName = new String(value); + } + } + else + { + _serverName = new String(value); + } + } + + if (_serverName == null) + { + _serverName = "UNKOWN"; + System.out.println("ERROR: Could not get server name from Portal. Cause is most likely ambiguous fields in the class. Please revise UtilServer's method of getting the current server name."); + } + } + catch (Exception exception) + { + System.out.println("FATAL ERROR WHILE TRYING TO GET SERVER NAME"); + exception.printStackTrace(); + + } + } + + return _serverName; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index cb4432ae2..4a9f30e1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -7,9 +7,12 @@ import java.io.InputStreamReader; import java.net.URL; import java.nio.charset.Charset; import java.security.cert.X509Certificate; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.UUID; +import java.util.function.Function; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; @@ -65,6 +68,7 @@ public class Chat extends MiniPlugin private long _silenced = 0; private boolean _threeSecondDelay = true; + private List> _customFilters = new ArrayList<>(); private HashMap _playerLastMessage = new HashMap(); @@ -309,6 +313,15 @@ public class Chat extends MiniPlugin return; } + for (Function restriction : _customFilters) + { + if (restriction.apply(event).booleanValue()) + { + event.setCancelled(true); + return; + } + } + if (SilenceCheck(sender)) { event.setCancelled(true); @@ -605,4 +618,12 @@ public class Chat extends MiniPlugin { _threeSecondDelay = b; } + + /** + * If the function returns Boolean.TRUE then the message will be CANCELLED. + */ + public void AddFilter(Function restriction) + { + _customFilters.add(restriction); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/AnalyticQueuer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/AnalyticQueuer.java index 18bb8b4e0..acc861435 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/AnalyticQueuer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/AnalyticQueuer.java @@ -2,9 +2,6 @@ package mineplex.game.clans.analytics; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import mineplex.core.common.util.MapBuilder; import mineplex.core.common.util.UtilCollections; @@ -13,37 +10,38 @@ import mineplex.core.common.util.UtilWeb; public class AnalyticQueuer extends Thread { - private List Queue = new ArrayList<>(); - - private ByteArrayOutputStream _bytes = new ByteArrayOutputStream(); + private ByteArrayOutputStream stream = new ByteArrayOutputStream(); + private DataOutputStream out = new DataOutputStream(stream); private long _lastPush = System.currentTimeMillis(); public void Queue(Section section, String[] data) { - Queue.add(new Analytic(section.getSection(), data, section.getStart(), section.getElapsed())); +// new Thread(() -> { +// write(new Analytic(section.getSection(), data, section.getStart(), section.getElapsed())); +// }).start(); } private void write(Analytic analytic) { - try ( - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(stream); - ) + try { - out.writeLong(analytic.getStart()); out.writeLong(analytic.getElapsed()); out.writeInt(analytic.getSection().getBytes().length); out.writeBytes(analytic.getSection()); - String data = UtilCollections.combine(analytic.getData(), ","); + String data = analytic.getData() == null ? "" : UtilCollections.combine(analytic.getData(), ","); + + System.out.println("data: " + data); out.writeInt(data.length()); - out.writeBytes(data); - _bytes.write(stream.toByteArray()); + if (analytic.getData() != null) + { + out.writeBytes(data); + } } catch (Exception exception) { @@ -53,49 +51,44 @@ public class AnalyticQueuer extends Thread public void run() { - while (true) - { - Iterator iterator = Queue.iterator(); - - while (iterator.hasNext()) - { - Analytic analytic = iterator.next(); - - write(analytic); - - iterator.remove(); - } - - - if (UtilTime.elapsed(_lastPush, 10000)) - { - String response = UtilWeb.doPOST("http://analytics.garblox.com/PushAnalyticData", - new MapBuilder() - .Put("authkey", Profiler.ANALYTICS_KEY) - .Put("service", "ClansBeta") - .Put("data", _bytes.toString()) - .GetMap() - ); - - _bytes.reset(); - - if (!response.equals("OK")) - { - System.out.println("[Clans Beta] Error while pushing analytic data to garblox: " + response); - } - - _lastPush = System.currentTimeMillis(); - } - - try - { - Thread.sleep(250); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - } +// while (true) +// { +// if (UtilTime.elapsed(_lastPush, 10000)) +// { +// System.out.println("PUSHING: Bytes[" + out.size() + "]"); +// +// String response = UtilWeb.doPOST("http://analytics.garblox.com/PushAnalyticData", +// new MapBuilder() +// .Put("authkey", Profiler.ANALYTICS_KEY) +// .Put("service", "ClansBeta") +// .Put("data", stream.toString()) +// .GetMap() +// ); +// +// // Clear +// stream.reset(); +// +// if (!response.equals("OK")) +// { +// System.out.println("[Clans Beta] Error while pushing analytic data to garblox: " + response); +// } +// else +// { +// System.out.println("ANALYTICS: OK."); +// } +// +// _lastPush = System.currentTimeMillis(); +// } +// +// try +// { +// Thread.sleep(250); +// } +// catch (Exception exception) +// { +// exception.printStackTrace(); +// } +// } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/Profiler.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/Profiler.java index c09d0f2c7..d73d7e08e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/Profiler.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/analytics/Profiler.java @@ -9,10 +9,11 @@ import mineplex.core.common.util.MapBuilder; import mineplex.core.common.util.UtilFile; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWeb; +import mineplex.game.clans.clans.ClansManager; public class Profiler { - public static final String ANALYTICS_KEY; +// public static final String ANALYTICS_KEY; public static Profiler Instance; @@ -22,47 +23,62 @@ public class Profiler static { - ANALYTICS_KEY = UtilFile.read(new File(UtilServer.getServer().getWorldContainer() + "/GarbloxAnalyticsKey")); +// ANALYTICS_KEY = UtilFile.read(new File(UtilServer.getServer().getWorldContainer() + "/GarbloxAnalyticsKey")); } public Profiler() { _queuer = new AnalyticQueuer(); - _queuer.start(); +// _queuer.start(); - String response = UtilWeb.doPOST("http://analytics.garblox.com/RegisterAnalytics", - new MapBuilder() - .Put("authkey", Profiler.ANALYTICS_KEY) - .Put("name", "ClansBeta") - .GetMap() - ); - - if (!response.equals("OK")) - { - System.out.println("[Clans Beta Analytics] Error while registering new analytic type: " + response); - } +// String response = UtilWeb.doPOST("http://analytics.garblox.com/RegisterAnalytics", +// new MapBuilder() +// .Put("authkey", Profiler.ANALYTICS_KEY) +// .Put("name", "ClansBeta") +// .GetMap() +// ); +// +// if (!response.equals("OK")) +// { +// System.out.println("[Clans Beta Analytics] Error while registering new analytic type: " + response); +// } Instance = this; } public void start(String section) { - Thread thread = Thread.currentThread(); - - if (_sections.get(thread) == null) - { - _sections.put(thread, new Stack<>()); - } - - _sections.get(thread).push(new Section(section, System.currentTimeMillis(), thread)); +// Thread thread = Thread.currentThread(); +// +// if (_sections.get(thread) == null) +// { +// _sections.put(thread, new Stack<>()); +// } +// +// _sections.get(thread).push(new Section(section, System.currentTimeMillis(), thread)); } public void end(String... data) { - Thread thread = Thread.currentThread(); - - Section section = _sections.get(thread).pop(); - - _queuer.Queue(section, data); +// Thread thread = Thread.currentThread(); +// +// Section section = _sections.get(thread).pop(); +// +// if (data == null || data.length == 0) +// { +// data = new String[] { "Server:" + UtilServer.getServerName() }; +// } +// else +// { +// String[] newData = new String[data.length + 1]; +// +// System.arraycopy(data, 0, newData, 1, data.length); +// +// data = newData; +// +// data[0] = "Server:" + UtilServer.getServerName(); +// } +// +// _queuer.Queue(section, data); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index b24a425d4..bfe579e0b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -327,7 +327,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _pvpTimer = new PvpTimer(this, _playTracker, statsManager); _tutorialManager = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler); - TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager); + TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager, chat); _scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, tutorial, clientManager, donationManager); _clanDataAccess = new ClansDataAccessLayer(this, _scoreboard); 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 4d772da0e..c0fc17a69 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 @@ -158,10 +158,10 @@ public class ClansUtility if (inform) { - _clansManager.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.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString)); + UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString)); + UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString)); } return null; @@ -184,7 +184,7 @@ public class ClansUtility if (!inform) return null; // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); + UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); if (matchList.size() > 0) { @@ -192,7 +192,7 @@ public class ClansUtility for (ClanInfo cur : matchList) matchString += cur.getName() + " "; - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "].")); + UtilPlayer.message(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "].")); } return null; @@ -568,31 +568,31 @@ public class ClansUtility { if (_clansManager.getClanMemberUuidMap().containsKey(caller.getUniqueId())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); return; } if (!_clansManager.Get(caller).canJoin()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - _clansManager.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + ".")); + UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - _clansManager.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + ".")); return; } if (clanInfo == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist")); + UtilPlayer.message(caller, F.main("Clans", "Error: Clan does not exist")); return; } if (!clanInfo.isInvited(caller.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + ".")); return; } if (clanInfo.getSize() >= clanInfo.getMaxSize()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!")); + UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!")); return; } @@ -605,12 +605,12 @@ public class ClansUtility if (data) { // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + ".")); clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName()); } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request")); + UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request")); } } }); @@ -623,13 +623,13 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); + UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); return; } @@ -643,7 +643,7 @@ public class ClansUtility public void run(Boolean data) { // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); clan.inform(F.name(caller.getName()) + " has left your Clan.", null); clan.left(caller.getName()); @@ -662,13 +662,13 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (getRole(caller) != ClanRole.LEADER) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); return; } @@ -691,11 +691,11 @@ public class ClansUtility { if (!data.booleanValue()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later")); + UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later")); } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You disbanded your Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You disbanded your Clan.")); } } }); @@ -717,25 +717,25 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(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) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory.")); return false; } if (!ClansManager.isClaimable(caller.getLocation())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!")); + UtilPlayer.message(caller, F.main("Clans", "You cannot claim territory at this location!")); return false; } if (clan.getEnergy() == 0) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); + UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); return false; } @@ -751,14 +751,14 @@ public class ClansUtility } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(_clansManager.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + ".")); + UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(_clansManager.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + ".")); return false; } } if (clan.getClaims() >= clan.getClaimsMax()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); + UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); return false; } @@ -784,8 +784,8 @@ public class ClansUtility if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + 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.")); return false; } @@ -795,7 +795,7 @@ public class ClansUtility } else if (rel(clan, adjClan) != ClanRelation.SELF) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + ".")); return false; } } @@ -804,21 +804,21 @@ public class ClansUtility // Boxed if (checkBox(caller.getLocation().getChunk(), 4)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); + 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.")); return false; } if (isNearAdminClaim(caller.getLocation())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!")); + UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!")); return false; } // Not Next to Self if (!selfAdj && !clan.getClaimSet().isEmpty()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory.")); + UtilPlayer.message(caller, F.main("Clans", "You must claim next to your other Territory.")); return false; } @@ -827,7 +827,7 @@ public class ClansUtility { if (!UtilTime.elapsed(_clansManager.getUnclaimMap().get(chunk).longValue(), _clansManager.getReclaimTime())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(_clansManager.getReclaimTime() - (System.currentTimeMillis() - _clansManager.getUnclaimMap().get(chunk).longValue()), 1, UtilTime.TimeUnit.FIT)) + ".")); + UtilPlayer.message(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(_clansManager.getReclaimTime() - (System.currentTimeMillis() - _clansManager.getUnclaimMap().get(chunk).longValue()), 1, UtilTime.TimeUnit.FIT)) + ".")); return false; } @@ -842,7 +842,7 @@ public class ClansUtility { if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); return false; } } @@ -864,7 +864,7 @@ public class ClansUtility _clansManager.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + UtilPlayer.message(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; @@ -901,7 +901,7 @@ public class ClansUtility } // Change Inform - _clansManager.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!")); + 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!")); // Inform UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); @@ -918,7 +918,7 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -929,13 +929,13 @@ public class ClansUtility if (target.equals(caller.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself.")); return; } if (self.getRole().ordinal() <= target.getRole().ordinal()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } @@ -970,7 +970,7 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -981,19 +981,19 @@ public class ClansUtility if (target.equals(caller.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself.")); return; } if (self.getRole().ordinal() <= target.getRole().ordinal()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } if (target.getRole() == ClanRole.RECRUIT) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further.")); return; } @@ -1020,7 +1020,7 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -1031,20 +1031,20 @@ public class ClansUtility if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); return; } if (clansPlayer.getRole() == ClanRole.LEADER) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked.")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband")); + UtilPlayer.message(caller, F.main("Clans", "Clan leaders cannot be kicked.")); + UtilPlayer.message(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)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); return; } @@ -1056,8 +1056,8 @@ public class ClansUtility public void run(Boolean data) { // Inform - if (player != null) _clansManager.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + ".")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan.")); + 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.")); clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName()); } }; @@ -1075,7 +1075,7 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return false; } @@ -1088,14 +1088,14 @@ public class ClansUtility // Role if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory.")); return false; } // Not Claimed if (ownerClan == null || !ownerClan.equals(clan)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you.")); + UtilPlayer.message(caller, F.main("Clans", "This Territory is not owned by you.")); return false; } @@ -1113,7 +1113,7 @@ public class ClansUtility _clansManager.getClanDataAccess().unclaim(chunk, caller.getName(), true); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); + UtilPlayer.message(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; @@ -1125,13 +1125,13 @@ public class ClansUtility if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return false; } if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); return false; } @@ -1149,7 +1149,7 @@ public class ClansUtility } // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory.")); + UtilPlayer.message(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; @@ -1159,21 +1159,21 @@ public class ClansUtility { if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites.")); return; } if (target.getName().equals(caller.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself.")); + UtilPlayer.message(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()); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan.")); - _clansManager.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + ".")); - _clansManager.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!")); + 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!")); // Task _clansManager.getClanDataAccess().invite(clan, target.getName(), caller.getName()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java index 22203f4d7..6dacd19e4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java @@ -140,7 +140,7 @@ public class ClansCommand extends CommandBase { if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9") /* My UUID (NewGarbo) */) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission.")); + UtilPlayer.message(caller, F.main("Clans", "This requires ADMIN+ permission.")); return; } @@ -152,16 +152,16 @@ public class ClansCommand extends CommandBase { _clansManager.getClanUtility().join(caller, clan); _clansManager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role.")); + UtilPlayer.message(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role.")); } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan provided does not exist.")); + UtilPlayer.message(caller, F.main("Clans", "Clan provided does not exist.")); } } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No clan provided.")); + UtilPlayer.message(caller, F.main("Clans", "No clan provided.")); } } @@ -170,7 +170,7 @@ public class ClansCommand extends CommandBase if (args.length == 0) { Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat()); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat()))); + UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat()))); return; } @@ -179,7 +179,7 @@ public class ClansCommand extends CommandBase { ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); else Plugin.chatClan(clan, caller, F.combine(args, 0, null, false)); } @@ -190,7 +190,7 @@ public class ClansCommand extends CommandBase if (args.length == 0) { Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat()); - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat()))); + UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat()))); return; } @@ -199,7 +199,7 @@ public class ClansCommand extends CommandBase { ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); else Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false)); } @@ -215,32 +215,32 @@ public class ClansCommand extends CommandBase return; } - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;")); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c create ", "Create new Clan", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c join ", "Join a Clan", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c leave ", "Leave your Clan", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c map ", "View Clan Map", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); + UtilPlayer.message(caller, F.main("Clans", "Commands List;")); + UtilPlayer.message(caller, F.help("/c create ", "Create new Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c join ", "Join a Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c leave ", "Leave your Clan", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c map ", "View Clan Map", Rank.ALL)); + UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c promote ", "Promote Player in Clan", Rank.MODERATOR)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c demote ", "Demote Player in Clan", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/c promote ", "Promote Player in Clan", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/c demote ", "Demote Player in Clan", Rank.MODERATOR)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR)); + UtilPlayer.message(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c invite ", "Invite Player to Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c kick ", "Kick Player from Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral ", "Request Neutrality with Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy ", "Declare ClanWar with Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c ally ", "Send Alliance to Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c trust ", "Give Trust to Clan", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c invite ", "Invite Player to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c kick ", "Kick Player from Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c neutral ", "Request Neutrality with Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c enemy ", "Declare ClanWar with Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c ally ", "Send Alliance to Clan", Rank.ADMIN)); + UtilPlayer.message(caller, F.help("/c trust ", "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)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER)); + UtilPlayer.message(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER)); - _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c ", "View Clan Information", Rank.ALL)); + UtilPlayer.message(caller, F.help("/c ", "View Clan Information", Rank.ALL)); } public void create(final Player caller, final String[] args) @@ -251,13 +251,13 @@ public class ClansCommand extends CommandBase if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); return; } if (Plugin.leftRecently(caller.getUniqueId(), 5 * 60 * 1000) != null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot create a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); + UtilPlayer.message(caller, F.main("Clans", "You cannot create a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); return; } @@ -270,37 +270,37 @@ public class ClansCommand extends CommandBase if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name.")); return; } if (!UtilInput.valid(args[1])) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name.")); + UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name.")); return; } if (args[1].length() < Plugin.getNameMin()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + ".")); return; } if (args[1].length() > Plugin.getNameMax()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + ".")); return; } if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*")) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name")); + UtilPlayer.message(caller, F.main("Clans", "Clan name inappropriate. Please try a different name")); return; } if (!ClansBlacklist.isValidClanName(args[1])) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name.")); + UtilPlayer.message(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name.")); return; } @@ -311,7 +311,7 @@ public class ClansCommand extends CommandBase { if (clanExists) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan.")); + UtilPlayer.message(caller, F.main("Clans", "Clan name is already in use by another Clan.")); } else { @@ -323,11 +323,11 @@ public class ClansCommand extends CommandBase if (data == null) { // Hopefully shouldn't happen! - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again")); + UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again")); } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + ".")); + UtilPlayer.message(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + ".")); } } }); @@ -347,13 +347,13 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input an invitee.")); return; } @@ -385,7 +385,7 @@ public class ClansCommand extends CommandBase if (territory == null || territory.Safe || territory.Owner.equals(clanName)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be in another Clan's territory to use this.")); + UtilPlayer.message(caller, F.main("Clans", "You must be in another Clan's territory to use this.")); return; } @@ -398,19 +398,19 @@ public class ClansCommand extends CommandBase if (loc == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error whilst finding location to teleport to.")); + UtilPlayer.message(caller, F.main("Clans", "Error whilst finding location to teleport to.")); return; } player.getPlayer().teleport(loc); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have been teleported to the Wilderness.")); + UtilPlayer.message(caller, F.main("Clans", "You have been teleported to the Wilderness.")); } }, new Callback() { public void run(DelayedTaskClient client) { - UtilTextMiddle.display("", "Teleporting to Wilderness in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Wilderness Teleport")))), 0, 5, 0, client.getPlayer()); + UtilTextMiddle.display("", "Teleporting to Wilderness in " + F.time(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Wilderness Teleport")))), 0, 5, 0, client.getPlayer()); } }, new Callback() { public void run(DelayedTaskClient client) @@ -458,31 +458,31 @@ public class ClansCommand extends CommandBase { if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); return; } if (Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000) != null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); + UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); return; } if (!Plugin.Get(caller).canJoin()) { - _clansManager.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 + ".")); + 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 + ".")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name.")); return; } if (!UtilInput.valid(args[1])) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name.")); + UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name.")); return; } @@ -491,13 +491,13 @@ public class ClansCommand extends CommandBase if (!clan.isInvited(caller.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + ".")); return; } if (clan.getSize() >= clan.getMaxSize()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!")); + UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!")); return; } @@ -514,12 +514,12 @@ public class ClansCommand extends CommandBase if (data) { // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + ".")); clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName()); } else { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request")); + UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request")); } } }); @@ -532,13 +532,13 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); + UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); return; } @@ -552,7 +552,7 @@ public class ClansCommand extends CommandBase public void run(Boolean data) { // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); clan.inform(F.name(caller.getName()) + " has left your Clan.", null); } }); @@ -569,13 +569,13 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a Player to kick.")); return; } @@ -590,13 +590,13 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote.")); return; } @@ -611,13 +611,13 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input player to demote.")); return; } @@ -632,19 +632,19 @@ public class ClansCommand extends CommandBase if (cA == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(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) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to ally.")); return; } @@ -654,31 +654,31 @@ public class ClansCommand extends CommandBase if (cA.isSelf(cB.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot ally with yourself.")); return; } if (cA.isAlly(cB.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + "."); + UtilPlayer.message(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + "."); return; } if (cA.getAllies() >= cA.getAlliesMax()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies.")); + UtilPlayer.message(caller, F.main("Clans", "You cannot have any more allies.")); return; } if (cB.getAllies() >= cB.getAlliesMax()) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies.")); + UtilPlayer.message(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies.")); return; } if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests.")); + UtilPlayer.message(caller, F.main("Clans", "Please do not spam alliance requests.")); return; } @@ -688,7 +688,7 @@ public class ClansCommand extends CommandBase Plugin.getClanDataAccess().ally(cA, cB, caller.getName()); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + ".")); + UtilPlayer.message(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); } @@ -698,7 +698,7 @@ public class ClansCommand extends CommandBase Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName()); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + ".")); + UtilPlayer.message(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); @@ -761,19 +761,19 @@ public class ClansCommand extends CommandBase if (cA == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(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) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships.")); return; } if (args.length < 2) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with.")); return; } @@ -783,11 +783,11 @@ public class ClansCommand extends CommandBase if (cB.isSelf(cA.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively...")); + UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively...")); } else if (cB.isNeutral(cA.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + ".")); } else if (cB.isAlly(cA.getName())) { @@ -795,7 +795,7 @@ public class ClansCommand extends CommandBase Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + ".")); + UtilPlayer.message(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); } @@ -850,7 +850,7 @@ public class ClansCommand extends CommandBase } // Change Inform - _clansManager.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!")); + 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!")); // Inform UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); @@ -886,19 +886,19 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } if (clan.getHome() == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home")); + UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home")); return; } if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk()))) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory.")); + UtilPlayer.message(caller, F.main("Clans", "Your Clan has lost its Home Territory.")); return; } @@ -906,7 +906,7 @@ public class ClansCommand extends CommandBase 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)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed.")); + UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed.")); return; } @@ -934,12 +934,12 @@ public class ClansCommand extends CommandBase Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0)); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); + UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); } }, new Callback() { public void run(DelayedTaskClient client) { - UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Home Teleport")))), 0, 5, 0, client.getPlayer()); + UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.time(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Home Teleport")))), 0, 5, 0, client.getPlayer()); } }, new Callback() { public void run(DelayedTaskClient client) @@ -964,7 +964,7 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } @@ -977,25 +977,25 @@ public class ClansCommand extends CommandBase if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home.")); + UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home.")); return; } if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); + UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); return; } if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName())) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); + UtilPlayer.message(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))) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed.")); + UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed.")); return; } @@ -1004,7 +1004,7 @@ public class ClansCommand extends CommandBase if (!bedPlaced) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed.")); + UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed.")); return; } @@ -1020,7 +1020,7 @@ public class ClansCommand extends CommandBase Plugin.ClanTips.displayTip(TipType.SETHOME, caller); // Inform - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); + UtilPlayer.message(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()); } @@ -1030,7 +1030,7 @@ public class ClansCommand extends CommandBase if (search == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter.")); return; } @@ -1052,13 +1052,13 @@ public class ClansCommand extends CommandBase { if (_clansManager.getClientManager().hasRank(caller, Rank.ADMIN)) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)")); + UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)")); return; } if (search == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter.")); + UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter.")); return; } @@ -1087,7 +1087,7 @@ public class ClansCommand extends CommandBase if (clan == null) { - _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); + UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan.")); return; } } @@ -1104,6 +1104,6 @@ public class ClansCommand extends CommandBase // return; // } - _clansManager.getTutorials().sendTutorialMsg(caller, clan.mTerritory()); + UtilPlayer.message(caller, clan.mTerritory()); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java index 86d794582..9910889d0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java @@ -51,7 +51,7 @@ public class RestartTutCommand extends CommandBase } else { - TutorialManager.Instance.sendTutorialMsg(caller, F.main("Clans", "You must be in a Safe Zone to restart the tutorial.")); + UtilPlayer.message(caller, F.main("Clans", "You must be in a Safe Zone to restart the tutorial.")); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java index 426b42787..541f3e9e1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvpTimer.java @@ -149,7 +149,7 @@ public class PvpTimer extends MiniClientPlugin } }, 10); - UtilPlayer.message(player, F.main("Clans", "You are currently safe from PvP because you are a new player. This safety will end in " + F.elem(UtilTime.MakeStr(getPvPTimerLeft(player) * 1000)))); + UtilPlayer.message(player, F.main("Clans", "You are currently safe from PvP because you are a new player. This safety will end in " + F.time(UtilTime.MakeStr(getPvPTimerLeft(player) * 1000)))); UtilPlayer.message(player, F.main("Clans", "Until it ends, you are immune to, and unable to deal PvP damage.")); UtilPlayer.message(player, F.main("Clans", "If you would like to disable the PvP safety permanently, then type " + F.elem("/pvp") + ".")); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java index 104c4155d..346f17fb8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/command/PvPTimerCommand.java @@ -38,7 +38,7 @@ public class PvPTimerCommand extends CommandBase } else { - UtilPlayer.message(caller, F.main("Clans", "You have " + F.elem(UtilTime.MakeStr(pvpTimerLeft * 1000)) + " before PvP Safety runs out for you.")); + UtilPlayer.message(caller, F.main("Clans", "You have " + F.time(UtilTime.MakeStr(pvpTimerLeft * 1000)) + " before PvP Safety runs out for you.")); new JsonMessage(F.main("Clans", "If you would like to permanently disable " + C.mBody + "PvP Safety, click ")) .extra("here") .color("green") diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java index be8cf6cbe..b3221c89f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java @@ -30,6 +30,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.donation.DonationManager; @@ -60,9 +61,6 @@ 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 AllowedBypass = C.cBlue + "Tutorial>"; - protected final TutorialManager _manager; protected final GoldManager _goldManager; protected final ClansManager _clansManager; @@ -307,7 +305,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener if (_goldReward != -1) { _goldManager.addGold(player, _goldReward); - _manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + ".")); + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + ".")); } if (_gemReward != -1) @@ -315,7 +313,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener _donationManager.RewardGems(new Callback() { public void run(Boolean data) { - _manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + ".")); + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + ".")); } }, "Clans", player.getName(), player.getUniqueId(), _gemReward); } @@ -325,7 +323,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener _donationManager.RewardCoins(new Callback() { public void run(Boolean data) { - _manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + ".")); + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + ".")); } }, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java index 36bfabcd3..56142641d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java @@ -11,6 +11,7 @@ import org.bukkit.plugin.java.JavaPlugin; 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; @@ -44,36 +45,6 @@ public class TutorialManager extends MiniPlugin _taskManager = taskManager; // _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, playtime, 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().isEmpty()) - { - return; - } - - if (chat.a.a().get(0).c().equals(ChatColor.stripColor(Tutorial.AllowedMessage))) - { - chat.a.a().remove(0); - } - else if (!chat.a.a().get(0).c().contains(Tutorial.AllowedBypass)) - { - if (isInTutorial(packet.getPlayer())) - { - packet.setCancelled(true); - } - } - } - } - } - }, PacketPlayOutChat.class); } public void addCommands() @@ -111,8 +82,7 @@ public class TutorialManager extends MiniPlugin { getTutorial(player).cancelFor(player); - - sendTutorialMsg(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); + UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); _playerTutorials.remove(player.getName()); } } @@ -129,7 +99,7 @@ public class TutorialManager extends MiniPlugin { if (isInTutorial(player)) { - sendTutorialMsg(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); + UtilPlayer.message(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); getTutorial(player).doSkip(player); } } @@ -146,19 +116,6 @@ public class TutorialManager extends MiniPlugin _playerTutorials.remove(event.getPlayer().getName()); } - public void sendTutorialMsg(Player player, String message) - { - player.sendMessage(Tutorial.AllowedMessage + message); - } - - public void sendTutorialMsg(Player player, LinkedList messages) - { - for (String message : messages) - { - sendTutorialMsg(player, message); - } - } - public void finishTutorial(Player player) { _playerTutorials.remove(player.getName()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java index 929f5ea7d..15598cd14 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java @@ -9,6 +9,7 @@ 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; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; @@ -155,15 +156,15 @@ public class TutorialTask implements Listener if (clan != null) description = description.replace("(clan)", clan.getName()); description = description.replace("{", C.cAqua).replace("}", C.cWhite); - _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 + 1) + ": " + _displayName); - _tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + description); - _tutorial._manager.sendTutorialMsg(player, " "); - _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cYellowB + "Part " + (_id + 1) + ": " + _displayName); + UtilPlayer.message(player, C.cWhite + " " + description); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); UtilTextMiddle.display("", getDisplayName(), player); @@ -238,14 +239,14 @@ public class TutorialTask implements Listener if (clan != null) finishMessage = finishMessage.replace("(clan)", clan.getName()); finishMessage = finishMessage.replace("{", C.cAqua).replace("}", C.cWhite); - _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); - _tutorial._manager.sendTutorialMsg(player, " "); - _tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + 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); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java index 8fb7ca99f..2a8b36d20 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java @@ -5,6 +5,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.game.clans.legacytutorial.TutorialManager; public class SkipTutorialCommand extends CommandBase @@ -23,7 +24,7 @@ public class SkipTutorialCommand extends CommandBase } else { - Plugin.sendTutorialMsg(caller, F.main("Tutorials", "You are not currently in a tutorial.")); + UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial.")); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java index 1b571cd1c..99c2cb4e5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java @@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; import mineplex.core.packethandler.PacketHandler; @@ -14,9 +15,9 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.economy.GoldManager; -import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.legacytutorial.Tutorial; import mineplex.game.clans.legacytutorial.TutorialManager; +import mineplex.game.clans.spawn.Spawn; public class TutorialGettingStarted extends Tutorial { @@ -58,28 +59,28 @@ public class TutorialGettingStarted extends Tutorial @Override protected void onFinishedDelay(Player player) { - _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 + "---------------------------------------------"); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold"); + UtilPlayer.message(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!"); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); } @Override public void onBegin(final Player player) { - _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! " + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cYellowB + "Getting Started"); + UtilPlayer.message(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"); - _manager.sendTutorialMsg(player, " "); - _manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java index 79f8ee727..86103397b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java @@ -2,13 +2,18 @@ package mineplex.game.clans.tutorial; import java.util.ArrayList; import java.util.EnumMap; +import java.util.Iterator; import java.util.List; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; @@ -28,7 +33,7 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement private EnumMap _tutorialMap; private EnumMap _shopMap; // Don't need to do anything with shops currently - public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Chat chat) { super("Clans Tutorial", plugin); @@ -40,6 +45,27 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement _shopMap = new EnumMap(TutorialType.class); addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, _clansMessageManager)); + + chat.AddFilter(event -> { + if (inTutorial(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to speak while in a tutorial.")); + + return Boolean.TRUE; + } + + Iterator recipients = event.getRecipients().iterator(); + + while (recipients.hasNext()) + { + Player recipient = recipients.next(); + + if (inTutorial(recipient)) + recipients.remove(); + } + + return Boolean.FALSE; + }); } @Override @@ -47,7 +73,7 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement { addCommand(new TutorialCommand(this)); } - + private void addTutorial(TutorialType type, Tutorial tutorial) { if (_tutorialMap.containsKey(type))