Implement additional teleport permissions.
This adds the follows permissions to the following items: - tshock.tp.tppotion: Teleportation Potion - tshock.tp.magicconch: Magic Conch - tshock.tp.demonconch: Demon Conch
This commit is contained in:
parent
19cc3f9b4c
commit
b3cf5f4e43
3 changed files with 50 additions and 0 deletions
|
|
@ -134,6 +134,7 @@ namespace TShockAPI
|
|||
{ PacketTypes.Teleport, HandleTeleport },
|
||||
{ PacketTypes.PlayerHealOther, HandleHealOther },
|
||||
{ PacketTypes.CatchNPC, HandleCatchNpc },
|
||||
{ PacketTypes.TeleportationPotion, HandleTeleportationPotion },
|
||||
{ PacketTypes.CompleteAnglerQuest, HandleCompleteAnglerQuest },
|
||||
{ PacketTypes.NumberOfAnglerQuestsCompleted, HandleNumberOfAnglerQuestsCompleted },
|
||||
{ PacketTypes.PlaceObject, HandlePlaceObject },
|
||||
|
|
@ -3475,6 +3476,44 @@ namespace TShockAPI
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool HandleTeleportationPotion(GetDataHandlerArgs args)
|
||||
{
|
||||
var type = args.Data.ReadByte();
|
||||
|
||||
void Fail(string tpItem)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected permissions {0} {1}", args.Player.Name, type);
|
||||
args.Player.SendErrorMessage("You do not have permission to teleport using {0}.", tpItem);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0: // Teleportation Potion
|
||||
if (!args.Player.HasPermission(Permissions.tppotion))
|
||||
{
|
||||
Fail("Teleportation Potions");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 1: // Magic Conch
|
||||
if (!args.Player.HasPermission(Permissions.magicconch))
|
||||
{
|
||||
Fail("the Magic Conch");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 2: // Demon Conch
|
||||
if (!args.Player.HasPermission(Permissions.demonconch))
|
||||
{
|
||||
Fail("the Demon Conch");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool HandleCompleteAnglerQuest(GetDataHandlerArgs args)
|
||||
{
|
||||
// Since packet 76 is NEVER sent to us, we actually have to rely on this to get the true count
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue