Fix issue with not synchronizing local avatar with server data at

program startup.
dev
sigonasr2 7 years ago
parent 58520ae3f3
commit 54181c7f7a
  1. BIN
      sigIRCv2.jar
  2. 1
      src/sig/modules/RabiRace/Profile.java
  3. 2
      src/sig/modules/RabiRace/Session.java
  4. 68
      src/sig/modules/RabiRace/SessionCreateWindow.java
  5. 3
      src/sig/modules/RabiRaceModule.java

Binary file not shown.

@ -198,6 +198,7 @@ public class Profile {
int i=0;
displayName = data[i++];
avatar = Avatar.getAvatarFromID(Integer.parseInt(data[i++]));
System.out.println("Updated Avatar for Player "+displayName+" with Avatar "+avatar.displayName);
playtime = Integer.parseInt(data[i++]);
healthUps = Integer.parseInt(data[i++]);
manaUps = Integer.parseInt(data[i++]);

@ -33,7 +33,7 @@ public class Session {
if (split.length>=7) {
String val = split[i++];
String[] playerlist = val.split(";");
System.out.println(Arrays.toString(playerlist));
//System.out.println(Arrays.toString(playerlist));
if (playerlist.length>1) {
for (String s : playerlist) {
Profile p = new Profile(RabiRaceModule.module,true);

@ -8,6 +8,8 @@ import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Box;
import javax.swing.BoxLayout;
@ -29,11 +31,13 @@ import sig.utils.TextUtils;
public class SessionCreateWindow extends JFrame{
JPanel container = new JPanel();
LengthValidationField session_name = new LengthValidationField(16);
LengthValidationField session_name = new LengthValidationField(24);
NumberValidationField maxplayers = new NumberValidationField();
FloatValidationField difficulty = new FloatValidationField();
JPasswordField pass = new JPasswordField();
JComboBox gametype = new JComboBox();
JComboBox<String> gametype = new JComboBox<String>();
NumberValidationField eggcount = new NumberValidationField();
List<JComboBox<String>> itemHunt = new ArrayList<JComboBox<String>>();
JButton create = new JButton("Create");
public SessionCreateWindow() {
@ -44,9 +48,12 @@ public class SessionCreateWindow extends JFrame{
JPanel playerpanel = new JPanel();
JPanel passwordpanel = new JPanel();
JPanel difficultypanel = new JPanel();
JPanel modepanel = new JPanel();
JPanel eggpropertiespanel = new JPanel();
JPanel itempropertiespanel = new JPanel();
JPanel[] panel_list = new JPanel[]{
namepanel,playerpanel,passwordpanel,difficultypanel
namepanel,playerpanel,passwordpanel,difficultypanel,modepanel,eggpropertiespanel,itempropertiespanel
};
for (JPanel panel : panel_list) {
@ -58,7 +65,7 @@ public class SessionCreateWindow extends JFrame{
JLabel nameLabel = new JLabel("Session Name: ");
String label = RabiRaceModule.module.myProfile.displayName+"'s Race";
if (label.length()>16) {
if (label.length()>session_name.length) {
label = "My Rabi-Race!";
}
session_name.setText(label);
@ -81,8 +88,50 @@ public class SessionCreateWindow extends JFrame{
difficulty.setPreferredSize(new Dimension(60,24));
difficulty.setText("5.00");
difficultypanel.add(Box.createHorizontalStrut(60));
difficultypanel.add(difficultyLabel);
difficultypanel.add(difficulty);
difficultypanel.add(Box.createHorizontalStrut(60));
JLabel modeLabel = new JLabel("Game Mode: ");
gametype.setPreferredSize(new Dimension(120,24));
gametype.addItem("Egg Mode");
gametype.addItem("Item Mode");
itempropertiespanel.setVisible(false);
eggpropertiespanel.setLayout(new BoxLayout(eggpropertiespanel,BoxLayout.LINE_AXIS));
eggpropertiespanel.setVisible(false);
JLabel eggLabel = new JLabel("Egg Count: ");
eggcount.setText("5");
eggcount.setPreferredSize(new Dimension(60,24));
eggpropertiespanel.add(Box.createHorizontalStrut(64));
eggpropertiespanel.add(eggLabel);
eggpropertiespanel.add(eggcount);
eggpropertiespanel.add(Box.createHorizontalStrut(192));
eggpropertiespanel.setSize(400, 24);
eggpropertiespanel.setMinimumSize(new Dimension(400, 24));
gametype.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
switch (((String)gametype.getSelectedItem())) {
case "Egg Mode":{
eggpropertiespanel.setVisible(true);
itempropertiespanel.setVisible(false);
}break;
case "Item Mode":{
eggpropertiespanel.setVisible(false);
itempropertiespanel.setVisible(true);
}break;
}
}
});
//itempropertiespanel.
modepanel.add(modeLabel);
modepanel.add(gametype);
for (JPanel panel : panel_list) {
panel.add(Box.createRigidArea(new Dimension(24,24)));
@ -149,6 +198,9 @@ public class SessionCreateWindow extends JFrame{
});
//create.add(Box.createRigidArea(new Dimension(24,24)));
playerpanel.setSize(200,24);
passwordpanel.setSize(200,24);
container.setLayout(new BoxLayout(container,BoxLayout.PAGE_AXIS));
@ -157,13 +209,15 @@ public class SessionCreateWindow extends JFrame{
container.add(playerpanel);
container.add(passwordpanel);
container.add(difficultypanel);
//container.add(modepanel);
//container.add(eggpropertiespanel);
container.add(create);
container.add(Box.createRigidArea(new Dimension(24,24)));
this.add(container);
this.setSize(400, 192);
this.setMinimumSize(new Dimension(400, 192));
this.setMaximumSize(new Dimension(400, 192));
this.setSize(400, 240);
this.setMinimumSize(new Dimension(400, 240));
this.setMaximumSize(new Dimension(400, 240));
this.setResizable(false);
}

@ -117,6 +117,9 @@ public class RabiRaceModule extends Module{
}
}
}, 5000, 5000, TimeUnit.MILLISECONDS);
myProfile.downloadProfile(); //Synchronize our profile at the beginning.
ScheduledExecutorService scheduler2 = Executors.newScheduledThreadPool(1);
scheduler2.scheduleWithFixedDelay(()->{
if (foundRabiRibi) {

Loading…
Cancel
Save