Skip to content

Commit

Permalink
增加权限判断
Browse files Browse the repository at this point in the history
  • Loading branch information
hufang360 committed Mar 7, 2023
1 parent 079ac0d commit 8e4cf27
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Pylon/Pylon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public class Pylon : TerrariaPlugin

public Pylon(Main game) : base(game)
{
Commands.ChatCommands.Add(new Command("pylon", PYCommand, "pylon", "py", "晶塔") { HelpText = "指令晶塔" });
Commands.ChatCommands.Add(new Command("pylon", Manage, "pylon", "py", "晶塔") { HelpText = "指令晶塔" });
}

public override void Initialize()
{
}

void PYCommand(CommandArgs args)
void Manage(CommandArgs args)
{
TSPlayer op = args.Player;

Expand Down Expand Up @@ -148,6 +148,11 @@ bool NearHasPylon(TSPlayer op)

void Place(CommandArgs args)
{
if (!args.Player.HasPermission("pylon.place"))
{
args.Player.SendErrorMessage("你没有放置晶塔的权限!");
return;
}
args.Parameters.RemoveAt(0);
if (args.Parameters.Count == 0)
{
Expand Down

0 comments on commit 8e4cf27

Please sign in to comment.