Jump to content
La fin ?! Elle est là ! ×
×
×
  • Create New...
  • 0

erreur de compilation


sotha sil
 Share

Question

Bonjour à tous^^

 

Voilà, je voudrais compiler mon fichier.java en .class, mais lorsque je lance la commande DOS, il m'affiche 10 erreurs, est-ce que quelqu'un pourrait m'aider à les résoudre SVP.?

voici les erreurs :

Hidden Content

    Give reaction to this post to see the hidden content.

 

 

Je suis disponible sur skype au besoin, sous le pseudo novelastre(indoril GT).

 

Merci à tous pour votre aide.

Cordialement

 

Sotha Sil

 

edit : voilà, une couleur pour le lien^^

Edited by Funky Emulation
Core X - External 2 Internal
Link to comment
Share on other sites

  • Answers 16
  • Created
  • Last Reply

Top Posters For This Question

16 answers to this question

Recommended Posts

  • 0
  • Retraité

Le finally avant ton "case 'g' :" n'est pas fermé, le reste doit découler de là.

 

package org.icore.game.parse;

import java.util.Map;

import org.icore.client.Player;
import org.icore.common.SQLManager;
import org.icore.common.SocketManager;
import org.icore.common.World;
import org.icore.game.GameThread;
import org.icore.kernel.Config;
import org.icore.object.Objects;

public class ParseAccount 
{
public static void parseAccountPacket(String packet, GameThread gt)
{	
	switch(packet.charAt(1))
	{
		case 'A':
			String[] infos = packet.substring(2).split("\\|");
			if(SQLManager.persoExist(infos[0]))
			{
				SocketManager.GAME_SEND_NAME_ALREADY_EXIST(gt.get_out());
				return;
			}
			//Validation du nom du personnage
			boolean isValid = true;
			String name = infos[0].toLowerCase();
			//Vérifie d'abord si il contient des termes définit
			if (name.length() < 2 && name.length() > 20 || name.contains("mj") || name.contains("modo") || name.contains("admin")) 
			{
				isValid = false;
			}

			//Si le nom passe le test, on vérifie que les caractère entré sont correct.
			if(isValid)
			{
				int tiretCount = 0;
				char exLetterA = ' ';
				char exLetterB = ' ';
				for(char curLetter : name.toCharArray())
				{
					if(!((curLetter >= 'a' && curLetter <= 'z') || curLetter == '-'))
					{
						isValid = false;
						break;
					}
					if(curLetter == exLetterA && curLetter == exLetterB)
					{
						isValid = false;
						break;
					}
					if(curLetter >= 'a' && curLetter <= 'z')
					{
						exLetterA = exLetterB;
						exLetterB = curLetter;
					}
					if(curLetter == '-')
					{
						if(tiretCount >= 1)
						{
							isValid = false;
							break;
						}
						else
						{
							tiretCount++;
						}
					}
				}
			}
			//Si le nom est invalide
			if(!isValid)
			{
				SocketManager.GAME_SEND_NAME_ALREADY_EXIST(gt.get_out());
				return;
			}
			if(gt.get_compte().GET_PERSO_NUMBER() >= Config.CONFIG_MAX_PERSOS)
			{
				SocketManager.GAME_SEND_CREATE_PERSO_FULL(gt.get_out());
				return;
			}
			if(gt.get_compte().createPerso(infos[0], Integer.parseInt(infos[2]), Integer.parseInt(infos[1]), Integer.parseInt(infos[3]),Integer.parseInt(infos[4]), Integer.parseInt(infos[5])))
			{
				SocketManager.GAME_SEND_CREATE_OK(gt.get_out());
				SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), gt.get_compte().get_persos());
			}
			else
			{
				SocketManager.GAME_SEND_CREATE_FAILED(gt.get_out());
			}				
	        break;

		case 'B':
               //Characteristics 2.0 améliorés by Return
               int stats = 0; // La stats

               int nombreDeFoi = 0;

