Addition of ForbiddenNames configuration.

This commit is contained in:
MobiusDevelopment
2020-10-13 23:59:01 +00:00
parent fcc7ec2a42
commit e637adc88b
8 changed files with 40 additions and 0 deletions

View File

@ -228,6 +228,11 @@ CancelLesserEffect = True
# Keep the effects buffs and debuff when you exit the game
StoreSkillCooltime = True
# Character name restriction
# Disallow characters to have a name which contains the words.
# Split them with ",". Example: announcements,announce...
ForbiddenNames = annou,ammou,amnou,anmou,anou,amou
# ---------------------------------------------------------------------------
# Buffs

View File

@ -1077,6 +1077,7 @@ public class Config
public static int DEATH_PENALTY_CHANCE;
public static boolean EFFECT_CANCELING;
public static boolean STORE_SKILL_COOLTIME;
public static String[] FORBIDDEN_NAMES;
public static byte BUFFS_MAX_AMOUNT;
public static byte DEBUFFS_MAX_AMOUNT;
public static boolean ENABLE_MODIFY_SKILL_DURATION;
@ -2776,6 +2777,7 @@ public class Config
DEATH_PENALTY_CHANCE = characterConfig.getInt("DeathPenaltyChance", 20);
EFFECT_CANCELING = characterConfig.getBoolean("CancelLesserEffect", true);
STORE_SKILL_COOLTIME = characterConfig.getBoolean("StoreSkillCooltime", true);
FORBIDDEN_NAMES = characterConfig.getString("ForbiddenNames", "").split(",");
BUFFS_MAX_AMOUNT = characterConfig.getByte("MaxBuffAmount", (byte) 24);
DEBUFFS_MAX_AMOUNT = characterConfig.getByte("MaxDebuffAmount", (byte) 6);
ENABLE_MODIFY_SKILL_DURATION = characterConfig.getBoolean("EnableModifySkillDuration", false);

View File

@ -98,6 +98,18 @@ public class CharacterCreate extends GameClientPacket
return;
}
if (Config.FORBIDDEN_NAMES.length > 0)
{
for (String st : Config.FORBIDDEN_NAMES)
{
if (_name.toLowerCase().contains(st.toLowerCase()))
{
getClient().sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
return;
}
}
}
PlayerInstance newChar = null;
PlayerTemplate template = null;

View File

@ -25,6 +25,7 @@ public class CharCreateFail extends GameServerPacket
public static final int REASON_TOO_MANY_CHARACTERS = 0x01;
public static final int REASON_NAME_ALREADY_EXISTS = 0x02;
public static final int REASON_16_ENG_CHARS = 0x03;
public static final int REASON_INCORRECT_NAME = 0x04;
private final int _error;

View File

@ -231,6 +231,11 @@ CancelLesserEffect = True
# Keep the effects buffs and debuff when you exit the game
StoreSkillCooltime = True
# Character name restriction
# Disallow characters to have a name which contains the words.
# Split them with ",". Example: announcements,announce...
ForbiddenNames = annou,ammou,amnou,anmou,anou,amou
# ---------------------------------------------------------------------------
# Buffs

View File

@ -1112,6 +1112,7 @@ public class Config
public static int DEATH_PENALTY_CHANCE;
public static boolean EFFECT_CANCELING;
public static boolean STORE_SKILL_COOLTIME;
public static String[] FORBIDDEN_NAMES;
public static byte BUFFS_MAX_AMOUNT;
public static byte DEBUFFS_MAX_AMOUNT;
public static boolean ENABLE_MODIFY_SKILL_DURATION;
@ -2842,6 +2843,7 @@ public class Config
DEATH_PENALTY_CHANCE = characterConfig.getInt("DeathPenaltyChance", 20);
EFFECT_CANCELING = characterConfig.getBoolean("CancelLesserEffect", true);
STORE_SKILL_COOLTIME = characterConfig.getBoolean("StoreSkillCooltime", true);
FORBIDDEN_NAMES = characterConfig.getString("ForbiddenNames", "").split(",");
BUFFS_MAX_AMOUNT = characterConfig.getByte("MaxBuffAmount", (byte) 24);
DEBUFFS_MAX_AMOUNT = characterConfig.getByte("MaxDebuffAmount", (byte) 6);
ENABLE_MODIFY_SKILL_DURATION = characterConfig.getBoolean("EnableModifySkillDuration", false);

View File

@ -98,6 +98,18 @@ public class CharacterCreate extends GameClientPacket
return;
}
if (Config.FORBIDDEN_NAMES.length > 0)
{
for (String st : Config.FORBIDDEN_NAMES)
{
if (_name.toLowerCase().contains(st.toLowerCase()))
{
getClient().sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
return;
}
}
}
PlayerInstance newChar = null;
PlayerTemplate template = null;

View File

@ -25,6 +25,7 @@ public class CharCreateFail extends GameServerPacket
public static final int REASON_TOO_MANY_CHARACTERS = 0x01;
public static final int REASON_NAME_ALREADY_EXISTS = 0x02;
public static final int REASON_16_ENG_CHARS = 0x03;
public static final int REASON_INCORRECT_NAME = 0x04;
private final int _error;