java - Error when using ProtocolLibrary PacketAdapter() -
i making craftbukkit plugin has message in player count list, hive-mc or omega realm. coding in ecplise , using protocollib v3.2.0 , craftbukkit 1.7.2 r0.3. new java , don't understand much. know imported.
so far, here imported methods, code, , error
methods:
import java.io.file; import java.io.ioexception; import java.util.arraylist; import java.util.arrays; import java.util.list; import org.bukkit.plugin.java.javaplugin; import com.comphenix.protocol.packettype; import com.comphenix.protocol.protocollibrary; import com.comphenix.protocol.events.listeneroptions; import com.comphenix.protocol.events.listenerpriority; import com.comphenix.protocol.events.packetadapter; import com.comphenix.protocol.wrappers.wrappedgameprofile;
code:
private list<wrappedgameprofile> message = new arraylist<wrappedgameprofile>(); public void onenable() { if(!new file(getdatafolder(),"reset.file").exists()){ try { getconfig().set("pcmessage", arrays.aslist(new string[]{"first line", "second line"})); new file(getdatafolder(),"reset.file").createnewfile(); } catch (ioexception e) { e.printstacktrace(); } } saveconfig(); (string str : getconfig().getstringlist("pcmessage")) message.add(new wrappedgameprofile("1", str)); protocollibrary .getprotocolmanager() .addpacketlistener( new packetadapter( this,listenerpriority.normal, arrays.aslist(new packettype[] {packettype.status.server.out_server_info}), new listeneroptions[] { listeneroptions.async })); { } }
error:
cannot instantiate type packetadapter
as see in javadocs packetadapeter, declared as:
public abstract class packetadapter implements packetlistener
abstract
means class not full class, , must implemented full class or anonymous class, cannot instantiated. need find subclass of packetadapter, or make 1 yourself.
for more information, see java tutorial abstract methods , classes.
Comments
Post a Comment