               try
			{
				stats = Integer.parseInt(packet.substring(2,4)); // LA STATS A AJOUTER
				nombreDeFoi = Integer.parseInt(packet.substring(5,packet.length()));

				if(stats<0)
					return;

				if(gt.getPerso().get_capital() < nombreDeFoi)
				{
					nombreDeFoi = gt.getPerso().get_capital();
				}
             
				gt.getPerso().boostStatFixedCount(stats, nombreDeFoi);
               }
               catch(Exception e)
			{}
               finally
			{
				gt.getPerso().set_savestat(0);

				SocketManager.GAME_SEND_KODE(gt.getPerso(), "V");
			}
			break;

		case 'g' :
			//Cadeaux à la connexion
			int presents = gt.get_compte().getCadeau();
			if(presents != 0)
			{
				String idPresent = Integer.toString(presents, 16);
				String effect = World.getObjTemplate(presents).getStrTemplate();
				SocketManager.GAME_SEND_Ag_PACKET(gt.get_out(), presents, "1~" + idPresent + "~1~~" + effect);
			}
			break;

		case 'G':
			sendAccountPresent(packet.substring(2), gt.getPerso());
			break;

		case 'D':
			String[] split = packet.substring(2).split("\\|");
			int GUID = Integer.parseInt(split[0]);
			String reponse = split.length>1?split[1]:"";

			if(gt.get_compte().get_persos().containsKey(GUID))
			{
				if(gt.get_compte().get_persos().get(GUID).get_lvl() <20 ||(gt.get_compte().get_persos().get(GUID).get_lvl() >=20 && reponse.equals(gt.get_compte().get_reponse())))
				{
					gt.get_compte().deletePerso(GUID);
					SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), gt.get_compte().get_persos());
				}
				else
					SocketManager.GAME_SEND_DELETE_PERSO_FAILED(gt.get_out());
			}
			else
				SocketManager.GAME_SEND_DELETE_PERSO_FAILED(gt.get_out());
			break;

		case 'f':
			int queueID = 1;
			int position = 1;
			SocketManager.MULTI_SEND_Af_PACKET(gt.get_out(),position,1,1,""+1,queueID);
			break;

		case 'i':
			gt.get_compte().setClientKey(packet.substring(2));
			break;

		case 'L':
			Map persos = gt.get_compte().get_persos();

			for(Player p : persos.values())
			{
				if(p.get_fight() != null && p.get_fight().getFighterByPerso(p) != null)
				{
					gt.get_compte().setGameThread(p.get_compte().getGameThread());
					gt.setPerso(p);
					if(gt.getPerso() != null)
					{
						gt.getPerso().OnJoinGame();
						return;
					}
				}
			}

			SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), persos);
			//SocketManager.GAME_SEND_HIDE_GENERATE_NAME(gt.get_out());
			break;

		case 'S':
			int charID = Integer.parseInt(packet.substring(2));

			if(gt.get_compte().get_persos().get(charID) != null)
			{
				gt.get_compte().setGameThread(gt);
				gt.setPerso(gt.get_compte().get_persos().get(charID));
				if(gt.getPerso() != null)
				{
					gt.getPerso().OnJoinGame();
					return;
				}
			}

			SocketManager.GAME_SEND_PERSO_SELECTION_FAILED(gt.get_out());
			break;

		case 'T':
			int guid = Integer.parseInt(packet.substring(2));
			gt.set_compte(Config.gameServer.getWaitingCompte(guid));

			if(gt.get_compte() != null)
			{
				String ip = gt.get_s().getInetAddress().getHostAddress();

				gt.get_compte().setGameThread(gt);
				gt.get_compte().setCurIP(ip);
				Config.gameServer.delWaitingCompte(gt.get_compte());
				SocketManager.GAME_SEND_ATTRIBUTE_SUCCESS(gt.get_out());
			}
			else
			{
				SocketManager.GAME_SEND_ATTRIBUTE_FAILED(gt.get_out());
			}
			break;

		case 'V':
			SocketManager.GAME_SEND_AV0(gt.get_out());
			break;

		case 'P':
			SocketManager.REALM_SEND_REQUIRED_APK(gt.get_out());
			break;
	}
}

