Merge branch 'clans/beta' of https://github.com/Mineplex-LLC/Minecraft-PC into clans/beta

This commit is contained in:
Ben 2016-03-31 20:03:50 +01:00
commit da99a12b23
58 changed files with 704 additions and 73 deletions

View File

@ -53,9 +53,13 @@ public enum UpdateType
*/
SLOWEST(32000),
/**
* ONce every 30 seconds
* Once every 30 seconds
*/
SEC_30(30000),
/**
* Once every 20 seconds
*/
SEC_20(20000),
/**
* Once every 16 seconds
*/

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -13,8 +15,10 @@ public class ClanAddAllyButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
player.closeInventory();
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddAlly)).isCancelled())
return;
player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to add an Ally").click(ClickEvent.SUGGEST_COMMAND, "/c ally ");
message.sendToPlayer(player);
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,9 @@ public class ClanAddTrustedButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddTrusted)).isCancelled())
return;
player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to trust a clan").click(ClickEvent.SUGGEST_COMMAND, "/c trust ");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,8 @@ public class ClanAddWarButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddWar)).isCancelled())
return;
player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to war a clan").click(ClickEvent.SUGGEST_COMMAND, "/war ");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -18,5 +20,6 @@ public class ClanCreateButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -18,6 +20,8 @@ public class ClanDisbandButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled())
return;
getPlayer().closeInventory();
getClansManager().getClanUtility().delete(getPlayer());
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -18,6 +20,6 @@ public class ClanEnergyButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Energy));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -23,6 +25,8 @@ public class ClanInviteButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Invite)).isCancelled())
return;
getShop().openPageForPlayer(getPlayer(), new ClanInvitePage(getClansManager(), getShop(), getClansManager().getClientManager(), _donationManager, player));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -21,6 +23,8 @@ public class ClanJoinButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Join)).isCancelled())
return;
player.closeInventory();
_clansManager.getClanUtility().join(player, _clanInfo);
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -18,7 +20,22 @@ public class ClanLeaveButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
getPlayer().closeInventory();
getClansManager().getClanUtility().leave(getPlayer());
if(clickType.equals(ClickType.SHIFT_RIGHT)) //disband
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled())
return;
getPlayer().closeInventory();
getClansManager().getClanUtility().delete(getPlayer());
}else if(clickType.equals(ClickType.SHIFT_LEFT)) //leave
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Leave)).isCancelled())
return;
getPlayer().closeInventory();
getClansManager().getClanUtility().leave(getPlayer());
}
}
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -24,6 +26,8 @@ public class ClanMemeberButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Member)).isCancelled())
return;
if (clickType == ClickType.LEFT)
{
// Promote

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.entity.Player;
@ -23,6 +25,8 @@ public class ClanTerritoryButton extends ClanButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Territory)).isCancelled())
return;
// if (_clansManager.getNetherManager().isInNether(player))
// {
// _clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + ".");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,8 @@ public class ClanWhoButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Who)).isCancelled())
return;
player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to lookup a clan").click(ClickEvent.SUGGEST_COMMAND, "/c who ");

View File

