_Firefight

Membre
  • Compteur de contenus

    93
  • Inscription

  • Dernière visite

  • Days Won

    2

_Firefight last won the day on 7 octobre 2015

_Firefight had the most liked content!

Réputation sur la communauté

-16

À propos de _Firefight

  • Rang
    Connaisseur
  • Date de naissance

Jeux

  • Minecraft
    Koora_

Autres informations

  • Genre
    Not Telling

Visiteurs récents du profil

590 visualisations du profil
  1. @TheShark34 Toujours le même problème :/ package fr.koora.nealfight; import java.awt.Color; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.MouseInfo; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JProgressBar; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.UIManager; import fr.theshark34.openlauncherlib.Authenticator; import fr.theshark34.openlauncherlib.GameLauncher; import fr.theshark34.s_update.S_Update; import fr.theshark34.s_update.Util; import net.kronos.mclib.auth.yggdrasil.AuthYggdrasilException; import net.kronos.mclib.auth.yggdrasil.model.response.YggdrasilAuthenticateResponse; public class LauncherFrame extends JFrame { public static final File GAME_DIR = new File(System.getProperty("user.home") + "/.nealfight"); private JLabel titre; private JTextField pseudo; private JPasswordField mdp; private JButton jouer; private JProgressBar pb; private String username = null; private String accessToken = null; private String id = null; public LauncherFrame() { WindowMover mover = new WindowMover(this); this.addMouseListener(mover); this.addMouseMotionListener(mover); this.setTitle("NealFight"); this.setSize(850, 500); this.setContentPane(new Panneau()); this.setUndecorated(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setLayout(null); titre = new JLabel(); titre.setFont(titre.getFont().deriveFont(60f)); titre.setBounds(0, 20, 850, 100); this.add(titre); pseudo = new JTextField(); pseudo.setBounds(15, 390, 150, 20); this.add(pseudo); mdp = new JPasswordField(); mdp.setBounds(15, 420, 150, 20); this.add(mdp); jouer = new JButton("Jouer"); jouer.setBounds(190, 410, 70, 30); this.add(jouer); jouer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Thread t = new Thread() { @Override public void run() { auth(); saveUsername(); update(); launchGame(username, accessToken, id); } }; t.start(); } }); pb = new JProgressBar(); pb.setStringPainted(true); pb.setBounds(0, 480, 850, 20); this.add(pb); this.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } new LauncherFrame().loadUsername(); } private void auth() { pseudo.setEnabled(false); mdp.setEnabled(false); jouer.setEnabled(false); try { YggdrasilAuthenticateResponse rep = Authenticator.auth(GAME_DIR, pseudo.getText(), new String(mdp.getPassword())); username = rep.getSelectedProfile().getName(); accessToken = rep.getAccessToken(); id = rep.getSelectedProfile().getId(); } catch (AuthYggdrasilException e) { pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); pseudo.setText(e.getErrorModel().getErrorMessage()); } if(username != null) { update(); final S_Update su = new S_Update("http://launcher.plutonia.fr/nealfight/", GAME_DIR); Thread t = new Thread() { @Override public void run() { boolean stop = false; while (!stop) { if (Util.getDownloadingFile() != null) { switch (su.getState()) { case S_Update.DOWNLOADING: pb.setString("Téléchargement de " + su.getCurrentFileName()); pb.setMaximum((int) Util.getDownloadingFileSize()); pb.setValue((int) Util.getDownloadingFile() .length()); break; case S_Update.UNZIPPING: pb.setString("Dezzipage de " + su.getCurrentFileName()); break; case S_Update.REMOVING: pb.setString("Suppression de " + su.getCurrentFileName()); break; case S_Update.FINISH: stop = true; break; } } } } }; try { if (su.checkForUpdate()) { pb.setString("Préparation de la mise à jours..."); su.createLists(); pb.setString("Mise à jours en cours..."); t.start(); su.update(); } } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jour NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); e.printStackTrace(); return; } pb.setString("Lancement du jeu en cours..."); try { if (su.checkForUpdate()) { pb.setString("Préparation de la mise à jours..."); su.createLists(); pb.setString("Mise à jours en cours..."); su.update(); } pb.setString("Lancement du jeu en cours..."); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jour NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); e.printStackTrace(); return; } } } private void update() { pb.setString("Vérification des mises à jours..."); } private void launchGame(String username, String accessToken, String id) { GameLauncher gl = new GameLauncher("1.7.2", GAME_DIR, "NealFight", username, accessToken, id, new String[] {"-Xms512M", "-Xmx1024M"}, false, false); this.setVisible(false); try { Process p = gl.launchMinecraft(); gl.printProcessOutput(p); p.waitFor(); System.exit(0); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jours NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); } } public static final File USERNAME_FILE = new File(GAME_DIR, "username.txt"); private void loadUsername() { GAME_DIR.mkdirs(); try { BufferedReader br = new BufferedReader( new FileReader(USERNAME_FILE)); pseudo.setText(br.readLine()); br.close(); } catch (IOException e) { } } private void saveUsername() { try { FileWriter fw = new FileWriter(USERNAME_FILE); fw.write(pseudo.getText()); fw.close(); } catch (IOException e) { } } public class WindowMover extends MouseAdapter { private Point click; private JFrame window; @Override public void mouseDragged(MouseEvent e) { if (click != null) { Point draggedPoint = MouseInfo.getPointerInfo() .getLocation(); window.setLocation(new Point((int) draggedPoint.getX() - (int) click.getX(), (int) draggedPoint .getY() - (int) click.getY())); } } @Override public void mousePressed(MouseEvent e) { click = e.getPoint(); } public WindowMover(JFrame window) { this.window = window; } } public class Panneau extends JPanel { public void paintComponent(Graphics g){ try { Image img = ImageIO.read(new File("nealfight.png")); g.drawImage(img, 850, 500, this); //Pour une image de fond //g.drawImage(img, 850, 500, this.getWidth(), this.getHeight(), this); } catch (IOException e) { e.printStackTrace(); } } } }
  2. ça ne le met pas ... :/ package fr.koora.nealfight; import java.awt.Color; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.MouseInfo; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JProgressBar; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.UIManager; import fr.theshark34.openlauncherlib.Authenticator; import fr.theshark34.openlauncherlib.GameLauncher; import fr.theshark34.s_update.S_Update; import fr.theshark34.s_update.Util; import net.kronos.mclib.auth.yggdrasil.AuthYggdrasilException; import net.kronos.mclib.auth.yggdrasil.model.response.YggdrasilAuthenticateResponse; public class LauncherFrame extends JFrame { public static final File GAME_DIR = new File(System.getProperty("user.home") + "/.nealfight"); private JLabel titre; private JTextField pseudo; private JPasswordField mdp; private JButton jouer; private JProgressBar pb; private String username = null; private String accessToken = null; private String id = null; public LauncherFrame() { WindowMover mover = new WindowMover(this); this.addMouseListener(mover); this.addMouseMotionListener(mover); this.setTitle("NealFight"); this.setSize(850, 500); this.setUndecorated(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setLayout(null); titre = new JLabel(); titre.setFont(titre.getFont().deriveFont(60f)); titre.setBounds(0, 20, 850, 100); this.add(titre); pseudo = new JTextField(); pseudo.setBounds(15, 390, 150, 20); this.add(pseudo); mdp = new JPasswordField(); mdp.setBounds(15, 420, 150, 20); this.add(mdp); jouer = new JButton("Jouer"); jouer.setBounds(190, 410, 70, 30); this.add(jouer); jouer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Thread t = new Thread() { @Override public void run() { auth(); saveUsername(); update(); launchGame(username, accessToken, id); } }; t.start(); } }); pb = new JProgressBar(); pb.setStringPainted(true); pb.setBounds(0, 480, 850, 20); this.add(pb); this.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } new LauncherFrame().loadUsername(); } private void auth() { pseudo.setEnabled(false); mdp.setEnabled(false); jouer.setEnabled(false); try { YggdrasilAuthenticateResponse rep = Authenticator.auth(GAME_DIR, pseudo.getText(), new String(mdp.getPassword())); username = rep.getSelectedProfile().getName(); accessToken = rep.getAccessToken(); id = rep.getSelectedProfile().getId(); } catch (AuthYggdrasilException e) { pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); pseudo.setText(e.getErrorModel().getErrorMessage()); } if(username != null) { update(); final S_Update su = new S_Update("http://launcher.plutonia.fr/nealfight/", GAME_DIR); Thread t = new Thread() { @Override public void run() { boolean stop = false; while (!stop) { if (Util.getDownloadingFile() != null) { switch (su.getState()) { case S_Update.DOWNLOADING: pb.setString("Téléchargement de " + su.getCurrentFileName()); pb.setMaximum((int) Util.getDownloadingFileSize()); pb.setValue((int) Util.getDownloadingFile() .length()); break; case S_Update.UNZIPPING: pb.setString("Dezzipage de " + su.getCurrentFileName()); break; case S_Update.REMOVING: pb.setString("Suppression de " + su.getCurrentFileName()); break; case S_Update.FINISH: stop = true; break; } } } } }; try { if (su.checkForUpdate()) { pb.setString("Préparation de la mise à jours..."); su.createLists(); pb.setString("Mise à jours en cours..."); t.start(); su.update(); } } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jour NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); e.printStackTrace(); return; } pb.setString("Lancement du jeu en cours..."); try { if (su.checkForUpdate()) { pb.setString("Préparation de la mise à jours..."); su.createLists(); pb.setString("Mise à jours en cours..."); su.update(); } pb.setString("Lancement du jeu en cours..."); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jour NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); pseudo.setEnabled(true); mdp.setEnabled(true); jouer.setEnabled(true); e.printStackTrace(); return; } } } private void update() { pb.setString("Vérification des mises à jours..."); } private void launchGame(String username, String accessToken, String id) { GameLauncher gl = new GameLauncher("1.7.2", GAME_DIR, "NealFight", username, accessToken, id, new String[] {"-Xms512M", "-Xmx1024M"}, false, false); this.setVisible(false); try { Process p = gl.launchMinecraft(); gl.printProcessOutput(p); p.waitFor(); System.exit(0); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Impossible de mettre à jours NealFight, veuillez contacter un gérant du serveur : " + e, "Erreur !", JOptionPane.ERROR_MESSAGE); } } public static final File USERNAME_FILE = new File(GAME_DIR, "username.txt"); private void loadUsername() { GAME_DIR.mkdirs(); try { BufferedReader br = new BufferedReader( new FileReader(USERNAME_FILE)); pseudo.setText(br.readLine()); br.close(); } catch (IOException e) { } } private void saveUsername() { try { FileWriter fw = new FileWriter(USERNAME_FILE); fw.write(pseudo.getText()); fw.close(); } catch (IOException e) { } } public class WindowMover extends MouseAdapter { private Point click; private JFrame window; @Override public void mouseDragged(MouseEvent e) { if (click != null) { Point draggedPoint = MouseInfo.getPointerInfo() .getLocation(); window.setLocation(new Point((int) draggedPoint.getX() - (int) click.getX(), (int) draggedPoint .getY() - (int) click.getY())); } } @Override public void mousePressed(MouseEvent e) { click = e.getPoint(); } public WindowMover(JFrame window) { this.window = window; } } public class Panneau extends JPanel { public void paintComponent(Graphics g){ try { Image img = ImageIO.read(new File("nealfight.png")); g.drawImage(img, 850, 500, this); //Pour une image de fond //g.drawImage(img, 850, 500, this.getWidth(), this.getHeight(), this); } catch (IOException e) { e.printStackTrace(); } } } } http://prntscr.com/6d416l
  3. No soucis ^^' Bonsoir, J'aimerais savoir une info, pour render une image background comme fait-on ? car là ça me met ça: http://prntscr.com/6d3fu5 Merci de vos réponses
  4. MERRCI
  5. J'attend tjrs, j'ai payé, et je n'ai rien, arnaque. Déconseille.
  6. Encore d'actualité ?