fixed bug with part 5 of the getting started tutorial (has to do with claiming events)
This commit is contained in:
parent
8f507c4b9c
commit
4232a5675f
@ -615,7 +615,7 @@ public class ClansAdmin
|
||||
clientClan.inform(caller.getName() + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
}
|
||||
|
||||
public void unclaim(Player caller, String args[])
|
||||
public void unclaim(Player caller, String[] args)
|
||||
{
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
@ -168,7 +168,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
private void help(Player caller)
|
||||
{
|
||||
UtilServer.getServer().getPluginManager().callEvent(new ClansCommandExecutedEvent(caller, "help", null));
|
||||
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "help");
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clans", "Commands List;"));
|
||||
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||
@ -825,10 +831,18 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
}
|
||||
|
||||
public void claim(Player caller, String args[])
|
||||
public void claim(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
|
||||
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "claim", args);
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
@ -952,7 +966,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (!Recharge.Instance.use(caller, "Territory Claim", 60000, true, false)) return;
|
||||
|
||||
// Event
|
||||
PlayerClaimTerritoryEvent event = new PlayerClaimTerritoryEvent(caller, caller.getLocation().getChunk());
|
||||
PlayerClaimTerritoryEvent claimEvent = new PlayerClaimTerritoryEvent(caller, caller.getLocation().getChunk());
|
||||
UtilServer.getServer().getPluginManager().callEvent(claimEvent);
|
||||
|
||||
if (claimEvent.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Task
|
||||
Plugin.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
||||
@ -982,7 +1002,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return (boxed >= req);
|
||||
}
|
||||
|
||||
public void unclaim(Player caller, String args[])
|
||||
public void unclaim(Player caller, String[] args)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
@ -1189,7 +1209,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
UtilServer.getServer().getPluginManager().callEvent(new ClansCommandExecutedEvent(caller, "info", search));
|
||||
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "info", search);
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true);
|
||||
if (clan == null) return;
|
||||
|
@ -12,6 +12,8 @@ public class ClansCommandExecutedEvent extends Event
|
||||
private String _command;
|
||||
private String[] _args;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
public ClansCommandExecutedEvent(Player player, String command, String... args)
|
||||
{
|
||||
_player = player;
|
||||
@ -47,6 +49,11 @@ public class ClansCommandExecutedEvent extends Event
|
||||
return _command;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
public String[] getArguments()
|
||||
{
|
||||
return _args;
|
||||
@ -61,4 +68,9 @@ public class ClansCommandExecutedEvent extends Event
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
}
|
@ -80,7 +80,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
}, 40L);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onClansShopButtonAdded(ClansShopAddButtonEvent event)
|
||||
{
|
||||
@ -202,6 +201,14 @@ public class TutorialGettingStarted extends Tutorial
|
||||
finishTask(event.getPlayer(), "Viewing Clan Info");
|
||||
}
|
||||
}
|
||||
else if (event.getCommand().equals("claim"))
|
||||
{
|
||||
if (isInTutorial(event.getPlayer()) && get(event.getPlayer()).hasFinishedTask(getTask("Go To The Wilderness")) && !get(event.getPlayer()).hasFinishedTask(getTask("Claiming Territory")))
|
||||
{
|
||||
finishTask(event.getPlayer(), "Claiming Territory");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -224,19 +231,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public boolean onClaim(final PlayerClaimTerritoryEvent event)
|
||||
{
|
||||
if (isInTutorial(event.getClaimer()) && get(event.getClaimer()).hasFinishedTask(getTask("Go To The Wilderness")) && !get(event.getClaimer()).hasFinishedTask(getTask("Claiming Territory")))
|
||||
{
|
||||
finishTask(event.getClaimer(), "Claiming Territory");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onSkillTriggered(final SkillTriggerEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user