@ -0,0 +1,67 @@
package mineplex.game.clans.clans.gui.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ClansButtonClickEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private ButtonType _type;
private boolean _cancelled;
public ClansButtonClickEvent(Player player, ButtonType type)
{
_player = player;
_type = type;
}
public Player getPlayer()
{
return _player;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public ButtonType getButtonType() {
return _type;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public enum ButtonType
{
AddAlly,
AddTrusted,
AddWar,
Create,
Disband,
Energy,
Invite,
Join,
Leave,
Member,
Territory,
Who;
}
}

View File

@ -20,8 +20,10 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
@ -286,6 +288,36 @@ public abstract class Tutorial implements Listener, ObjectiveListener
}
}
@EventHandler
public void displayText(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
for (Map.Entry<Player, TutorialSession> entry : _playerSessionMap.entrySet())
{
String extra = _objectives.get(entry.getValue().getObjectiveIndex()).getExtraDescription(entry.getKey());
if (extra == null)
{
// None defined.
continue;
}
if (entry.getValue().incrementAndGetTextSeconds() < 20)
{
// 20 second delay between displaying.
return;
}
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(entry.getKey(), C.cGray + " " + extra);
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
entry.getValue().setTextSeconds(0);
}
}
public void addHologram(Player player, Location location, String... text)
{
if (_playerSessionMap.containsKey(player))

View File

@ -14,6 +14,7 @@ public class TutorialSession
private List<Hologram> _hologramList = new ArrayList<>();
private Location _homeLocation;
private int _colorTick;
private int _textSeconds;
public TutorialSession()
{
@ -58,4 +59,15 @@ public class TutorialSession
{
return ++_colorTick;
}
public void setTextSeconds(int seconds)
{
_textSeconds = seconds;
}
public int incrementAndGetTextSeconds()
{
_textSeconds++;
return _textSeconds;
}
}

View File

@ -6,24 +6,32 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.game.clans.tutorial.Tutorial;
import mineplex.game.clans.tutorial.TutorialRegion;
/**
* An Objective represents a set of goals that need to be completed to move on to the next Objective in the quest
*/
public abstract class Objective<Plugin, Data extends ObjectiveData> implements Listener
public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveData> implements Listener
{
private Plugin _plugin;
private JavaPlugin _javaPlugin;
private String _name;
private String _description;
private String _extraDescription;
private boolean _displayStartMessage;
private int _startMessageDelay;
private boolean _displayFinishMessage;
private int _finishMessageDelay;
private HashMap<UUID, Data> _active;
private List<ObjectiveListener> _listeners;
@ -35,6 +43,10 @@ public abstract class Objective<Plugin, Data extends ObjectiveData> implements L
_name = name;
_description = description;
_extraDescription = extraDescription;
_displayStartMessage = true;
_displayFinishMessage = true;
_startMessageDelay = 60;
_finishMessageDelay = 1;
_active = new HashMap<>();
_listeners = new LinkedList<>();
@ -114,6 +126,9 @@ public abstract class Objective<Plugin, Data extends ObjectiveData> implements L
_listeners.forEach(listener -> listener.onObjectiveStart(player, this));
if (_displayStartMessage)
Bukkit.getServer().getScheduler().runTaskLater(getJavaPlugin(), () -> showStartMessage(player), _startMessageDelay);
customStart(player);
}
@ -181,8 +196,13 @@ public abstract class Objective<Plugin, Data extends ObjectiveData> implements L
{
System.out.println(String.format("Tutorial> [%s] finished objective [%s]", player.getName(), getName(player)));
showFinishMessage(player);
_active.remove(player.getUniqueId());
if (_displayFinishMessage)
Bukkit.getServer().getScheduler().runTaskLater(getJavaPlugin(), () -> showFinishMessage(player), _finishMessageDelay);
customFinish(player);
_listeners.forEach(listener -> listener.onObjectiveFinish(player, this));
@ -241,4 +261,44 @@ public abstract class Objective<Plugin, Data extends ObjectiveData> implements L
}
public abstract void addScoreboardLines(Player player, List<String> lines);
private void showStartMessage(Player player)
{
UtilTextMiddle.display(C.cAqua + "Tutorial", getName(player), player);
}
private void showFinishMessage(Player player)
{
UtilTextMiddle.display(C.cGreen + "Tutorial Completed", getName(player), player);
}
public void setDisplayStartMessage(boolean displayStartMessage)
{
_displayStartMessage = displayStartMessage;
}
public void setDisplayFinishMessage(boolean displayFinishMessage)
{
_displayFinishMessage = displayFinishMessage;
}
public int getStartMessageDelay()
{
return _startMessageDelay;
}
public void setStartMessageDelay(int startMessageDelay)
{
_startMessageDelay = startMessageDelay;
}
public int getFinishMessageDelay()
{
return _finishMessageDelay;
}
public void setFinishMessageDelay(int finishMessageDelay)
{
_finishMessageDelay = finishMessageDelay;
}
}

View File

