Skocz do zawartości
  • 0

Wywala błąd po napisaniu na chacie


GabE

Pytanie

Siemka, mam mały problem ponieważ napisałem kod na chat, działał lecz po jakimś czasie zaczął wywalać błąd po napisaniu na chacie i nic sie nie wyświetla również na chacie.

 

kod:

public class ChatListener implements Listener{
	Main main;
	
	public ChatListener(Main main)
	{
		this.main = main;
	}
	
	  @EventHandler(priority=EventPriority.HIGHEST)
	  public void onChat(AsyncPlayerChatEvent event)
	  {
	    if (!event.isCancelled())
	    {
	      Player gracz = event.getPlayer();
	      for (String group : this.main.getConfig().getConfigurationSection("chat").getKeys(false)) {
	        if (gracz.hasPermission("chat." + group))
	        {
	              event.setCancelled(true);
	              String message = this.main.getConfig().getString("chat." + group).replaceAll("&", "§").replace("[>]", "»");
	             
	              message = message.replaceAll("%wiadomosc%", event.getMessage());
	              message = message.replaceAll("%gracz%", event.getPlayer().getName());
	              if (gracz.hasPermission(this.main.getConfig().getString("uprawnienia.chatkolor"))) {
	                message = message.replaceAll("&", "§");
	              }
	              Bukkit.broadcastMessage(message);
	              return;
	        }
	      }
	    }
	  }

 

błąd:

 

Spoiler

[22:44:52] [Netty Server IO #3/ERROR]: Could not pass event AsyncPlayerChatEvent to test v0.1
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:311) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:588) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:575) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.PlayerConnection.chat(PlayerConnection.java:1663) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1612) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1550) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(SourceFile:36) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(SourceFile:9) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.NetworkManager.a(NetworkManager.java:130) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.NetworkManager.channelRead0(NetworkManager.java:119) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at net.minecraft.server.v1_16_R3.NetworkManager.channelRead0(NetworkManager.java:1) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:547) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:501) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.IllegalArgumentException: Permission name cannot be null
        at org.bukkit.permissions.PermissibleBase.isPermissionSet(PermissibleBase.java:55) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at ru.tehkode.permissions.bukkit.regexperms.PermissiblePEX.hasPermission(PermissiblePEX.java:135) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.entity.CraftHumanEntity.hasPermission(CraftHumanEntity.java:190) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        at test.main.listener.ChatListener.onChat(ChatListener.java:34) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:309) ~[craftbukkit-1.16.4.jar:git-Bukkit-3eb7236]
        ... 49 more
[22:44:52] [pool-7-thread-1/WARN]: java.io.IOException: Server returned HTTP response code: 401 for URL: https://api.github.com/gists
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1932)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1528)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
[22:44:52] [pool-7-thread-1/WARN]:      at ru.tehkode.permissions.bukkit.ErrorReport.gistText(ErrorReport.java:120)
[22:44:52] [pool-7-thread-1/WARN]:      at ru.tehkode.permissions.bukkit.ErrorReport$Builder.build(ErrorReport.java:374)
[22:44:52] [pool-7-thread-1/WARN]:      at ru.tehkode.permissions.bukkit.ErrorReport.withException(ErrorReport.java:330)
[22:44:52] [pool-7-thread-1/WARN]:      at ru.tehkode.permissions.bukkit.ErrorReport$2.run(ErrorReport.java:193)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[22:44:52] [pool-7-thread-1/WARN]:      at java.base/java.lang.Thread.run(Thread.java:832)
[22:44:53] [pool-7-thread-1/ERROR]: [PermissionsEx] Error occurred with PermissionsEx! Please post it to http://git.io/<html><body>You are being <a href="https://git.io/create">redirected</a>.</body></html>. Full error:
java.lang.IllegalArgumentException: Permissions being checked must not be null!
        at org.apache.commons.lang.Validate.notNull(Validate.java:192)
        at ru.tehkode.permissions.bukkit.regexperms.PermissiblePEX.permissionValue(PermissiblePEX.java:227)
        at ru.tehkode.permissions.bukkit.regexperms.PermissiblePEX.hasPermission(PermissiblePEX.java:127)
        at org.bukkit.craftbukkit.v1_16_R3.entity.CraftHumanEntity.hasPermission(CraftHumanEntity.java:190)
        at test.main.listener.ChatListener.onChat(ChatListener.java:34)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:309)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:588)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:575)
        at net.minecraft.server.v1_16_R3.PlayerConnection.chat(PlayerConnection.java:1663)
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1612)
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1550)
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(SourceFile:36)
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(SourceFile:9)
        at net.minecraft.server.v1_16_R3.NetworkManager.a(NetworkManager.java:130)
        at net.minecraft.server.v1_16_R3.NetworkManager.channelRead0(NetworkManager.java:119)
        at net.minecraft.server.v1_16_R3.NetworkManager.channelRead0(NetworkManager.java:1)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:547)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:501)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
        at java.base/java.lang.Thread.run(Thread.java:832)

 

 

Config:

chat:
  gracz: "&7%gracz% &8[>] &7%wiadomosc%"
  admin: "&4(ADMIN) %gracz% &8[>] &7%wiadomosc%"

 

Edytowane przez xNightPower_
Nieaktywny

Błędy umieszczam w spoilerze.

Odnośnik do komentarza
Udostępnij na innych stronach

3 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
7 minut temu, GabE napisał:

Siemka, mam mały problem ponieważ napisałem kod na chat, działał lecz po jakimś czasie zaczął wywalać błąd po napisaniu na chacie i nic sie nie wyświetla również na chacie.

No cóż, błąd jest taki:

7 minut temu, GabE napisał:

Caused by: java.lang.IllegalArgumentException: Permission name cannot be null

[22:44:53] [pool-7-thread-1/ERROR]: [PermissionsEx] Error occurred with PermissionsEx! Please post it to http://git.io/<html><body>You are being <a href="https://git.io/create">redirected</a>.</body></html>. Full error:
java.lang.IllegalArgumentException: Permissions being checked must not be null!

Zrób jakiś debug w postaci wysyłania kontrolnych wiadomości i sprawdzania do którego momentu dochodzi kod.

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

Pokazałeś że masz config może nie ma linijki "uprawnienia.chatkolor" i dlatego wyrzuca ci błąd? 

Nie potrzebnie cancelujesz ten event możesz poprostu ustawić format co umożliwia AsyncPlayerChatEvent czyli setFormat();

Edytowane przez Sneyrox
missclick
Odnośnik do komentarza
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...