public static void sendAccountPresent(String packet, Player _perso) 
{
	String[] infos = packet.split("\\|");
	int objectID = Integer.parseInt(infos[0]);
	int guidPlayer = Integer.parseInt(infos[1]);
	Player player = null;
	Objects object = null;

	try 
	{
		player = World.getPersonnage(guidPlayer);
		object = World.getObjTemplate(objectID).createNewItem(1, true, -1);
	} 
	catch (Exception e) 
	{}

	if (player == null || object == null) 
	{
		return;
	}

	player.addObjet(object, false);
	World.addObjet(object, true);
	_perso.get_compte().setCadeau();
	SQLManager.UPDATE_PRESENTS(_perso.get_compte());
	SocketManager.GAME_SEND_AGK_PACKET(_perso.get_compte().getGameThread().get_out());
}	
}

java style =)

Link to comment
Share on other sites

  • 0

ah navré, j'avais pas vu le menu déroulant :-/merci pour tout^^

 

EDIT : mais maintenant ça me met 41 erreurs lorsque je veux compiler :-/

 

Hidden Content

    Give reaction to this post to see the hidden content.

Edited by Funky Emulation
Core X - External 2 Internal
Link to comment
Share on other sites

  • 0

package org.icore.game.parse;

import java.util.Map;

import org.icore.client.Player;
import org.icore.common.SQLManager;
import org.icore.common.SocketManager;
import org.icore.common.World;
import org.icore.game.GameThread;
import org.icore.kernel.Config;
import org.icore.object.Objects;

public class ParseAccount {

public static void parseAccountPacket(String packet, GameThread gt)
{

	switch(packet.charAt(1))
	{
		case 'A':
			String[] infos = packet.substring(2).split("\\|");
			if(SQLManager.persoExist(infos[0]))
			{
				SocketManager.GAME_SEND_NAME_ALREADY_EXIST(gt.get_out());
				return;
			}
			//Validation du nom du personnage
			boolean isValid = true;
			String name = infos[0].toLowerCase();
			//V�rifie d'abord si il contient des termes d�finit
			if (name.length() < 2 && name.length() > 20 || name.contains("mj") || name.contains("modo") || name.contains("admin")) {
				isValid = false;
			}

			//Si le nom passe le test, on v�rifie que les caract�re entr� sont correct.
			if(isValid)
			{
				int tiretCount = 0;
				char exLetterA = ' ';
				char exLetterB = ' ';
				for(char curLetter : name.toCharArray())
				{
					if(!((curLetter >= 'a' && curLetter <= 'z') || curLetter == '-'))
					{
						isValid = false;
						break;
					}
					if(curLetter == exLetterA && curLetter == exLetterB)
					{
						isValid = false;
						break;
					}
					if(curLetter >= 'a' && curLetter <= 'z')
					{
						exLetterA = exLetterB;
						exLetterB = curLetter;
					}
					if(curLetter == '-')
					{
						if(tiretCount >= 1)
						{
							isValid = false;
							break;
						}
						else
						{
							tiretCount++;
						}
					}
				}
			}
			//Si le nom est invalide
			if(!isValid)
			{
				SocketManager.GAME_SEND_NAME_ALREADY_EXIST(gt.get_out());
				return;
			}
			if(gt.get_compte().GET_PERSO_NUMBER() >= Config.CONFIG_MAX_PERSOS)
			{
				SocketManager.GAME_SEND_CREATE_PERSO_FULL(gt.get_out());
				return;
			}
			if(gt.get_compte().createPerso(infos[0], Integer.parseInt(infos[2]), Integer.parseInt(infos[1]), Integer.parseInt(infos[3]),Integer.parseInt(infos[4]), Integer.parseInt(infos[5])))
			{
				SocketManager.GAME_SEND_CREATE_OK(gt.get_out());
				SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), gt.get_compte().get_persos());
			}else
			{
				SocketManager.GAME_SEND_CREATE_FAILED(gt.get_out());
			}

	        break;


              case 'B':
               //Characteristics 2.0 am�lior�s by Return
               int stats = 0; // La stats

