L2JMobius

C6 Blessed Scroll of Escape: Clan Hall

Strelook66 · 6 · 2522

Online Strelook66

  • Knight
  • ***
    • Posts: 82
Hi,

The Blessed Scroll of Escape: Clan Hall (ID: 5858) wasn't working, and kept throwing an exception:
Code: [Select]
Exception for: [Character: Test11[268485039] - Account: test5 - IP: 127.0.0.1] on packet.run: UseItem
java.lang.NullPointerException: Cannot invoke "org.l2jmobius.gameserver.model.clan.Clan.getClanId()" because "clan" is null
at org.l2jmobius.gameserver.instancemanager.ClanHallManager.getClanHallByOwner(ClanHallManager.java:241)
at org.l2jmobius.gameserver.network.clientpackets.UseItem.run(UseItem.java:183)
at org.l2jmobius.gameserver.network.clientpackets.UseItem.run(UseItem.java:51)
at org.l2jmobius.gameserver.network.GameClient.channelRead0(GameClient.java:132)
at org.l2jmobius.gameserver.network.GameClient.channelRead0(GameClient.java:70)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:831)

Simple fix in org.l2jmobius.gameserver.network.clientpackets.UseItem:

Code: [Select]
if ((itemId == 5858) && (ClanHallManager.getInstance().getClanHallByOwner(player.getClan()) == null))      <== change this line

if ((itemId == 5858) && ((player.getClan()) == null))      <== to this
{
player.sendMessage("Blessed Scroll of Escape: Clan Hall cannot be used due to unsuitable terms.");
return;
}


Offline ver

  • Knight
  • ***
    • Posts: 70
And what if player has a clan, but that clan does not have clanhall ?:)

Maybe that would be better?
Code: [Select]
if ((itemId == 5858) && ((player.getClan() == null) || (ClanHallManager.getInstance().getClanHallByOwner(player.getClan()) == null)))


Offline nasseka

  • Distinguished King
  • *****
    • Posts: 1729
    • L2Unknown
If player has no clan, scroll takes him as normal soe as i remember


Online Strelook66

  • Knight
  • ***
    • Posts: 82
If player has no clan, scroll takes him as normal soe as i remember

That is correct :). I tested it and it works for people without a clan.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16123
And what if player has a clan, but that clan does not have clanhall ?:)

Maybe that would be better?
Code: [Select]
if ((itemId == 5858) && ((player.getClan() == null) || (ClanHallManager.getInstance().getClanHallByOwner(player.getClan()) == null)))

This would be correct.
Player could have Clan, but no clanhall.