@ -4,9 +4,13 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.game.clans.tutorial.TutorialRegion;
public abstract class ObjectiveGoal <T extends Objective> implements Listener
@ -17,6 +21,10 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
private String _name;
private String _description;
private String _extraDescription;
private boolean _displayStartMessage;
private int _startMessageDelay;
private boolean _displayFinishMessage;
private int _finishMessageDelay;
public ObjectiveGoal(T objective, String name, String description)
{
@ -31,6 +39,10 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
_name = name;
_description = description;
_extraDescription = extraDescription;
_displayStartMessage = true;
_startMessageDelay = 40;
_displayFinishMessage = true;
_finishMessageDelay = 1;
}
public String getName(Player player)
@ -68,6 +80,12 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
System.out.println(String.format("Tutorial> [%s] started objective goal [%s]", player.getName(), getName(player)));
_active.add(player.getUniqueId());
if (_displayStartMessage)
{
Bukkit.getServer().getScheduler().runTaskLater(_objective.getJavaPlugin(), () -> displayStartMessage(player), _startMessageDelay);
}
customStart(player);
}
@ -95,11 +113,18 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
{
System.out.println(String.format("Tutorial> [%s] finished objective goal [%s]", player.getName(), getName(player)));
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
_active.remove(player.getUniqueId());
if (_displayFinishMessage)
{
Bukkit.getServer().getScheduler().runTaskLater(_objective.getJavaPlugin(), () -> displayFinishMessage(player), _finishMessageDelay);
}
customFinish(player);
_objective.completeGoal(this, player);
}
}
@ -123,4 +148,48 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
{
return _objective;
}
protected void displayFinishMessage(Player player)
{
UtilTextMiddle.display(C.cGreen + "Completed Objective", getName(player), player);
}
protected void displayStartMessage(Player player)
{
if (player == null || !player.isOnline())
{
return;
}
UtilTextMiddle.display(C.cYellow + "New Objective", getName(player), player);
if (getExtraDescription(player) != null)
{
// Display extra information for the first time.
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, C.cGray + " " + getExtraDescription(player));
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
}
}
public void setDisplayStartMessage(boolean displayStartMessage)
{
_displayStartMessage = displayStartMessage;
}
public void setDisplayFinishMessage(boolean displayFinishMessage)
{
_displayFinishMessage = displayFinishMessage;
}
public void setStartMessageDelay(int startMessageDelay)
{
_startMessageDelay = startMessageDelay;
}
public void setFinishMessageDelay(int finishMessageDelay)
{
_finishMessageDelay = finishMessageDelay;
}
}

View File

@ -6,9 +6,10 @@ import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.game.clans.tutorial.Tutorial;
import net.md_5.bungee.api.ChatColor;
public abstract class OrderedObjective<Plugin> extends Objective<Plugin, OrderedObjectiveData>
public abstract class OrderedObjective<Plugin extends Tutorial> extends Objective<Plugin, OrderedObjectiveData>
{
private List<ObjectiveGoal> _goals;

View File

@ -6,8 +6,9 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.game.clans.tutorial.Tutorial;
public abstract class SingleObjective<Plugin> extends Objective<Plugin, ObjectiveData>
public abstract class SingleObjective<Plugin extends Tutorial> extends Objective<Plugin, ObjectiveData>
{
private final ObjectiveData _nullData;

View File

@ -6,9 +6,10 @@ import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.game.clans.tutorial.Tutorial;
import net.md_5.bungee.api.ChatColor;
public abstract class UnorderedObjective<Plugin> extends Objective<Plugin, UnorderedObjectiveData>
public abstract class UnorderedObjective<Plugin extends Tutorial> extends Objective<Plugin, UnorderedObjectiveData>
{
private List<ObjectiveGoal> _goals;

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.DyeColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -19,6 +20,8 @@ import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilInv;
@ -27,6 +30,7 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.economy.GoldManager;
@ -127,6 +131,27 @@ public class ClansMainTutorial extends Tutorial
player.getInventory().clear();
ClansManager.getInstance().getPvpTimer().pause(player);
// Spawn Holograms
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -6),
C.cGoldB + "Welcome to the Clans Tutorial!",
" ",
"This will teach you the basics of Clans.",
"It will take about 5 minutes to complete.",
"You must complete it before playing Clans.",
" ",
"Walk forward to begin!");
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23),
"Jump Off!");
ClanInfo clan = ClansManager.getInstance().getClan(player);
if (clan != null)
{
ClansManager.getInstance().getClanDataAccess().delete(clan, null);
}
}
@Override
@ -378,4 +403,10 @@ public class ClansMainTutorial extends Tutorial
{
return _mapManager;
}
@EventHandler (priority = EventPriority.LOWEST)
public void onClick(ClansButtonClickEvent event) {
if(isInTutorial(event.getPlayer()))
event.setCancelled(true);
}
}

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective;
import mineplex.core.common.util.C;
import mineplex.game.clans.clans.siege.weapon.Cannon;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -13,6 +14,7 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.LoadCannonGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.MountCannonGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClanInfoGoal;
import java.util.HashMap;
import java.util.Map;
@ -23,15 +25,25 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Attack Enemy", "Attack and raid this enemy!");
super(clansMainTutorial, javaPlugin, "Enemy Clans", "Attack and raid this enemy!");
_cannon = new HashMap<>();
addGoal(new GetMapGoal(this));
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Enemy Clan", "By looking at your map, identify your new enemy"));
addGoal(new HoldItemGoal(
this, Material.MAP,
"Identify Enemy on Map",
"Find the red square land on the map.",
"Look at your map to help find where the Enemy Clan is. It's marked by " +
"a " + C.cRed + "red square" + C.mBody + ".",
40
));
addGoal(new ClanInfoGoal(this));
addGoal(new MountCannonGoal(this));
addGoal(new LoadCannonGoal(this));
addGoal(new BlowUpWallGoal(this));
addGoal(new StealEnemyPotatoesGoal(this));
setStartMessageDelay(60);
}
@Override

