changes to tutorial
This commit is contained in:
parent
ba27d94158
commit
b8e2086928
@ -19,9 +19,9 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
|
|
||||||
@ -689,6 +689,16 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
ClanInfo clan = getClanByPlayer(caller);
|
ClanInfo clan = getClanByPlayer(caller);
|
||||||
|
|
||||||
|
// Pre Event
|
||||||
|
PlayerPreClaimTerritoryEvent preEvent = new PlayerPreClaimTerritoryEvent(caller, caller.getLocation().getChunk(), clan);
|
||||||
|
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(preEvent);
|
||||||
|
|
||||||
|
if (preEvent.isCancelled())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (clan == null)
|
if (clan == null)
|
||||||
{
|
{
|
||||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package mineplex.game.clans.clans.event;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
|
||||||
|
public class PlayerPreClaimTerritoryEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private Player _claimer;
|
||||||
|
private Chunk _claimedChunk;
|
||||||
|
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
private ClanInfo _clan;
|
||||||
|
|
||||||
|
public PlayerPreClaimTerritoryEvent(Player claimer, Chunk claimedChunk, ClanInfo clan)
|
||||||
|
{
|
||||||
|
_claimer = claimer;
|
||||||
|
_claimedChunk = claimedChunk;
|
||||||
|
_clan = clan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getClaimer()
|
||||||
|
{
|
||||||
|
return _claimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClanInfo getClan()
|
||||||
|
{
|
||||||
|
return _clan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk getClaimedChunk()
|
||||||
|
{
|
||||||
|
return _claimedChunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -169,36 +169,43 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
get(player).LastDescriptionSentTime = 0;
|
get(player).LastDescriptionSentTime = 0;
|
||||||
get(player).CurrentTask.visibleFinish(player);
|
get(player).CurrentTask.visibleFinish(player);
|
||||||
|
|
||||||
// Cycle to next task, or null if last task.
|
// 6 Seconds for player to read the finish message (sent by the line above)
|
||||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||||
|
|
||||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
|
||||||
{
|
{
|
||||||
_taskManager.completedTask(new Callback<Boolean>()
|
public void run()
|
||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
// Cycle to next task, or null if last task.
|
||||||
{
|
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||||
// If last task, end tutorial.
|
|
||||||
if (task.equals(_tasks.get(_tasks.size())))
|
|
||||||
{
|
|
||||||
finishFor(player);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Start next task in 1.5 Seconds (just to give a more smooth feel to the tutorial)
|
|
||||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
get(player).CurrentTask.startFor(player);
|
|
||||||
}
|
|
||||||
}, 10L);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||||
|
{
|
||||||
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
public void run(final Boolean completed)
|
||||||
|
{
|
||||||
|
// If last task, end tutorial.
|
||||||
|
if (task.equals(_tasks.get(_tasks.size())))
|
||||||
|
{
|
||||||
|
finishFor(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start next task in 1.5 Seconds (just to give a more smooth feel to the tutorial)
|
||||||
|
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
get(player).CurrentTask.startFor(player);
|
||||||
|
}
|
||||||
|
}, 30L);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||||
|
}
|
||||||
|
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||||
}
|
}
|
||||||
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
}
|
||||||
}
|
}, 6 * 20L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TutorialTask<?> getTask(final String technicalName)
|
public TutorialTask<?> getTask(final String technicalName)
|
||||||
@ -303,35 +310,32 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
// Sets the tutorial as complete in the TaskManager and effects.
|
// Sets the tutorial as complete in the TaskManager and effects.
|
||||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
_taskManager.completedTask(new Callback<Boolean>()
|
public void run(final Boolean completed)
|
||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
if (_ghostMode)
|
||||||
{
|
{
|
||||||
if (_ghostMode)
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
for (Player other : UtilServer.getPlayers())
|
other.showPlayer(player);
|
||||||
{
|
player.showPlayer(other);
|
||||||
other.showPlayer(player);
|
|
||||||
player.showPlayer(other);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
final int index = i;
|
|
||||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
|
||||||
}
|
|
||||||
}, i * 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
|
||||||
}
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
final int index = i;
|
||||||
|
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
||||||
|
}
|
||||||
|
}, i * 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
}, 20 * 2);
|
}, 20 * 2);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -19,27 +20,24 @@ public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
|||||||
_description = "Clans can claim 16x16 areas of Territory! "
|
_description = "Clans can claim 16x16 areas of Territory! "
|
||||||
+ "Once claimed, only your Clan can break/place blocks here. "
|
+ "Once claimed, only your Clan can break/place blocks here. "
|
||||||
+ "This is the perfect place to build a base and stash your items! "
|
+ "This is the perfect place to build a base and stash your items! "
|
||||||
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
+ "You can only claim in the Wilderness, and not next to other Clan's Territory. "
|
||||||
+ "Claim some Territory now, by typing {/c claim}!";
|
+ "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
public void onClansCommand(PlayerPreClaimTerritoryEvent event)
|
||||||
{
|
{
|
||||||
if (!isDoing(event.getPlayer()))
|
if (!isDoing(event.getClaimer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
if (!ClansManager.getInstance().isInClan(event.getClaimer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getCommand().equals("claim"))
|
finishFor(event.getClaimer());
|
||||||
{
|
event.setCancelled(true);
|
||||||
finishFor(event.getPlayer());
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
_technicalName = "CustomizeKlass";
|
_technicalName = "CustomizeKlass";
|
||||||
|
|
||||||
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
||||||
+ "Click on the enchantment table, and click the edit build button.";
|
+ "Click on the enchantment table, and click the edit build button. "
|
||||||
|
+ "Make sure to select an axe ability to try out in the next task!";
|
||||||
|
|
||||||
_taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f);
|
_taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f);
|
||||||
}
|
}
|
||||||
@ -44,7 +45,7 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
Player player = Bukkit.getPlayer(iterator.next());
|
Player player = Bukkit.getPlayer(iterator.next());
|
||||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player);
|
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player);
|
||||||
|
|
||||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
|
||||||
{
|
{
|
||||||
finishFor(player);
|
finishFor(player);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
|||||||
{
|
{
|
||||||
Player player = Bukkit.getPlayer(iterator.next());
|
Player player = Bukkit.getPlayer(iterator.next());
|
||||||
|
|
||||||
if (player.getLocation().getY() < 100)
|
if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
|
||||||
{
|
{
|
||||||
finishFor(player);
|
finishFor(player);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(event.getCommand());
|
||||||
|
|
||||||
if (event.getCommand().equals("info"))
|
if (event.getCommand().equals("info"))
|
||||||
{
|
{
|
||||||
finishFor(event.getPlayer());
|
finishFor(event.getPlayer());
|
||||||
|
Loading…
Reference in New Issue
Block a user