Invalid Method declaration

Developmento

Mitglied
Hi,

habe hier folgenden Code:

Java:
import java.util.ArrayList;
import java.util.List;




public class Gni {

	private Player player;
	private Npc[] localNpcs;
	private List<Integer> addedIndexes;
	private int newListIndex = 0;
	public Gni(Player player) {
		this.player = player;
		localNpcs = new Npc[256];
		addedIndexes = new ArrayList<Integer>();
	}
	
	private final sendUpdate() {
		player.getConnection().write(createPacket());

	}
	public OutStream createPacket() {
		OutStream packet = new OutStream();
		OutStream updateBlock = new OutStream();
		packet.writePacketVarShort(6);
		processGlobalNpcInform(packet, updateBlock);
		packet.writeBytes(updateBlock.buffer(), 0, updateBlock.offset());
		packet.endPacketVarShort();
		return packet;
	}
	
	private void processGlobalNpcInform(OutStream packet, OutStream updateBlock) {
		 processInScreenNpcs(packet, updateBlock);
		 addInScreenNpcs(packet, updateBlock);
	}
	
	
	private void addInScreenNpcs(OutStream packet,OutStream updateBlock) {
		for (Npc npc : World.getNpcs()) {
			if(newListIndex > 250)
				break;
			if(npc == null || addedIndexes.contains(npc.getIndex()) || !player.getLocation().withinDistance(npc.getLocation()))
				continue;
			packet.writeBits(15, npc.getIndex());
			packet.writeBits(14, npc.getId());
			packet.writeBits(1, 1);
	        int y = npc.getLocation().getY() - player.getLocation().getY();
	        if (y < 15)
	            y += 32;
	        int x = npc.getLocation().getX() - player.getLocation().getX();
	        if (x < 15)
	            x += 32;
			packet.writeBits(5, y);
			packet.writeBits(5, x);
			packet.writeBits(1, npc.getMask().isUpdateNeeded() ? 1 : 0);
			packet.writeBits(2, npc.getLocation().getZ());
			packet.writeBits(3, 0); //direction
			localNpcs[newListIndex++] = npc;
			addedIndexes.add(npc.getIndex());
			if (npc.getMask().isUpdateNeeded())
				appendUpdateBlock(npc, updateBlock);
		}
		if (updateBlock.offset() >= 3)
			packet.writeBits(15, 32767);
		packet.finishBitAccess();
	}
	
	private void processInScreenNpcs(OutStream packet,OutStream updateBlock) {
		int size = newListIndex;
		newListIndex = 0;
		packet.initBitAccess();
		packet.writeBits(8, size);
		for(int index = 0; index < size; index++) {
			Npc npc = localNpcs[index];
			if(npc == null || npc.isHidden() || !player.getLocation().withinDistance(npc.getLocation())) {
				packet.writeBits(1, 1);
				packet.writeBits(2, 3);
				if(npc != null)
					addedIndexes.remove((Object)npc.getIndex());
				continue;
			}
			localNpcs[newListIndex++] = npc;
			if (npc.getWalk().getRunDir() != -1) {
				packet.writeBits(1, 1);
				packet.writeBits(2, 2);
				packet.writeBits(1, 1);
				packet.writeBits(3, npc.getWalk().getWalkDir());
				packet.writeBits(3, npc.getWalk().getRunDir());
				packet.writeBits(1, npc.getMask().isUpdateNeeded() ? 1 : 0);
			}else if (npc.getWalk().getWalkDir() != -1) {
				packet.writeBits(1, 1);
				packet.writeBits(2, 1);
				packet.writeBits(3, npc.getWalk().getWalkDir());
				packet.writeBits(1, npc.getMask().isUpdateNeeded() ? 1 : 0);
			}else{
				if (npc.getMask().isUpdateNeeded()) {
					packet.writeBits(1, 1);
					packet.writeBits(2, 0);
				} else {
					packet.writeBits(1, 0);
				}
			}
			if (npc.getMask().isUpdateNeeded())
				appendUpdateBlock(npc, updateBlock);
		}
	}
	
	private static void appendUpdateBlock(Npc n, OutStream stream) {
		int maskData = 0;
		if(n.getMask().isAnimationUpdate())
			maskData |= 0x4;
		if(n.getMask().isGraphicUpdate())
			maskData |= 0x10;
		if(n.getMask().isGraphic2Update())
			maskData |= 0x2000;
		if(n.getMask().isHitUpdate())
			maskData |= 0x8;
		if(n.getMask().isHit2Update())
			maskData |= 0x400;
		
		
		if(maskData > 128)
			maskData |= 0x1;
		if(maskData > 32768) 
			maskData |= 0x800;
		stream.writeByte(maskData);
		if(maskData > 128)
			stream.writeByte(maskData >> 8);
		if(maskData > 32768)
			stream.writeByte(maskData  >> 16);
		
		
		if(n.getMask().isAnimationUpdate())
			applyAnimationMask(n, stream);
		if(n.getMask().isGraphicUpdate())
			applyGraphicMask(n, stream);
		if(n.getMask().isGraphic2Update())
			applyGraphic2Mask(n, stream);
		if(n.getMask().isHitUpdate())
			applyHit1Mask(n, stream);
		if(n.getMask().isHit2Update())
			applyHit2Mask(n, stream);
	}
	
