Jump to content

Recommended Posts

Posted

you should refactor everything at once so you dont end up having a gazillion refactoring changesets^^

I don't have in mind what my next refactor is going to be, so I commit them separately.

 

I hope you move them in datapack in the future

Fine, now go play with your flying ship.

Posted

I hope you move them in datapack in the future

 

hahahahah

 

change GameServer.java to Console.java. for obvious reasons

Posted

I hope you move them in datapack in the future

 

Pointless, if you leave them in the core you can use them for much greater things :

 

Its best to unhardcode stuff like olympiad and such features.

Guest Elfocrash
Posted

Pointless, if you leave them in the core you can use them for much greater things :

 

Its best to unhardcode stuff like olympiad and such features.

It is best to unhardcode as much stuff as you can for obvious reasons + starting with the handlers is a good move as it is easy us fuck.

Posted

Personally, I want java on my eclipse and scripts on the dp

And some people want a million dollar, we cant have everyone satisfied.

Posted

It is best to unhardcode as much stuff as you can for obvious reasons + starting with the handlers is a good move as it is easy us -beep-.

 

Yes its good to unhardcode stuff(altho using them in jars is pretty much the best way for performance gains, or just caching them), but there are things that should not be unhardcoded.

 

Keeping the handlers in the core gives you the possibility of having class based restriction so for example

 

if (itemId = infinite line of itemIds) or if (potions.class)

 

Doesnt seem much but used properly on the places where it can its a pretty good thing.

Posted

And some people want a million dollar, we cant have everyone satisfied.

 

really ?

 

You compare two really different things.

 

On l2j everything is possible while on real life not ;)

Posted

really ?

 

You compare two really different things.

 

On l2j everything is possible while on real life not ;)

I am comparing the desire in general not the specific environment.

Guest Elfocrash
Posted

but there are things that should not be unhardcoded.

I never said he should do it on everything. He can't do it either way knowledgewise to start with.

Posted

Where do we start :) Damn L2J community is still striving and going good. That's interesting news, but now on a more serious note regarding the packs and some replies here.

 

The educational myth

 

Personally, I don't believe L2 to be the best option for educational purposes. Mainly because L2J and generally private servers is a concept way too close to the market. Everything around here is done for the money. It is not a good ground for education when everyone expects your product to reach production state and make money. There are countless of open source projects out there for Java Developers that want to learn to use Java Technologies. Some that I could name are the Jetty Open Source Web Server, Apache Solr Indexer, the NoSQL Cassandra database etc. They all include amazing technologies, JAX-RS, JAXB, EJB3, Spring, Hibernate etc.

 

The new hot L2J Project

 

I'll pretend to be your grandpa, "listen kid", you don't create a new L2J Project just because you want to refractor the code in a way you believe is the right one. If you ask ten people where they want handlers to be, you will get ten different answers, even if they can be in the core, or in the datapack. The same will go for the name of L2PcInstance class. Purity is not a goal you should pursue in real life. On the other hand, chaos isn't a goal either. You can't create a pack full of shitty customs just because you learnt how to adopt every share out there to your pack.

 

Why should a pack exist ?

 

A pack should exist if it gives value to the people that need it. Ask this question to yourself when you create a pack, what am I doing different than the others that will make my target group prefer me over them ? Specifically for your pack, you should ask what does it do better than acis, in which sections does it improve it. That's how you can find your packs identity. I could name some reasons where acis fails and you could succeed. Examples: lack of custom codes, lack of essential things like custom gatekeeper/buffer, lack of SVN access for easy sync.

 

PS:

if (itemId = infinite line of itemIds) or if (potions.class)

That's not a reason for handlers to stay in the core -.-'. And it violates the Liskov principle of Object Oriented Programming.

 

Posted

Where do we start :) Damn L2J community is still striving and going good. That's interesting news, but now on a more serious note regarding the packs and some replies here.

 

The educational myth

 

