= Updated command formatting

This commit is contained in:
Matthew Cech
2019-06-19 22:35:11 -07:00
parent 06317a4528
commit 174c38887e
7 changed files with 21 additions and 23 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ public class CommandBlurry extends Command
return; return;
} }
preProcessed = new File(filename); preProcessed = new File(filename);
ApplySnap(ImageIO.read(preProcessed), name); applySnap(ImageIO.read(preProcessed), name);
} }
catch (IOException e) catch (IOException e)
{ {
@@ -67,7 +67,7 @@ public class CommandBlurry extends Command
ImageUtils.blockingFileDelete(postProcessed); ImageUtils.blockingFileDelete(postProcessed);
} }
private static void ApplySnap(BufferedImage image, String name) throws IOException private static void applySnap(BufferedImage image, String name) throws IOException
{ {
BufferedImage blurred = ImageUtils.copyImage(image); BufferedImage blurred = ImageUtils.copyImage(image);
// Iterate over each column left to right and touch up each pixel // Iterate over each column left to right and touch up each pixel
+6 -6
View File
@@ -19,13 +19,13 @@ public class CommandBoop extends Command
public BoopTracker() { super("booptracker"); } public BoopTracker() { super("booptracker"); }
public void ApplyBoop() public void applyBoop()
{ {
++boops; ++boops;
markDirty(); markDirty();
} }
public int HowMany() public int howMany()
{ {
return boops; return boops;
} }
@@ -68,14 +68,14 @@ public class CommandBoop extends Command
{ {
if(input.mentions == null) if(input.mentions == null)
{ {
boopTracker.ApplyBoop(); boopTracker.applyBoop();
res.send(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.HowMany())); res.send(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.howMany()));
} }
else else
{ {
if(input.mentions.length == 1) if(input.mentions.length == 1)
{ {
boopTracker.ApplyBoop(); boopTracker.applyBoop();
res.send(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name)); res.send(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name));
return; return;
} }
@@ -83,7 +83,7 @@ public class CommandBoop extends Command
String booped = ""; String booped = "";
for(int i = 0; i < input.mentions.length; i++) for(int i = 0; i < input.mentions.length; i++)
{ {
boopTracker.ApplyBoop(); boopTracker.applyBoop();
if(i < input.mentions.length-1) if(i < input.mentions.length-1)
booped += input.mentions[i].name + ", "; booped += input.mentions[i].name + ", ";
else else
+4 -4
View File
@@ -48,9 +48,9 @@ public class CommandHelpBuilder extends Command {
// Format outstring and send it back for now // Format outstring and send it back for now
String out = ""; String out = "";
out += PopulateSection(KittyRole.Admin, commandsByRole, true) + "\n"; out += populateSection(KittyRole.Admin, commandsByRole, true) + "\n";
out += PopulateSection(KittyRole.Mod, commandsByRole, true) + "\n"; out += populateSection(KittyRole.Mod, commandsByRole, true) + "\n";
out += PopulateSection(KittyRole.General, commandsByRole, false) + "\n"; out += populateSection(KittyRole.General, commandsByRole, false) + "\n";
// Write out file // Write out file
String filename = "buildhelp_out.txt"; String filename = "buildhelp_out.txt";
@@ -73,7 +73,7 @@ public class CommandHelpBuilder extends Command {
} }
// Generates the section for a specific role, optionally adding spacing after for another section // Generates the section for a specific role, optionally adding spacing after for another section
private String PopulateSection(KittyRole role, HashMap<KittyRole, ArrayList<Command>> commandsByRole, boolean delimitSection) private String populateSection(KittyRole role, HashMap<KittyRole, ArrayList<Command>> commandsByRole, boolean delimitSection)
{ {
// Formatting variables // Formatting variables
final String headerStart = "<h2>"; final String headerStart = "<h2>";
+5 -5
View File
@@ -52,11 +52,11 @@ public class CommandMap extends Command
String widthStr = parser.getOption("-w", true); String widthStr = parser.getOption("-w", true);
if(widthStr != null) if(widthStr != null)
width = ValidateSize(Integer.parseInt(widthStr), MaxWidth); width = validateSize(Integer.parseInt(widthStr), MaxWidth);
String heightStr = parser.getOption("-h", true); String heightStr = parser.getOption("-h", true);
if(heightStr != null) if(heightStr != null)
height = ValidateSize(Integer.parseInt(heightStr), MaxHeight); height = validateSize(Integer.parseInt(heightStr), MaxHeight);
} }
catch(NumberFormatException e) catch(NumberFormatException e)
{ {
@@ -83,7 +83,7 @@ public class CommandMap extends Command
// Response body creation // Response body creation
body += "```\n"; body += "```\n";
body += GenerateMap(width, height, randGenerator); body += generateMap(width, height, randGenerator);
body += "\n```"; body += "\n```";
// Send back the map // Send back the map
@@ -91,7 +91,7 @@ public class CommandMap extends Command
} }
// Verifies and appropriately caps input as necessary // Verifies and appropriately caps input as necessary
int ValidateSize(int input, int max) int validateSize(int input, int max)
{ {
if(input < 0) if(input < 0)
throw new NumberFormatException(); throw new NumberFormatException();
@@ -104,7 +104,7 @@ public class CommandMap extends Command
// Does the map generation // Does the map generation
String GenerateMap(int width, int height, Random gen) String generateMap(int width, int height, Random gen)
{ {
String landscape[][] = new String[width][height]; String landscape[][] = new String[width][height];
int r1 = rand(gen); int r1 = rand(gen);
+2 -2
View File
@@ -59,7 +59,7 @@ public class CommandPerish extends Command
return; return;
} }
preProcessed = new File(filename); preProcessed = new File(filename);
ApplyTintEffect(ImageIO.read(preProcessed), name); applyTintEffect(ImageIO.read(preProcessed), name);
} }
catch (IOException e) catch (IOException e)
{ {
@@ -73,7 +73,7 @@ public class CommandPerish extends Command
ImageUtils.blockingFileDelete(postProcessed); ImageUtils.blockingFileDelete(postProcessed);
} }
private static void ApplyTintEffect(BufferedImage image, String name) throws IOException private static void applyTintEffect(BufferedImage image, String name) throws IOException
{ {
// Iterate over each column left to right and touch up each pixel // Iterate over each column left to right and touch up each pixel
for(int x = 0; x < image.getWidth(); ++x) for(int x = 0; x < image.getWidth(); ++x)
-2
View File
@@ -41,8 +41,6 @@ public class CommandShutdown extends Command
break; break;
} }
if(isSafe) if(isSafe)
{ {
// Force upkeep, this works so long as upkeep is on the main thread. // Force upkeep, this works so long as upkeep is on the main thread.
+2 -2
View File
@@ -53,7 +53,7 @@ public class CommandStark extends Command
return; return;
} }
preProcessed = new File(filename); preProcessed = new File(filename);
ApplySnap(ImageIO.read(preProcessed), name); applySnap(ImageIO.read(preProcessed), name);
} }
catch (IOException e) catch (IOException e)
{ {
@@ -67,7 +67,7 @@ public class CommandStark extends Command
ImageUtils.blockingFileDelete(postProcessed); ImageUtils.blockingFileDelete(postProcessed);
} }
private static void ApplySnap(BufferedImage image, String name) throws IOException private static void applySnap(BufferedImage image, String name) throws IOException
{ {
BufferedImage snap = ImageUtils.copyImage(image); BufferedImage snap = ImageUtils.copyImage(image);
// Iterate over each column left to right and touch up each pixel // Iterate over each column left to right and touch up each pixel