disable certain clans commands whilst in tutorial
This commit is contained in:
parent
a8bd0e4406
commit
a30a591b58
@ -633,7 +633,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
if (event.getLeaveMessage() != null)
|
||||
{
|
||||
event.setLeaveMessage(null);
|
||||
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
|
||||
UtilServer.broadcast(F.sys("Leave", event.getPlayer().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,9 +61,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
ClansCommandPreExecutedEvent event = new ClansCommandPreExecutedEvent(caller, args);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
|
||||
return;
|
||||
|
||||
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h"))
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -26,6 +27,7 @@ import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.message.ClansMessageManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorial.Tutorial;
|
||||
@ -76,17 +78,6 @@ public class ClansMainTutorial extends Tutorial
|
||||
getMessage().removePlayer(player);
|
||||
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(player), new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
if (data.booleanValue())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your Clan has been deleted."));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -263,6 +254,43 @@ public class ClansMainTutorial extends Tutorial
|
||||
locations.stream().map(Location::getBlock).forEach(this::destroyFence);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void teleport(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if (event.getArguments().length < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInTutorial(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getArguments()[0].equalsIgnoreCase("join")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("leave")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("map")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("stuck")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("promote")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("demote")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("invite")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("kick")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("neutral")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("enemy")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("ally")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("trust")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("unclaim")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("delete")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("disband")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("admin")
|
||||
|| event.getArguments()[0].equalsIgnoreCase("x"))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to run this command during the Tutorial."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void checkInRegion(UpdateEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user