Remove some of the old WoM direct code, also cleanup IRC and fix an issue with it (Thanks WhatIDoHere)

This commit is contained in:
UnknownShadow200 2016-01-05 18:08:30 +11:00
parent 59c1ce39ba
commit b9eb8d09ea
10 changed files with 347 additions and 1869 deletions

View File

@ -300,7 +300,6 @@ namespace MCGalaxy.Commands
Server.adminsjoinsilent = false;
//Server.mono = false;
Server.server_owner = "Notch";
Server.WomDirect = false;
Server.flipHead = false;
@ -313,9 +312,6 @@ namespace MCGalaxy.Commands
Server.showEmptyRanks = false;
//WOM Direct
Server.WomDirect = false;
#endregion
}

View File

@ -133,10 +133,6 @@ namespace MCGalaxy.Gui
this.lsNudRoundTime = new System.Windows.Forms.NumericUpDown();
this.lsNudFloodTime = new System.Windows.Forms.NumericUpDown();
this.lsCmbControlRank = new System.Windows.Forms.ComboBox();
this.cmbGrieferStoneType = new System.Windows.Forms.ComboBox();
this.chkGrieferStoneBan = new System.Windows.Forms.CheckBox();
this.txtGrieferStone = new System.Windows.Forms.TextBox();
this.cmbGrieferStoneRank = new System.Windows.Forms.ComboBox();
this.lsNudLives = new System.Windows.Forms.NumericUpDown();
this.cmbAFKKickPerm = new System.Windows.Forms.ComboBox();
this.chkGuestLimitNotify = new System.Windows.Forms.CheckBox();
@ -179,8 +175,6 @@ namespace MCGalaxy.Gui
this.lblGlobalChatColor = new System.Windows.Forms.Label();
this.chkGlobalChat = new System.Windows.Forms.CheckBox();
this.groupBox13 = new System.Windows.Forms.GroupBox();
this.label48 = new System.Windows.Forms.Label();
this.label47 = new System.Windows.Forms.Label();
this.chkShowEmptyRanks = new System.Windows.Forms.CheckBox();
this.chkIgnoreGlobal = new System.Windows.Forms.CheckBox();
this.chkNotifyOnJoinLeave = new System.Windows.Forms.CheckBox();
@ -192,7 +186,6 @@ namespace MCGalaxy.Gui
this.chkSmile = new System.Windows.Forms.CheckBox();
this.label34 = new System.Windows.Forms.Label();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.chkGrieferStone = new System.Windows.Forms.CheckBox();
this.chkShutdown = new System.Windows.Forms.CheckBox();
this.txtShutdown = new System.Windows.Forms.TextBox();
this.hackrank_kick_time = new System.Windows.Forms.TextBox();
@ -253,10 +246,8 @@ namespace MCGalaxy.Gui
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label30 = new System.Windows.Forms.Label();
this.txechx = new System.Windows.Forms.CheckBox();
this.button3 = new System.Windows.Forms.Button();
this.editTxtsBt = new System.Windows.Forms.Button();
this.txtHost = new System.Windows.Forms.TextBox();
this.chkWomDirect = new System.Windows.Forms.CheckBox();
this.chkRestart = new System.Windows.Forms.CheckBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
@ -1507,46 +1498,6 @@ namespace MCGalaxy.Gui
this.lsCmbControlRank.TabIndex = 9;
this.toolTip.SetToolTip( this.lsCmbControlRank, "Minimum rank required to administrate Lava Survival." );
//
// cmbGrieferStoneType
//
this.cmbGrieferStoneType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbGrieferStoneType.FormattingEnabled = true;
this.cmbGrieferStoneType.Location = new System.Drawing.Point( 110, 138 );
this.cmbGrieferStoneType.Name = "cmbGrieferStoneType";
this.cmbGrieferStoneType.Size = new System.Drawing.Size( 94, 21 );
this.cmbGrieferStoneType.TabIndex = 13;
this.toolTip.SetToolTip( this.cmbGrieferStoneType, "The block type that griefer_stone will look like in-game." );
//
// chkGrieferStoneBan
//
this.chkGrieferStoneBan.Appearance = System.Windows.Forms.Appearance.Button;
this.chkGrieferStoneBan.AutoSize = true;
this.chkGrieferStoneBan.Location = new System.Drawing.Point( 210, 137 );
this.chkGrieferStoneBan.Name = "chkGrieferStoneBan";
this.chkGrieferStoneBan.Size = new System.Drawing.Size( 127, 23 );
this.chkGrieferStoneBan.TabIndex = 43;
this.chkGrieferStoneBan.Text = "Griefer_stone Tempban";
this.toolTip.SetToolTip( this.chkGrieferStoneBan, "Should griefer_stone tempban the player or just kick them?" );
this.chkGrieferStoneBan.UseVisualStyleBackColor = true;
//
// txtGrieferStone
//
this.txtGrieferStone.Location = new System.Drawing.Point( 186, 129 );
this.txtGrieferStone.Name = "txtGrieferStone";
this.txtGrieferStone.Size = new System.Drawing.Size( 134, 21 );
this.txtGrieferStone.TabIndex = 36;
this.toolTip.SetToolTip( this.txtGrieferStone, "Kick message for griefer_stone. Only works if tempban is off!" );
//
// cmbGrieferStoneRank
//
this.cmbGrieferStoneRank.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbGrieferStoneRank.FormattingEnabled = true;
this.cmbGrieferStoneRank.Location = new System.Drawing.Point( 148, 112 );
this.cmbGrieferStoneRank.Name = "cmbGrieferStoneRank";
this.cmbGrieferStoneRank.Size = new System.Drawing.Size( 87, 21 );
this.cmbGrieferStoneRank.TabIndex = 45;
this.toolTip.SetToolTip( this.cmbGrieferStoneRank, "The maximum rank that griefer_stone will kick or ban." );
//
// lsNudLives
//
this.lsNudLives.Location = new System.Drawing.Point( 71, 133 );
@ -1991,11 +1942,6 @@ namespace MCGalaxy.Gui
this.groupBox13.AutoSize = true;
this.groupBox13.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox13.Controls.Add( this.chkGuestLimitNotify );
this.groupBox13.Controls.Add( this.cmbGrieferStoneRank );
this.groupBox13.Controls.Add( this.label48 );
this.groupBox13.Controls.Add( this.chkGrieferStoneBan );
this.groupBox13.Controls.Add( this.cmbGrieferStoneType );
this.groupBox13.Controls.Add( this.label47 );
this.groupBox13.Controls.Add( this.chkShowEmptyRanks );
this.groupBox13.Controls.Add( this.chkIgnoreGlobal );
this.groupBox13.Controls.Add( this.chkNotifyOnJoinLeave );
@ -2015,24 +1961,6 @@ namespace MCGalaxy.Gui
this.groupBox13.TabStop = false;
this.groupBox13.Text = "Extra";
//
// label48
//
this.label48.AutoSize = true;
this.label48.Location = new System.Drawing.Point( 6, 115 );
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size( 140, 13 );
this.label48.TabIndex = 44;
this.label48.Text = "Griefer_stone kick/ban rank:";
//
// label47
//
this.label47.AutoSize = true;
this.label47.Location = new System.Drawing.Point( 6, 140 );
this.label47.Name = "label47";
this.label47.Size = new System.Drawing.Size( 98, 13 );
this.label47.TabIndex = 42;
this.label47.Text = "Griefer_stone type:";
//
// chkShowEmptyRanks
//
this.chkShowEmptyRanks.Appearance = System.Windows.Forms.Appearance.Button;
@ -2137,8 +2065,6 @@ namespace MCGalaxy.Gui
//
this.groupBox12.AutoSize = true;
this.groupBox12.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox12.Controls.Add( this.txtGrieferStone );
this.groupBox12.Controls.Add( this.chkGrieferStone );
this.groupBox12.Controls.Add( this.chkShutdown );
this.groupBox12.Controls.Add( this.txtShutdown );
this.groupBox12.Controls.Add( this.hackrank_kick );
@ -2155,16 +2081,6 @@ namespace MCGalaxy.Gui
this.groupBox12.TabStop = false;
this.groupBox12.Text = "Messages";
//
// chkGrieferStone
//
this.chkGrieferStone.AutoSize = true;
this.chkGrieferStone.Location = new System.Drawing.Point( 12, 132 );
this.chkGrieferStone.Name = "chkGrieferStone";
this.chkGrieferStone.Size = new System.Drawing.Size( 174, 17 );
this.chkGrieferStone.TabIndex = 35;
this.chkGrieferStone.Text = "Custom griefer_stone message:";
this.chkGrieferStone.UseVisualStyleBackColor = true;
//
// chkShutdown
//
this.chkShutdown.AutoSize = true;
@ -2755,10 +2671,8 @@ namespace MCGalaxy.Gui
this.groupBox2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox2.Controls.Add( this.label30 );
this.groupBox2.Controls.Add( this.txechx );
this.groupBox2.Controls.Add( this.button3 );
this.groupBox2.Controls.Add( this.editTxtsBt );
this.groupBox2.Controls.Add( this.txtHost );
this.groupBox2.Controls.Add( this.chkWomDirect );
this.groupBox2.Controls.Add( this.chkRestart );
this.groupBox2.Controls.Add( this.chkPublic );
this.groupBox2.Controls.Add( this.chkVerify );
@ -2791,16 +2705,6 @@ namespace MCGalaxy.Gui
this.txechx.UseVisualStyleBackColor = true;
this.txechx.CheckedChanged += new System.EventHandler( this.txechx_CheckedChanged );
//
// button3
//
this.button3.Location = new System.Drawing.Point( 10, 49 );
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size( 120, 27 );
this.button3.TabIndex = 43;
this.button3.Text = "Edit WoM Direct Options";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler( this.button3_Click );
//
// editTxtsBt
//
this.editTxtsBt.Cursor = System.Windows.Forms.Cursors.Hand;
@ -2821,18 +2725,6 @@ namespace MCGalaxy.Gui
this.txtHost.TabIndex = 2;
this.txtHost.TextChanged += new System.EventHandler( this.txtPort_TextChanged );
//
// chkWomDirect
//
this.chkWomDirect.Appearance = System.Windows.Forms.Appearance.Button;
this.chkWomDirect.AutoSize = true;
this.chkWomDirect.Location = new System.Drawing.Point( 135, 49 );
this.chkWomDirect.Name = "chkWomDirect";
this.chkWomDirect.Size = new System.Drawing.Size( 107, 23 );
this.chkWomDirect.TabIndex = 25;
this.chkWomDirect.Text = "Enable WoM Direct";
this.chkWomDirect.UseVisualStyleBackColor = true;
this.chkWomDirect.CheckedChanged += new System.EventHandler( this.chkWomDirect_CheckedChanged );
//
// chkRestart
//
this.chkRestart.Appearance = System.Windows.Forms.Appearance.Button;
@ -4911,8 +4803,6 @@ namespace MCGalaxy.Gui
private System.Windows.Forms.Label lblGlobalChatColor;
private System.Windows.Forms.TextBox txtMaxUndo;
private System.Windows.Forms.Label label52;
private System.Windows.Forms.TextBox txtGrieferStone;
private System.Windows.Forms.CheckBox chkGrieferStone;
private System.Windows.Forms.GroupBox groupBox20;
private System.Windows.Forms.Label label54;
private System.Windows.Forms.Label label53;
@ -4958,14 +4848,8 @@ namespace MCGalaxy.Gui
private System.Windows.Forms.ComboBox lsCmbControlRank;
private System.Windows.Forms.Label label68;
private System.Windows.Forms.Button lsBtnEndVote;
private System.Windows.Forms.ComboBox cmbGrieferStoneType;
private System.Windows.Forms.Label label47;
private System.Windows.Forms.CheckBox chkGrieferStoneBan;
private System.Windows.Forms.ComboBox cmbGrieferStoneRank;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.NumericUpDown numCountReset;
private System.Windows.Forms.Label label69;
private System.Windows.Forms.CheckBox chkWomDirect;
private System.Windows.Forms.NumericUpDown lsNudLives;
private System.Windows.Forms.TextBox txtSQLPort;
private System.Windows.Forms.Label label70;
@ -4987,7 +4871,6 @@ namespace MCGalaxy.Gui
private System.Windows.Forms.Label label75;
private System.Windows.Forms.Label label76;
private System.Windows.Forms.ComboBox cmbAFKKickPerm;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.CheckBox chkGuestLimitNotify;
private System.Windows.Forms.TextBox levelList;
private System.Windows.Forms.Label label78;

View File

@ -62,7 +62,6 @@ namespace MCGalaxy.Gui {
cmbIRCColour.Items.AddRange(colors);
cmbColor.Items.AddRange(colors);
cmbGlobalChatColor.Items.AddRange(colors);
button3.Enabled = Server.WomDirect;
grpIRC.BackColor = Server.irc ? Color.White : Color.LightGray;
grpSQL.BackColor = Server.useMySQL ? Color.White : Color.LightGray;
@ -85,7 +84,6 @@ namespace MCGalaxy.Gui {
cmbVerificationRank.Items.Add(grp.name);
lsCmbSetupRank.Items.Add(grp.name);
lsCmbControlRank.Items.Add(grp.name);
cmbGrieferStoneRank.Items.Add(grp.name);
cmbAFKKickPerm.Items.Add(grp.name);
cmbViewQueue.Items.Add(grp.name);
cmbEnterQueue.Items.Add(grp.name);
@ -125,7 +123,6 @@ namespace MCGalaxy.Gui {
cmbOpChat.SelectedIndex = ( opchatperm != String.Empty ? cmbOpChat.Items.IndexOf(opchatperm) : 1 );
cmbAdminChat.SelectedIndex = ( adminchatperm != String.Empty ? cmbAdminChat.Items.IndexOf(adminchatperm) : 1 );
cmbVerificationRank.SelectedIndex = ( verifyadminsperm != String.Empty ? cmbVerificationRank.Items.IndexOf(verifyadminsperm) : 1 );
cmbGrieferStoneRank.SelectedIndex = ( grieferstonerank != String.Empty ? cmbGrieferStoneRank.Items.IndexOf(grieferstonerank) : 1 );
cmbAFKKickPerm.SelectedIndex = ( afkkickrank != String.Empty ? cmbAFKKickPerm.Items.IndexOf(afkkickrank) : 1 );
cmbEnterQueue.SelectedIndex = ( enterqueuerank != String.Empty ? cmbEnterQueue.Items.IndexOf(enterqueuerank) : 1 );
cmbLeaveQueue.SelectedIndex = ( leavequeuerank != String.Empty ? cmbLeaveQueue.Items.IndexOf(leavequeuerank) : 1 );
@ -133,9 +130,6 @@ namespace MCGalaxy.Gui {
cmbClearQueue.SelectedIndex = ( clearqueuerank != String.Empty ? cmbClearQueue.Items.IndexOf(clearqueuerank) : 1 );
cmbGotoNext.SelectedIndex = ( gotonextrank != String.Empty ? cmbGotoNext.Items.IndexOf(gotonextrank) : 1 );
for ( byte b = 1; b < 50; b++ )
cmbGrieferStoneType.Items.Add(Block.Name(b));
//Load server stuff
LoadProp("properties/server.properties");
LoadRanks();
@ -458,14 +452,6 @@ namespace MCGalaxy.Gui {
txtShutdown.Text = value;
break;
case "custom-griefer-stone":
chkGrieferStone.Checked = ( value.ToLower() == "true" );
break;
case "custom-griefer-stone-message":
txtGrieferStone.Text = value;
break;
case "auto-restart":
chkRestartTime.Checked = ( value.ToLower() == "true" );
break;
@ -646,21 +632,6 @@ namespace MCGalaxy.Gui {
color = c.Name(value); if ( color != "" ) color = value; else { Server.s.Log("Could not find " + value); return; }
}
cmbGlobalChatColor.SelectedIndex = cmbGlobalChatColor.Items.IndexOf(c.Name(color)); break;
case "griefer-stone-tempban":
chkGrieferStoneBan.Checked = value.ToLower() == "true";
break;
case "griefer-stone-type":
try { cmbGrieferStoneType.SelectedIndex = cmbGrieferStoneType.Items.IndexOf(value); }
catch {
try { cmbGrieferStoneType.SelectedIndex = cmbGrieferStoneType.Items.IndexOf(Block.Name(Convert.ToByte(value))); }
catch { Server.s.Log("Could not find " + value); }
}
break;
case "wom-direct":
chkWomDirect.Checked = value.ToLower() == "true";
break;
case "premium-only":
chkPrmOnly.Checked = value.ToLower() == "true";
break;
@ -813,8 +784,6 @@ namespace MCGalaxy.Gui {
Server.customBanMessage = txtBanMessage.Text;
Server.customShutdown = chkShutdown.Checked;
Server.customShutdownMessage = txtShutdown.Text;
Server.customGrieferStone = chkGrieferStone.Checked;
Server.customGrieferStoneMessage = txtGrieferStone.Text;
Server.higherranktp = chkTpToHigherRanks.Checked;
Server.globalignoreops = chkIgnoreGlobal.Checked; // Wasn't in previous setting-saver
@ -844,10 +813,6 @@ namespace MCGalaxy.Gui {
Server.UseGlobalChat = chkGlobalChat.Checked;
Server.GlobalChatColor = cmbGlobalChatColor.SelectedItem.ToString();
Server.WomDirect = chkWomDirect.Checked;
//Server.Server_ALT = ;
//Server.Server_Disc = ;
//Server.Server_Flag = ;
Server.PremiumPlayersOnly = chkPrmOnly.Checked;
Server.reviewview = Group.GroupList.Find(grp => grp.name == cmbViewQueue.SelectedItem.ToString()).Permission;
@ -1677,14 +1642,6 @@ txtBackupLocation.Text = folderDialog.SelectedPath;
}
private void button3_Click(object sender, EventArgs e) {
new GUI.WoM().Show();
}
private void chkWomDirect_CheckedChanged(object sender, EventArgs e) {
button3.Enabled = chkWomDirect.Checked;
}
private void forceUpdateBtn_Click(object sender, EventArgs e) {
forceUpdateBtn.Enabled = false;
if ( MessageBox.Show("Would you like to force update MCGalaxy now?", "Force Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK ) {

135
GUI/WoM.Designer.cs generated
View File

@ -1,135 +0,0 @@
namespace MCGalaxy.GUI
{
partial class WoM
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WoM));
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(69, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Server Name";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 45);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 1;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(31, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Description";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(12, 94);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 3;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(12, 135);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 20);
this.textBox3.TabIndex = 4;
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(46, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(27, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Flag";
//
// button1
//
this.button1.Location = new System.Drawing.Point(25, 165);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 6;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// WoM
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(130, 200);
this.Controls.Add(this.button1);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "WoM";
this.Text = "WoM Direct";
this.Load += new System.EventHandler(this.WoM_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
}
}

View File

@ -1,59 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MCGalaxy.GUI
{
public partial class WoM : Form
{
public WoM()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
if (textBox3.Text.ToCharArray().Length > 15)
{
MessageBox.Show("Only 15 characters allowed!", "Warning");
return;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (WOMBeat.SetSettings(Server.IP, "" + Server.port, textBox1.Text, textBox2.Text, textBox3.Text))
{
MessageBox.Show("Your settings have been saved!", "Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
Server.Server_ALT = textBox1.Text;
Server.Server_Disc = textBox2.Text;
Server.Server_Flag = textBox3.Text;
this.Close();
}
else
MessageBox.Show("There was an error, check the error log for more details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void WoM_Load(object sender, EventArgs e)
{
textBox1.Text = Server.Server_ALT;
textBox2.Text = Server.Server_Disc;
textBox3.Text = Server.Server_Flag;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -35,13 +35,9 @@ namespace MCGalaxy {
private bool reset = false;
private byte retries = 0;
public string usedCmd = "";
Dictionary<string, List<string>> users = new Dictionary<string, List<string>>();
public ForgeBot(string channel, string opchannel, string nick, string server) {
/*if (!File.Exists("Sharkbite.Thresher.dll"))
{
Server.irc = false;
Server.s.Log("[IRC] The IRC dll was not found!");
return;
}*/
this.channel = channel.Trim(); this.opchannel = opchannel.Trim(); this.nick = nick.Replace(" ", ""); this.server = server;
banCmd = new List<string>();
banCmd.Add("resetbot");
@ -68,10 +64,13 @@ namespace MCGalaxy {
connection.Listener.OnJoin += new JoinEventHandler(Listener_OnJoin);
connection.Listener.OnPart += new PartEventHandler(Listener_OnPart);
connection.Listener.OnDisconnected += new DisconnectedEventHandler(Listener_OnDisconnected);
connection.Listener.OnChannelModeChange += new ChannelModeChangeEventHandler(Listener_OnChannelModeChange);
connection.Listener.OnNames += new NamesEventHandler(Listener_OnNames);
connection.Listener.OnKick += new KickEventHandler(Listener_OnKick);
connection.Listener.OnKill += new KillEventHandler(Listener_OnKill);
// Load banned commands list
if (File.Exists("text/ircbancmd.txt")) // Backwards compatibility
{
if (File.Exists("text/ircbancmd.txt")) { // Backwards compatibility
using (StreamWriter sw = File.CreateText("text/irccmdblacklist.txt")) {
sw.WriteLine("#Here you can put commands that cannot be used from the IRC bot.");
sw.WriteLine("#Lines starting with \"#\" are ignored.");
@ -79,8 +78,7 @@ namespace MCGalaxy {
sw.WriteLine(line);
}
File.Delete("text/ircbancmd.txt");
}
else {
} else {
if (!File.Exists("text/irccmdblacklist.txt"))
File.WriteAllLines("text/irccmdblacklist.txt", new String[] { "#Here you can put commands that cannot be used from the IRC bot.", "#Lines starting with \"#\" are ignored." });
foreach (string line in File.ReadAllLines("text/irccmdblacklist.txt"))
@ -88,6 +86,7 @@ namespace MCGalaxy {
}
}
}
public void Say(string message, bool opchat = false, bool color = true) {
if (!Server.irc || !IsConnected()) return;
@ -100,10 +99,12 @@ namespace MCGalaxy {
connection.Sender.PublicMessage(opchat ? opchannel : channel, message);
}
public void Pm(string user, string message) {
if (Server.irc && IsConnected())
connection.Sender.PrivateMessage(user, message);
}
public void Reset() {
if (!Server.irc) return;
reset = true;
@ -111,10 +112,15 @@ namespace MCGalaxy {
Disconnect("IRC Bot resetting...");
Connect();
}
void Listener_OnJoin(UserInfo user, string channel) {
connection.Sender.Names(channel);
doJoinLeaveMessage(user.Nick, "joined", channel);
}
void Listener_OnPart(UserInfo user, string channel, string reason) {
List<string> chanNicks = GetNicks(channel);
RemoveNick(user.Nick, chanNicks);
if (user.Nick == nick) return;
doJoinLeaveMessage(user.Nick, "left", channel);
}
@ -123,6 +129,7 @@ namespace MCGalaxy {
Server.s.Log(String.Format("{0} has {1} channel {2}", who, verb, channel));
Player.GlobalMessage(String.Format("%I[IRC] {0} has {1} the{2} channel", who, verb, (channel.ToLower() == opchannel.ToLower() ? " operator" : "")));
}
void Player_PlayerDisconnect(Player p, string reason) {
if (Server.irc && IsConnected())
if (Server.guestLeaveNotify == false && p.group.Permission <= LevelPermission.Guest) {
@ -140,6 +147,8 @@ namespace MCGalaxy {
}
void Listener_OnQuit(UserInfo user, string reason) {
List<string> chanNicks = GetNicks(channel);
RemoveNick(user.Nick, chanNicks);
if (user.Nick == nick) return;
Server.s.Log(user.Nick + " has left IRC");
Player.GlobalMessage("%I" + user.Nick + Server.DefaultColor + " has left IRC");
@ -181,6 +190,19 @@ namespace MCGalaxy {
if (ircCommand == ".x") {
if (Server.ircControllers.Contains(user.Nick))
{
List<string> chanNicks;
if (!users.TryGetValue(channel, out chanNicks))
return;
int index = GetNickIndex(user.Nick, chanNicks);
if (index < 0) {
Server.IRC.Say("You are not on the bot's list of " +
"users for some reason, please leave and rejoin."); return;
}
string prefix = GetPrefix(chanNicks[index]);
if (prefix == "" || prefix == "+") {
Server.IRC.Say("You must be at least a half-op on the channel to use commands from IRC."); return;
}
string cmdName = parts.Length >= 2 ? parts[1] : "";
if (banCmd.Contains(cmdName)) {
Server.IRC.Say("You are not allowed to use this command from IRC."); return;
@ -249,6 +271,17 @@ namespace MCGalaxy {
return;
}
foreach (var kvp in users) {
int index = GetNickIndex(user.Nick, kvp.Value);
if (index >= 0) {
string prefix = GetPrefix(kvp.Value[index]);
kvp.Value[index] = prefix + newNick;
} else {
// should never happen, but just in case.
connection.Sender.Names(kvp.Key);
}
}
string key;
if (newNick.Split('|').Length == 2) {
key = newNick.Split('|')[1];
@ -268,15 +301,13 @@ namespace MCGalaxy {
else
Player.GlobalMessage("[IRC] %I" + user.Nick + Server.DefaultColor + " is now known as " + newNick);
}
void Player_PlayerChat(Player p, string message) {
if (String.IsNullOrEmpty(message.Trim())) {
Player.SendMessage(p, "You cannot send that message");
return;
}
if (Server.ircColorsEnable && Server.irc && IsConnected())
Say(p.color + p.prefix + p.DisplayName + "%r: " + message, p.opchat);
if (Server.ircColorsEnable == false && Server.irc && IsConnected())
@ -284,6 +315,7 @@ namespace MCGalaxy {
Say(p.DisplayName + ": " + message, p.opchat);
}
}
public void Connect() {
if (!Server.irc || Server.shuttingDown) return;
@ -305,13 +337,90 @@ namespace MCGalaxy {
Server.ErrorLog(e);
}
}
public void Disconnect(string reason) {
if (IsConnected()) { connection.Disconnect(reason); Server.s.Log("Disconnected from IRC!"); }
if (IsConnected()) {
connection.Disconnect(reason);
Server.s.Log("Disconnected from IRC!");
users.Clear();
}
}
public bool IsConnected() {
if (!Server.irc) return false;
try { return connection.Connected; }
catch { return false; }
}
void Listener_OnNames(string channel, string[] nicks, bool last) {
List<string> chanNicks = GetNicks(channel);
foreach (string n in nicks)
UpdateNick(n, chanNicks);
}
void Listener_OnChannelModeChange(UserInfo who, string channel, ChannelModeInfo[] modes) {
connection.Sender.Names(channel);
}
void Listener_OnKick(UserInfo user, string channel, string kickee, string reason) {
List<string> chanNicks = GetNicks(channel);
RemoveNick(user.Nick, chanNicks);
}
void Listener_OnKill(UserInfo user, string nick, string reason) {
foreach (var kvp in users)
RemoveNick(user.Nick, kvp.Value);
}
List<string> GetNicks(string channel) {
List<string> chanNicks;
if (!users.TryGetValue(channel, out chanNicks)) {
chanNicks = new List<string>();
users[channel] = chanNicks;
}
return chanNicks;
}
void UpdateNick(string n, List<string> chanNicks) {
string unprefixNick = Unprefix(n);
for (int i = 0; i < chanNicks.Count; i++ ) {
if (unprefixNick == Unprefix(chanNicks[i])) {
chanNicks[i] = n; return;
}
}
chanNicks.Add(n);
}
void RemoveNick(string n, List<string> chanNicks) {
int index = GetNickIndex(n, chanNicks);
if (index >= 0) chanNicks.RemoveAt(index);
}
int GetNickIndex(string n, List<string> chanNicks) {
string unprefixNick = Unprefix(n);
for (int i = 0; i < chanNicks.Count; i++ ) {
if (unprefixNick == Unprefix(chanNicks[i]))
return i;
}
return -1;
}
string Unprefix(string nick) {
if (nick.Length == 0 || IsNickChar(nick[0]))
return nick;
return nick.Substring(1);
}
string GetPrefix(string nick) {
if (nick.Length == 0 || IsNickChar(nick[0]))
return "";
return nick.Substring(0, 1);
}
bool IsNickChar(char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
c == '[' || c == ']' || c == '{' || c == '}' || c == '^' || c == '`' || c == '_' || c == '|';
}
}
}

View File

@ -501,12 +501,6 @@
<Compile Include="GUI\Win32\Margins.cs" />
<Compile Include="GUI\Win32\Natives.cs" />
<Compile Include="GUI\Win32\RECT.cs" />
<Compile Include="GUI\WoM.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\WoM.Designer.cs">
<DependentUpon>WoM.cs</DependentUpon>
</Compile>
<Compile Include="Levels\Texture_Settings.cs" />
<Compile Include="Database\DatabaseTransactionHelper.cs" />
<Compile Include="Database\Database.cs" />
@ -522,7 +516,6 @@
<Compile Include="GUI\EditText.Designer.cs">
<DependentUpon>EditText.cs</DependentUpon>
</Compile>
<Compile Include="Network\WOMBeat.cs" />
<Compile Include="Games\LavaSurvival.cs" />
<Compile Include="Levels\BlockQueue.cs" />
<Compile Include="Database\MySQLTransactionHelper.cs" />
@ -611,9 +604,6 @@
<DependentUpon>Window.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GUI\WoM.resx">
<DependentUpon>WoM.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="SharkBite.Thresher\ChannelModeInfo.cs" />
<Compile Include="SharkBite.Thresher\CommandBuilder.cs" />
<Compile Include="SharkBite.Thresher\Connection.cs" />

View File

@ -1,112 +0,0 @@
/*
Copyright 2011 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.IO;
using System.Net;
using System.Text;
namespace MCGalaxy
{
internal sealed class WOMBeat : IBeat
{
public string URL
{
get
{
return "http://direct.worldofminecraft.com/hb.php";
}
}
public bool Persistance
{
get
{
return true;
}
}
public static bool SetSettings(string IP, string Port, string Name, string Disc, string flags)
{
string url = "http://direct.worldofminecraft.com/server.php";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
string flag = "&flags=%5B" + flags + "%5D";
if (flags.StartsWith("["))
flag = "&flags=" + flags;
string Parameters = "ip=" + IP + "&port=" + Port + "&salt=" + Server.salt + "&alt=" + Name.Replace(' ', '+') + "&desc=" + Disc.Replace(' ', '+') + "&noforward=1" + flag;
int totalTries = 0;
int totalTriesStream = 0;
try
{
totalTries++;
totalTriesStream = 0;
// Set all the request settings
//Server.s.Log(beat.Parameters);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
byte[] formData = Encoding.ASCII.GetBytes(Parameters);
request.ContentLength = formData.Length;
request.Timeout = 15000; // 15 seconds
try
{
totalTriesStream++;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(formData, 0, formData.Length);
requestStream.Flush();
requestStream.Close();
requestStream.Dispose();
}
return true;
}
catch (Exception e)
{
Server.ErrorLog(e);
return false;
}
}
catch (Exception e)
{
Server.ErrorLog(e);
return false;
}
}
public string Prepare()
{
return "&port=" + Server.port +
"&max=" + Server.players +
"&name=" + Heart.EncodeUrl(Server.name) +
"&public=" + Server.pub +
"&version=" + Server.version +
"&salt=" + Server.salt +
"&users=" + Player.number +
"&alt=" + Server.Server_ALT +
"&desc=" + Server.Server_Disc +
"&flags=" + Server.Server_Flag;
}
public void OnResponse(string line)
{
}
}
}

View File

@ -349,7 +349,6 @@ namespace MCGalaxy
public static bool adminsjoinsilent = false;
public static bool mono { get { return (Type.GetType("Mono.Runtime") != null); } }
public static string server_owner = "Notch";
public static bool WomDirect = false;
public static bool UseSeasons = false;
public static bool guestLimitNotify = false;
public static bool guestJoinNotify = true;