               int nombreDeFoi = 0;

               try{
               stats = Integer.parseInt(packet.substring(2,4)); // LA STATS A AJOUTER
               nombreDeFoi = Integer.parseInt(packet.substring(5,packet.length()));
               if(stats<0)

                   return;

               if(gt.getPerso().get_capital() < nombreDeFoi)
               {
                   nombreDeFoi=gt.getPerso().get_capital();
               }
               gt.getPerso().boostStatFixedCount(stats, nombreDeFoi);

               }
                catch(Exception e){}
               
               finally{}

               gt.getPerso().set_savestat(0);

                SocketManager.GAME_SEND_KODE(gt.getPerso(), "V");

		case 'g'://Cadeaux � la connexion
			int presents = gt.get_compte().getCadeau();
			if (presents != 0) {
				String idPresent = Integer.toString(presents, 16);
				String effect = World.getObjTemplate(presents).getStrTemplate();
				SocketManager.GAME_SEND_Ag_PACKET(gt.get_out(), presents, "1~" + idPresent + "~1~~" + effect);
			}
			break;
		case 'G':
			sendAccountPresent(packet.substring(2), gt.getPerso());
			break;
		case 'D':
			String[] split = packet.substring(2).split("\\|");
			int GUID = Integer.parseInt(split[0]);
			String reponse = split.length>1?split[1]:"";

			if(gt.get_compte().get_persos().containsKey(GUID))
			{
				if(gt.get_compte().get_persos().get(GUID).get_lvl() <20 ||(gt.get_compte().get_persos().get(GUID).get_lvl() >=20 && reponse.equals(gt.get_compte().get_reponse())))
				{
					gt.get_compte().deletePerso(GUID);
					SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), gt.get_compte().get_persos());
				}
				else
					SocketManager.GAME_SEND_DELETE_PERSO_FAILED(gt.get_out());
			}else
				SocketManager.GAME_SEND_DELETE_PERSO_FAILED(gt.get_out());
		break;

		case 'f':
			int queueID = 1;
			int position = 1;
			SocketManager.MULTI_SEND_Af_PACKET(gt.get_out(),position,1,1,""+1,queueID);
		break;

		case 'i':
			gt.get_compte().setClientKey(packet.substring(2));
		break;

		case 'L':
			Map persos = gt.get_compte().get_persos();
			for(Player p : persos.values())
			{
				if(p.get_fight() != null && p.get_fight().getFighterByPerso(p) != null)
				{
					gt.get_compte().setGameThread(p.get_compte().getGameThread());
					gt.setPerso(p);
					if(gt.getPerso() != null)
					{
						gt.getPerso().OnJoinGame();
						return;
					}
				}
			}

			SocketManager.GAME_SEND_PERSO_LIST(gt.get_out(), persos);
			//SocketManager.GAME_SEND_HIDE_GENERATE_NAME(gt.get_out());
		break;

		case 'S':
			int charID = Integer.parseInt(packet.substring(2));
			if(gt.get_compte().get_persos().get(charID) != null)
			{
				gt.get_compte().setGameThread(gt);
				gt.setPerso(gt.get_compte().get_persos().get(charID));
				if(gt.getPerso() != null)
				{
					gt.getPerso().OnJoinGame();
					return;
				}
			}
			SocketManager.GAME_SEND_PERSO_SELECTION_FAILED(gt.get_out());
		break;

		case 'T':
			int guid = Integer.parseInt(packet.substring(2));
			gt.set_compte(Config.gameServer.getWaitingCompte(guid));
			if(gt.get_compte() != null)
			{
				String ip = gt.get_s().getInetAddress().getHostAddress();

				gt.get_compte().setGameThread(gt);
				gt.get_compte().setCurIP(ip);
				Config.gameServer.delWaitingCompte(gt.get_compte());
				SocketManager.GAME_SEND_ATTRIBUTE_SUCCESS(gt.get_out());
			}else
			{
				SocketManager.GAME_SEND_ATTRIBUTE_FAILED(gt.get_out());
			}
		break;

		case 'V':
			SocketManager.GAME_SEND_AV0(gt.get_out());
		break;

		case 'P':
			SocketManager.REALM_SEND_REQUIRED_APK(gt.get_out());
			break;
	}
}

