Cuberite Forum
Invalid handler with info.lua - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Invalid handler with info.lua (/thread-1495.html)



Invalid handler with info.lua - gv1222 - 06-22-2014

I have been experimenting with the info.lua file and am now stuck at one point where it says "Invalid handler for command /ping, command will not be registered." I have added the handler for the command as "PingPlayer" and written the handler out in ping.lua. Below I added my info.lua and ping.lua files. (Note: all other commands + Handlers work). What's the issue? Thanks.
INFO.LUA
g_PluginInfo =
{
  Name = "Basics",
  Version = "0.1",
  Description = "Adds some basic commands",

  Commands =
  {
    ["/heal"] =
    {
      Permission =  "basic.heal",
      HelpString =  " Heal player to full health.",
      Handler =  HealPlayer,
    },

    ["/ping"] =
    {
      Permission =  "basic.ping",
      HelpString =  " Get a players ping to the server.",
      Handler =  PingPlayer,
    },

    ["/feed"] =
    {
      Permission =  "basic.feed",
      HelpString =  " Feed player to full hunger.",
      Handler =  FeedPlayer,
    },
  },
}

ping.lua
function PingPlayer(Split, Player)
  if Split[2] == nil then
    Player:SendMessageSuccess(Player:GetClientHandle():GetPing())
  elseif(Player:HasPermission("basics.ping.other")) then
    local Ping = function(OtherPlayer)
      if (OtherPlayer:GetName() == Split[2]) then
        Player:SendMessageSuccess("Player " .. Split[2].."ping: " .. OtherPlayer:GetClientHandle():GetPing())
        return true
      end
    end
    if (not(cRoot:Get():FindAndDoWithPlayer(Split[2], Ping))) then
      Player:SendMessageFailure("Player not found.")
    end
  end
  return true
end



RE: Invalid handler with info.lua - xoft - 06-22-2014

This should work. Are you on Linux? You need to observe filename capitalization, the server expects the Info.lua file to have uppercase I and all the other letters lowercase. This is important, because the Info.lua file needs to be loaded as the last file in the plugin.


RE: Invalid handler with info.lua - gv1222 - 06-23-2014

Capitalizing the I in Info.lua fixed it, thanks. And for the record this was on windows not linux


RE: Invalid handler with info.lua - xoft - 06-23-2014

Hmm, we may have a problem here. We expect the filesystem to preserver letter case, which just happens to be true for WinXP+, but is not always guaranteed. What if there was a filesystem that reported all the filenames in uppercase, like DOS used to?

Shall we keep assuming that the Info.lua file is properly capitalized, or shall we allow for case-insensitiveness for this particular file?


RE: Invalid handler with info.lua - worktycho - 06-23-2014

The only way I can see this being a problem is if someone what to support burning plugins to CDs, the ISO 9660 file system only supports upper-case.