diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 6c6c28dd..5aed7b6c 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -141,9 +141,6 @@ namespace TShockAPI [Description("This will save the world if Terraria crashes from an unhandled exception.")] public bool SaveWorldOnCrash = true; - [Description("This is kick players who have custom items in their inventory (via a mod)")] - public bool KickCustomItems = false; - [Description("This will announce a player's location on join")] public bool EnableGeoIP = false; diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 2d7cb7c7..fea1db63 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -27,11 +27,11 @@ namespace TShockAPI.DB creator.EnsureExists(table); //Add default groups - AddGroup("default", "canwater,canlava,warp,canbuild"); + AddGroup("default", "warp,canbuild"); AddGroup("newadmin", "default", "kick,editspawn,reservedslot"); AddGroup("admin", "newadmin", "ban,unban,whitelist,causeevents,spawnboss,spawnmob,managewarp,time,tp,pvpfun,kill,logs,immunetokick,tphere"); - AddGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,ignorecheatdetection,ignoregriefdetection,usebanneditem,manageusers"); - AddGroup("vip", "default", "canwater,canlava,warp,canbuild,reservedslot"); + AddGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,ignorecheatdetection,usebanneditem,manageusers"); + AddGroup("vip", "default", "reservedslot"); String file = Path.Combine(TShock.SavePath, "groups.txt"); if (File.Exists(file)) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index d0c5204c..266b702c 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -25,6 +25,7 @@ using Terraria; using TShockAPI.Net; using System.IO.Streams; +using System.Net; namespace TShockAPI { @@ -211,6 +212,28 @@ namespace TShockAPI } args.Player.Difficulty = difficulty; args.Player.ReceivedInfo = true; + + NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); + + if (TShock.Config.EnableGeoIP && TShock.Geo != null) + { + var code = TShock.Geo.TryGetCountryCode(IPAddress.Parse(args.Player.IP)); + args.Player.Country = code == null ? "N/A" : MaxMind.GeoIPCountry.GetCountryNameByCode(code); + if (code == "A1") + if (TShock.Config.KickProxyUsers) + TShock.Utils.Kick(args.Player, "Proxies are not allowed"); + Log.Info(string.Format("{0} ({1}) from '{2}' group from '{3}' joined.", args.Player.Name, args.Player.IP, args.Player.Group.Name, args.Player.Country)); + TShock.Utils.Broadcast(args.Player.Name + " has joined from the " + args.Player.Country, Color.Yellow); + } + else + { + Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", args.Player.Name, args.Player.IP, args.Player.Group.Name)); + TShock.Utils.Broadcast(args.Player.Name + " has joined", Color.Yellow); + } + + if (TShock.Config.DisplayIPToAdmins) + TShock.Utils.SendLogs(string.Format("{0} has joined. IP: {1}", args.Player.Name, args.Player.IP), Color.Blue); + return false; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 352a677e..ee52e973 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -262,7 +262,8 @@ namespace TShockAPI { try { - SendData(PacketTypes.TileSendSquare, "", size, (x - (size / 2)), (y - (size / 2))); + int num = (size - 1) / 2; + SendData(PacketTypes.TileSendSquare, "", size, (float)(x - num), (float)(y - num)); return true; } catch (Exception ex) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 5b8dd873..bfd4c737 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -715,30 +715,14 @@ namespace TShockAPI return; } - NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); - NetMessage.syncPlayers(); - - if (Config.EnableGeoIP && Geo != null) - { - var code = Geo.TryGetCountryCode(IPAddress.Parse(player.IP)); - player.Country = code == null ? "N/A" : MaxMind.GeoIPCountry.GetCountryNameByCode(code); - if (code == "A1") - if (TShock.Config.KickProxyUsers) - TShock.Utils.Kick(player, "Proxies are not allowed"); - Log.Info(string.Format("{0} ({1}) from '{2}' group from '{3}' joined.", player.Name, player.IP, player.Group.Name, player.Country)); - TShock.Utils.Broadcast(player.Name + " has joined from the " + player.Country, Color.Yellow); - } - else - { - Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", player.Name, player.IP, player.Group.Name)); - TShock.Utils.Broadcast(player.Name + " has joined", Color.Yellow); - } - TShock.Utils.ShowFileToUser(player, "motd.txt"); if (HackedHealth(player)) { TShock.Utils.HandleCheater(player, "Health/Mana cheat detected. Please use a different character."); } + + NetMessage.syncPlayers(); + if (Config.AlwaysPvP) { player.SetPvP(true); @@ -756,8 +740,6 @@ namespace TShockAPI player.Teleport((int)pos.X, (int)pos.Y); player.SendTileSquare((int)pos.X, (int)pos.Y); } - if (Config.DisplayIPToAdmins) - Utils.SendLogs(string.Format("{0} has joined. IP: {1}", player.Name, player.IP), Color.Blue); e.Handled = true; }