View File

@ -13,16 +13,17 @@ public class ClanObjective extends OrderedObjective<ClansMainTutorial>
{
public ClanObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Clans", "Create clan with /c create <name>");
super(clansMainTutorial, javaPlugin, "Clan Basics", "Create clan with /c create <name>");
addGoal(new LeaveSpawnGoal(this));
addGoal(new CreateClanGoal(this));
addGoal(new ClanManagementGoal(this));
addGoal(new ClanDetailsGoal(this));
addGoal(new ClanInfoGoal(this));
addGoal(new ClaimLandGoal(this));
addGoal(new BuildHouseGoal(this));
addGoal(new SetHomeGoal(this));
// Wait 1 second because the player is logging in/loading
setStartMessageDelay(20);
}
@Override

View File

@ -18,6 +18,8 @@ public class ClassesObjective extends OrderedObjective<ClansMainTutorial>
addGoal(new EquipDefaultBuildGoal(this));
addGoal(new OpenClassManagerGoal(this));
addGoal(new UseBullsChargeGoal(this));
setStartMessageDelay(60);
}
@Override

View File

@ -16,6 +16,8 @@ public class EnergyObjective extends OrderedObjective<ClansMainTutorial>
addGoal(new ExplainEnergyGoal(this));
addGoal(new BuyEnergyGoal(this));
setStartMessageDelay(60);
}
@Override

View File

@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.game.clans.tutorial.objective.OrderedObjective;
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.HoldItemGoal;
@ -18,10 +19,18 @@ public class FieldsObjective extends OrderedObjective<ClansMainTutorial>
{
super(clansMainTutorial, javaPlugin, "Fields", "Get various resources by mining for them in the fields");
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Fields", "Look at your map and find the Fields Region"));
addGoal(new HoldItemGoal(
this,
Material.MAP,
"Identify Fields on Map",
"Find the Orange Striped Area on your map",
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + "."
));
addGoal(new GoToFieldsGoal(this));
addGoal(new MineDiamondsGoal(this));
addGoal(new SellDiamondsGoal(this));
setStartMessageDelay(60);
}
@Override

View File

@ -16,6 +16,8 @@ public class FinalObjective extends OrderedObjective<ClansMainTutorial>
addGoal(new TpClanHomeGoal(this)); // IMPLEMENTED
addGoal(new DisbandClanGoal(this)); // IMPLEMENTED
setStartMessageDelay(60);
}
@Override

View File

@ -14,12 +14,24 @@ public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial
{
super(clansMainTutorial, javaPlugin, "Purchase Items", "Purchase Items from Shop");
addGoal(new PurchaseGoal(this, Material.IRON_HELMET, "Purchase Iron Helmet", "Talk to the Pvp Gear NPC and purchase an Iron Helmet"));
addGoal(new PurchaseGoal(this, Material.IRON_CHESTPLATE, "Purchase Iron Chestplate", "Talk to the Pvp Gear NPC and purchase an Iron Chestplate"));
addGoal(new PurchaseGoal(this, Material.IRON_LEGGINGS, "Purchase Iron Leggings", "Talk to the Pvp Gear NPC and purchase Iron Leggings"));
addGoal(new PurchaseGoal(this, Material.IRON_BOOTS, "Purchase Iron Boots", "Talk to the Pvp Gear NPC and purchase Iron Boots"));
addGoal(new PurchaseGoal(this, Material.IRON_AXE, "Purchase Iron Axe", "Talk to the Pvp Gear NPC and purchase an Iron Axe"));
addGoal(new PurchaseGoal(
this,
Material.IRON_HELMET,
"Purchase Iron Helmet",
"Buy an Iron Helmet",
"The shops sell everything you could ever need and more."
));
addGoal(new PurchaseGoal(this, Material.IRON_CHESTPLATE, "Purchase Iron Chestplate",
"Buy an Iron Chestplate"));
addGoal(new PurchaseGoal(this, Material.IRON_LEGGINGS, "Purchase Iron Leggings",
"Buy Iron Leggings"));
addGoal(new PurchaseGoal(this, Material.IRON_BOOTS, "Purchase Iron Boots",
"Buy Iron Boots"));
addGoal(new PurchaseGoal(this, Material.IRON_AXE, "Purchase Iron Axe",
"Buy an Iron Axe"));
// addGoal(new PurchaseGoal(this, Material.IRON_PICKAXE, "Purchase Iron Pickaxe", "Talk to the Pvp Gear NPC and purchase an Iron Pickaxe"));
setStartMessageDelay(60);
}
@Override

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.F;
import mineplex.core.npc.Npc;
import mineplex.core.npc.NpcManager;
import mineplex.database.tables.records.NpcsRecord;
@ -35,9 +36,17 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
_npcMap = new HashMap<>();
_npcManager = npcManager;
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Shops", "Look at your map and find the shops"));
addGoal(new HoldItemGoal(
this,
Material.MAP,
"Identify Shops on Map",
"Find the Yellow striped area on your map",
"Shops are marked on the map by the " + F.elem("Yellow Stripes") + "."
));
addGoal(new GoToShopsGoal(this));
addGoal(new SellPotatoesGoal(this));
setStartMessageDelay(60);
}
@Override

