Merge branch 'clans-beta' of ssh://184.154.0.242:7999/min/Mineplex into clans-beta
Conflicts: Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java
This commit is contained in:
commit
3b125dc8a5
@ -84,19 +84,6 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
else
|
||||
deniedAccess = true;
|
||||
}
|
||||
else if (servUp.contains("CLANS-"))
|
||||
{
|
||||
if (playerRank.has(Rank.MODERATOR))
|
||||
{
|
||||
Plugin.sendPlayerToServer(player, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player,
|
||||
F.main(Plugin.getName(), C.cRed + "You must join clans through the hub! Join " + C.cGold + "ClansHub-1"
|
||||
+ C.cRed + "!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.sendPlayerToServer(player, args[0]);
|
||||
|
@ -106,6 +106,10 @@ public class PlayerScoreboard
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore extra lines
|
||||
if (i >= _teamNames.length)
|
||||
continue;
|
||||
|
||||
//Update
|
||||
Team team = _scoreboard.getTeam(_teamNames[i]);
|
||||
if (team == null)
|
||||
|
@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class Clans extends JavaPlugin
|
||||
{
|
||||
public static final String VERSION = "0.16";
|
||||
public static final String VERSION = "0.17";
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
// Modules
|
||||
|
@ -64,15 +64,25 @@ public class ClaimVisualizer extends MiniPlugin
|
||||
{
|
||||
addCommand(new ClaimVisualizeCommand(this));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void cleanup(UpdateEvent event)
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOWER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_calculated.clear();
|
||||
for (ClanInfo clan : _clansManager.getClanMap().values())
|
||||
{
|
||||
_calculated.put(clan, new NautHashMap<String, VisualizedChunkData>());
|
||||
|
||||
for (String serialized : clan.getClaimSet())
|
||||
{
|
||||
calculate(clan, serialized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -126,20 +136,15 @@ public class ClaimVisualizer extends MiniPlugin
|
||||
{
|
||||
for (int z = 0; z < 16; z++)
|
||||
{
|
||||
if (z == 0 || z == 15 || x == 0 || x == 15)
|
||||
if (chunk.shouldDisplayEdge(x, z) && (z == 0 || z == 15 || x == 0 || x == 15))
|
||||
{
|
||||
if (!chunk.shouldDisplay(x, z))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = chunk.getChunk().getBlock(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER,
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST,
|
||||
new Location(
|
||||
chunk.getChunk().getWorld(),
|
||||
block.getX() + .5,
|
||||
Math.max(UtilBlock.getHighest(player.getWorld(), block.getX(), block.getZ()).getY(), player.getLocation().getY()) + .5,
|
||||
UtilBlock.getHighest(player.getWorld(), block.getX(), block.getZ()).getY() + .5,
|
||||
block.getZ() + .5),
|
||||
new Vector(0f, 0f, 0f), 0f, 1, ViewDist.NORMAL, player);
|
||||
}
|
||||
@ -219,15 +224,19 @@ public class ClaimVisualizer extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUnclaim(PlayerUnClaimTerritoryEvent event)
|
||||
public void update(ClanInfo clan)
|
||||
{
|
||||
_calculated.clear();
|
||||
|
||||
for (String serialized : event.getClan().getClaimSet())
|
||||
for (String serialized : clan.getClaimSet())
|
||||
{
|
||||
calculate(event.getClan(), serialized);
|
||||
calculate(clan, serialized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUnclaim(PlayerUnClaimTerritoryEvent event)
|
||||
{
|
||||
if (event.getClan().getClaimCount() == 1)
|
||||
{
|
||||
for (Player player : event.getClan().getOnlinePlayers())
|
||||
@ -240,17 +249,6 @@ public class ClaimVisualizer extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClaim(PlayerClaimTerritoryEvent event)
|
||||
{
|
||||
_calculated.clear();
|
||||
|
||||
for (String serialized : event.getClan().getClaimSet())
|
||||
{
|
||||
calculate(event.getClan(), serialized);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVisualizing(Player player)
|
||||
{
|
||||
return _visualizing.contains(player.getName());
|
||||
@ -306,6 +304,31 @@ public class ClaimVisualizer extends MiniPlugin
|
||||
|
||||
_visualizing.add(player.getName());
|
||||
UtilPlayer.message(player, F.main("Clans", "You are now visualizing your claims."));
|
||||
|
||||
for (VisualizedChunkData chunk : _calculated.get(clan).values())
|
||||
{
|
||||
if (!chunk.getChunk().getWorld().equals(player.getWorld()))
|
||||
{
|
||||
// return not break because a clan can't have claims in different worlds.
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilMath.offset2d(chunk.getChunk().getBlock(0, 0, 0).getLocation(), player.getLocation()) > 36)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for (int x = 0; x < 16; x++)
|
||||
{
|
||||
for (int z = 0; z < 16; z++)
|
||||
{
|
||||
if (chunk.shouldDisplayEdge(x, z) && (z == 0 || z == 15 || x == 0 || x == 15))
|
||||
{
|
||||
Block block = chunk.getChunk().getBlock(x, 0, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void disableVisualizer(Player player)
|
||||
|
@ -8,33 +8,41 @@ import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
public class VisualizedChunkData
|
||||
{
|
||||
private List<EnumDirection> _displayable;
|
||||
private List<EnumDirection> _displayableEdges;
|
||||
private Chunk _chunk;
|
||||
|
||||
public long _start;
|
||||
|
||||
public VisualizedChunkData(Chunk chunk, List<EnumDirection> dir)
|
||||
{
|
||||
_chunk = chunk;
|
||||
_displayable = dir;
|
||||
_displayableEdges = dir;
|
||||
_start = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean shouldDisplay(int x, int z)
|
||||
public double getLife()
|
||||
{
|
||||
if (z == 15 && !_displayable.contains(EnumDirection.SOUTH))
|
||||
return (double) (System.currentTimeMillis() - _start);
|
||||
}
|
||||
|
||||
public boolean shouldDisplayEdge(int x, int z)
|
||||
{
|
||||
if (z == 15 && !_displayableEdges.contains(EnumDirection.SOUTH))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x == 15 && !_displayable.contains(EnumDirection.EAST))
|
||||
if (x == 15 && !_displayableEdges.contains(EnumDirection.EAST))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x == 0 && !_displayable.contains(EnumDirection.WEST))
|
||||
if (x == 0 && !_displayableEdges.contains(EnumDirection.WEST))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (z == 0 && !_displayable.contains(EnumDirection.NORTH))
|
||||
if (z == 0 && !_displayableEdges.contains(EnumDirection.NORTH))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -42,7 +50,8 @@ public class VisualizedChunkData
|
||||
return true;
|
||||
}
|
||||
|
||||
public Chunk getChunk() {
|
||||
public Chunk getChunk()
|
||||
{
|
||||
return _chunk;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.clans.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -24,6 +25,7 @@ import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.clans.ClansBlacklist;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClientClan;
|
||||
import mineplex.game.clans.clans.event.ClanJoinEvent;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
@ -382,6 +384,10 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
|
||||
return;
|
||||
}
|
||||
|
||||
ClanJoinEvent event = new ClanJoinEvent(clan, caller);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
// Task
|
||||
Plugin.getClanDataAccess().join(clan, caller, ClanRole.RECRUIT, new Callback<Boolean>()
|
||||
|
@ -7,6 +7,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.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
@ -23,6 +24,12 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (ClansManager.getInstance().getClan(caller) != null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Tutorial", "You cannot restart the tutorial while in a clan"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null
|
||||
&& ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation()))
|
||||
{
|
||||
@ -44,7 +51,7 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
TutorialManager.Instance.sendTutorialMsg(caller, F.main("Clans", "You must be in a safezone to restart the tutorial."));
|
||||
TutorialManager.Instance.sendTutorialMsg(caller, F.main("Clans", "You must be in a Safe Zone to restart the tutorial."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,19 +42,17 @@ public class ClansScoreboardManager extends ScoreboardManager
|
||||
|
||||
private void init(TutorialManager tutorialManager)
|
||||
{
|
||||
setTitle(" MINEPLEX CLANS ");
|
||||
setTitle("Clans Alpha " + Clans.VERSION);
|
||||
|
||||
ScoreboardData data = getData("default", true);
|
||||
|
||||
data.write(C.cGreen + "Clans Alpha " + Clans.VERSION);
|
||||
data.writeEmpty();
|
||||
data.writeElement(new ScoreboardElementClan(_clansManager));
|
||||
data.writeElement(new ScoreboardElementPlayer(_clansManager));
|
||||
data.writeElement(new ScoreboardElementPlayerCount(_clansManager));
|
||||
|
||||
data.writeElement(_worldEvent);
|
||||
// data.writeElement(new ScoreboardElementPlayerCount(_clansManager));
|
||||
|
||||
data.writeElement(_warManager);
|
||||
|
||||
data.writeElement(_worldEvent);
|
||||
|
||||
for (Tutorial tutorial : tutorialManager.getTutorials().values())
|
||||
{
|
||||
data.writeElement(tutorial);
|
||||
|
@ -35,8 +35,7 @@ public class ScoreboardElementClan implements ScoreboardElement
|
||||
|
||||
// Energy
|
||||
if (clanInfo.getEnergyCostPerMinute() > 0)
|
||||
output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
|
||||
output.add(C.cYellow + "Home " + C.cWhite + clanInfo.getBedStatusStr());
|
||||
output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -27,10 +27,9 @@ public class ScoreboardElementPlayer implements ScoreboardElement
|
||||
{
|
||||
List<String> output = new ArrayList<String>();
|
||||
output.add(C.cYellow + "Gold " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.Gold) + "");
|
||||
output.add("");
|
||||
|
||||
String regionString = C.xWilderness + "Wilderness";
|
||||
|
||||
output.add(" ");
|
||||
ClanTerritory claim = _clansManager.getClanUtility().getClaim(player.getLocation());
|
||||
if (claim != null)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ public class ScoreboardElementPlayerCount implements ScoreboardElement
|
||||
List<String> output = new ArrayList<String>();
|
||||
|
||||
output.add("");
|
||||
output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100");
|
||||
output.add(C.cYellow + "Players " + C.cWhite + UtilServer.getPlayers().length + "/100");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
{
|
||||
for (WarInvasion invasion : invasions)
|
||||
{
|
||||
if (invasion.getInvaderClan().equals(playerClan))
|
||||
if (invasion.getInvaderClan().equals(playerClan.getName()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -125,15 +125,24 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
final ClanInfo killerClan = event.getKiller().getClan();
|
||||
|
||||
ClanWarData war = clan.getWarData(killerClan);
|
||||
if (war != null && !war.isOnCooldown())
|
||||
if (war != null)
|
||||
{
|
||||
if (war.isOnCooldown())
|
||||
{
|
||||
// Ignore!
|
||||
return;
|
||||
}
|
||||
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
|
||||
|
||||
// War already exists
|
||||
war.increment(killerClan.getName());
|
||||
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
|
||||
_clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) +
|
||||
clan.getName() + " " + C.Reset + "(" + killerClan.getFormattedWarPoints(clan) + C.Reset + ")"));
|
||||
_clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) +
|
||||
killerClan.getName() + " " + C.Reset + "(" + clan.getFormattedWarPoints(killerClan) + C.Reset + ")"));
|
||||
war.increment(killerClan.getName());
|
||||
checkWarComplete(war);
|
||||
|
||||
ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan;
|
||||
@ -142,9 +151,6 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
|
||||
_clansManager.getScoreboard().refresh(killerClan);
|
||||
_clansManager.getScoreboard().refresh(clan);
|
||||
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -155,14 +161,13 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
public void run(ClanWarData data)
|
||||
{
|
||||
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
|
||||
_clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName()));
|
||||
_clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName()));
|
||||
|
||||
_clansManager.getScoreboard().refresh(killerClan);
|
||||
_clansManager.getScoreboard().refresh(clan);
|
||||
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
|
||||
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -271,7 +276,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
@EventHandler
|
||||
public void onInvasionEnd(WarInvasionEndEvent event)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvaderClan() + " has ended.")));
|
||||
Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvadedClan()) + " has ended."));
|
||||
|
||||
}
|
||||
|
||||
@ -301,13 +306,14 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
|
||||
if (clan != null)
|
||||
{
|
||||
List<WarInvasion> invadedList = _invadedMap.get(clan);
|
||||
List<WarInvasion> invaderList = _invaderMap.get(clan);
|
||||
List<WarInvasion> invadedList = _invadedMap.get(clan.getName());
|
||||
List<WarInvasion> invaderList = _invaderMap.get(clan.getName());
|
||||
|
||||
if (invaderList != null && !invaderList.isEmpty())
|
||||
{
|
||||
for (WarInvasion invasion : invaderList)
|
||||
{
|
||||
element.add(" ");
|
||||
element.add(C.cPurpleB + "Invading");
|
||||
element.add(" " + invasion.getInvadedClan());
|
||||
element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT));
|
||||
@ -318,6 +324,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
{
|
||||
for (WarInvasion invasion : invadedList)
|
||||
{
|
||||
element.add(" ");
|
||||
element.add(C.cRedB + "Invaded");
|
||||
element.add(" " + invasion.getInvaderClan());
|
||||
element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT));
|
||||
|
@ -8,6 +8,7 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -19,6 +20,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
@ -27,6 +29,8 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
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;
|
||||
@ -40,6 +44,7 @@ import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClanJoinEvent;
|
||||
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
@ -66,7 +71,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
protected final TaskManager _taskManager;
|
||||
protected final DonationManager _donationManager;
|
||||
|
||||
protected final LinkedHashMap<Integer, TutorialTask<?>> _tasks;
|
||||
// protected final LinkedHashMap<Integer, TutorialTask<?>> _tasks;
|
||||
private final ArrayList<TutorialTask<?>> _tasks;
|
||||
protected final LinkedHashMap<String, TutorialTask<?>> _nameToTask;
|
||||
protected final LinkedHashMap<String, TutorialClient> _inTutorial;
|
||||
|
||||
@ -89,7 +95,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
_donationManager = donationManager;
|
||||
_taskManager = taskManager;
|
||||
_manager = manager;
|
||||
_tasks = new LinkedHashMap<>();
|
||||
_tasks = new ArrayList<TutorialTask<?>>();
|
||||
_inTutorial = new LinkedHashMap<>();
|
||||
_nameToTask = new LinkedHashMap<>();
|
||||
|
||||
@ -122,7 +128,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
lines.add(C.cAqua + "Tutorial");
|
||||
|
||||
for (final TutorialTask<?> task : _tasks.values())
|
||||
for (final TutorialTask<?> task : _tasks)
|
||||
{
|
||||
if (get(player).CurrentTask.equals(task))
|
||||
{
|
||||
@ -142,10 +148,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
public TutorialTask<?> getTask(int index)
|
||||
{
|
||||
return _tasks.get(index);
|
||||
}
|
||||
|
||||
protected void addTask(TutorialTask<?> task)
|
||||
{
|
||||
_tasks.put(_tasks.size() + 1, task);
|
||||
_tasks.add(task);
|
||||
_nameToTask.put(task.getTechnicalName(), task);
|
||||
}
|
||||
|
||||
@ -158,6 +169,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
return get(player).CurrentTask.getID() < task.getID();
|
||||
}
|
||||
|
||||
private TutorialTask<?> getLastTask()
|
||||
{
|
||||
return _tasks.get(_tasks.size() - 1);
|
||||
}
|
||||
|
||||
protected void finishTask(final Player player, final TutorialTask<?> task)
|
||||
{
|
||||
@ -175,8 +191,10 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
final TutorialTask<?> lastTask = getLastTask();
|
||||
// Cycle to next task, or null if last task.
|
||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||
get(player).CurrentTask = task.equals(lastTask) ? null : _tasks.get(task.getDataId() + 1);
|
||||
System.out.println("Next Task: " + get(player).CurrentTask);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||
{
|
||||
@ -185,7 +203,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
// If last task, end tutorial.
|
||||
if (task.equals(_tasks.get(_tasks.size())))
|
||||
if (task.equals(lastTask))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
@ -196,6 +214,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
System.out.println("STARTING NEXT TASK!");
|
||||
get(player).CurrentTask.startFor(player);
|
||||
get(player).CurrentTaskStartTime = System.currentTimeMillis();
|
||||
}
|
||||
@ -253,23 +272,22 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
private void finishFor(final Player player)
|
||||
{
|
||||
if (player.getOpenInventory() != null)
|
||||
{
|
||||
_inTutorial.get(player.getName()).QueuedFinish = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if (player.getOpenInventory() != null)
|
||||
// {
|
||||
// _inTutorial.get(player.getName()).QueuedFinish = true;
|
||||
// return;
|
||||
// }
|
||||
_manager.finishTutorial(player);
|
||||
_inTutorial.remove(player.getName());
|
||||
|
||||
UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20);
|
||||
onFinished(player);
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
// Custom Finish Method (usually messages)
|
||||
onFinished(player);
|
||||
|
||||
UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20, player);
|
||||
onFinishedDelay(player);
|
||||
|
||||
// Do Reward
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||
{
|
||||
@ -306,6 +324,25 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
}
|
||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilInv.remove(player, Material.IRON_AXE, (byte) 0, 1);
|
||||
|
||||
UtilInv.remove(player, Material.IRON_HELMET, (byte) 0, 1);
|
||||
UtilInv.remove(player, Material.IRON_CHESTPLATE, (byte) 0, 1);
|
||||
UtilInv.remove(player, Material.IRON_LEGGINGS, (byte) 0, 1);
|
||||
UtilInv.remove(player, Material.IRON_BOOTS, (byte) 0, 1);
|
||||
|
||||
ItemStack[] armor = player.getInventory().getArmorContents();
|
||||
for (int i = 0 ; i < armor.length; i++)
|
||||
{
|
||||
if (UtilItem.isIronProduct(armor[i]))
|
||||
{
|
||||
armor[i] = null;
|
||||
}
|
||||
}
|
||||
player.getInventory().setArmorContents(armor);
|
||||
}
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@ -341,13 +378,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
}
|
||||
}, 20 * 2);
|
||||
}
|
||||
}, 20 * 4);
|
||||
}, 20 * 2);
|
||||
}
|
||||
|
||||
// Implementation left to sub classes.
|
||||
protected void onFinished(final Player player)
|
||||
{
|
||||
}
|
||||
|
||||
protected void onFinishedDelay(final Player player)
|
||||
{
|
||||
}
|
||||
|
||||
// Implementation left to sub classes.
|
||||
protected void onBegin(final Player player)
|
||||
@ -358,7 +399,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
{
|
||||
if (!_manager.isInTutorial(player))
|
||||
{
|
||||
_manager._playerTutorials.put(player.getName(), this);
|
||||
_manager.setTutorial(player, this);
|
||||
}
|
||||
|
||||
_inTutorial.put(player.getName(), new TutorialClient(player, this));
|
||||
@ -403,11 +444,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
return _inTutorial.containsKey(player);
|
||||
}
|
||||
|
||||
public Map<Integer, TutorialTask<?>> getTasks()
|
||||
{
|
||||
return _tasks;
|
||||
}
|
||||
|
||||
public boolean hasCompleted(final Player player)
|
||||
{
|
||||
return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||
@ -507,7 +543,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
}
|
||||
}
|
||||
|
||||
get(player).CurrentTask.trySendDescription(player);
|
||||
get(player).CurrentTask.trySendDescription(player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -533,6 +569,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
evt.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoinClan(ClanJoinEvent event)
|
||||
{
|
||||
if (isInTutorial(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(final PlayerJoinEvent evt)
|
||||
{
|
||||
@ -553,9 +598,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
if (get(player) != null && get(player).CurrentTask != null)
|
||||
System.out.println("Cleaning up Player in " + getClass().getName());
|
||||
|
||||
if (get(player) != null && get(player).CurrentTask != null)
|
||||
{
|
||||
System.out.println("Cleaning up current task: " + get(player).CurrentTask.getClass().getName());
|
||||
get(player).CurrentTask.cleanup(player);
|
||||
|
||||
}
|
||||
|
||||
System.out.println("removing from in tutorial");
|
||||
_inTutorial.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,12 @@ public class TutorialClient
|
||||
{
|
||||
Player = player;
|
||||
|
||||
CurrentTask = tutorial._tasks.get(1);
|
||||
CurrentTask = tutorial.getTask(0);
|
||||
CurrentTaskStartTime = System.currentTimeMillis();
|
||||
|
||||
InClanOnStart = tutorial._clansManager.isInClan(player);
|
||||
|
||||
|
||||
/*
|
||||
for (TutorialTask<?> task : tutorial._tasks.values())
|
||||
{
|
||||
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
||||
@ -36,5 +37,6 @@ public class TutorialClient
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class TutorialManager extends MiniPlugin
|
||||
public static TutorialManager Instance;
|
||||
|
||||
private final Map<Class<? extends Tutorial>, Tutorial> _tutorials = new HashMap<>();
|
||||
protected final Map<String, Tutorial> _playerTutorials = new HashMap<>();
|
||||
private final Map<String, Tutorial> _playerTutorials = new HashMap<>();
|
||||
|
||||
private final TaskManager _taskManager;
|
||||
|
||||
@ -138,10 +138,13 @@ public class TutorialManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void quit(PlayerQuitEvent event)
|
||||
{
|
||||
System.out.println("Player Quit. In Tutorial: " + isInTutorial(event.getPlayer()));
|
||||
|
||||
if (!isInTutorial(event.getPlayer()))
|
||||
return;
|
||||
|
||||
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
|
||||
_playerTutorials.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public void sendTutorialMsg(Player player, String message)
|
||||
@ -156,6 +159,16 @@ public class TutorialManager extends MiniPlugin
|
||||
sendTutorialMsg(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
public void finishTutorial(Player player)
|
||||
{
|
||||
_playerTutorials.remove(player.getName());
|
||||
}
|
||||
|
||||
public void setTutorial(Player player, Tutorial tutorial)
|
||||
{
|
||||
_playerTutorials.put(player.getName(), tutorial);
|
||||
}
|
||||
|
||||
public Tutorial getTutorial(final Player player)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class TutorialTask<T extends Tutorial> implements Listener
|
||||
@ -38,7 +39,6 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
|
||||
protected long _descriptionWaitTime = 30000;
|
||||
|
||||
protected NautArrayList<String> _playersFinished = new NautArrayList<>();
|
||||
protected NautArrayList<String> _inTask = new NautArrayList<>();
|
||||
|
||||
private long _lastTaskTp;
|
||||
@ -64,7 +64,7 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
{
|
||||
_inTask.add(player.getName());
|
||||
|
||||
trySendDescription(player);
|
||||
trySendDescription(player, true);
|
||||
|
||||
customStartFor(player);
|
||||
|
||||
@ -124,7 +124,7 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25);
|
||||
UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
return _inTask != null && player != null && _inTask.contains(player.getName());
|
||||
}
|
||||
|
||||
public void trySendDescription(Player player)
|
||||
public void trySendDescription(Player player, boolean force)
|
||||
{
|
||||
if (!_tutorial.isInTutorial(player))
|
||||
{
|
||||
@ -149,19 +149,24 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||
if (force || System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||
{
|
||||
String description = _description;
|
||||
ClanInfo clan = getClans().getClan(player);
|
||||
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 + ": " + _displayName);
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_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 + "---------------------------------------------");
|
||||
|
||||
UtilTextMiddle.display("", getDisplayName());
|
||||
UtilTextMiddle.display("", getDisplayName(), player);
|
||||
|
||||
client.LastDescriptionSentTime = System.currentTimeMillis();
|
||||
}
|
||||
@ -207,30 +212,39 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
{
|
||||
return _tutorial._clansManager;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
|
||||
public int getDataId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return _id + 1;
|
||||
}
|
||||
|
||||
public void finishFor(Player player)
|
||||
{
|
||||
customEndFor(player);
|
||||
cleanup(player);
|
||||
_tutorial.finishTask(player, this);
|
||||
}
|
||||
|
||||
public void visibleFinish(Player player)
|
||||
{
|
||||
_inTask.remove(player.getName());
|
||||
|
||||
if (_finishMessage != null)
|
||||
{
|
||||
String finishMessage = _finishMessage;
|
||||
ClanInfo clan = getClans().getClan(player);
|
||||
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.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + finishMessage);
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
@ -239,7 +253,6 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
_inTask.remove(player.getName());
|
||||
_playersFinished.remove(player.getName());
|
||||
}
|
||||
|
||||
public long getDescriptionWaitTime()
|
||||
|
@ -48,7 +48,14 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
|
||||
{
|
||||
finishFor(player);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
// handled in onUpdate
|
||||
}
|
||||
}
|
||||
|
@ -25,18 +25,6 @@ public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
@Override
|
||||
public void customStartFor(final Player player)
|
||||
{
|
||||
if (_tutorial.get(player).InClanOnStart)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, 6 * 20);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -46,6 +34,8 @@ public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("COMPLETE DISBAND CLAN!");
|
||||
|
||||
finishFor(event.getDisbander());
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
||||
+ "Purchase Iron Armor from the PvP Shop. "
|
||||
+ "Then put on your armor to equip the Knight Class.";
|
||||
|
||||
_subtasks = new String[] {
|
||||
"Open the PvP Shop",
|
||||
"Buy Iron Armor Set",
|
||||
"Equip Iron Armor"
|
||||
};
|
||||
// _subtasks = new String[] {
|
||||
// "Open the PvP Shop",
|
||||
// "Buy Iron Armor Set",
|
||||
// "Equip Iron Armor"
|
||||
// };
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
@ -62,6 +62,11 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
|
||||
if (getClans().getClassManager().Get(player).GetGameClass() != null)
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -57,12 +57,19 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0)
|
||||
{
|
||||
finishFor(event.getPlayer());
|
||||
_inTask.remove(event.getPlayer().getName());
|
||||
return;
|
||||
}
|
||||
|
||||
event.setFree(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
// handled in on update
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
@ -78,6 +85,7 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax())
|
||||
{
|
||||
finishFor(player);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
@ -45,12 +47,20 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
String playerName = iterator.next();
|
||||
Player player = UtilPlayer.searchExact(playerName);
|
||||
|
||||
if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
|
||||
{
|
||||
finishFor(player);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
// We handle this in update() to avoid ConcurrentModificationException
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("FINISH CARROT");
|
||||
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
|
@ -9,14 +9,18 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -39,7 +43,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
// _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
|
||||
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||
@ -49,7 +53,6 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
_teleported.put(player.getName(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +73,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
{
|
||||
Player _player = Bukkit.getPlayer(iterator.next());
|
||||
|
||||
if (!_teleported.get(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
if (!_teleported.containsKey(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||
_teleported.put(_player.getName(), true);
|
||||
@ -78,6 +81,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onAbilityUesd(SkillTriggerEvent event)
|
||||
{
|
||||
@ -88,6 +92,25 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
finishFor(event.GetPlayer());
|
||||
}
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onRightClick(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!isDoing(player))
|
||||
return;
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
ItemStack item = player.getItemInHand();
|
||||
if (item != null && item.getType() == Material.IRON_AXE)
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
|
@ -16,7 +16,7 @@ public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||
_technicalName = "CommandClanX";
|
||||
|
||||
_description = "Now you can view information about your clan. "
|
||||
+ "To do this type {/c [clan name]}! "
|
||||
+ "To do this type {/c (clan)}! "
|
||||
+ "You can also use any clan's name to get some information about them as well.";
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class TutorialGettingStarted extends Tutorial
|
||||
|
||||
// addTask(new TaskWelcome(this, 1));
|
||||
|
||||
int id = 0;
|
||||
int id = -1;
|
||||
addTask(new TaskCreateClan(this, ++id));
|
||||
addTask(new TaskViewClanDetails(this, ++id));
|
||||
addTask(new TaskLeaveSpawn(this, ++id));
|
||||
@ -49,6 +49,13 @@ public class TutorialGettingStarted extends Tutorial
|
||||
|
||||
@Override
|
||||
public void onFinished(final Player player)
|
||||
{
|
||||
player.resetPlayerTime();
|
||||
player.teleport(Spawn.getEastSpawn());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishedDelay(Player player)
|
||||
{
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
|
||||
@ -56,11 +63,8 @@ public class TutorialGettingStarted extends Tutorial
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
|
||||
player.resetPlayerTime();
|
||||
player.teleport(Spawn.getEastSpawn());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBegin(final Player player)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user