Personally, I don't believe L2 to be the best option for educational purposes. Mainly because L2J and generally private servers is a concept way too close to the market. Everything around here is done for the money. It is not a good ground for education when everyone expects your product to reach production state and make money. There are countless of open source projects out there for Java Developers that want to learn to use Java Technologies. Some that I could name are the Jetty Open Source Web Server, Apache Solr Indexer, the NoSQL Cassandra database etc. They all include amazing technologies, JAX-RS, JAXB, EJB3, Spring, Hibernate etc.

 

The new hot L2J Project

 

I'll pretend to be your grandpa, "listen kid", you don't create a new L2J Project just because you want to refractor the code in a way you believe is the right one. If you ask ten people where they want handlers to be, you will get ten different answers, even if they can be in the core, or in the datapack. The same will go for the name of L2PcInstance class. Purity is not a goal you should pursue in real life. On the other hand, chaos isn't a goal either. You can't create a pack full of shitty customs just because you learnt how to adopt every share out there to your pack.

 

Why should a pack exist ?

 

A pack should exist if it gives value to the people that need it. Ask this question to yourself when you create a pack, what am I doing different than the others that will make my target group prefer me over them ? Specifically for your pack, you should ask what does it do better than acis, in which sections does it improve it. That's how you can find your packs identity. I could name some reasons where acis fails and you could succeed. Examples: lack of custom codes, lack of essential things like custom gatekeeper/buffer, lack of SVN access for easy sync.

 

PS:That's not a reason for handlers to stay in the core -.-'. And it violates the Liskov principle of Object Oriented Programming.

 

 

Okay than i'll be more specific, heres a part from the l2jfree global restriction engine

 

public final boolean canUseItemHandler(Class<? extends IItemHandler> clazz, int itemId, L2Playable activeChar,

L2ItemInstance item, L2PcInstance player)

{

if (clazz == SummonItems.class)

{

if (player != null && isInFunEvent(player) && started() && !allowSummon())

{

activeChar.sendPacket(ActionFailed.STATIC_PACKET);

return false;

}

}

else if (clazz == Potions.class)

{

if (player != null && isInFunEvent(player) && started() && !allowPotions())

{

player.sendPacket(ActionFailed.STATIC_PACKET);

return false;

}

}

 

return true;

}

 

Same can be done with a specific skillhandler, skilltargethandler, admincommand handler or whatever you wish. Mainly for me thats the reason why i keep handlers in the core. Things like that in my book worth more than unhardcoding something becuse if you look it(and dont think about what l2j does because most of their stuff is just eyecandy or theoretically good stuff executed badly), you get better functionality over a simple convention of code design.

Posted

Wow, you take things a bit too serious, Leluche. There is no reason for competition, there is no reason to create a project to compete acis and try to make something better than this. Also, there are no rules for creating a new project.

 

I do it for the lols as I said to the first post, that most of you missed, and as you can see at some previous replies haters gonna hate. If I want to refactor everything to food names I am gonna do it and the last thing I have in mind about this project is earning money.

Posted
public final boolean canUseItemHandler(Class<? extends IItemHandler> clazz, int itemId, L2Playable activeChar,

        L2ItemInstance item, L2PcInstance player)

  {

      if (clazz == SummonItems.class) // Implementation agnostic ?

      {

        if (player != null && isInFunEvent(player) && started() && !allowSummon())

        {

            activeChar.sendPacket(ActionFailed.STATIC_PACKET);

            return false;

        }

      }

      else if (clazz == Potions.class) //Implementation agnostic ?

      {

        if (player != null && isInFunEvent(player) && started() && !allowPotions())

        {

            player.sendPacket(ActionFailed.STATIC_PACKET);

            return false;

        }

      }

     

      return true;

  }

 

This is a bad coding practice.

 

public final boolean canUseItemHandler(itemHandler handler, int itemId, L2Playable activeChar,

        L2ItemInstance item, L2PcInstance player)

  {

    boolean result = false;

 

    result = handler.evaluateConditions(itemId,activeChar,item,player); // ItemHandler interface includes evaluateConditions(...);

     

    return result;

  }

 

Easier, faster and implementation agnostic since this code section does not need to know the class type of the handler to evaluate. And it avoids reflecting on the Class<?> equality.

Guest
This topic is now closed to further replies.

×
×
  • Create New...