View File

@ -17,11 +17,18 @@ public class HoldItemGoal extends ObjectiveGoal<Objective>
private DefaultHashMap<String, EnclosedObject<Integer>> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0)));
private Material _material;
public HoldItemGoal(Objective objective, Material material, String name, String description)
public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText, int startDelay)
{
super(objective, name, description);
super(objective, name, description, helpText);
_material = material;
setStartMessageDelay(startDelay);
}
public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText)
{
this(objective, material, name, description, helpText, 120);
}
@Override

View File

@ -24,7 +24,12 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public BlowUpWallGoal(AttackEnemyObjective objective)
{
super(objective, "Attack Enemy", "Attack enemy clan! Blow a hole in their base by Left-Clicking to fire the Cannon.");
super(
objective,
"Blow up the Enemy Base",
"Left-Click whilst sitting on the cannon to fire",
"This is the fun part. Use the Cannon to smash a hole in your enemys wall KA-BOOM!"
);
}
@Override

View File

@ -6,6 +6,7 @@ import java.util.Map;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.game.clans.clans.map.events.PlayerGetMapEvent;
import mineplex.game.clans.clans.siege.weapon.Cannon;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
@ -15,7 +16,17 @@ public class GetMapGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public GetMapGoal(AttackEnemyObjective objective)
{
super(objective, "Get a Map", "Use the /map command to recieve a map.");
super(
objective,
"Get a Map",
"Get a Map ( Type /map )",
"You can get a Map any time you need one. The map will show you who " +
"owns the land around the map. Your clan is " + C.cAqua + "aqua" +
C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " +
"and your enemies are " + C.cRed + "red" + C.mBody + "."
);
setStartMessageDelay(120);
}
@Override

View File

@ -13,7 +13,13 @@ public class LoadCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public LoadCannonGoal(AttackEnemyObjective objective)
{
super(objective, "Load Cannon", "Right click to open the Cannon, and load it with TNT!");
super(
objective,
"Load the Cannon",
"Right click whilst sitting on the Cannon, and load it with TNT!",
"First youll need to load this baby up with some TNT. Right click whilst sitting " +
"on the Cannon, and load it with TNT!"
);
}
@Override

View File

@ -20,7 +20,13 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public MountCannonGoal(AttackEnemyObjective objective)
{
super(objective, "Get on Cannon", "Right click on the Cannon to hop on!");
super(
objective,
"Get on the Cannon",
"Right click on the Cannon to hop on!",
"To break through an enemy Clans fortress youll need some serious " +
"firepower. Try using this TNT Cannon to get the job done!"
);
}
@Override

View File

@ -27,14 +27,20 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
public StealEnemyPotatoesGoal(AttackEnemyObjective objective)
{
super(objective, "Steal Enemy Potatoes", "Steal the enemy's potatoes");
super(
objective,
"Steal Potatoes",
"Retrieve the potatoes from the Enemy Clans base",
"Now that their walls are down, its time to get rich! Go steal their " +
"potatoes for your Clan!"
);
}
@Override
public String getDescription(Player player)
{
int count = _playersMap.get(player.getUniqueId()).get();
return "Steal Potatoes " + count + "/10";
return "Retrieve the potatoes from the Enemy Clans base " + count + "/10";
}
@Override

View File

