On going map tutorials started and finished.

This commit is contained in:
NewGarbo 2015-10-21 06:55:06 +01:00
parent eb203131a7
commit a5df50de92
7 changed files with 92 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialType;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
import mineplex.game.clans.tutorials.types.TutorialOnGoingMap;
public class ClansDisplay extends MiniPlugin
{
@ -115,6 +116,7 @@ public class ClansDisplay extends MiniPlugin
UtilTextMiddle.display("", ownerString, 0, 25, 10, player);
UtilPlayer.message(player, F.main("Territory", ownerString));
((TutorialGettingStarted) TutorialManager.Instance.getTutorials().get(TutorialType.GETTING_STARTED)).onEnterTerritory(player, ownerString);
((TutorialOnGoingMap) TutorialManager.Instance.getTutorials().get(TutorialType.ON_GOING)).onEnterTerritory(player, ownerString);
}
public int width = 8;

View File

@ -34,7 +34,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
protected final TutorialManager _manager;
protected final GoldManager _goldManager;
protected final ClansManager _clansManager;
private final TaskManager _taskManager;
protected final TaskManager _taskManager;
private final int _rewardAmount;
@ -60,7 +60,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
ArrayList<String> lines = new ArrayList<>();
if (!isInTutorial(player) && _doScoreboard)
if (!isInTutorial(player) || !_doScoreboard)
{
return lines;
}

View File

@ -17,6 +17,7 @@ import mineplex.game.clans.tutorials.commands.EndTutorialCommand;
import mineplex.game.clans.tutorials.commands.QAResetCommand;
import mineplex.game.clans.tutorials.commands.TaskInfoCommand;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
import mineplex.game.clans.tutorials.types.TutorialOnGoingMap;
public class TutorialManager extends MiniPlugin
{
@ -36,6 +37,7 @@ public class TutorialManager extends MiniPlugin
_taskManager = taskManager;
_tutorials.put(TutorialType.GETTING_STARTED, new TutorialGettingStarted(this, clansManager, goldManager, taskManager));
_tutorials.put(TutorialType.ON_GOING, new TutorialOnGoingMap(this, clansManager, goldManager, taskManager));
registerEvents(_tutorials.get(TutorialType.GETTING_STARTED));
}

View File

@ -1,10 +1,12 @@
package mineplex.game.clans.tutorials;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
import mineplex.game.clans.tutorials.types.TutorialOnGoingMap;
public enum TutorialType
{
GETTING_STARTED(TutorialGettingStarted.class, "Getting Started", "GettingStartedTutorial");
GETTING_STARTED(TutorialGettingStarted.class, "Getting Started", "GettingStartedTutorial"),
ON_GOING(TutorialOnGoingMap.class, "Ongoing Map", "OngoingMapTutorial");
private final Class<? extends Tutorial> _clazz;
private final String _uniqueId;

View File

@ -0,0 +1,31 @@
package mineplex.game.clans.tutorials.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.tutorials.TutorialManager;
public class OngoingOptOutCommand extends CommandBase<TutorialManager>
{
public OngoingOptOutCommand(final TutorialManager plugin)
{
super(plugin, Rank.ALL, "optout");
}
@Override
public void Execute(final Player caller, final String[] args)
{
Plugin.getTaskManager().completedTask(new Callback<Boolean>()
{
public void run(Boolean completed)
{
UtilPlayer.message(caller, F.main("Tutorials", "You have opted out of territory warnings, be careful!"));
}
}, caller, "ClansOnGoingOptOut");
}
}

View File

@ -66,15 +66,15 @@ public class TutorialGettingStarted extends Tutorial
public void onEnterTerritory(Player player, String ownerString)
{
if (isInTutorial(player) && ownerString.contains("Spawn") && get(player).hasFinishedPart(getPart(2)) && !get(player).hasFinishedPart(getPart(3)))
if (isInTutorial(player) && ownerString.endsWith("Spawn") && get(player).hasFinishedPart(getPart(2)) && !get(player).hasFinishedPart(getPart(3)))
{
getPart(3).getWaiter().consume(player);
}
else if (isInTutorial(player) && ownerString.contains("Wilderness") && get(player).hasFinishedPart(getPart(3)) && !get(player).hasFinishedPart(getPart(4)))
else if (isInTutorial(player) && ownerString.endsWith("Wilderness") && get(player).hasFinishedPart(getPart(3)) && !get(player).hasFinishedPart(getPart(4)))
{
getPart(4).getWaiter().consume(player);
}
else if (isInTutorial(player) && ownerString.contains("Shop") && get(player).hasFinishedPart(getPart(5)) && !get(player).hasFinishedPart(getPart(6)))
else if (isInTutorial(player) && ownerString.endsWith("Shops") && get(player).hasFinishedPart(getPart(5)) && !get(player).hasFinishedPart(getPart(6)))
{
getPart(6).getWaiter().consume(player);
}

View File

@ -0,0 +1,49 @@
package mineplex.game.clans.tutorials.types;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.Tutorial;
import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialType;
public class TutorialOnGoingMap extends Tutorial
{
public TutorialOnGoingMap(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager)
{
super(0, goldManager, taskManager, clansManager, manager, TutorialType.ON_GOING);
_doScoreboard = false;
}
public void onEnterTerritory(Player player, String ownerString)
{
if (!_taskManager.hasCompletedTask(player, "ClansOnGoingOptOut"))
{
if (ownerString.contains("Fields"))
{
UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Fields!");
UtilPlayer.message(player, C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
else if (ownerString.contains("Shop"))
{
UtilPlayer.message(player, C.cGreenB + "Welcome the Shops!");
UtilPlayer.message(player, C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
else if (ownerString.contains("Borderlands"))
{
UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Borderlands!");
UtilPlayer.message(player, C.cRed + "The Borderlands are the very outer reaches of the maps. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
}
}
}