From 24a7c30d62e6ea59be0baee7c037e06d69e726aa Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sun, 2 Jun 2019 10:43:36 +0300 Subject: [PATCH] fix town creation --- towny/commands.lua | 4 ++-- towny/town.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/towny/commands.lua b/towny/commands.lua index d744038..f44e74c 100644 --- a/towny/commands.lua +++ b/towny/commands.lua @@ -126,8 +126,8 @@ local function town_command (name, param) return towny.create_town(nil, name, pr2) elseif (pr1 == "invite" and not minetest.get_player_by_name(pr2)) then return invite_respond(name, (pr2:lower() == "accept" or minetest.is_yes(pr2))) - elseif pr1 == "join" and towny.get_town_by_name(pr2) and not town then - return join_town(pr2,name,false) + elseif pr1 == "join" and not town then + return join_town(towny.get_town_by_name(pr2), name, false) elseif pr1 == "show" or pr1 == "info" then if not towny.get_town_by_name(pr2) then return false, "No such town." diff --git a/towny/town.lua b/towny/town.lua index 85feb5f..e26f2bb 100644 --- a/towny/town.lua +++ b/towny/town.lua @@ -94,8 +94,8 @@ function towny.create_town(pos, player, name) return err_msg(player, "You're already in a town! Please leave your current town before founding a new one!") end - local _,__,distance = towny.regions.get_closest_town(pos) - if distance < towny.regions.distance * towny.regions.size and not towny_admin then + local tn,__,distance = towny.regions.get_closest_town(pos) + if tn and distance < towny.regions.distance * towny.regions.size and not towny_admin then return err_msg(player, "This location is too close to another town!") end