Jump to content

Recommended Posts

Posted (edited)

Code for forbidden names which users can't name their characters.

### Eclipse Workspace Patch 1.0
#P aCis_350
Index: config/server.properties
===================================================================
--- config/server.properties (revision 5)
+++ config/server.properties (working copy)
@@ -64,6 +64,9 @@
 # Allow delete chars after D days, 0 = feature disabled.
 DeleteCharAfterDays = 7
 
+#Restricted names for characters
+RestrictedNames = fuck,dildo,admin
+
 # Define how many players are allowed to play simultaneously on your server.
 MaximumOnlineUsers = 100
 
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 5)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -521,6 +521,8 @@
  
  /** clients related */
  public static int DELETE_DAYS;
+ public static String FORBIDDEN_NAMES;
+ public static List<String> LIST_FORBIDDEN_NAMES = new ArrayList<>();
  public static int MAXIMUM_ONLINE_USERS;
  public static int MIN_PROTOCOL_REVISION;
  public static int MAX_PROTOCOL_REVISION;
@@ -1108,6 +1110,12 @@
  SERVER_LIST_TESTSERVER = server.getProperty("TestServer", false);
  
  DELETE_DAYS = server.getProperty("DeleteCharAfterDays", 7);
+ FORBIDDEN_NAMES = server.getProperty("RestrictedNames", "fuck,dildo,admin");
+ LIST_FORBIDDEN_NAMES = new ArrayList<>();
+ for (String listid : FORBIDDEN_NAMES.split(","))
+ {
+ LIST_FORBIDDEN_NAMES.add(listid);
+ }
  MAXIMUM_ONLINE_USERS = server.getProperty("MaximumOnlineUsers", 100);
  MIN_PROTOCOL_REVISION = server.getProperty("MinProtocolRevision", 730);
  MAX_PROTOCOL_REVISION = server.getProperty("MaxProtocolRevision", 746);
Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 5)
+++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)
@@ -79,6 +79,18 @@
  return;
  }
  
+ if(!Config.FORBIDDEN_NAMES.isEmpty())
+ {
+ for(String st : Config.LIST_FORBIDDEN_NAMES)
+ {
+ if(_name.toLowerCase().contains(st))
+ {
+ sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
+ return;
+ }
+ }
+ }
+ 
  if (!StringUtil.isValidPlayerName(_name))
  {
  sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
Edited by Gam3Master
  • Like 1
Posted

Give credits for what? its 1 line code and is already implement in every project (acis, l2j e.t.c)

Really? I am not sure if aCis has it.

Posted (edited)

Code for forbidden names which users can't name their characters.

 

http://pastebin.com/9JXurCeE

Your code will not work properly. If you forbid one player name, if statement return false.

Just change

if(Config.FORBIDDEN_NAMES.length > 1)

to

if(Config.FORBIDDEN_NAMES.length >= 1) or if(Config.FORBIDDEN_NAMES.length > 0)

 

Thank you for your sharing ;)

Edited by ClassyCraw
Posted

Your code will not work properly. If you forbid one player name, if statement return false.

Just change

if(Config.FORBIDDEN_NAMES.length > 1)

to

if(Config.FORBIDDEN_NAMES.length >= 1) or if(Config.FORBIDDEN_NAMES.length > 0)

 

Thank you for your sharing ;)

thanks for response I will update it

Posted (edited)

Both ways sux. Simply

if (!Config.WHAT_EVER_CONFIG_IT_IS.isEmpty())

So, if config is empty, the feature is disabled.

Edited by SweeTs
Posted (edited)

Oh right it's [], so simply length > 0. Also, in your case you can't leave it empty (error otherwise)  :P

 

Also, while the config uses lower case letters, you don't have to use st.toLowerCase(), simply st is enough.

Edited by SweeTs
Posted (edited)

Also, while the config uses lower case letters, you don't have to use st.toLowerCase(), simply st is enough.

 

That would mean Dildo, dIldo, diLdo, dilDo, dildO (and all others possibilies) would be legit.

 

And yeah I did that to write dildo 5x. Now 6x.

Edited by Tryskell
Posted

Lets not forget Amouncements, Anouncements, Announcenets, Annonucements, Announcenemts, Annauncements, Nlk, Admln and whatever else I saw in my servers xD

Posted (edited)
+ for (String listid : FORBIDDEN_NAMES.split(","))
+ {
+ LIST_FORBIDDEN_NAMES.add(String.valueOf(listid));
+ }

String.valueOf is useless.

 

 

 

+ if(!Config.FORBIDDEN_NAMES.isEmpty())
+ {
+ for(String st : Config.LIST_FORBIDDEN_NAMES)
+ {
+ if(_name.toLowerCase().contains(st))
+ {
+ sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
+ return;
+ }
+ }
+ }

>

if (LIST_FORBIDDEN_NAMES.contains(_name.toLowerCase())
{
 sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
 return;
}
Edited by Tryskell
Guest
This topic is now closed to further replies.


  • Posts

    • It's also the players' fault, because there have been decent servers implementing some of the things you said plus some other 'innovations', plus many QOL things for newbies (ingame bestiary, with drops searchers, etc). In the end, it's the players who decide to feed into that shit and play the most garbage servers simply because the owners of the servers gave their clan leaders 100 euros, or they insta quit the server because they didn't win the first QA, etc, etc, etc.   In the end, if a server is garbage or great it doesn't really matter if the players don't wanna stay in there.   Players are no better than the devs themselves, in the end it seems there are abusive devs who will milk the shit out of their willingly milkable players, or there are none, goes both ways.
    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
  • Topics

×
×
  • Create New...