Using https://github.com/cuberite/cuberite/issues/1441 as a reference, but it seems the "hack" broke (or I just programmed it wrong), and I just learned Lua today so I have no idea where to go from here.
This isn't the actual plugin, but this is a quick test one I made to see if Bungeecord Teleporting works (yes I realize I could just use /server or the slash server bungee plugin to do this exact thing, this is just a proof of concept plugin that you can do Bungee TP using Plugin Messages through Cuberite).
If you notice, I have two Plugin Message lines. The first (currently commented) spits out this error:
The second (currently in used) spits this error.
I'm really hoping this is just me screwing up the code. If it isn't, it's probably something that only VERY few people can explain.
Edit: Just attempted converting everything to Byte (including the Connect), and it's the same error with a new line number.
function Initialize(Plugin) Plugin:SetName("NewPlugin") Plugin:SetVersion(1) -- Hooks PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that -- Command Bindings cPluginManager.BindCommand("/serverchange", "test.node", ServerChange, " - Description of command") LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) return true end function ServerChange(a_Script,a_Player) local server = "TestServer1"; local StringLen = server:len(); local bytearray = "" for i = 1, StringLen do bytearray = bytearray .. "\\"; local nextbyte = string.byte(server,i) local nextstring = tostring(nextbyte); bytearray = bytearray .. nextstring; end -- cClientHandle:SendPluginMessage("BungeeCord", "\0\7Connect\0\14" .. bytearray); cClientHandle:SendPluginMessage("BungeeCord", "\0\7Connect\0\14TestServer1"); end function OnDisable() LOG(PLUGIN:GetName() .. " is shutting down...") end
This isn't the actual plugin, but this is a quick test one I made to see if Bungeecord Teleporting works (yes I realize I could just use /server or the slash server bungee plugin to do this exact thing, this is just a proof of concept plugin that you can do Bungee TP using Plugin Messages through Cuberite).
If you notice, I have two Plugin Message lines. The first (currently commented) spits out this error:
Code:
[22:03:45] LUA: Plugins/BungeeTest/Main.lua:29: error in function 'SendPluginMessage'.
argument #1 is 'class cClientHandle'; 'cClientHandle' expected.
[22:03:45] Stack trace:
[22:03:45] [C](-1): SendPluginMessage
[22:03:45] Plugins/BungeeTest/Main.lua(29): (no name)
[22:03:45] Stack trace end
[22:03:45] Error in plugin BungeeTest calling function <callback>()
The Exact same thing but one line later:
I'm really hoping this is just me screwing up the code. If it isn't, it's probably something that only VERY few people can explain.
Edit: Just attempted converting everything to Byte (including the Connect), and it's the same error with a new line number.