@ -35,7 +35,13 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
public BuildHouseGoal(ClanObjective objective)
{
super(objective, "Build House", "Build a Stone Brick house. (Place all your blocks)");
super(
objective,
"Build a House",
"Build a House (place all your blocks)",
"The first thing you should do on your land is build a house, even " +
"if its made of dirt! This will give you a safe place to store your loot!"
);
}
@Override

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import java.util.List;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -15,12 +16,19 @@ import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
import mineplex.game.clans.tutorial.TutorialRegion;
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
import org.bukkit.event.EventPriority;
public class ClaimLandGoal extends ObjectiveGoal<ClanObjective>
{
public ClaimLandGoal(ClanObjective objective)
{
super(objective, "Claim Land", "Claim land by opening the Clan Management page with /c and click the Claim Land Button");
super(
objective,
"Claim Land",
"Claim Land using the Clan Menu ( Type /c )",
"The first thing your Clan needs to do before you can start to " +
"build your fortress is claim the land in an area for your Clan."
);
}
@Override
@ -54,4 +62,11 @@ public class ClaimLandGoal extends ObjectiveGoal<ClanObjective>
event.setCancelled(true);
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Territory))
event.setCancelled(false);
}
}

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -8,6 +9,7 @@ import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
import org.bukkit.event.EventPriority;
public class ClanDetailsGoal extends ObjectiveGoal<ClanObjective>
{
@ -51,4 +53,11 @@ public class ClanDetailsGoal extends ObjectiveGoal<ClanObjective>
}
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && (event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Who)))
event.setCancelled(false);
}
}

View File

@ -1,8 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import mineplex.game.clans.clans.ClanInfo;
@ -12,7 +10,7 @@ import mineplex.game.clans.clans.ClansPlayer;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.core.repository.tokens.ClanToken;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -20,17 +18,23 @@ import java.sql.Timestamp;
import java.util.UUID;
public class ClanInfoGoal extends ObjectiveGoal<ClanObjective>
public class ClanInfoGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public ClanInfoGoal(ClanObjective objective)
public ClanInfoGoal(AttackEnemyObjective objective)
{
super(objective, "Info on other clan", "Get info on other clans by using the command /c <ClanName>");
super(
objective,
"Lookup Enemy Details",
"View info about the enemy clan by typing /c EnemyClan",
"You can lookup details about your enemy before going for an " +
"attack! This can give you a crucial advantage before " +
"you begin."
);
}
@Override
protected void customStart(Player player)
{
player.sendMessage(F.main("Clans", "You can use the command /c <ClanName> to get information about other clans. Try typing /c randomClan"));
}
@Override
@ -46,23 +50,27 @@ public class ClanInfoGoal extends ObjectiveGoal<ClanObjective>
if(event.getArguments().length < 1) return;
event.setCancelled(true);
event.setCancelled(true);
if (!event.getArguments()[0].equalsIgnoreCase("EnemyClan"))
{
// Display info
return;
}
ClanToken token = new ClanToken();
token.Name = event.getArguments()[0];
token.Description = "Best clan ever!";
token.Name = "EnemyClan";
token.Description = "The meanest clan in the world!";
token.Home = "";
token.Admin = false;
token.Energy = 4320;
token.Id = UtilMath.random.nextInt(100);
token.Energy = UtilMath.random.nextInt(1000);
token.Id = -1;
token.Kills = UtilMath.random.nextInt(100);
token.Murder = UtilMath.random.nextInt(100);
token.Deaths = UtilMath.random.nextInt(100);
token.WarWins = UtilMath.random.nextInt(100);
token.WarLosses = UtilMath.random.nextInt(100);
token.DateCreated = new Timestamp(System.currentTimeMillis());
token.LastOnline = new Timestamp(System.currentTimeMillis());
token.DateCreated = new Timestamp(System.currentTimeMillis() - (UtilTime.TimeUnit.DAYS.getMilliseconds() * 10));
token.LastOnline = new Timestamp(System.currentTimeMillis() - (UtilTime.TimeUnit.DAYS.getMilliseconds() * 1));
ClanInfo clan = new ClanInfo(ClansManager.getInstance(), token);

View File

