Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean inputErrors(){
- JTextField[] tinyint = {G_level,M_slots,A_holy,A_shadow,A_arcane,A_nature,A_fire,A_frost};
- JTextField[] smallint = {M_carry,M_stack,A_armor,W_speed,G_durability,S_0value,S_1value,S_2value,S_3value,S_4value,S_5value,S_6value,S_7value,S_8value,S_9value};
- JTextField[] mediumint = {NEWENTRYFIELD,A_block};
- JTextField[] regularint = {M_buy,M_sell};
- String[] tinynames = {"Level","Slots","Holy res","Shadow res","Arcane res","Nature res","Fire res","Frost res"};
- String[] smallnames = {"Max carry","Max stack","Armor","Speed","Durability","Stat values","Stat values","Stat values","Stat values","Stat values","Stat values","Stat values","Stat values","Stat values","Stat values"};
- String[] mediumnames = {"Entry","Block"};
- String[] regularnames = {"Buy price","Sell price"};
- boolean errors = false;
- int i=0,j=0,k=0,l=0;
- String errorz = "The following errors ocurred during export:\n";
- for (JTextField next : tinyint){if (next.getText().length() == 0){next.setText("0");}
- try{if(Float.parseFloat(next.getText()) > 127){next.setText("127");}i++;
- } catch (Exception e){errorz+=tinynames[i] + " must contain only numbers\n";errors = true;}}
- for (JTextField next : smallint){if (next.getText().length() == 0){next.setText("0");}
- try{if(Float.parseFloat(next.getText()) > 32767){next.setText("32767");}j++;
- } catch (Exception e){errorz+=smallnames[j] + " must contain only numbers\n";errors = true;}}
- for (JTextField next : mediumint){if (next.getText().length() == 0){next.setText("0");}
- try{if(Float.parseFloat(next.getText()) > 8388607){next.setText("8388607");}k++;
- } catch (Exception e){errorz+=mediumnames[k] + " must contain only numbers\n";errors = true;}}
- for (JTextField next : regularint){if (next.getText().length() == 0){next.setText("0");}
- try{if(Float.parseFloat(next.getText()) > 2147483647){next.setText("2147483647");}l++;
- } catch (Exception e){errorz+=regularnames[l] + " must contain only numbers\n";errors = true;}}
- if (G_name.getText().indexOf("\"") != -1){errorz+="Name must not contain quotation marks, apostrophes, or asterisks\n";errors = true;}
- if (G_name.getText().indexOf("\'") != -1){errorz+="Name must not contain quotation marks, apostrophes, or asterisks\n";errors = true;}
- if (G_description.getText().indexOf("\"") != -1){errorz+="Description must not contain quotation marks, apostrophes, or asterisks\n";errors = true;}
- if (G_description.getText().indexOf("\'") != -1){errorz+="Description must not contain quotation marks, apostrophes, or asterisks\n";errors = true;}
- ereport = errorz;
- return errors;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement