Advertisement
Spectrewiz

Backup of some of my PluginMain.cs, no longer using this atm

Feb 12th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.03 KB | None | 0 0
  1. //Here are the chat commands
  2.             Commands.ChatCommands.Add(new Command("TicketClear", TicMonth, "TicMonth", "Ticmonth", "ticmonth", "ticMonth"));
  3.             Commands.ChatCommands.Add(new Command("TicketClear", TicDay, "TicDay", "Ticday", "ticday", "ticDay"));
  4.             Commands.ChatCommands.Add(new Command("TicketClear", TicYear, "TicYear", "Ticyear", "ticyear", "ticYear"));
  5.  
  6. //Here is some of the Switch Case
  7.                     case "day": //I need to figure this out soon
  8.                         args.Player.SendMessage("Coming Soon!", Color.Gold);
  9.                         Console.ForegroundColor = ConsoleColor.Yellow;
  10.                         Console.WriteLine(string.Format("{0} tried to access the command: ticketclear day, but it can't be accessed because it isn't part of the plugin yet. It is coming soon.", args.Player.Name));
  11.                         Console.ResetColor();
  12.                         break;
  13.                     default:
  14.                         args.Player.SendMessage("Syntax: all or day.", Color.Red);
  15.                         break;
  16.  
  17.  
  18.  
  19.         public static void TicMonth(CommandArgs args)
  20.         {
  21.             if (args.Parameters.Count == 1)
  22.             {
  23.                 if (i == 1)
  24.                 {
  25.                     string mm = args.Parameters[0];
  26.                     StreamWriter tw = new StreamWriter("TempClear.txt", true);
  27.                     tw.WriteLine(mm);
  28.                     tw.Close();
  29.                     args.Player.SendMessage("You have set the Month!");
  30.                     args.Player.SendMessage("Selecting a day: use /ticday <dd>");
  31.                     i++;
  32.                 }
  33.                 else
  34.                 {
  35.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  36.                 }
  37.             }
  38.             else if (args.Parameters.Count > 1)
  39.             {
  40.                 if (i == 1)
  41.                 {
  42.                     args.Player.SendMessage("You can't input more than one option!", Color.Red);
  43.                 }
  44.                 else
  45.                 {
  46.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  47.                 }
  48.             }
  49.             else if (args.Parameters.Count < 1)
  50.             {
  51.                 if (i == 1)
  52.                 {
  53.                     args.Player.SendMessage("Syntax: /ticmonth <mm>", Color.Red);
  54.                 }
  55.                 else
  56.                 {
  57.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  58.                 }
  59.             }
  60.         }
  61.         public static void TicDay(CommandArgs args)
  62.         {
  63.             if (args.Parameters.Count == 1)
  64.             {
  65.                 if (i == 2)
  66.                 {
  67.                     string dd = args.Parameters[0];
  68.                     StreamWriter tw = new StreamWriter("TempClear.txt", true);
  69.                     tw.WriteLine(dd);
  70.                     tw.Close();
  71.                     args.Player.SendMessage("You have set the day!");
  72.                     args.Player.SendMessage("Selecting a year: use /ticyear <yyyy>");
  73.                     i++;
  74.                 }
  75.                 else
  76.                 {
  77.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  78.                 }
  79.             }
  80.             else if (args.Parameters.Count > 1)
  81.             {
  82.                 if (i == 2)
  83.                 {
  84.                     args.Player.SendMessage("You can't input more than one option!", Color.Red);
  85.                 }
  86.                 else
  87.                 {
  88.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  89.                 }
  90.             }
  91.             else if (args.Parameters.Count < 1)
  92.             {
  93.                 if (i == 2)
  94.                 {
  95.                     args.Player.SendMessage("Syntax: /ticday <dd>", Color.Red);
  96.                 }
  97.                 else
  98.                 {
  99.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  100.                 }
  101.             }
  102.         }
  103.         public static void TicYear(CommandArgs args)
  104.         {
  105.             if (args.Parameters.Count == 1)
  106.             {
  107.                 if (i == 3)
  108.                 {
  109.                     string yyyy = args.Parameters[0];
  110.                     StreamWriter tw = new StreamWriter("TempClear.txt", true);
  111.                     tw.WriteLine(yyyy);
  112.                     tw.Close();
  113.                     args.Player.SendMessage("You have set the date!");
  114.                     args.Player.SendMessage("Clearing that day...");
  115.                     StreamReader tics = new StreamReader("Tickets.txt", true);
  116.                     StreamWriter ticclear = new StreamWriter("Tickets.txt", true);
  117.                     StreamReader clear = new StreamReader("TempClear.txt", true);
  118.                     string line = null;
  119.                     string line_to_delete = clear.ReadToEnd();
  120.                     try
  121.                     {
  122.                         while ((line = clear.ReadLine()) != null)
  123.                         {
  124.                             while ((line = tics.ReadLine()) != null)
  125.                             {
  126.                                 if (String.Compare(line, line_to_delete) == 0)
  127.                                     continue;
  128.                                 tics.Close();
  129.                                 clear.Close();
  130.                                 ticclear.WriteLine(line);
  131.                                 ticclear.Close();
  132.                             }
  133.                         }
  134.                     }
  135.                     catch (Exception e)
  136.                     {
  137.                         args.Player.SendMessage("Something went wrong and you couldnt clear that date.", Color.Red);
  138.                         Console.ForegroundColor = ConsoleColor.Red;
  139.                         Console.WriteLine(e.Message);
  140.                         Console.ResetColor();
  141.                     }
  142.                     i = 0;
  143.                     File.Delete("TempClear.txt");
  144.                 }
  145.                 else
  146.                 {
  147.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  148.                 }
  149.             }
  150.             else if (args.Parameters.Count > 1)
  151.             {
  152.                 if (i == 3)
  153.                 {
  154.                     args.Player.SendMessage("You can't input more than one option!", Color.Red);
  155.                 }
  156.                 else
  157.                 {
  158.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  159.                 }
  160.             }
  161.             else if (args.Parameters.Count < 1)
  162.             {
  163.                 if (i == 3)
  164.                 {
  165.                     args.Player.SendMessage("Syntax: /ticyear <yyyy>", Color.Red);
  166.                 }
  167.                 else
  168.                 {
  169.                     args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
  170.                 }
  171.             }
  172.         }
  173.     }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement