= Data Structures formatting update
This commit is contained in:
@@ -18,13 +18,13 @@ public class KittyChannel //extends DatabaseTrackedObject
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String Serialize()
|
||||
// public String serialize()
|
||||
// {
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void DeSerialzie(String string)
|
||||
// public void deSerialzie(String string)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
@@ -119,9 +119,9 @@ public class KittyGuild extends DatabaseTrackedObject
|
||||
|
||||
public boolean joinRaffle(KittyUser user)
|
||||
{
|
||||
if(!raffleUsersChosen.contains(user) && !raffleUsersUnchosen.contains(user) && user.GetBeans() > raffleCost && raffling)
|
||||
if(!raffleUsersChosen.contains(user) && !raffleUsersUnchosen.contains(user) && user.getBeans() > raffleCost && raffling)
|
||||
{
|
||||
user.ChangeBeans(raffleCost);
|
||||
user.changeBeans(raffleCost);
|
||||
raffleUsersUnchosen.add(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class KittyRP
|
||||
|
||||
public File endRP(KittyUser user) throws FileNotFoundException, UnsupportedEncodingException
|
||||
{
|
||||
if(!users.contains(Long.parseLong(user.discordID)) && user.GetRole().getValue() < 2)
|
||||
if(!users.contains(Long.parseLong(user.discordID)) && user.getRole().getValue() < 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,26 +27,26 @@ public class KittyTrackedLong extends DatabaseTrackedObject
|
||||
super(differentiator + readableName + UniqueID);
|
||||
}
|
||||
|
||||
public long Add(long toAdd)
|
||||
public long add(long toAdd)
|
||||
{
|
||||
tracked += toAdd;
|
||||
markDirty();
|
||||
return tracked;
|
||||
}
|
||||
|
||||
public long Subtract(long toSubtract)
|
||||
public long subtract(long toSubtract)
|
||||
{
|
||||
tracked -= toSubtract;
|
||||
markDirty();
|
||||
return tracked;
|
||||
}
|
||||
|
||||
public long Get()
|
||||
public long get()
|
||||
{
|
||||
return tracked;
|
||||
}
|
||||
|
||||
public long Set(long newValue)
|
||||
public long set(long newValue)
|
||||
{
|
||||
tracked = newValue;
|
||||
markDirty();
|
||||
|
||||
@@ -31,7 +31,7 @@ public class KittyUser extends DatabaseTrackedObject
|
||||
}
|
||||
|
||||
// Can be positive or negative
|
||||
public void ChangeBeans(int amount)
|
||||
public void changeBeans(int amount)
|
||||
{
|
||||
beans += amount;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class KittyUser extends DatabaseTrackedObject
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public void ChangeRole(KittyRole newRole)
|
||||
public void changeRole(KittyRole newRole)
|
||||
{
|
||||
if(newRole != role)
|
||||
{
|
||||
@@ -48,12 +48,12 @@ public class KittyUser extends DatabaseTrackedObject
|
||||
}
|
||||
}
|
||||
|
||||
public long GetBeans()
|
||||
public long getBeans()
|
||||
{
|
||||
return beans;
|
||||
}
|
||||
|
||||
public KittyRole GetRole()
|
||||
public KittyRole getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ public class TaggedPairStore
|
||||
{
|
||||
taggedPairs = new HashMap<String, HashMap<String, String>>();
|
||||
allPairs = new HashMap<String, String>();
|
||||
Parse(input);
|
||||
parse(input);
|
||||
}
|
||||
|
||||
// Calls back on each item in the entire structure. Provides section, then a pair of the keyString and valueString.
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void ForEach(BiConsumer<? super String, Pair<? super String, ? super String>> action)
|
||||
public void forEach(BiConsumer<? super String, Pair<? super String, ? super String>> action)
|
||||
{
|
||||
Iterator it = taggedPairs.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
@@ -62,7 +62,7 @@ public class TaggedPairStore
|
||||
|
||||
// Calls back each item in the structure but does not priv
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void ForEach(Consumer<Pair<? super String, ? super String>> action)
|
||||
public void forEach(Consumer<Pair<? super String, ? super String>> action)
|
||||
{
|
||||
Iterator it = allPairs.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
@@ -123,7 +123,7 @@ public class TaggedPairStore
|
||||
// Parses out the string passed in into the sectionkeyValue HashMap.
|
||||
// Any character used in a split call is escaped just in case on
|
||||
// account of some characters having specific regex meanings.
|
||||
private void Parse(String input)
|
||||
private void parse(String input)
|
||||
{
|
||||
if(input == null)
|
||||
return;
|
||||
@@ -143,7 +143,7 @@ public class TaggedPairStore
|
||||
|
||||
// Parse section name. If it already exists, don't bother making it.
|
||||
String sectionName = section.substring(0, pos);
|
||||
AddSection(sectionName);
|
||||
addSection(sectionName);
|
||||
|
||||
// Parse out the pairs within the section, split them all out.
|
||||
String unparsedPairs = section.substring(pos + 1);
|
||||
@@ -171,7 +171,7 @@ public class TaggedPairStore
|
||||
|
||||
// Dumps out a string array
|
||||
@SuppressWarnings("unused")
|
||||
private void Dump(String[] toPrint)
|
||||
private void dump(String[] toPrint)
|
||||
{
|
||||
System.out.println("Length: " + toPrint.length);
|
||||
|
||||
@@ -181,28 +181,28 @@ public class TaggedPairStore
|
||||
|
||||
// Adds a KeyValue pair to the specified section if it's not already there.
|
||||
// Also creates the section if it's not already present.
|
||||
public void AddKeyValue(String sectionName, String key, String value)
|
||||
public void addKeyValue(String sectionName, String key, String value)
|
||||
{
|
||||
AddSection(sectionName);
|
||||
addSection(sectionName);
|
||||
taggedPairs.get(sectionName).putIfAbsent(key, value);
|
||||
allPairs.putIfAbsent(key, value);
|
||||
}
|
||||
|
||||
// Adds a given section to the hashmap if it's not already present
|
||||
public void AddSection(String sectionName)
|
||||
public void addSection(String sectionName)
|
||||
{
|
||||
taggedPairs.putIfAbsent(sectionName, new HashMap<String, String>());
|
||||
}
|
||||
|
||||
// Returns a HashMap of Keys to Values for a given section
|
||||
@SuppressWarnings("unchecked")
|
||||
public HashMap<String, String> GetSection(String sectionName)
|
||||
public HashMap<String, String> getSection(String sectionName)
|
||||
{
|
||||
return (HashMap<String, String>) taggedPairs.get(sectionName).clone();
|
||||
}
|
||||
|
||||
// Look up a global key
|
||||
public String GetKey(String key)
|
||||
public String getKey(String key)
|
||||
{
|
||||
if(allPairs.containsKey(key))
|
||||
return allPairs.get(key);
|
||||
|
||||
@@ -35,13 +35,13 @@ public class UserInput
|
||||
return;
|
||||
|
||||
if(!event.getMessage().getMentionedMembers().isEmpty())
|
||||
mentions = FindMentionedUsers(event);
|
||||
mentions = findMentionedUsers(event);
|
||||
|
||||
toParse = toParse.trim();
|
||||
String commandIndicator = guildContext.getCommandIndicator();
|
||||
if(toParse.startsWith(commandIndicator))
|
||||
{
|
||||
int loc = FindFirstWhitespace(toParse);
|
||||
int loc = findFirstWhitespace(toParse);
|
||||
|
||||
if(loc <= 0)
|
||||
{
|
||||
@@ -61,22 +61,22 @@ public class UserInput
|
||||
}
|
||||
}
|
||||
|
||||
//Used for injecting direct commands from plugins
|
||||
// Used for injecting direct commands from plugins
|
||||
public UserInput(String input, KittyGuild contextGuild)
|
||||
{
|
||||
int loc = FindFirstWhitespace(input);
|
||||
int loc = findFirstWhitespace(input);
|
||||
key = input.substring(0, loc);
|
||||
args = input.substring(loc);
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
public boolean IsValid()
|
||||
public boolean isValid()
|
||||
{
|
||||
return isValid;
|
||||
}
|
||||
|
||||
// Finds first whitespace in the string
|
||||
private int FindFirstWhitespace(String str)
|
||||
private int findFirstWhitespace(String str)
|
||||
{
|
||||
for (int i = 0; i < str.length(); ++i)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public class UserInput
|
||||
return -1;
|
||||
}
|
||||
|
||||
private KittyUser[] FindMentionedUsers(GuildMessageReceivedEvent event)
|
||||
private KittyUser[] findMentionedUsers(GuildMessageReceivedEvent event)
|
||||
{
|
||||
List <Member> JDAMentions = event.getMessage().getMentionedMembers();
|
||||
KittyUser [] KittyMentions = new KittyUser[JDAMentions.size()];
|
||||
|
||||
Reference in New Issue
Block a user