public static void sendAccountPresent(String packet, Player _perso) {
	String[] infos = packet.split("\\|");
	int objectID = Integer.parseInt(infos[0]);
	int guidPlayer = Integer.parseInt(infos[1]);
	Player player = null;
	Objects object = null;

	try {
		player = World.getPersonnage(guidPlayer);
		object = World.getObjTemplate(objectID).createNewItem(1, true, -1);
	} catch (Exception e) {}
	if (player == null || object == null) {
		return;
	}
	player.addObjet(object, false);
	World.addObjet(object, true);
	_perso.get_compte().setCadeau();
	SQLManager.UPDATE_PRESENTS(_perso.get_compte());
	SocketManager.GAME_SEND_AGK_PACKET(_perso.get_compte().getGameThread().get_out());
}


}

Et là ?

Link to comment
Share on other sites

  • 0
  • Retraité

Ton point de vue sur les erreurs est trop simpliste... Il y a plusieurs analyses successives lors de la compilation, et si une erreur est rencontrée dans une analyse la suivante ne s'exécute pas.

 

Comme tu ne sais visiblement pas coder je te conseille d'installer Eclipse pour faire tes modifications, la compilation sera bien plus facile à faire qu'à la cmd...

 

Pour finir le fait de laisser le finally vide, dans le code de Gin, est discutable tout dépend de ce que font les fonctions exécutées mais il manque le break; pour cloturer le case 'B' (ca ne produit pas d'erreur mais il est nécessaire au niveau de la logique)

java style =)

Link to comment
Share on other sites

  • 0

simpliste.?non je dirais (comme tu l'as dit), elles sont vue d'un œil de néophyte hélas :-/

Voilà pourquoi je m'adresse à vous, le java, je voudrais l'apprendre (autodidacte, openclassroom), mais IRL je ne peux pas :-/

 

Le texte java, permet le mode tactique dans l'émulateur 1.29.

et cette erreur.?elle viendrais de ou alors.?:-/

Link to comment
Share on other sites

  • 0
  • Retraité

Du fait que tu as sans doute mal recopié et oublié le p de package au tout début. Mais je te répète que ma solution est meilleure que celle de Gin vu qu'elle remet le break; comme il faut.

 

Pour les erreurs rencontrées la dernière fois, tu saurai faire un screen des fichiers présents dans le même dossier que ton ParseAccount.java ?

java style =)

Link to comment
Share on other sites

  • 0

je prend ta solution alors, pas de soucis^^

(merci à lui aussi en tout cas^^)

 

voila le screen que tu veux :

Hidden Content

    Give reaction to this post to see the hidden content.

Edited by Funky Emulation
Core X - External 2 Internal
Link to comment
Share on other sites

  • 0

Mais je te répète que ma solution est meilleure que celle de Gin vu qu'elle remet le break; comme il faut

Je vois pas en quoi c'est meilleur vue qu'en aucun cas la compilation posera problème, après c'est sur que niveau logique, il serait juste de rajouter un break;

Link to comment
Share on other sites

  • 0

Pour ma pars, je serais pas t'en dire plus sotha, mise à pars suivre le conseil de Nicosti.

Installe Eclipse pour faire tes modifications, la compilation est bien plus facile que de le faire via l'invite de commande.

Link to comment
Share on other sites

  • 0
  • Retraité

Je vois pas en quoi c'est meilleur vue qu'en aucun cas la compilation posera problème, après c'est sur que niveau logique, il serait juste de rajouter un break;

 

T'inquiète je sais, je l'avais dis au message d'avant que c'était juste meilleur au niveau de la logique de mettre le break; ;)

 

 

Après, si je me souviens des erreurs, il me semble qu'elles étaient dues au fait que lors de la compilation le compilateur ne trouvait pas certaines classes. Du coup installe eclipse et ajoute moi sur Skype j'essayerai de t'aider ce week end.

  • J'adore 1

java style =)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.