forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo.lua
More file actions
59 lines (48 loc) · 1.89 KB
/
do.lua
File metadata and controls
59 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function HandleDoCommand(Split, Player)
if #Split < 3 then
SendMessage(Player, cChatColor.LightGray .. "Usage: " .. Split[1] .. " <player> <command> [arguments]")
return true
end
-- Get the command and arguments.
local newSplit = table.concat(Split, " ", 3)
local FoundPlayerCallback = function(a_Player)
local pluginManager = cRoot:Get():GetPluginManager()
if (pluginManager:ExecuteCommand(a_Player, newSplit)) then
LOGINFO(Player:GetName() .. " executed a sudo command.")
SendMessageSuccess(Player, cChatColor.LightGray .. "Executed the command.")
else
LOGINFO(Player:GetName() .. " failed to execute a sudo command.")
SendMessageFailure(Player, cChatColor.LightGray .. "Couldn't execute that command.")
end
return true
end
if not cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) then
SendMessageFailure(Player, cChatColor.LightGray .. "Couldn't find that player.")
return true
end
return true
end
function HandleSudoCommand ( Split, Player )
if #Split < 3 then
SendMessage(Player, cChatColor.LightGray .. "Usage: " .. Split[1] .. " <player> <command> [arguments]")
return true
end
-- Get the command and arguments.
local newSplit = table.concat( Split, " ", 3 )
local FoundPlayerCallback = function( a_Player )
local pluginManager = cRoot:Get():GetPluginManager()
if (pluginManager:ForceExecuteCommand( a_Player, newSplit )) then
LOGINFO(Player:GetName() .. " executed a sudo command.")
SendMessageSuccess(Player, cChatColor.LightGray .. "Executed the command.")
else
LOGINFO(Player:GetName() .. " failed to execute a sudo command.")
SendMessageFailure(Player, cChatColor.LightGray .. "Couldn't execute that command.")
end
return true
end
if not cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) then
SendMessageFailure(Player, cChatColor.LightGray .. "Couldn't find that player.")
return true
end
return true
end