	private static void applyAnimationMask(Npc n, OutStream outStream) {
		outStream.writeShortLE(n.getMask().getLastAnimation().getId());
		outStream.writeByte128(n.getMask().getLastAnimation().getDelay());
	}
	
	private static void applyGraphicMask(Npc n, OutStream out) {
		out.writeShort128(n.getMask().getLastGraphics().getId());
		out.writeIntV1(n.getMask().getLastGraphics().getDelay());
		out.writeByte128(n.getMask().getLastGraphics().getHeight());
	}
	
	private static void applyGraphic2Mask(Npc n, OutStream out) {
		out.writeShort(n.getMask().getLastGraphics().getId());
		out.writeIntV1(n.getMask().getLastGraphics().getDelay());
		out.writeByteC(n.getMask().getLastGraphics().getHeight());
	}
	
	private static void applyHit1Mask(Npc n, OutStream out) {
		out.writeSmart(n.getHits().getHitDamage1());
		out.writeByte128(n.getHits().getHitType1());
		int Amthp = n.getSkills().getHitPoints();
		int Maxhp = n.getSkills().getMaxHitPoints();
		if (Amthp > Maxhp)
			Amthp = Maxhp;
		out.writeByte128(Amthp*255/Maxhp);
	}
	
	private static void applyHit2Mask(Npc n, OutStream out) {
		out.writeSmart(n.getHits().getHitDamage2());
		out.writeByte(n.getHits().getHitType2());
	}
	
}

Beim Compilen kriege ich folgende Meldung:
Zeile 23: invalid method declaration; return type required
private final sendUpdate() {
-----------^
 

Developmento

Mitglied
Danke für deine Antwort.
Nur habe ich das schon versucht und bekomme ganze 16 Errors
Java:
src\dragonkk\rs2rsps\model\player\Gni.java:117: cannot find symbol
symbol  : method isGraphicUpdate()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isGraphicUpdate())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:119: cannot find symbol
symbol  : method isGraphic2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isGraphic2Update())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:123: cannot find symbol
symbol  : method isHit2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isHit2Update())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:140: cannot find symbol
symbol  : method isGraphicUpdate()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isGraphicUpdate())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:142: cannot find symbol
symbol  : method isGraphic2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isGraphic2Update())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:146: cannot find symbol
symbol  : method isHit2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(n.getMask().isHit2Update())
                              ^
src\dragonkk\rs2rsps\model\player\Gni.java:156: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeShort128(n.getMask().getLastGraphics().getId());
                                             ^
src\dragonkk\rs2rsps\model\player\Gni.java:157: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeIntV1(n.getMask().getLastGraphics().getDelay());
                                          ^
src\dragonkk\rs2rsps\model\player\Gni.java:158: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeByte128(n.getMask().getLastGraphics().getHeight());
                                            ^
src\dragonkk\rs2rsps\model\player\Gni.java:162: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeShort(n.getMask().getLastGraphics().getId());
                                          ^
src\dragonkk\rs2rsps\model\player\Gni.java:163: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeIntV1(n.getMask().getLastGraphics().getDelay());
                                          ^
src\dragonkk\rs2rsps\model\player\Gni.java:164: cannot find symbol
symbol  : method getLastGraphics()
location: class dragonkk.rs2rsps.model.npc.Mask
                out.writeByteC(n.getMask().getLastGraphics().getHeight());
                                          ^
