+ Added roll, RPEnd, RPG, RPStart, Shutdown
This commit is contained in:
@@ -5,6 +5,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import core.Command;
|
||||
import core.Localizer;
|
||||
import core.RPManager;
|
||||
import dataStructures.*;
|
||||
|
||||
@@ -13,24 +14,30 @@ public class CommandRPEnd extends Command
|
||||
public CommandRPEnd (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return "Ends RP in channel"; }
|
||||
public String HelpText() { return Localizer.Stub("Ends RP in channel"); }
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
File sending = null;
|
||||
try {
|
||||
|
||||
try
|
||||
{
|
||||
sending = RPManager.instance.endRP(channel, user);
|
||||
} catch (FileNotFoundException | UnsupportedEncodingException e)
|
||||
}
|
||||
catch (FileNotFoundException | UnsupportedEncodingException e)
|
||||
{
|
||||
System.out.println("I don't know how you got here");
|
||||
}
|
||||
|
||||
if(sending != null)
|
||||
{
|
||||
res.CallFile(sending, "txt");
|
||||
res.Call("Here's your file!");
|
||||
res.Call(Localizer.Stub("Here's your file!"));
|
||||
}
|
||||
else
|
||||
res.Call("You can't end this RP!");
|
||||
{
|
||||
res.Call(Localizer.Stub("You can't end this RP!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commands;
|
||||
|
||||
import core.Command;
|
||||
import core.Localizer;
|
||||
import core.rpg.RPGFramework;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
@@ -22,7 +23,7 @@ public class CommandRPG extends Command
|
||||
}
|
||||
|
||||
@Override
|
||||
public String HelpText() { return "Admin+ command only right now - experimental text RPG! Format is !rpg <rpg command>"; };
|
||||
public String HelpText() { return Localizer.Stub("Admin+ command only right now - experimental text RPG! Format is !rpg <rpg command>"); };
|
||||
|
||||
|
||||
@Override
|
||||
@@ -42,7 +43,7 @@ public class CommandRPG extends Command
|
||||
|
||||
if(result == null)
|
||||
{
|
||||
res.Call("Invalid RPG Command!");
|
||||
res.Call(Localizer.Stub("Invalid RPG Command!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package commands;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import core.Command;
|
||||
import core.Localizer;
|
||||
import core.RPManager;
|
||||
import dataStructures.*;
|
||||
|
||||
@@ -11,7 +12,7 @@ public class CommandRPStart extends Command
|
||||
public CommandRPStart (KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return "Starts an rp, add people to it by mentioning them!"; }
|
||||
public String HelpText() { return Localizer.Stub("Starts an rp, add people to it by mentioning them!"); }
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CommandRoll extends Command
|
||||
public CommandRoll(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return "Based on input of xdy where x is number of dice and y is faces kitty will roll that amount of dice, display the individual rolls and total"; }
|
||||
public String HelpText() { return Localizer.Stub("Based on input of xdy where x is number of dice and y is faces kitty will roll that amount of dice, display the individual rolls and total"); }
|
||||
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
@@ -27,7 +27,7 @@ public class CommandRoll extends Command
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
res.Call("Didn't work ;3;");
|
||||
res.Call(Localizer.Stub("Didn't work ;3;"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package commands;
|
||||
|
||||
import core.Command;
|
||||
import core.DatabaseManager;
|
||||
import core.Localizer;
|
||||
import core.Stats;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
@@ -17,7 +18,7 @@ public class CommandShutdown extends Command
|
||||
public CommandShutdown(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||
|
||||
@Override
|
||||
public String HelpText() { return "Stops kitty. `-s` or `safe` as an argument attempts to sync off the database before shutdown."; }
|
||||
public String HelpText() { return Localizer.Stub("Stops kitty. `-s` or `safe` as an argument attempts to sync off the database before shutdown."); }
|
||||
|
||||
// Called when the command is run!
|
||||
@Override
|
||||
@@ -41,12 +42,12 @@ public class CommandShutdown extends Command
|
||||
if(isSafe)
|
||||
{
|
||||
DatabaseManager.instance.Upkeep(); // Force upkeep, this works so long as on main thread.
|
||||
res.CallImmediate("Forced shutdown, database synced before abandoning threads.");
|
||||
res.CallImmediate(Localizer.Stub("Forced shutdown, database synced before abandoning threads."));
|
||||
System.exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.CallImmediate("Forced immediate shutdown, threads abandoned without sync.");
|
||||
res.CallImmediate(Localizer.Stub("Forced immediate shutdown, threads abandoned without sync."));
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user