Class MapPrefixHandler
- java.lang.Object
-
- com.mrivanplays.jdcf.settings.prefix.MapPrefixHandler
-
- All Implemented Interfaces:
PrefixHandler
public class MapPrefixHandler extends java.lang.Object implements PrefixHandler
Represents a prefix handler, working with a simple map. Opens opportunities for much different long term storage types.
-
-
Constructor Summary
Constructors Constructor Description MapPrefixHandler(java.util.Map<java.lang.Long,java.lang.String> prefixesMap, java.util.function.Consumer<java.util.Map<java.lang.Long,java.lang.String>> saveFunction)
MapPrefixHandler(java.util.Map<java.lang.Long,java.lang.String> prefixesMap, java.util.function.Consumer<java.util.Map<java.lang.Long,java.lang.String>> saveFunction, java.lang.String defaultPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.String
getDefaultPrefix()
Returns the default command prefix of the bot.@Nullable java.lang.String
getGuildPrefix(long guildId)
Returns the prefix, which belongs to the specified guild id.void
savePrefixes()
Saves the prefixesvoid
setDefaultPrefix(@NotNull java.lang.String defaultPrefix)
Sets a new default prefix of the bot.void
setGuildPrefix(@NotNull java.lang.String prefix, long guildId)
Sets a new guild prefix.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.mrivanplays.jdcf.settings.prefix.PrefixHandler
getPrefix, getPrefix
-
-
-
-
Constructor Detail
-
MapPrefixHandler
public MapPrefixHandler(java.util.Map<java.lang.Long,java.lang.String> prefixesMap, java.util.function.Consumer<java.util.Map<java.lang.Long,java.lang.String>> saveFunction)
-
MapPrefixHandler
public MapPrefixHandler(java.util.Map<java.lang.Long,java.lang.String> prefixesMap, java.util.function.Consumer<java.util.Map<java.lang.Long,java.lang.String>> saveFunction, java.lang.String defaultPrefix)
-
-
Method Detail
-
getDefaultPrefix
@NotNull public @NotNull java.lang.String getDefaultPrefix()
Description copied from interface:PrefixHandler
Returns the default command prefix of the bot.- Specified by:
getDefaultPrefix
in interfacePrefixHandler
- Returns:
- default prefix
-
setDefaultPrefix
public void setDefaultPrefix(@NotNull @NotNull java.lang.String defaultPrefix)
Description copied from interface:PrefixHandler
Sets a new default prefix of the bot.- Specified by:
setDefaultPrefix
in interfacePrefixHandler
- Parameters:
defaultPrefix
- prefix
-
getGuildPrefix
@Nullable public @Nullable java.lang.String getGuildPrefix(long guildId)
Description copied from interface:PrefixHandler
Returns the prefix, which belongs to the specified guild id.- Specified by:
getGuildPrefix
in interfacePrefixHandler
- Parameters:
guildId
- the guild id- Returns:
- guild prefix
-
setGuildPrefix
public void setGuildPrefix(@NotNull @NotNull java.lang.String prefix, long guildId)
Description copied from interface:PrefixHandler
Sets a new guild prefix.- Specified by:
setGuildPrefix
in interfacePrefixHandler
- Parameters:
prefix
- the prefix you want to setguildId
- the guild id for which you want to set the prefix
-
savePrefixes
public void savePrefixes()
Description copied from interface:PrefixHandler
Saves the prefixes- Specified by:
savePrefixes
in interfacePrefixHandler
-
-