src\dragonkk\rs2rsps\model\npc\Npc.java:73: cannot find symbol
symbol  : method isHit2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                if(!this.getMask().isHit2Update()) {
                                  ^
src\dragonkk\rs2rsps\model\npc\Npc.java:102: cannot find symbol
symbol  : method isHit2Update()
location: class dragonkk.rs2rsps.model.npc.Mask
                }else if(!this.getMask().isHit2Update()) {
                                        ^
src\dragonkk\rs2rsps\model\npc\Npc.java:104: cannot find symbol
symbol  : method setHit2Update(boolean)
location: class dragonkk.rs2rsps.model.npc.Mask
                        this.getMask().setHit2Update(true);
                                      ^
src\dragonkk\rs2rsps\update\EntityUpdate.java:67: sendUpdate() has private acces
s in dragonkk.rs2rsps.model.player.Gni
                                                player.getGni().sendUpdate();
                                                               ^
Note: src\dragonkk\rs2rsps\cache\IdxSystemWriter.java uses or overrides a deprec
ated API.
Note: Recompile with -Xlint:deprecation for details.
16 errors
Drücken Sie eine beliebige Taste . . .
 

hdi

Top Contributor
Ach komm... In deinem ersten Post hieß die Meldung "return type required", die Antwort die du erhalten hast war "Return type fehlt", und darauf deine Antwort "Danke". :D

Und jetzt hast du halt: Cannot find method. Soll ich dir das jetzt wirklich ins Deutsche übersetzen?
Das Problem ist er findet die Methoden nicht. Das kann zB daran liegen dass du irgendwelche Dateien noch nicht gespeichert hast. Oder daran dass du dich irgendwo verschrieben hast (Klassen-/Methodenname)
 

Final_Striker

Top Contributor
Du musst die verwendete Klasse mit import importieren.

Versuche es mal mit:
Java:
import dragonkk.rs2rsps.model.npc.Mask;
 

Developmento

Mitglied
Ach komm... In deinem ersten Post hieß die Meldung "return type required", die Antwort die du erhalten hast war "Return type fehlt", und darauf deine Antwort "Danke". :D

Und jetzt hast du halt: Cannot find method. Soll ich dir das jetzt wirklich ins Deutsche übersetzen?
Das Problem ist er findet die Methoden nicht. Das kann zB daran liegen dass du irgendwelche Dateien noch nicht gespeichert hast. Oder daran dass du dich irgendwo verschrieben hast (Klassen-/Methodenname)

Habs :) Danke für deine Hilfe und auch der anderen.
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
M Lambda "invalid method reference no suitable method found" Allgemeine Java-Themen 2
J Interpreter-Fehler Fehler beim Verschlüsseln Invalid AES key length Allgemeine Java-Themen 1
T JNA: Invalid sizeof type 4 Allgemeine Java-Themen 0
S Invalid Chunk Exception Allgemeine Java-Themen 3
P JavaDoc und Backslashes: "Invalid unicode" Allgemeine Java-Themen 3
R VM-Error - BadWindow (invalid Window parameter) Allgemeine Java-Themen 4
K class invalid for deserialization Allgemeine Java-Themen 2
X sax parse exception invalid XML character Allgemeine Java-Themen 4
B Invalid escape sequenze Allgemeine Java-Themen 17
T PDF drucken: "invalid flavor" Allgemeine Java-Themen 8
F Invalid or Corrupt Jarfile! Allgemeine Java-Themen 3
K Cipherproblem: Invalid key length Allgemeine Java-Themen 7
M javax.mail – Sending failed – Invalid Addresses Allgemeine Java-Themen 8
mrStudent The method append is not applicable for the arguments (Queue<Integer>, Queue<Integer>) Allgemeine Java-Themen 4
J Final Method Allgemeine Java-Themen 9
R Delete files before creating new from temp using Java file method Allgemeine Java-Themen 1
J Reflection-Method Hook? Allgemeine Java-Themen 14
B Exception in Application init method Allgemeine Java-Themen 5
Thallius JSONArray - the method length() is undefined for JSONArray Allgemeine Java-Themen 4
N Per Reflection auf (method) local inner class zugreifen? Allgemeine Java-Themen 3
C Method Area, Stack, Heap Allgemeine Java-Themen 7
R Stop a method??? Allgemeine Java-Themen 34
R Merkwürdiges Verhalten der equals Method Allgemeine Java-Themen 4
N Method-Annotations in aufgerufener Methode auswerten Allgemeine Java-Themen 2
I Template Method pattern mit "geschützten Methoden" Allgemeine Java-Themen 5
X Cannot refer to a non-final variable settings inside an inner class defined in a different method Allgemeine Java-Themen 4
G JavaDoc: Spezielle Beschreibung nur in Method Detail Allgemeine Java-Themen 5
faetzminator IllegalArgumentException bei Method.invoke() Allgemeine Java-Themen 6
R Fehler:method does not override a method from its superclass Allgemeine Java-Themen 3
G javax.jms.IllegalStateException: This method. Allgemeine Java-Themen 4
K Bound mismatch: The generic method sort(List<T>) of ty Allgemeine Java-Themen 4
G Taushen der Input variablen einer method Allgemeine Java-Themen 14
R The mark method of InputStream does nothing. Allgemeine Java-Themen 4
J httpclient: Post-method aber trotzdem "URI to long&quot Allgemeine Java-Themen 4
G Error: Hashtable Type safety: The method put(Object, Object) Allgemeine Java-Themen 6
J Method.invoke -> Exceptions der Funktion abfangen Allgemeine Java-Themen 5
padde479 The static method sleep(long) from the type Thread should. Allgemeine Java-Themen 2
C Code of a method longer than 65535 bytes Allgemeine Java-Themen 3
K The method clone() from the type Object is not visible. Allgemeine Java-Themen 9
O Pointer/reference on method Allgemeine Java-Themen 10
E Open Declaration Funktioniert nicht Allgemeine Java-Themen 0

Ähnliche Java Themen

Neue Themen


Oben