Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package core;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import dataStructures.KittyCharacter;
|
||||
import dataStructures.KittyUser;
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
|
||||
public class CharacterManager
|
||||
{
|
||||
public static CharacterManager instance;
|
||||
|
||||
private Vector <KittyCharacter> characters = new Vector<KittyCharacter>();
|
||||
public CharacterManager()
|
||||
{
|
||||
if(instance == null)
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalLog.Error(LogFilter.Core, "Attempted to create a second CharacterManager singleton!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addCharacter(KittyUser user, String name, String bio, String refImage)
|
||||
{
|
||||
for(KittyCharacter character:characters)
|
||||
{
|
||||
if(character.getName().equals(name) && character.getOwner().discordID.equals(user.discordID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
characters.add(new KittyCharacter(user, name, bio, refImage));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeCharacter(KittyUser user, String name)
|
||||
{
|
||||
for(KittyCharacter character:characters)
|
||||
{
|
||||
if(character.getName().equals(name) && character.getOwner().discordID.equals(user.discordID))
|
||||
{
|
||||
characters.remove(character);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean editRefImage(KittyUser user, String name, String refImage)
|
||||
{
|
||||
for(KittyCharacter character:characters)
|
||||
{
|
||||
if(character.getName().equals(name) && character.getOwner().discordID.equals(user.discordID))
|
||||
{
|
||||
return character.editRefImage(user, refImage);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean editBio(KittyUser user, String name, String bio)
|
||||
{
|
||||
for(KittyCharacter character:characters)
|
||||
{
|
||||
if(character.getName().equals(name) && character.getOwner().discordID.equals(user.discordID))
|
||||
{
|
||||
return character.editBio(user, bio);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -423,6 +423,7 @@ public class ObjectBuilderFactory
|
||||
manager.Register(LocCommands.Stub("crouton"), new CommandCrouton(KittyRole.General, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("benchmark, bench"), new CommandBenchmark(KittyRole.General, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("rafflejoin"), new CommandRaffleJoin(KittyRole.General, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("charactercreate"), new CommandCharacterCreate(KittyRole.General, KittyRating.Safe));
|
||||
manager.Register(LocCommands.Stub("leaderboard"), new CommandLeaderboard(KittyRole.General, KittyRating.Safe));
|
||||
|
||||
return manager;
|
||||
|
||||
Reference in New Issue
Block a user