Skip to content

Commit

Permalink
Fix joining a level that does not allow guns but you still were using…
Browse files Browse the repository at this point in the history
… a gun meaning you couldn't place/delete any blocks (Thanks lavacraft), fix levels with + in their name causing /server backup to error.
  • Loading branch information
UnknownShadow200 committed Jun 9, 2016
1 parent f8f54b2 commit 27eae5f
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Blocks/Block.Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public static void SaveBlocks(IEnumerable<Blocks> givenList) {
w.WriteLine("# If someone has royally screwed up the ranks, just delete this file and let the server restart");
w.WriteLine("# Allowed ranks: " + Group.concatList(false, false, true));
w.WriteLine("# Disallow and allow can be left empty, just make sure there's 2 spaces between the colons");
w.WriteLine("# This works entirely on permission values, not names. Do not enter a rank name. Use it's permission value");
w.WriteLine("# This works entirely on permission values, not names. Do not enter a rank name. Use its permission value");
w.WriteLine("# BlockName : LowestRank : Disallow : Allow");
w.WriteLine("# lava : 60 : 80,67 : 40,41,55");
w.WriteLine("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class CmdLoginMessage : Command {

public override string name { get { return "loginmessage"; } }
public override string shortcut { get { return "loginmsg"; } }
public override string type { get { return CommandTypes.Other; } }
public override string type { get { return CommandTypes.Chat; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public CmdLoginMessage() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class CmdLogoutMessage : Command {

public override string name { get { return "logoutmessage"; } }
public override string shortcut { get { return "logoutmsg"; } }
public override string type { get { return CommandTypes.Other; } }
public override string type { get { return CommandTypes.Chat; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public CmdLogoutMessage() { }
Expand Down
2 changes: 1 addition & 1 deletion Commands/Moderation/CmdJail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override void Use(Player p, string message) {
Player.Message(p, "You freed " + who.name + " from jail");
Player.SendChatFrom(who, who.ColoredName + " %Swas &afreed %Sfrom jail", false);
}
Server.jailed.Save();
Server.jailed.Save(true);
}

public override void Help(Player p) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class CmdReview : Command
{
public override string name { get { return "review"; } }
public override string shortcut { get { return "rvw"; } }
public override string type { get { return CommandTypes.Other; } }
public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdReview() { }
Expand Down
2 changes: 1 addition & 1 deletion Commands/other/CmdMain.cs → Commands/World/CmdMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class CmdMain : Command {

public override string name { get { return "main"; } }
public override string shortcut { get { return "h"; } }
public override string type { get { return CommandTypes.Other; } }
public override string type { get { return CommandTypes.World; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override CommandPerm[] AdditionalPerms {
Expand Down
2 changes: 1 addition & 1 deletion Database/Backup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static void CopyDatabase(StreamWriter sql) {
}
}
sql.WriteLine();
using (DataTable tableRowData = Database.fillData("SELECT * FROM " + tableName))
using (DataTable tableRowData = Database.fillData("SELECT * FROM `" + tableName + "`"))
{
if (tableRowData.Rows.Count > 0)
{
Expand Down
8 changes: 4 additions & 4 deletions MCGalaxy_.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@
<Compile Include="Commands\Chat\CmdHigh5.cs" />
<Compile Include="Commands\Chat\CmdHug.cs" />
<Compile Include="Commands\Chat\CmdIgnore.cs" />
<Compile Include="Commands\Chat\CmdLoginMessage.cs" />
<Compile Include="Commands\Chat\CmdLogoutMessage.cs" />
<Compile Include="Commands\Chat\CmdMe.cs" />
<Compile Include="Commands\Chat\CmdNick.cs" />
<Compile Include="Commands\Chat\CmdOpChat.cs" />
Expand Down Expand Up @@ -303,6 +305,7 @@
<Compile Include="Commands\Moderation\CmdResetBot.cs" />
<Compile Include="Commands\Moderation\CmdRestart.cs" />
<Compile Include="Commands\Moderation\CmdRestoreSelection.cs" />
<Compile Include="Commands\Moderation\CmdReview.cs" />
<Compile Include="Commands\Moderation\CmdSetRank.cs" />
<Compile Include="Commands\Moderation\CmdShutdown.cs" />
<Compile Include="Commands\Moderation\CmdTempBan.cs" />
Expand Down Expand Up @@ -334,15 +337,11 @@
<Compile Include="Commands\other\CmdImpersonate.cs" />
<Compile Include="Commands\other\CmdInvincible.cs" />
<Compile Include="Commands\other\CmdKill.cs" />
<Compile Include="Commands\other\CmdLoginMessage.cs" />
<Compile Include="Commands\other\CmdLogoutMessage.cs" />
<Compile Include="Commands\other\CmdMain.cs" />
<Compile Include="Commands\other\CmdMove.cs" />
<Compile Include="Commands\other\CmdPass.cs" />
<Compile Include="Commands\other\CmdRepeat.cs" />
<Compile Include="Commands\other\CmdReport.cs" />
<Compile Include="Commands\other\CmdResetPass.cs" />
<Compile Include="Commands\other\CmdReview.cs" />
<Compile Include="Commands\other\CmdRide.cs" />
<Compile Include="Commands\other\CmdSend.cs" />
<Compile Include="Commands\other\CmdSendCmd.cs" />
Expand Down Expand Up @@ -378,6 +377,7 @@
<Compile Include="Commands\World\CmdImport.cs" />
<Compile Include="Commands\World\CmdLoad.cs" />
<Compile Include="Commands\World\CmdLockdown.cs" />
<Compile Include="Commands\World\CmdMain.cs" />
<Compile Include="Commands\World\CmdMap.cs" />
<Compile Include="Commands\World\CmdMuseum.cs" />
<Compile Include="Commands\World\CmdNewLvl.cs" />
Expand Down
4 changes: 3 additions & 1 deletion Network/Player.Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,10 @@ public bool SendRawMap(Level oldLevel, Level level) {

if ( OnSendMap != null )
OnSendMap(this, buffer);
if (!level.guns)
if (!level.guns && aiming) {
aiming = false;
ClearBlockchange();
}
} catch( Exception ex ) {
success = false;
PlayerActions.ChangeMap(this, Server.mainLevel.name);
Expand Down
7 changes: 2 additions & 5 deletions Player/PlayerExtList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,14 @@ public int Count { get {
return players.Count;
} }

public void Save() { Save(path, true); }

public void Save(string path, bool console) {
public void Save(bool console = false) {
using (StreamWriter w = File.CreateText(path)) {
lock (locker) {
foreach (string line in lines)
w.WriteLine(line);
}
}
if (console)
Server.s.Log("SAVED: " + path);
if (console) Server.s.Log("SAVED: " + path);
}

public static PlayerExtList Load(string path) {
Expand Down

0 comments on commit 27eae5f

Please sign in to comment.