@ -5,10 +5,12 @@ import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
/**
* Created by Adam on 29/03/2016.
@ -17,7 +19,13 @@ public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
{
public ClanManagementGoal(ClanObjective objective)
{
super(objective, "Manage your clan", "Manage your clan by using the command /c");
super(
objective,
"Open the Clan Menu",
"Open the Clan Menu ( Type /c )",
"Clan Menu lets you view all clan information and perform actions: " +
"who is online, Claiming Land, Inviting Players and much more."
);
}
@Override
@ -42,4 +50,11 @@ public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
}
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy))
event.setCancelled(false);
}
}

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import mineplex.core.common.util.F;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -7,12 +9,20 @@ import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClanCreationCompleteEvent;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
import org.bukkit.event.EventPriority;
public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
{
public CreateClanGoal(ClanObjective objective)
{
super(objective, "Create a Clan", "Create a Clan using /c create");
super(
objective,
"Create a Clan",
"Type /c create <name> to create a new Clan",
F.elem("Clans") + " are groups of players that can claim land, build fortresses, " +
"and fight epic battles. Together they will challenge other clans for " +
"control of the land."
);
}
@Override
@ -39,4 +49,11 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
finish(event.getFounder());
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Create))
event.setCancelled(false);
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.tutorial.TutorialRegion;
@ -18,21 +19,24 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
{
public LeaveSpawnGoal(ClanObjective objective)
{
super(objective, "Leave Spawn", "Exit the tutorial spawn area");
super(
objective,
"Leave Spawn",
"Jump off Spawn Island",
F.elem("Spawn Island") + " is where you will respawn when you die. This area is " +
"a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " +
"From here, you can teleport to various places, as well as read some helpful " +
"hints. To leave " + F.elem("Spawn Island") + ", simply jump off!"
);
// 2 seconds after start message
setStartMessageDelay(20 * 3);
}
@Override
protected void setup(Player player, TutorialRegion region)
{
getObjective().getPlugin().addHologram(player,
getObjective().getPlugin().getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -6),
C.cGoldB + "Welcome to the Clans Tutorial!",
" ",
"This will teach you the basics of Clans.",
"It will take about 5 minutes to complete.",
"You must complete it before playing Clans.",
" ",
"Walk forward to begin!");
}
@Override

View File

@ -18,7 +18,16 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
{
public SetHomeGoal(ClanObjective objective)
{
super(objective, "Set Home", "Set your Clan's home by typing /c sethome");
super(
objective,
"Set Clan Home",
"Set your Clan's Home ( Type /c sethome )",
"Your Clan Home is a special place in your base that you can teleport " +
"to from " + F.elem("Spawn Island") + ". You can teleport to it " +
"at any time by typing " + F.elem("/c home") + "."
);
setDisplayFinishMessage(false);
}
@Override
@ -48,7 +57,7 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
// we need to save this for later when the player teleports home!
getObjective().getPlugin().getTutorialSession(event.getPlayer()).setHomeLocation(event.getPlayer().getLocation());
finish(event.getPlayer());
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have successfully set your Clan's Home to " + UtilWorld.locToStrClean(event.getPlayer().getLocation()) + "."));
@ -57,7 +66,7 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
{
UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You must set your home in your own land claim."));
}
event.setCancelled(true);
}
}

View File

@ -11,7 +11,15 @@ public class EquipDefaultBuildGoal extends ObjectiveGoal<ClassesObjective>
{
public EquipDefaultBuildGoal(ClassesObjective objective)
{
super(objective, "Equip Armor", "Equip your newly bought armor to try out it's abilities");
super(
objective,
"Equip Armor",
"Put on your Iron Armor",
"When you wear a full set of armor, it will equip a class! The Iron set makes you " +
"into a Knight. Each class has different skills and is strong in its own way."
);
setStartMessageDelay(120);
}
@Override

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
@ -14,7 +15,13 @@ public class OpenClassManagerGoal extends ObjectiveGoal<ClassesObjective>
{
public OpenClassManagerGoal(ClassesObjective objective)
{
super(objective, "Open Class Manager", "Open the Class Manager by right clicking on an enchantment table");
super(
objective, "Open Class Manager",
"Right-Click on the Enchantment Table",
"Each class has lots of different skills, and you can pick which ones you want to " +
"equip! Click on an " + F.elem("Enchanting Table") + " to have a look at " +
"this menu."
);
}
@Override

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
@ -32,6 +33,11 @@ public class SelectBullsChargeGoal extends ObjectiveGoal<ClassesObjective>
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
getActivePlayers().forEach(uuid -> {
Player player = UtilPlayer.searchExact(uuid);

View File

@ -11,7 +11,13 @@ public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective>
{
public UseBullsChargeGoal(ClassesObjective objective)
{
super(objective, "Use Bulls Charge", "Use the Bull's Charge skill to make yourself run faster");
super(
objective,
"Use Bulls Charge",
"Right-Click with Axe to use Bull's Charge",
"One of your default abilities as Knight is Bulls Charge. This ability will make " +
"you run faster for a short time, and deal extra damage to enemies."
);
}
@Override

View File

@ -12,7 +12,12 @@ public class BuyEnergyGoal extends ObjectiveGoal<EnergyObjective>
{
public BuyEnergyGoal(EnergyObjective objective)
{
super(objective, "Buy Energy", "Buy Energy from the Energy Shop");
super(
objective,
"Buy Energy",
"Buy Clan Energy from the Energy Shop",
"You can buy Clan Energy at the Shops."
);
}
@Override

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -9,12 +10,21 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
{
public ExplainEnergyGoal(EnergyObjective objective)
{
super(objective, "About Energy", "Check your Energy");
super(
objective,
"About Energy",
"Look at your energy in your Clans Menu ( Type /c )",
"Owning land isnt free! You will need to buy Energy from the Shops to retain " +
"ownership of it. If your Clan Energy ever reaches 0, you will lose your " +
"land claims!"
);
}
@Override
@ -34,10 +44,19 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
finish(player);
}, 20 * 10L);
}, 20 * 3L);
setStartMessageDelay(120);
}
@Override
protected void customFinish(Player player)
{
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy))
event.setCancelled(false);
}
}

View File

@ -20,7 +20,13 @@ public class GoToFieldsGoal extends ObjectiveGoal<FieldsObjective>
{
public GoToFieldsGoal(FieldsObjective objective)
{
super(objective, "Go to the Fields", "Run to the center of the map, to the Fields");
super(
objective,
"Go to the Fields",
"Go to the Fields",
"The Fields are a very dangerous place where players come to fight and harvest " +
"resources!"
);
}
@Override

View File

@ -25,7 +25,13 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
public MineDiamondsGoal(FieldsObjective objective)
{
super(objective, "Mine Diamonds", "Search for some diamonds in the Fields and mine them");
super(
objective,
"Mine Diamonds",
"Search for some diamonds in the Fields and mine them",
"Mining in the Fields is a great way to make lots of money! The ores will " +
"regenerate over time. Be careful of enemies though!"
);
_playersMap = new HashMap<>();
}

View File

@ -15,7 +15,12 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
{
public SellDiamondsGoal(FieldsObjective objective)
{
super(objective, "Sell Diamonds", "Return to shops and sell your diamonds to the Mining NPC");
super(
objective,
"Sell Diamonds",
"Sell your Diamonds to the Mining Shop",
"Go back to the Shops and sell your precious diamonds!"
);
}
@Override
@ -29,6 +34,8 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
{
// Close Middle Gate
getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.RED);
// Close Fields Gate
getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK);
}
@EventHandler

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -18,7 +19,14 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
{
public DisbandClanGoal(FinalObjective objective)
{
super(objective, "Disband Clan", "Use the /c command to disband your Tutorial Clan");
super(
objective,
"Disband Clan",
"Disband your Clan ( Type /c )",
"Now that the tutorial is almost finished, lets delete your Clan. Disbanding a " +
"Clan will delete it, and unclaim all of your land. Open the Clans Menu " +
"and do this now."
);
}
@Override
@ -44,4 +52,11 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null);
finish(event.getDisbander());
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) {
if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Disband))
event.setCancelled(false);
}
}

View File

@ -20,7 +20,14 @@ public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
{
public TpClanHomeGoal(FinalObjective objective)
{
super(objective, "Teleport to Clan Home", "Use the /c home command to teleport to your Clan Home");
super(
objective,
"Teleport to Clan Home",
"Teleport back to your Clan Home ( Type /c home )",
"You can teleport back to your Clan Home at any time, as long as it's set!"
);
setStartMessageDelay(120);
}
@Override

View File

@ -20,7 +20,12 @@ public class GoToShopsGoal extends ObjectiveGoal<ShopsObjective>
{
public GoToShopsGoal(ShopsObjective objective)
{
super(objective, "Go to the Shops", "Head over to the Shops (use your map)");
super(
objective,
"Go to the Shops",
"Head over to the Shops (use your map)",
"The shops are the place where you can buy and sell all sorts of items!"
);
}
@Override

View File

@ -17,6 +17,19 @@ public class PurchaseGoal extends ObjectiveGoal
{
super(objective, name, description);
_material = material;
setDisplayStartMessage(false);
setDisplayFinishMessage(false);
}
public PurchaseGoal(Objective objective, Material material, String name, String description,
String helpText)
{
super(objective, name, description, helpText);
_material = material;
setDisplayStartMessage(false);
setDisplayFinishMessage(false);
}
@Override

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
@ -15,7 +16,14 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
{
public SellPotatoesGoal(ShopsObjective objective)
{
super(objective, "Sell Potatoes", "Right click the Organic Produce NPC and sell your potatoes");
super(
objective,
"Sell Potatoes",
"Sell your Potatoes to the " + F.elem("Organic Produce Shop NPC") + ".",
"Farming is a great way to make money in Clans. Build a farm in your land, " +
"harvest " +
"the crops and sell it to the shops for profit!"
);
}
@Override
@ -29,6 +37,9 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
{
// Shops Fences Closed
getObjective().getPlugin().spawnFences(getObjective().getPlugin().getRegion(player), DyeColor.BROWN);
// Remove all potatoes from inventory
UtilInv.removeAll(player, Material.POTATO_ITEM, (byte) 0);
}
@EventHandler