Merge remote-tracking branch 'upstream/master'
Conflicts: TShockAPI/Commands.cs TShockAPI/TShock.cs
This commit is contained in:
commit
070f5a7801
2 changed files with 45 additions and 10 deletions
39
TShockAPI/Commands.cs
Normal file → Executable file
39
TShockAPI/Commands.cs
Normal file → Executable file
|
|
@ -80,7 +80,7 @@ namespace TShockAPI
|
||||||
commands.Add(new Command("ban", "ban", Ban));
|
commands.Add(new Command("ban", "ban", Ban));
|
||||||
commands.Add(new Command("off", "maintenance", Off));
|
commands.Add(new Command("off", "maintenance", Off));
|
||||||
commands.Add(new Command("reload", "cfg", Reload));
|
commands.Add(new Command("reload", "cfg", Reload));
|
||||||
commands.Add(new Command("dropmetor", "causeevents", DropMeteor));
|
commands.Add(new Command("dropmeteor", "causeevents", DropMeteor));
|
||||||
commands.Add(new Command("star", "causeevents", Star));
|
commands.Add(new Command("star", "causeevents", Star));
|
||||||
commands.Add(new Command("bloodmoon", "causeevents", Bloodmoon));
|
commands.Add(new Command("bloodmoon", "causeevents", Bloodmoon));
|
||||||
commands.Add(new Command("eater", "spawnboss", Eater));
|
commands.Add(new Command("eater", "spawnboss", Eater));
|
||||||
|
|
@ -90,6 +90,7 @@ namespace TShockAPI
|
||||||
commands.Add(new Command("invade", "causeevents", Invade));
|
commands.Add(new Command("invade", "causeevents", Invade));
|
||||||
commands.Add(new Command("password", "cfg", Password));
|
commands.Add(new Command("password", "cfg", Password));
|
||||||
commands.Add(new Command("save", "cfg", Save));
|
commands.Add(new Command("save", "cfg", Save));
|
||||||
|
commands.Add(new Command("home", "tp", Home));
|
||||||
commands.Add(new Command("spawn", "tp", Spawn));
|
commands.Add(new Command("spawn", "tp", Spawn));
|
||||||
commands.Add(new Command("tp", "tp", TP));
|
commands.Add(new Command("tp", "tp", TP));
|
||||||
commands.Add(new Command("tphere", "tp", TPHere));
|
commands.Add(new Command("tphere", "tp", TPHere));
|
||||||
|
|
@ -377,12 +378,21 @@ namespace TShockAPI
|
||||||
Tools.SendMessage(ply, "World saved.");
|
Tools.SendMessage(ply, "World saved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Home(CommandArgs args)
|
||||||
|
{
|
||||||
|
int ply = args.PlayerID;
|
||||||
|
TShock.Teleport(ply, Main.player[args.PlayerID].SpawnX * 16 + 8 - Main.player[ply].width / 2,
|
||||||
|
Main.player[args.PlayerID].SpawnY * 16 - Main.player[ply].height);
|
||||||
|
Tools.SendMessage(ply, "Teleported to your spawnpoint.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Spawn(CommandArgs args)
|
public static void Spawn(CommandArgs args)
|
||||||
{
|
{
|
||||||
int ply = args.PlayerID;
|
int ply = args.PlayerID;
|
||||||
TShock.Teleport(ply, Main.spawnTileX*16 + 8 - Main.player[ply].width/2,
|
TShock.Teleport(ply, Main.spawnTileX*16 + 8 - Main.player[ply].width/2,
|
||||||
Main.spawnTileY*16 - Main.player[ply].height);
|
Main.spawnTileY*16 - Main.player[ply].height);
|
||||||
Tools.SendMessage(ply, "Teleported to your spawnpoint.");
|
Tools.SendMessage(ply, "Teleported to the map's spawnpoint.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AuthToken(CommandArgs args)
|
public static void AuthToken(CommandArgs args)
|
||||||
|
|
@ -683,13 +693,34 @@ namespace TShockAPI
|
||||||
NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
||||||
NetMessage.syncPlayers();
|
NetMessage.syncPlayers();
|
||||||
Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to night.");
|
Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to night.");
|
||||||
|
} else if (arg[1] == "dusk")
|
||||||
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
|
Main.time = 0.0;
|
||||||
|
NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
||||||
|
NetMessage.syncPlayers();
|
||||||
|
Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to dusk.");
|
||||||
|
} else if (arg[1] == "noon")
|
||||||
|
{
|
||||||
|
Main.dayTime = true;
|
||||||
|
Main.time = 27000.0;
|
||||||
|
NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
||||||
|
NetMessage.syncPlayers();
|
||||||
|
Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to noon.");
|
||||||
|
} else if (arg[1] == "midnight")
|
||||||
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
|
Main.time = 16200.0;
|
||||||
|
NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
||||||
|
NetMessage.syncPlayers();
|
||||||
|
Tools.Broadcast(Tools.FindPlayer(args.PlayerID) + " set time to midnight.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time <day/night>",
|
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time <day/night/dusk/noon/midnight>",
|
||||||
new[] {255f, 0f, 0f});
|
new[] {255f, 0f, 0f});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time <day/night>",
|
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /time <day/night/dusk/noon/midnight>",
|
||||||
new[] {255f, 0f, 0f});
|
new[] {255f, 0f, 0f});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
16
TShockAPI/TShock.cs
Normal file → Executable file
16
TShockAPI/TShock.cs
Normal file → Executable file
|
|
@ -15,7 +15,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static string saveDir = "./tshock/";
|
public static string saveDir = "./tshock/";
|
||||||
|
|
||||||
public static Version VersionNum = new Version(1, 9, 0, 0);
|
public static Version VersionNum = new Version(1, 9, 0, 1);
|
||||||
|
|
||||||
public static string VersionCodename = "SPACEEE";
|
public static string VersionCodename = "SPACEEE";
|
||||||
|
|
||||||
|
|
@ -201,6 +201,15 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (e.MsgID == 4)
|
if (e.MsgID == 4)
|
||||||
{
|
{
|
||||||
|
var ban = Bans.GetBanByName(Main.player[e.Msg.whoAmI].name);
|
||||||
|
if (ban != null)
|
||||||
|
{
|
||||||
|
Tools.Kick(e.Msg.whoAmI, "You are banned: " + ban.Reason);
|
||||||
|
}
|
||||||
|
if (Main.player[e.Msg.whoAmI].name.Length > 32)
|
||||||
|
{
|
||||||
|
Tools.Kick(e.Msg.whoAmI, "Name exceeded 32 characters.");
|
||||||
|
}
|
||||||
if (players[e.Msg.whoAmI] == null)
|
if (players[e.Msg.whoAmI] == null)
|
||||||
{
|
{
|
||||||
Tools.ForceKick(e.Msg.whoAmI, "Player doesn't exist");
|
Tools.ForceKick(e.Msg.whoAmI, "Player doesn't exist");
|
||||||
|
|
@ -549,11 +558,6 @@ namespace TShockAPI
|
||||||
Tools.ForceKick(ply, "You are banned: " + ban.Reason);
|
Tools.ForceKick(ply, "You are banned: " + ban.Reason);
|
||||||
handler.Handled = true;
|
handler.Handled = true;
|
||||||
}
|
}
|
||||||
else if (Tools.FindPlayer(ply).Length > 32)
|
|
||||||
{
|
|
||||||
Tools.ForceKick(ply, "Your name was too long.");
|
|
||||||
handler.Handled = true;
|
|
||||||
}
|
|
||||||
else if (!FileTools.OnWhitelist(ip))
|
else if (!FileTools.OnWhitelist(ip))
|
||||||
{
|
{
|
||||||
Tools.ForceKick(ply, "Not on whitelist.");
|
Tools.ForceKick(ply, "Not on whitelist.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue