diff options
Diffstat (limited to 'src')
28 files changed, 350 insertions, 504 deletions
diff --git a/src/com/dabomstew/pkrandom/CustomNamesSet.java b/src/com/dabomstew/pkrandom/CustomNamesSet.java index 7ebdde6..a13543b 100644 --- a/src/com/dabomstew/pkrandom/CustomNamesSet.java +++ b/src/com/dabomstew/pkrandom/CustomNamesSet.java @@ -38,11 +38,11 @@ public class CustomNamesSet { // Alternate constructor: blank all lists // Used for importing old names and on the editor dialog. public CustomNamesSet() { - trainerNames = new ArrayList<String>(); - trainerClasses = new ArrayList<String>(); - doublesTrainerNames = new ArrayList<String>(); - doublesTrainerClasses = new ArrayList<String>(); - pokemonNicknames = new ArrayList<String>(); + trainerNames = new ArrayList<>(); + trainerClasses = new ArrayList<>(); + doublesTrainerNames = new ArrayList<>(); + doublesTrainerClasses = new ArrayList<>(); + pokemonNicknames = new ArrayList<>(); } private List<String> readNamesBlock(InputStream in) throws IOException { @@ -55,7 +55,7 @@ public class CustomNamesSet { // Read the block and translate it into a list of names. byte[] namesData = FileFunctions.readFullyIntoBuffer(in, size); - List<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<>(); Scanner sc = new Scanner(new ByteArrayInputStream(namesData), "UTF-8"); while (sc.hasNextLine()) { String name = sc.nextLine().trim(); @@ -84,7 +84,7 @@ public class CustomNamesSet { private void writeNamesBlock(OutputStream out, List<String> names) throws IOException { String newln = SysConstants.LINE_SEP; - StringBuffer outNames = new StringBuffer(); + StringBuilder outNames = new StringBuilder(); boolean first = true; for (String name : names) { if (!first) { diff --git a/src/com/dabomstew/pkrandom/FileFunctions.java b/src/com/dabomstew/pkrandom/FileFunctions.java index 402070e..b7483d4 100755 --- a/src/com/dabomstew/pkrandom/FileFunctions.java +++ b/src/com/dabomstew/pkrandom/FileFunctions.java @@ -67,8 +67,8 @@ public class FileFunctions { return new File(original.getAbsolutePath().replace(original.getName(), "") + filename); } - private static List<String> overrideFiles = Arrays.asList(new String[] { SysConstants.customNamesFile, - SysConstants.tclassesFile, SysConstants.tnamesFile, SysConstants.nnamesFile }); + private static List<String> overrideFiles = Arrays.asList(SysConstants.customNamesFile, + SysConstants.tclassesFile, SysConstants.tnamesFile, SysConstants.nnamesFile); public static boolean configExists(String filename) { if (overrideFiles.contains(filename)) { @@ -141,8 +141,8 @@ public class FileFunctions { return buf; } - public static void readFully(InputStream in, byte[] buf, int offset, int length) throws IOException { - int offs = 0, read = 0; + private static void readFully(InputStream in, byte[] buf, int offset, int length) throws IOException { + int offs = 0, read; while (offs < length && (read = in.read(buf, offs + offset, length - offs)) != -1) { offs += read; } @@ -169,7 +169,7 @@ public class FileFunctions { } } - public static int getFileChecksum(InputStream stream) { + private static int getFileChecksum(InputStream stream) { try { Scanner sc = new Scanner(stream, "UTF-8"); CRC32 checksum = new CRC32(); @@ -197,14 +197,12 @@ public class FileFunctions { // have to check the CRC int crc = readFullInt(data, offsetInData); - if (getFileChecksum(filename) != crc) { - return false; - } + return getFileChecksum(filename) == crc; } return true; } - public static byte[] getCodeTweakFile(String filename) throws IOException { + private static byte[] getCodeTweakFile(String filename) throws IOException { InputStream is = FileFunctions.class.getResourceAsStream("/com/dabomstew/pkrandom/patches/" + filename); byte[] buf = readFullyIntoBuffer(is, is.available()); is.close(); @@ -220,8 +218,7 @@ public class FileFunctions { out.write(buf, 0, count); } in.close(); - byte[] output = out.toByteArray(); - return output; + return out.toByteArray(); } public static void applyPatch(byte[] rom, String patchName) throws IOException { diff --git a/src/com/dabomstew/pkrandom/GFXFunctions.java b/src/com/dabomstew/pkrandom/GFXFunctions.java index e44b365..dda768f 100644 --- a/src/com/dabomstew/pkrandom/GFXFunctions.java +++ b/src/com/dabomstew/pkrandom/GFXFunctions.java @@ -38,8 +38,8 @@ public class GFXFunctions { return drawTiledImage(data, palette, offset, width, height, 8, 8, bpp); } - public static BufferedImage drawTiledImage(byte[] data, int[] palette, int offset, int width, int height, - int tileWidth, int tileHeight, int bpp) { + private static BufferedImage drawTiledImage(byte[] data, int[] palette, int offset, int width, int height, + int tileWidth, int tileHeight, int bpp) { if (bpp != 1 && bpp != 2 && bpp != 4 && bpp != 8) { throw new IllegalArgumentException("Bits per pixel must be a multiple of 2."); } @@ -81,7 +81,7 @@ public class GFXFunctions { public static void pseudoTransparency(BufferedImage img, int transColor) { int width = img.getWidth(); int height = img.getHeight(); - Queue<Integer> visitPixels = new LinkedList<Integer>(); + Queue<Integer> visitPixels = new LinkedList<>(); boolean[][] queued = new boolean[width][height]; for (int x = 0; x < width; x++) { diff --git a/src/com/dabomstew/pkrandom/MiscTweak.java b/src/com/dabomstew/pkrandom/MiscTweak.java index ef8096e..4f288b2 100755 --- a/src/com/dabomstew/pkrandom/MiscTweak.java +++ b/src/com/dabomstew/pkrandom/MiscTweak.java @@ -32,25 +32,25 @@ public class MiscTweak implements Comparable<MiscTweak> { private static final ResourceBundle bundle = ResourceBundle.getBundle("com/dabomstew/pkrandom/gui/Bundle"); - public static List<MiscTweak> allTweaks = new ArrayList<MiscTweak>(); + public static List<MiscTweak> allTweaks = new ArrayList<>(); /* @formatter:off */ // Higher priority value (third argument) = run first public static final MiscTweak BW_EXP_PATCH = new MiscTweak(1, "bwPatch", 0); - public static final MiscTweak NERF_X_ACCURACY = new MiscTweak(2, "nerfXAcc", 0); - public static final MiscTweak FIX_CRIT_RATE = new MiscTweak(4, "critRateFix", 0); - public static final MiscTweak FASTEST_TEXT = new MiscTweak(8, "fastestText", 0); - public static final MiscTweak RUNNING_SHOES_INDOORS = new MiscTweak(16, "runningShoes", 0); - public static final MiscTweak RANDOMIZE_PC_POTION = new MiscTweak(32, "pcPotion", 0); - public static final MiscTweak ALLOW_PIKACHU_EVOLUTION = new MiscTweak(64, "pikachuEvo", 0); - public static final MiscTweak NATIONAL_DEX_AT_START = new MiscTweak(128, "nationalDex", 0); - public static final MiscTweak UPDATE_TYPE_EFFECTIVENESS = new MiscTweak(256, "typeEffectiveness", 0); - public static final MiscTweak RANDOMIZE_HIDDEN_HOLLOWS = new MiscTweak(512, "hiddenHollows", 0); - public static final MiscTweak LOWER_CASE_POKEMON_NAMES = new MiscTweak(1024, "lowerCaseNames", 0); - public static final MiscTweak RANDOMIZE_CATCHING_TUTORIAL = new MiscTweak(2048, "catchingTutorial", 0); - public static final MiscTweak BAN_LUCKY_EGG = new MiscTweak(4096, "luckyEgg", 1); - public static final MiscTweak NO_FREE_LUCKY_EGG = new MiscTweak(8192,"freeLuckyEgg",0); - public static final MiscTweak BAN_BIG_MANIAC_ITEMS = new MiscTweak(16384, "maniacItems",1); + public static final MiscTweak NERF_X_ACCURACY = new MiscTweak(1 << 1, "nerfXAcc", 0); + public static final MiscTweak FIX_CRIT_RATE = new MiscTweak(1 << 2, "critRateFix", 0); + public static final MiscTweak FASTEST_TEXT = new MiscTweak(1 << 3, "fastestText", 0); + public static final MiscTweak RUNNING_SHOES_INDOORS = new MiscTweak(1 << 4, "runningShoes", 0); + public static final MiscTweak RANDOMIZE_PC_POTION = new MiscTweak(1 << 5, "pcPotion", 0); + public static final MiscTweak ALLOW_PIKACHU_EVOLUTION = new MiscTweak(1 << 6, "pikachuEvo", 0); + public static final MiscTweak NATIONAL_DEX_AT_START = new MiscTweak(1 << 7, "nationalDex", 0); + public static final MiscTweak UPDATE_TYPE_EFFECTIVENESS = new MiscTweak(1 << 8, "typeEffectiveness", 0); + public static final MiscTweak RANDOMIZE_HIDDEN_HOLLOWS = new MiscTweak(1 << 9, "hiddenHollows", 0); + public static final MiscTweak LOWER_CASE_POKEMON_NAMES = new MiscTweak(1 << 10, "lowerCaseNames", 0); + public static final MiscTweak RANDOMIZE_CATCHING_TUTORIAL = new MiscTweak(1 << 11, "catchingTutorial", 0); + public static final MiscTweak BAN_LUCKY_EGG = new MiscTweak(1 << 12, "luckyEgg", 1); + public static final MiscTweak NO_FREE_LUCKY_EGG = new MiscTweak(1 << 13,"freeLuckyEgg",0); + public static final MiscTweak BAN_BIG_MANIAC_ITEMS = new MiscTweak(1 << 14, "maniacItems",1); /* @formatter:on */ private final int value; diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java index 0e2e4d5..7686b57 100644 --- a/src/com/dabomstew/pkrandom/Randomizer.java +++ b/src/com/dabomstew/pkrandom/Randomizer.java @@ -29,7 +29,6 @@ import java.io.PrintStream; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -78,7 +77,6 @@ public class Randomizer { // long seed2 = 123456789; // TESTING
// RandomSource.seed(seed2); // TESTING
RandomSource.seed(seed);
- final boolean raceMode = settings.isRaceMode();
int checkValue = 0;
@@ -128,7 +126,7 @@ public class Randomizer { int currentMiscTweaks = settings.getCurrentMiscTweaks();
if (romHandler.miscTweaksAvailable() != 0) {
int codeTweaksAvailable = romHandler.miscTweaksAvailable();
- List<MiscTweak> tweaksToApply = new ArrayList<MiscTweak>();
+ List<MiscTweak> tweaksToApply = new ArrayList<>();
for (MiscTweak mt : MiscTweak.allTweaks) {
if ((codeTweaksAvailable & mt.getValue()) > 0 && (currentMiscTweaks & mt.getValue()) > 0) {
@@ -186,9 +184,9 @@ public class Randomizer { StringBuilder evoStr = new StringBuilder(pk.evolutionsFrom.get(0).to.fullName());
for (int i = 1; i < numEvos; i++) {
if (i == numEvos - 1) {
- evoStr.append(" and " + pk.evolutionsFrom.get(i).to.fullName());
+ evoStr.append(" and ").append(pk.evolutionsFrom.get(i).to.fullName());
} else {
- evoStr.append(", " + pk.evolutionsFrom.get(i).to.fullName());
+ evoStr.append(", ").append(pk.evolutionsFrom.get(i).to.fullName());
}
}
// log.println(pk.fullName() + " now evolves into " + evoStr.toString());
@@ -293,17 +291,12 @@ public class Randomizer { List<MoveLearnt> data = moveData.get(pkmn.number);
- boolean first = true;
for (MoveLearnt ml : data) {
- // if (!first) {
- // sb.append(", ");
- // }
try {
sb.append("Level ").append(String.format("%-2d", ml.level)).append(": ").append(moves.get(ml.move).name).append(System.getProperty("line.separator"));
} catch (NullPointerException ex) {
- sb.append("invalid move at level" + ml.level);
+ sb.append("invalid move at level").append(ml.level);
}
- first = false;
}
movesets.add(sb.toString());
}
@@ -371,7 +364,7 @@ public class Randomizer { }
// Static Pokemon
- checkValue = maybeChangeAndLogStaticPokemon(log, romHandler, raceMode, checkValue);
+ checkValue = maybeChangeAndLogStaticPokemon(log, romHandler, checkValue);
// Wild Pokemon
if (settings.isUseMinimumCatchRate()) {
@@ -653,7 +646,6 @@ public class Randomizer { if (itemCount > 0) {
log.print(", ");
}
- itemCount++;
log.print(itemNames[pkmn.darkGrassHeldItem] + " (dark grass only)");
}
}
@@ -692,7 +684,7 @@ public class Randomizer { if (romHandler.isYellow()) {
starterCount = 2;
}
- List<Pokemon> starters = new ArrayList<Pokemon>();
+ List<Pokemon> starters = new ArrayList<>();
for (int i = 0; i < starterCount; i++) {
Pokemon pkmn = romHandler.randomPokemon();
while (starters.contains(pkmn)) {
@@ -710,7 +702,7 @@ public class Randomizer { if (romHandler.isYellow()) {
starterCount = 2;
}
- List<Pokemon> starters = new ArrayList<Pokemon>();
+ List<Pokemon> starters = new ArrayList<>();
for (int i = 0; i < starterCount; i++) {
Pokemon pkmn = romHandler.random2EvosPokemon();
while (starters.contains(pkmn)) {
@@ -743,18 +735,13 @@ public class Randomizer { }
log.print("(rate=" + es.rate + ")");
log.println();
- boolean first = true;
for (Encounter e : es.encounters) {
- // if (!first) {
- // log.print(", ");
- // }
-
// sb.append(String.format("%03d %s", pkmn.number, pkmn.fullName())).append(System.getProperty("line.separator")).append(String.format("HP %d ATK %-3d DEF %-3d SPATK %-3d SPDEF %-3d SPD %-3d", pkmn.hp, pkmn.attack, pkmn.defense, pkmn.speed, pkmn.spatk, pkmn.spdef)).append(System.getProperty("line.separator"));
StringBuilder sb = new StringBuilder();
- sb.append(e.pokemon.fullName() + " Lv");
+ sb.append(e.pokemon.fullName()).append(" Lv");
if (e.maxLevel > 0 && e.maxLevel != e.level) {
- sb.append("s " + e.level + "-" + e.maxLevel);
+ sb.append("s ").append(e.level).append("-").append(e.maxLevel);
} else {
sb.append(e.level);
}
@@ -762,7 +749,6 @@ public class Randomizer { StringBuilder sb2 = new StringBuilder();
sb2.append(String.format("HP %-3d ATK %-3d DEF %-3d SPATK %-3d SPDEF %-3d SPEED %-3d", e.pokemon.hp, e.pokemon.attack, e.pokemon.defense, e.pokemon.spatk, e.pokemon.spdef, e.pokemon.speed));
log.print(sb2);
- first = false;
log.println();
}
log.println();
@@ -804,8 +790,7 @@ public class Randomizer { }
}
- private int maybeChangeAndLogStaticPokemon(final PrintStream log, final RomHandler romHandler, boolean raceMode,
- int checkValue) {
+ private int maybeChangeAndLogStaticPokemon(final PrintStream log, final RomHandler romHandler, int checkValue) {
if (romHandler.canChangeStaticPokemon()) {
List<Pokemon> oldStatics = romHandler.getStaticPokemon();
if (settings.getStaticPokemonMod() == Settings.StaticPokemonMod.RANDOM_MATCHING) { // Legendary for L
@@ -823,7 +808,7 @@ public class Randomizer { log.println("Static Pokemon: Unchanged." + NEWLINE);
} else {
log.println("--Static Pokemon--");
- Map<Pokemon, Integer> seenPokemon = new TreeMap<Pokemon, Integer>();
+ Map<Pokemon, Integer> seenPokemon = new TreeMap<>();
for (int i = 0; i < oldStatics.size(); i++) {
Pokemon oldP = oldStatics.get(i);
Pokemon newP = newStatics.get(i);
diff --git a/src/com/dabomstew/pkrandom/RomFunctions.java b/src/com/dabomstew/pkrandom/RomFunctions.java index c219f2b..ef6e2ec 100755 --- a/src/com/dabomstew/pkrandom/RomFunctions.java +++ b/src/com/dabomstew/pkrandom/RomFunctions.java @@ -39,7 +39,7 @@ public class RomFunctions { public static Set<Pokemon> getBasicOrNoCopyPokemon(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemonInclFormes(); - Set<Pokemon> dontCopyPokes = new TreeSet<Pokemon>(); + Set<Pokemon> dontCopyPokes = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() < 1) { @@ -57,7 +57,7 @@ public class RomFunctions { public static Set<Pokemon> getMiddleEvolutions(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemon(); - Set<Pokemon> middleEvolutions = new TreeSet<Pokemon>(); + Set<Pokemon> middleEvolutions = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() > 0) { @@ -73,7 +73,7 @@ public class RomFunctions { public static Set<Pokemon> getFinalEvolutions(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemon(); - Set<Pokemon> finalEvolutions = new TreeSet<Pokemon>(); + Set<Pokemon> finalEvolutions = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() == 0) { @@ -90,10 +90,10 @@ public class RomFunctions { /** * Get the 4 moves known by a Pokemon at a particular level. * - * @param pkmn - * @param movesets - * @param level - * @return + * @param pkmn Pokemon index to get moves for. + * @param movesets Map of Pokemon indices mapped to movesets. + * @param level Level to get at. + * @return Array with move indices. */ public static int[] getMovesAtLevel(int pkmn, Map<Integer, List<MoveLearnt>> movesets, int level) { return getMovesAtLevel(pkmn, movesets, level, 0); @@ -126,9 +126,7 @@ public class RomFunctions { // add this move to the moveset if (moveCount == 4) { // shift moves up and add to last slot - for (int i = 0; i < 3; i++) { - curMoves[i] = curMoves[i + 1]; - } + System.arraycopy(curMoves, 1, curMoves, 0, 3); curMoves[3] = ml.move; } else { // add to next available slot @@ -197,13 +195,12 @@ public class RomFunctions { int currentMatchStart = beginOffset; int currentCharacterPosition = 0; - int docSize = endOffset; int needleSize = needle.length; int[] toFillTable = buildKMPSearchTable(needle); - List<Integer> results = new ArrayList<Integer>(); + List<Integer> results = new ArrayList<>(); - while ((currentMatchStart + currentCharacterPosition) < docSize) { + while ((currentMatchStart + currentCharacterPosition) < endOffset) { if (needle[currentCharacterPosition] == (haystack[currentCharacterPosition + currentMatchStart])) { currentCharacterPosition = currentCharacterPosition + 1; @@ -233,7 +230,7 @@ public class RomFunctions { return results; } - public static int searchForFirst(byte[] haystack, int beginOffset, byte[] needle) { + private static int searchForFirst(byte[] haystack, int beginOffset, byte[] needle) { int currentMatchStart = beginOffset; int currentCharacterPosition = 0; @@ -345,7 +342,6 @@ public class RomFunctions { fullDesc.append(newline); } fullDesc.append(thisLine.toString()); - linesWritten++; } return fullDesc.toString(); @@ -387,14 +383,14 @@ public class RomFunctions { int currLineCC = 0; int linesWritten = 0; char currLineLastChar = 0; - for (int i = 0; i < words.length; i++) { - int reqLength = ssd.lengthFor(words[i]); + for (String word : words) { + int reqLength = ssd.lengthFor(word); if (currLineWC > 0) { reqLength++; } if ((currLineCC + reqLength > maxLineLength) || (currLineCC >= sentenceNewLineSize && (currLineLastChar == '.' || currLineLastChar == '?' - || currLineLastChar == '!' || currLineLastChar == '…' || currLineLastChar == ','))) { + || currLineLastChar == '!' || currLineLastChar == '…' || currLineLastChar == ','))) { // new line // Save current line, if applicable if (currLineWC > 0) { @@ -408,26 +404,26 @@ public class RomFunctions { thisLine = new StringBuilder(); } // Start the new line - thisLine.append(words[i]); + thisLine.append(word); currLineWC = 1; - currLineCC = ssd.lengthFor(words[i]); - if (words[i].length() == 0) { + currLineCC = ssd.lengthFor(word); + if (word.length() == 0) { currLineLastChar = 0; } else { - currLineLastChar = words[i].charAt(words[i].length() - 1); + currLineLastChar = word.charAt(word.length() - 1); } } else { // add to current line if (currLineWC > 0) { thisLine.append(' '); } - thisLine.append(words[i]); + thisLine.append(word); currLineWC++; currLineCC += reqLength; - if (words[i].length() == 0) { + if (word.length() == 0) { currLineLastChar = 0; } else { - currLineLastChar = words[i].charAt(words[i].length() - 1); + currLineLastChar = word.charAt(word.length() - 1); } } } @@ -440,7 +436,6 @@ public class RomFunctions { fullPara.append(newline); } fullPara.append(thisLine.toString()); - linesWritten++; } if (para > 0) { finalResult.append(newpara); @@ -454,7 +449,7 @@ public class RomFunctions { } public interface StringSizeDeterminer { - public int lengthFor(String encodedText); + int lengthFor(String encodedText); } public static class StringLengthSD implements StringSizeDeterminer { diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java index 1d720cb..56ea15e 100644 --- a/src/com/dabomstew/pkrandom/Settings.java +++ b/src/com/dabomstew/pkrandom/Settings.java @@ -425,6 +425,7 @@ public class Settings { writeFullInt(out, 0);
}
} catch (IOException e) {
+ e.printStackTrace(); // better than nothing
}
@@ -433,7 +434,7 @@ public class Settings { try {
writeFullInt(out, currentMiscTweaks);
} catch (IOException e) {
-
+ e.printStackTrace(); // better than nothing
}
// @ 35 trainer pokemon level modifier
@@ -453,8 +454,6 @@ public class Settings { byte[] romName = this.romName.getBytes("US-ASCII");
out.write(romName.length);
out.write(romName);
- } catch (UnsupportedEncodingException e) {
- out.write(0);
} catch (IOException e) {
out.write(0);
}
@@ -467,6 +466,7 @@ public class Settings { writeFullInt(out, (int) checksum.getValue());
writeFullInt(out, FileFunctions.getFileChecksum(SysConstants.customNamesFile));
} catch (IOException e) {
+ e.printStackTrace(); // better than nothing
}
return Base64.getEncoder().encodeToString(out.toByteArray());
@@ -815,479 +815,432 @@ public class Settings { return romName;
}
- public Settings setRomName(String romName) {
+ public void setRomName(String romName) {
this.romName = romName;
- return this;
}
public boolean isUpdatedFromOldVersion() {
return updatedFromOldVersion;
}
- public Settings setUpdatedFromOldVersion(boolean updatedFromOldVersion) {
+ private void setUpdatedFromOldVersion(boolean updatedFromOldVersion) {
this.updatedFromOldVersion = updatedFromOldVersion;
- return this;
}
public GenRestrictions getCurrentRestrictions() {
return currentRestrictions;
}
- public Settings setCurrentRestrictions(GenRestrictions currentRestrictions) {
+ public void setCurrentRestrictions(GenRestrictions currentRestrictions) {
this.currentRestrictions = currentRestrictions;
- return this;
}
public int getCurrentMiscTweaks() {
return currentMiscTweaks;
}
- public Settings setCurrentMiscTweaks(int currentMiscTweaks) {
+ public void setCurrentMiscTweaks(int currentMiscTweaks) {
this.currentMiscTweaks = currentMiscTweaks;
- return this;
}
public boolean isUpdateMoves() {
return updateMoves;
}
- public Settings setUpdateMoves(boolean updateMoves) {
+ public void setUpdateMoves(boolean updateMoves) {
this.updateMoves = updateMoves;
- return this;
}
public boolean isUpdateMovesLegacy() {
return updateMovesLegacy;
}
- public Settings setUpdateMovesLegacy(boolean updateMovesLegacy) {
+ public void setUpdateMovesLegacy(boolean updateMovesLegacy) {
this.updateMovesLegacy = updateMovesLegacy;
- return this;
}
public boolean isChangeImpossibleEvolutions() {
return changeImpossibleEvolutions;
}
- public Settings setChangeImpossibleEvolutions(boolean changeImpossibleEvolutions) {
+ public void setChangeImpossibleEvolutions(boolean changeImpossibleEvolutions) {
this.changeImpossibleEvolutions = changeImpossibleEvolutions;
- return this;
}
public boolean isMakeEvolutionsEasier() {
return makeEvolutionsEasier;
}
- public Settings setMakeEvolutionsEasier(boolean makeEvolutionsEasier) {
+ public void setMakeEvolutionsEasier(boolean makeEvolutionsEasier) {
this.makeEvolutionsEasier = makeEvolutionsEasier;
- return this;
}
public boolean isRaceMode() {
return raceMode;
}
- public Settings setRaceMode(boolean raceMode) {
+ public void setRaceMode(boolean raceMode) {
this.raceMode = raceMode;
- return this;
}
public boolean doBlockBrokenMoves() {
return blockBrokenMoves;
}
- public Settings setBlockBrokenMoves(boolean blockBrokenMoves) {
+ public void setBlockBrokenMoves(boolean blockBrokenMoves) {
this.blockBrokenMoves = blockBrokenMoves;
- return this;
}
public boolean isLimitPokemon() {
return limitPokemon;
}
- public Settings setLimitPokemon(boolean limitPokemon) {
+ public void setLimitPokemon(boolean limitPokemon) {
this.limitPokemon = limitPokemon;
- return this;
}
public BaseStatisticsMod getBaseStatisticsMod() {
return baseStatisticsMod;
}
- public Settings setBaseStatisticsMod(BaseStatisticsMod baseStatisticsMod) {
- this.baseStatisticsMod = baseStatisticsMod;
- return this;
+ public void setBaseStatisticsMod(boolean... bools) {
+ setBaseStatisticsMod(getEnum(BaseStatisticsMod.class, bools));
}
- public Settings setBaseStatisticsMod(boolean... bools) {
- return setBaseStatisticsMod(getEnum(BaseStatisticsMod.class, bools));
+ private void setBaseStatisticsMod(BaseStatisticsMod baseStatisticsMod) {
+ this.baseStatisticsMod = baseStatisticsMod;
}
public boolean isBaseStatsFollowEvolutions() {
return baseStatsFollowEvolutions;
}
- public Settings setBaseStatsFollowEvolutions(boolean baseStatsFollowEvolutions) {
+ public void setBaseStatsFollowEvolutions(boolean baseStatsFollowEvolutions) {
this.baseStatsFollowEvolutions = baseStatsFollowEvolutions;
- return this;
}
public boolean isStandardizeEXPCurves() {
return standardizeEXPCurves;
}
- public Settings setStandardizeEXPCurves(boolean standardizeEXPCurves) {
+ public void setStandardizeEXPCurves(boolean standardizeEXPCurves) {
this.standardizeEXPCurves = standardizeEXPCurves;
- return this;
}
public ExpCurveMod getExpCurveMod() {
return expCurveMod;
}
- public Settings setExpCurveMod(ExpCurveMod expCurveMod) {
- this.expCurveMod = expCurveMod;
- return this;
+ public void setExpCurveMod(boolean... bools) {
+ setExpCurveMod(getEnum(ExpCurveMod.class, bools));
}
- public Settings setExpCurveMod(boolean... bools) {
- return setExpCurveMod(getEnum(ExpCurveMod.class, bools));
+ private void setExpCurveMod(ExpCurveMod expCurveMod) {
+ this.expCurveMod = expCurveMod;
}
public boolean isUpdateBaseStats() {
return updateBaseStats;
}
- public Settings setUpdateBaseStats(boolean updateBaseStats) {
+ public void setUpdateBaseStats(boolean updateBaseStats) {
this.updateBaseStats = updateBaseStats;
- return this;
}
public AbilitiesMod getAbilitiesMod() {
return abilitiesMod;
}
- public Settings setAbilitiesMod(AbilitiesMod abilitiesMod) {
- this.abilitiesMod = abilitiesMod;
- return this;
+ public void setAbilitiesMod(boolean... bools) {
+ setAbilitiesMod(getEnum(AbilitiesMod.class, bools));
}
- public Settings setAbilitiesMod(boolean... bools) {
- return setAbilitiesMod(getEnum(AbilitiesMod.class, bools));
+ private void setAbilitiesMod(AbilitiesMod abilitiesMod) {
+ this.abilitiesMod = abilitiesMod;
}
public boolean isAllowWonderGuard() {
return allowWonderGuard;
}
- public Settings setAllowWonderGuard(boolean allowWonderGuard) {
+ public void setAllowWonderGuard(boolean allowWonderGuard) {
this.allowWonderGuard = allowWonderGuard;
- return this;
}
public boolean isAbilitiesFollowEvolutions() {
return abilitiesFollowEvolutions;
}
- public Settings setAbilitiesFollowEvolutions(boolean abilitiesFollowEvolutions) {
+ public void setAbilitiesFollowEvolutions(boolean abilitiesFollowEvolutions) {
this.abilitiesFollowEvolutions = abilitiesFollowEvolutions;
- return this;
}
public boolean isBanTrappingAbilities() {
return banTrappingAbilities;
}
- public Settings setBanTrappingAbilities(boolean banTrappingAbilities) {
+ public void setBanTrappingAbilities(boolean banTrappingAbilities) {
this.banTrappingAbilities = banTrappingAbilities;
- return this;
}
public boolean isBanNegativeAbilities() {
return banNegativeAbilities;
}
- public Settings setBanNegativeAbilities(boolean banNegativeAbilities) {
+ public void setBanNegativeAbilities(boolean banNegativeAbilities) {
this.banNegativeAbilities = banNegativeAbilities;
- return this;
}
public boolean isBanBadAbilities() {
return banBadAbilities;
}
- public Settings setBanBadAbilities(boolean banBadAbilities) {
+ public void setBanBadAbilities(boolean banBadAbilities) {
this.banBadAbilities = banBadAbilities;
- return this;
}
public StartersMod getStartersMod() {
return startersMod;
}
- public Settings setStartersMod(StartersMod startersMod) {
- this.startersMod = startersMod;
- return this;
+ public void setStartersMod(boolean... bools) {
+ setStartersMod(getEnum(StartersMod.class, bools));
}
- public Settings setStartersMod(boolean... bools) {
- return setStartersMod(getEnum(StartersMod.class, bools));
+ private void setStartersMod(StartersMod startersMod) {
+ this.startersMod = startersMod;
}
public int[] getCustomStarters() {
return customStarters;
}
- public Settings setCustomStarters(int[] customStarters) {
+ public void setCustomStarters(int[] customStarters) {
this.customStarters = customStarters;
- return this;
}
public boolean isRandomizeStartersHeldItems() {
return randomizeStartersHeldItems;
}
- public Settings setRandomizeStartersHeldItems(boolean randomizeStartersHeldItems) {
+ public void setRandomizeStartersHeldItems(boolean randomizeStartersHeldItems) {
this.randomizeStartersHeldItems = randomizeStartersHeldItems;
- return this;
}
public boolean isBanBadRandomStarterHeldItems() {
return banBadRandomStarterHeldItems;
}
- public Settings setBanBadRandomStarterHeldItems(boolean banBadRandomStarterHeldItems) {
+ public void setBanBadRandomStarterHeldItems(boolean banBadRandomStarterHeldItems) {
this.banBadRandomStarterHeldItems = banBadRandomStarterHeldItems;
- return this;
}
public boolean isLimitMusketeers() {
return limitMusketeers;
}
- public Settings setLimitMusketeers(boolean limitMusketeers) {
+
+ public void setLimitMusketeers(boolean limitMusketeers) {
this.limitMusketeers = limitMusketeers;
- return this;
}
public boolean isLimit600() {
return limit600;
}
- public Settings setLimit600(boolean limit600) {
+
+ public void setLimit600(boolean limit600) {
this.limit600 = limit600;
- return this;
}
public TypesMod getTypesMod() {
return typesMod;
}
- public Settings setTypesMod(TypesMod typesMod) {
- this.typesMod = typesMod;
- return this;
+ public void setTypesMod(boolean... bools) {
+ setTypesMod(getEnum(TypesMod.class, bools));
}
- public Settings setTypesMod(boolean... bools) {
- return setTypesMod(getEnum(TypesMod.class, bools));
+ private void setTypesMod(TypesMod typesMod) {
+ this.typesMod = typesMod;
}
public EvolutionsMod getEvolutionsMod() {
return evolutionsMod;
}
- public Settings setEvolutionsMod(EvolutionsMod evolutionsMod) {
- this.evolutionsMod = evolutionsMod;
- return this;
+ public void setEvolutionsMod(boolean... bools) {
+ setEvolutionsMod(getEnum(EvolutionsMod.class, bools));
}
- public Settings setEvolutionsMod(boolean... bools) {
- return setEvolutionsMod(getEnum(EvolutionsMod.class, bools));
+ private void setEvolutionsMod(EvolutionsMod evolutionsMod) {
+ this.evolutionsMod = evolutionsMod;
}
public boolean isEvosSimilarStrength() {
return evosSimilarStrength;
}
- public Settings setEvosSimilarStrength(boolean evosSimilarStrength) {
+ public void setEvosSimilarStrength(boolean evosSimilarStrength) {
this.evosSimilarStrength = evosSimilarStrength;
- return this;
}
public boolean isEvosSameTyping() {
return evosSameTyping;
}
- public Settings setEvosSameTyping(boolean evosSameTyping) {
+ public void setEvosSameTyping(boolean evosSameTyping) {
this.evosSameTyping = evosSameTyping;
- return this;
}
public boolean isEvosMaxThreeStages() {
return evosMaxThreeStages;
}
- public Settings setEvosMaxThreeStages(boolean evosMaxThreeStages) {
+ public void setEvosMaxThreeStages(boolean evosMaxThreeStages) {
this.evosMaxThreeStages = evosMaxThreeStages;
- return this;
}
public boolean isEvosForceChange() {
return evosForceChange;
}
- public Settings setEvosForceChange(boolean evosForceChange) {
+ public void setEvosForceChange(boolean evosForceChange) {
this.evosForceChange = evosForceChange;
- return this;
}
public boolean isRandomizeMovePowers() {
return randomizeMovePowers;
}
- public Settings setRandomizeMovePowers(boolean randomizeMovePowers) {
+ public void setRandomizeMovePowers(boolean randomizeMovePowers) {
this.randomizeMovePowers = randomizeMovePowers;
- return this;
}
public boolean isRandomizeMoveAccuracies() {
return randomizeMoveAccuracies;
}
- public Settings setRandomizeMoveAccuracies(boolean randomizeMoveAccuracies) {
+ public void setRandomizeMoveAccuracies(boolean randomizeMoveAccuracies) {
this.randomizeMoveAccuracies = randomizeMoveAccuracies;
- return this;
}
public boolean isRandomizeMovePPs() {
return randomizeMovePPs;
}
- public Settings setRandomizeMovePPs(boolean randomizeMovePPs) {
+ public void setRandomizeMovePPs(boolean randomizeMovePPs) {
this.randomizeMovePPs = randomizeMovePPs;
- return this;
}
public boolean isRandomizeMoveTypes() {
return randomizeMoveTypes;
}
- public Settings setRandomizeMoveTypes(boolean randomizeMoveTypes) {
+ public void setRandomizeMoveTypes(boolean randomizeMoveTypes) {
this.randomizeMoveTypes = randomizeMoveTypes;
- return this;
}
public boolean isRandomizeMoveCategory() {
return randomizeMoveCategory;
}
- public Settings setRandomizeMoveCategory(boolean randomizeMoveCategory) {
+ public void setRandomizeMoveCategory(boolean randomizeMoveCategory) {
this.randomizeMoveCategory = randomizeMoveCategory;
- return this;
}
public MovesetsMod getMovesetsMod() {
return movesetsMod;
}
- public Settings setMovesetsMod(MovesetsMod movesetsMod) {
- this.movesetsMod = movesetsMod;
- return this;
+ public void setMovesetsMod(boolean... bools) {
+ setMovesetsMod(getEnum(MovesetsMod.class, bools));
}
- public Settings setMovesetsMod(boolean... bools) {
- return setMovesetsMod(getEnum(MovesetsMod.class, bools));
+ private void setMovesetsMod(MovesetsMod movesetsMod) {
+ this.movesetsMod = movesetsMod;
}
public boolean isStartWithGuaranteedMoves() {
return startWithGuaranteedMoves;
}
- public Settings setStartWithGuaranteedMoves(boolean startWithGuaranteedMoves) {
+ public void setStartWithGuaranteedMoves(boolean startWithGuaranteedMoves) {
this.startWithGuaranteedMoves = startWithGuaranteedMoves;
- return this;
}
public int getGuaranteedMoveCount() {
return guaranteedMoveCount;
}
- public Settings setGuaranteedMoveCount(int guaranteedMoveCount) {
+
+ public void setGuaranteedMoveCount(int guaranteedMoveCount) {
this.guaranteedMoveCount = guaranteedMoveCount;
- return this;
}
public boolean isReorderDamagingMoves() {
return reorderDamagingMoves;
}
- public Settings setReorderDamagingMoves(boolean reorderDamagingMoves) {
+ public void setReorderDamagingMoves(boolean reorderDamagingMoves) {
this.reorderDamagingMoves = reorderDamagingMoves;
- return this;
}
public boolean isMovesetsForceGoodDamaging() {
return movesetsForceGoodDamaging;
}
- public Settings setMovesetsForceGoodDamaging(boolean movesetsForceGoodDamaging) {
+ public void setMovesetsForceGoodDamaging(boolean movesetsForceGoodDamaging) {
this.movesetsForceGoodDamaging = movesetsForceGoodDamaging;
- return this;
}
public int getMovesetsGoodDamagingPercent() {
return movesetsGoodDamagingPercent;
}
- public Settings setMovesetsGoodDamagingPercent(int movesetsGoodDamagingPercent) {
+ public void setMovesetsGoodDamagingPercent(int movesetsGoodDamagingPercent) {
this.movesetsGoodDamagingPercent = movesetsGoodDamagingPercent;
- return this;
}
public TrainersMod getTrainersMod() {
return trainersMod;
}
- public Settings setTrainersMod(TrainersMod trainersMod) {
- this.trainersMod = trainersMod;
- return this;
+ public void setTrainersMod(boolean... bools) {
+ setTrainersMod(getEnum(TrainersMod.class, bools));
}
- public Settings setTrainersMod(boolean... bools) {
- return setTrainersMod(getEnum(TrainersMod.class, bools));
+ private void setTrainersMod(TrainersMod trainersMod) {
+ this.trainersMod = trainersMod;
}
public boolean isRivalCarriesStarterThroughout() {
return rivalCarriesStarterThroughout;
}
- public Settings setRivalCarriesStarterThroughout(boolean rivalCarriesStarterThroughout) {
+ public void setRivalCarriesStarterThroughout(boolean rivalCarriesStarterThroughout) {
this.rivalCarriesStarterThroughout = rivalCarriesStarterThroughout;
- return this;
}
public boolean isTrainersUsePokemonOfSimilarStrength() {
return trainersUsePokemonOfSimilarStrength;
}
- public Settings setTrainersUsePokemonOfSimilarStrength(boolean trainersUsePokemonOfSimilarStrength) {
+ public void setTrainersUsePokemonOfSimilarStrength(boolean trainersUsePokemonOfSimilarStrength) {
this.trainersUsePokemonOfSimilarStrength = trainersUsePokemonOfSimilarStrength;
- return this;
}
public boolean isTrainersMatchTypingDistribution() {
return trainersMatchTypingDistribution;
}
- public Settings setTrainersMatchTypingDistribution(boolean trainersMatchTypingDistribution) {
+ public void setTrainersMatchTypingDistribution(boolean trainersMatchTypingDistribution) {
this.trainersMatchTypingDistribution = trainersMatchTypingDistribution;
- return this;
}
public boolean isTrainersBlockLegendaries() {
return trainersBlockLegendaries;
}
- public Settings setTrainersBlockLegendaries(boolean trainersBlockLegendaries) {
+ public void setTrainersBlockLegendaries(boolean trainersBlockLegendaries) {
this.trainersBlockLegendaries = trainersBlockLegendaries;
- return this;
}
public boolean isTrainersEnforceDistribution() {
@@ -1313,378 +1266,340 @@ public class Settings { return trainersBlockEarlyWonderGuard;
}
- public Settings setTrainersBlockEarlyWonderGuard(boolean trainersBlockEarlyWonderGuard) {
+ public void setTrainersBlockEarlyWonderGuard(boolean trainersBlockEarlyWonderGuard) {
this.trainersBlockEarlyWonderGuard = trainersBlockEarlyWonderGuard;
- return this;
}
public boolean isRandomizeTrainerNames() {
return randomizeTrainerNames;
}
- public Settings setRandomizeTrainerNames(boolean randomizeTrainerNames) {
+ public void setRandomizeTrainerNames(boolean randomizeTrainerNames) {
this.randomizeTrainerNames = randomizeTrainerNames;
- return this;
}
public boolean isRandomizeTrainerClassNames() {
return randomizeTrainerClassNames;
}
- public Settings setRandomizeTrainerClassNames(boolean randomizeTrainerClassNames) {
+ public void setRandomizeTrainerClassNames(boolean randomizeTrainerClassNames) {
this.randomizeTrainerClassNames = randomizeTrainerClassNames;
- return this;
}
public boolean isTrainersForceFullyEvolved() {
return trainersForceFullyEvolved;
}
- public Settings setTrainersForceFullyEvolved(boolean trainersForceFullyEvolved) {
+ public void setTrainersForceFullyEvolved(boolean trainersForceFullyEvolved) {
this.trainersForceFullyEvolved = trainersForceFullyEvolved;
- return this;
}
public int getTrainersForceFullyEvolvedLevel() {
return trainersForceFullyEvolvedLevel;
}
- public Settings setTrainersForceFullyEvolvedLevel(int trainersForceFullyEvolvedLevel) {
+ public void setTrainersForceFullyEvolvedLevel(int trainersForceFullyEvolvedLevel) {
this.trainersForceFullyEvolvedLevel = trainersForceFullyEvolvedLevel;
- return this;
}
public boolean isTrainersLevelModified() {
return trainersLevelModified;
}
- public Settings setTrainersLevelModified(boolean trainersLevelModified) {
+ public void setTrainersLevelModified(boolean trainersLevelModified) {
this.trainersLevelModified = trainersLevelModified;
- return this;
}
public int getTrainersLevelModifier() {
return trainersLevelModifier;
}
- public Settings setTrainersLevelModifier(int trainersLevelModifier) {
+ public void setTrainersLevelModifier(int trainersLevelModifier) {
this.trainersLevelModifier = trainersLevelModifier;
- return this;
}
public WildPokemonMod getWildPokemonMod() {
return wildPokemonMod;
}
- public Settings setWildPokemonMod(WildPokemonMod wildPokemonMod) {
- this.wildPokemonMod = wildPokemonMod;
- return this;
+ public void setWildPokemonMod(boolean... bools) {
+ setWildPokemonMod(getEnum(WildPokemonMod.class, bools));
}
- public Settings setWildPokemonMod(boolean... bools) {
- return setWildPokemonMod(getEnum(WildPokemonMod.class, bools));
+ private void setWildPokemonMod(WildPokemonMod wildPokemonMod) {
+ this.wildPokemonMod = wildPokemonMod;
}
public WildPokemonRestrictionMod getWildPokemonRestrictionMod() {
return wildPokemonRestrictionMod;
}
- public Settings setWildPokemonRestrictionMod(WildPokemonRestrictionMod wildPokemonRestrictionMod) {
- this.wildPokemonRestrictionMod = wildPokemonRestrictionMod;
- return this;
+ public void setWildPokemonRestrictionMod(boolean... bools) {
+ setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, bools));
}
- public Settings setWildPokemonRestrictionMod(boolean... bools) {
- return setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, bools));
+ private void setWildPokemonRestrictionMod(WildPokemonRestrictionMod wildPokemonRestrictionMod) {
+ this.wildPokemonRestrictionMod = wildPokemonRestrictionMod;
}
public boolean isUseTimeBasedEncounters() {
return useTimeBasedEncounters;
}
- public Settings setUseTimeBasedEncounters(boolean useTimeBasedEncounters) {
+ public void setUseTimeBasedEncounters(boolean useTimeBasedEncounters) {
this.useTimeBasedEncounters = useTimeBasedEncounters;
- return this;
}
public boolean isBlockWildLegendaries() {
return blockWildLegendaries;
}
- public Settings setBlockWildLegendaries(boolean blockWildLegendaries) {
+ public void setBlockWildLegendaries(boolean blockWildLegendaries) {
this.blockWildLegendaries = blockWildLegendaries;
- return this;
}
public boolean isUseMinimumCatchRate() {
return useMinimumCatchRate;
}
- public Settings setUseMinimumCatchRate(boolean useMinimumCatchRate) {
+ public void setUseMinimumCatchRate(boolean useMinimumCatchRate) {
this.useMinimumCatchRate = useMinimumCatchRate;
- return this;
}
public int getMinimumCatchRateLevel() {
return minimumCatchRateLevel;
}
- public Settings setMinimumCatchRateLevel(int minimumCatchRateLevel) {
+ public void setMinimumCatchRateLevel(int minimumCatchRateLevel) {
this.minimumCatchRateLevel = minimumCatchRateLevel;
- return this;
}
public boolean isRandomizeWildPokemonHeldItems() {
return randomizeWildPokemonHeldItems;
}
- public Settings setRandomizeWildPokemonHeldItems(boolean randomizeWildPokemonHeldItems) {
+ public void setRandomizeWildPokemonHeldItems(boolean randomizeWildPokemonHeldItems) {
this.randomizeWildPokemonHeldItems = randomizeWildPokemonHeldItems;
- return this;
}
public boolean isBanBadRandomWildPokemonHeldItems() {
return banBadRandomWildPokemonHeldItems;
}
- public Settings setBanBadRandomWildPokemonHeldItems(boolean banBadRandomWildPokemonHeldItems) {
+ public void setBanBadRandomWildPokemonHeldItems(boolean banBadRandomWildPokemonHeldItems) {
this.banBadRandomWildPokemonHeldItems = banBadRandomWildPokemonHeldItems;
- return this;
}
public boolean isBalanceShakingGrass() {
return balanceShakingGrass;
}
- public Settings setBalanceShakingGrass(boolean balanceShakingGrass) {
+ public void setBalanceShakingGrass(boolean balanceShakingGrass) {
this.balanceShakingGrass = balanceShakingGrass;
- return this;
}
public boolean isWildLevelsModified() {
return wildLevelsModified;
}
- public Settings setWildLevelsModified(boolean wildLevelsModified) {
+ public void setWildLevelsModified(boolean wildLevelsModified) {
this.wildLevelsModified = wildLevelsModified;
- return this;
}
public int getWildLevelModifier() {
return wildLevelModifier;
}
- public Settings setWildLevelModifier(int wildLevelModifier) {
+ public void setWildLevelModifier(int wildLevelModifier) {
this.wildLevelModifier = wildLevelModifier;
- return this;
}
public StaticPokemonMod getStaticPokemonMod() {
return staticPokemonMod;
}
- public Settings setStaticPokemonMod(StaticPokemonMod staticPokemonMod) {
- this.staticPokemonMod = staticPokemonMod;
- return this;
+ public void setStaticPokemonMod(boolean... bools) {
+ setStaticPokemonMod(getEnum(StaticPokemonMod.class, bools));
}
- public Settings setStaticPokemonMod(boolean... bools) {
- return setStaticPokemonMod(getEnum(StaticPokemonMod.class, bools));
+ private void setStaticPokemonMod(StaticPokemonMod staticPokemonMod) {
+ this.staticPokemonMod = staticPokemonMod;
}
public TMsMod getTmsMod() {
return tmsMod;
}
- public Settings setTmsMod(TMsMod tmsMod) {
- this.tmsMod = tmsMod;
- return this;
+ public void setTmsMod(boolean... bools) {
+ setTmsMod(getEnum(TMsMod.class, bools));
}
- public Settings setTmsMod(boolean... bools) {
- return setTmsMod(getEnum(TMsMod.class, bools));
+ private void setTmsMod(TMsMod tmsMod) {
+ this.tmsMod = tmsMod;
}
public boolean isTmLevelUpMoveSanity() {
return tmLevelUpMoveSanity;
}
- public Settings setTmLevelUpMoveSanity(boolean tmLevelUpMoveSanity) {
+ public void setTmLevelUpMoveSanity(boolean tmLevelUpMoveSanity) {
this.tmLevelUpMoveSanity = tmLevelUpMoveSanity;
- return this;
}
public boolean isKeepFieldMoveTMs() {
return keepFieldMoveTMs;
}
- public Settings setKeepFieldMoveTMs(boolean keepFieldMoveTMs) {
+ public void setKeepFieldMoveTMs(boolean keepFieldMoveTMs) {
this.keepFieldMoveTMs = keepFieldMoveTMs;
- return this;
}
public boolean isFullHMCompat() {
return fullHMCompat;
}
- public Settings setFullHMCompat(boolean fullHMCompat) {
+ public void setFullHMCompat(boolean fullHMCompat) {
this.fullHMCompat = fullHMCompat;
- return this;
}
public boolean isTmsForceGoodDamaging() {
return tmsForceGoodDamaging;
}
- public Settings setTmsForceGoodDamaging(boolean tmsForceGoodDamaging) {
+ public void setTmsForceGoodDamaging(boolean tmsForceGoodDamaging) {
this.tmsForceGoodDamaging = tmsForceGoodDamaging;
- return this;
}
public int getTmsGoodDamagingPercent() {
return tmsGoodDamagingPercent;
}
- public Settings setTmsGoodDamagingPercent(int tmsGoodDamagingPercent) {
+ public void setTmsGoodDamagingPercent(int tmsGoodDamagingPercent) {
this.tmsGoodDamagingPercent = tmsGoodDamagingPercent;
- return this;
}
public TMsHMsCompatibilityMod getTmsHmsCompatibilityMod() {
return tmsHmsCompatibilityMod;
}
- public Settings setTmsHmsCompatibilityMod(TMsHMsCompatibilityMod tmsHmsCompatibilityMod) {
- this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
- return this;
+ public void setTmsHmsCompatibilityMod(boolean... bools) {
+ setTmsHmsCompatibilityMod(getEnum(TMsHMsCompatibilityMod.class, bools));
}
- public Settings setTmsHmsCompatibilityMod(boolean... bools) {
- return setTmsHmsCompatibilityMod(getEnum(TMsHMsCompatibilityMod.class, bools));
+ private void setTmsHmsCompatibilityMod(TMsHMsCompatibilityMod tmsHmsCompatibilityMod) {
+ this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
}
public MoveTutorMovesMod getMoveTutorMovesMod() {
return moveTutorMovesMod;
}
- public Settings setMoveTutorMovesMod(MoveTutorMovesMod moveTutorMovesMod) {
- this.moveTutorMovesMod = moveTutorMovesMod;
- return this;
+ public void setMoveTutorMovesMod(boolean... bools) {
+ setMoveTutorMovesMod(getEnum(MoveTutorMovesMod.class, bools));
}
- public Settings setMoveTutorMovesMod(boolean... bools) {
- return setMoveTutorMovesMod(getEnum(MoveTutorMovesMod.class, bools));
+ private void setMoveTutorMovesMod(MoveTutorMovesMod moveTutorMovesMod) {
+ this.moveTutorMovesMod = moveTutorMovesMod;
}
public boolean isTutorLevelUpMoveSanity() {
return tutorLevelUpMoveSanity;
}
- public Settings setTutorLevelUpMoveSanity(boolean tutorLevelUpMoveSanity) {
+ public void setTutorLevelUpMoveSanity(boolean tutorLevelUpMoveSanity) {
this.tutorLevelUpMoveSanity = tutorLevelUpMoveSanity;
- return this;
}
public boolean isKeepFieldMoveTutors() {
return keepFieldMoveTutors;
}
- public Settings setKeepFieldMoveTutors(boolean keepFieldMoveTutors) {
+ public void setKeepFieldMoveTutors(boolean keepFieldMoveTutors) {
this.keepFieldMoveTutors = keepFieldMoveTutors;
- return this;
}
public boolean isTutorsForceGoodDamaging() {
return tutorsForceGoodDamaging;
}
- public Settings setTutorsForceGoodDamaging(boolean tutorsForceGoodDamaging) {
+ public void setTutorsForceGoodDamaging(boolean tutorsForceGoodDamaging) {
this.tutorsForceGoodDamaging = tutorsForceGoodDamaging;
- return this;
}
public int getTutorsGoodDamagingPercent() {
return tutorsGoodDamagingPercent;
}
- public Settings setTutorsGoodDamagingPercent(int tutorsGoodDamagingPercent) {
+ public void setTutorsGoodDamagingPercent(int tutorsGoodDamagingPercent) {
this.tutorsGoodDamagingPercent = tutorsGoodDamagingPercent;
- return this;
}
public MoveTutorsCompatibilityMod getMoveTutorsCompatibilityMod() {
return moveTutorsCompatibilityMod;
}
- public Settings setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod moveTutorsCompatibilityMod) {
- this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
- return this;
+ public void setMoveTutorsCompatibilityMod(boolean... bools) {
+ setMoveTutorsCompatibilityMod(getEnum(MoveTutorsCompatibilityMod.class, bools));
}
- public Settings setMoveTutorsCompatibilityMod(boolean... bools) {
- return setMoveTutorsCompatibilityMod(getEnum(MoveTutorsCompatibilityMod.class, bools));
+ private void setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod moveTutorsCompatibilityMod) {
+ this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
}
public InGameTradesMod getInGameTradesMod() {
return inGameTradesMod;
}
- public Settings setInGameTradesMod(InGameTradesMod inGameTradesMod) {
- this.inGameTradesMod = inGameTradesMod;
- return this;
+ public void setInGameTradesMod(boolean... bools) {
+ setInGameTradesMod(getEnum(InGameTradesMod.class, bools));
}
- public Settings setInGameTradesMod(boolean... bools) {
- return setInGameTradesMod(getEnum(InGameTradesMod.class, bools));
+ private void setInGameTradesMod(InGameTradesMod inGameTradesMod) {
+ this.inGameTradesMod = inGameTradesMod;
}
public boolean isRandomizeInGameTradesNicknames() {
return randomizeInGameTradesNicknames;
}
- public Settings setRandomizeInGameTradesNicknames(boolean randomizeInGameTradesNicknames) {
+ public void setRandomizeInGameTradesNicknames(boolean randomizeInGameTradesNicknames) {
this.randomizeInGameTradesNicknames = randomizeInGameTradesNicknames;
- return this;
}
public boolean isRandomizeInGameTradesOTs() {
return randomizeInGameTradesOTs;
}
- public Settings setRandomizeInGameTradesOTs(boolean randomizeInGameTradesOTs) {
+ public void setRandomizeInGameTradesOTs(boolean randomizeInGameTradesOTs) {
this.randomizeInGameTradesOTs = randomizeInGameTradesOTs;
- return this;
}
public boolean isRandomizeInGameTradesIVs() {
return randomizeInGameTradesIVs;
}
- public Settings setRandomizeInGameTradesIVs(boolean randomizeInGameTradesIVs) {
+ public void setRandomizeInGameTradesIVs(boolean randomizeInGameTradesIVs) {
this.randomizeInGameTradesIVs = randomizeInGameTradesIVs;
- return this;
}
public boolean isRandomizeInGameTradesItems() {
return randomizeInGameTradesItems;
}
- public Settings setRandomizeInGameTradesItems(boolean randomizeInGameTradesItems) {
+ public void setRandomizeInGameTradesItems(boolean randomizeInGameTradesItems) {
this.randomizeInGameTradesItems = randomizeInGameTradesItems;
- return this;
}
public FieldItemsMod getFieldItemsMod() {
return fieldItemsMod;
}
- public Settings setFieldItemsMod(FieldItemsMod fieldItemsMod) {
- this.fieldItemsMod = fieldItemsMod;
- return this;
+ public void setFieldItemsMod(boolean... bools) {
+ setFieldItemsMod(getEnum(FieldItemsMod.class, bools));
}
- public Settings setFieldItemsMod(boolean... bools) {
- return setFieldItemsMod(getEnum(FieldItemsMod.class, bools));
+ private void setFieldItemsMod(FieldItemsMod fieldItemsMod) {
+ this.fieldItemsMod = fieldItemsMod;
}
public boolean isBanBadRandomFieldItems() {
@@ -1692,66 +1607,60 @@ public class Settings { }
- public Settings setBanBadRandomFieldItems(boolean banBadRandomFieldItems) {
+ public void setBanBadRandomFieldItems(boolean banBadRandomFieldItems) {
this.banBadRandomFieldItems = banBadRandomFieldItems;
- return this;
}
public ShopItemsMod getShopItemsMod() {
return shopItemsMod;
}
- public Settings setShopItemsMod(ShopItemsMod shopItemsMod) {
- this.shopItemsMod = shopItemsMod;
- return this;
+ public void setShopItemsMod(boolean... bools) {
+ setShopItemsMod(getEnum(ShopItemsMod.class, bools));
}
- public Settings setShopItemsMod(boolean... bools) {
- return setShopItemsMod(getEnum(ShopItemsMod.class, bools));
+ private void setShopItemsMod(ShopItemsMod shopItemsMod) {
+ this.shopItemsMod = shopItemsMod;
}
public boolean isBanBadRandomShopItems() {
return banBadRandomShopItems;
}
- public Settings setBanBadRandomShopItems(boolean banBadRandomShopItems) {
+ public void setBanBadRandomShopItems(boolean banBadRandomShopItems) {
this.banBadRandomShopItems = banBadRandomShopItems;
- return this;
}
public boolean isBanRegularShopItems() {
return banRegularShopItems;
}
- public Settings setBanRegularShopItems(boolean banRegularShopItems) {
+ public void setBanRegularShopItems(boolean banRegularShopItems) {
this.banRegularShopItems = banRegularShopItems;
- return this;
}
public boolean isBanOPShopItems() {
return banOPShopItems;
}
- public Settings setBanOPShopItems(boolean banOPShopItems) {
+ public void setBanOPShopItems(boolean banOPShopItems) {
this.banOPShopItems = banOPShopItems;
- return this;
}
public boolean isBalanceShopPrices() {
return balanceShopPrices;
}
- public Settings setBalanceShopPrices(boolean balanceShopPrices) {
+ public void setBalanceShopPrices(boolean balanceShopPrices) {
this.balanceShopPrices = balanceShopPrices;
- return this;
}
public boolean isGuaranteeEvolutionItems() {
return guaranteeEvolutionItems;
}
- public Settings setGuaranteeEvolutionItems(boolean guaranteeEvolutionItems) {
+
+ public void setGuaranteeEvolutionItems(boolean guaranteeEvolutionItems) {
this.guaranteeEvolutionItems = guaranteeEvolutionItems;
- return this;
}
private static int makeByteSelected(boolean... bools) {
@@ -1787,7 +1696,7 @@ public class Settings { out.write((value >> 8) & 0xFF);
}
- public static <E extends Enum<E>> E restoreEnum(Class<E> clazz, byte b, int... indices) {
+ private static <E extends Enum<E>> E restoreEnum(Class<E> clazz, byte b, int... indices) {
boolean[] bools = new boolean[indices.length];
int i = 0;
for (int idx : indices) {
@@ -1798,7 +1707,7 @@ public class Settings { }
@SuppressWarnings("unchecked")
- public static <E extends Enum<E>> E getEnum(Class<E> clazz, boolean... bools) {
+ private static <E extends Enum<E>> E getEnum(Class<E> clazz, boolean... bools) {
int index = getSetEnum(clazz.getSimpleName(), bools);
try {
return ((E[]) clazz.getMethod("values").invoke(null))[index];
diff --git a/src/com/dabomstew/pkrandom/Utils.java b/src/com/dabomstew/pkrandom/Utils.java index 1825802..616917e 100644 --- a/src/com/dabomstew/pkrandom/Utils.java +++ b/src/com/dabomstew/pkrandom/Utils.java @@ -88,7 +88,7 @@ public class Utils { } public static void validatePresetSupplementFiles(String config, CustomNamesSet customNames) - throws UnsupportedEncodingException, InvalidSupplementFilesException { + throws InvalidSupplementFilesException { byte[] data = DatatypeConverter.parseBase64Binary(config); if (data.length < Settings.LENGTH_OF_SETTINGS_DATA + 9) { @@ -116,8 +116,7 @@ public class Utils { public static File getExecutionLocation() throws UnsupportedEncodingException { URL location = RandomizerGUI.class.getProtectionDomain().getCodeSource().getLocation(); - File fh = new File(java.net.URLDecoder.decode(location.getFile(), "UTF-8")); - return fh; + return new File(java.net.URLDecoder.decode(location.getFile(), "UTF-8")); } public static class InvalidROMException extends Exception { diff --git a/src/com/dabomstew/pkrandom/newnds/NARCArchive.java b/src/com/dabomstew/pkrandom/newnds/NARCArchive.java index 9b92f72..8a029d1 100644 --- a/src/com/dabomstew/pkrandom/newnds/NARCArchive.java +++ b/src/com/dabomstew/pkrandom/newnds/NARCArchive.java @@ -8,10 +8,10 @@ import java.util.TreeMap; public class NARCArchive { - public List<String> filenames = new ArrayList<String>(); - public List<byte[]> files = new ArrayList<byte[]>(); + private List<String> filenames = new ArrayList<>(); + public List<byte[]> files = new ArrayList<>(); - public boolean hasFilenames = false; + private boolean hasFilenames = false; public NARCArchive() { // creates a new empty NARC with no filenames by default @@ -155,7 +155,7 @@ public class NARCArchive { // each frame int offset = 0x10; - Map<String, byte[]> frames = new TreeMap<String, byte[]>(); + Map<String, byte[]> frames = new TreeMap<>(); for (int i = 0; i < frameCount; i++) { byte[] magic = new byte[] { data[offset + 3], data[offset + 2], data[offset + 1], data[offset] }; String magicS = new String(magic, "US-ASCII"); diff --git a/src/com/dabomstew/pkrandom/newnds/NDSFile.java b/src/com/dabomstew/pkrandom/newnds/NDSFile.java index dace672..4442554 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSFile.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSFile.java @@ -34,8 +34,8 @@ public class NDSFile { public int offset, size; public int fileID; public String fullPath; - public Extracted status = Extracted.NOT; - public String extFilename; + private Extracted status = Extracted.NOT; + private String extFilename; public byte[] data; public NDSFile(NDSRom parent) { @@ -53,8 +53,7 @@ public class NDSFile { if (parent.isWritingEnabled()) { // make a file String tmpDir = parent.getTmpFolder(); - String tmpFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); - this.extFilename = tmpFilename; + this.extFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); File tmpFile = new File(tmpDir + extFilename); FileOutputStream fos = new FileOutputStream(tmpFile); fos.write(buf); @@ -76,8 +75,7 @@ public class NDSFile { return newcopy; } else { String tmpDir = parent.getTmpFolder(); - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); } } @@ -113,7 +111,7 @@ public class NDSFile { } private enum Extracted { - NOT, TO_FILE, TO_RAM; + NOT, TO_FILE, TO_RAM } } diff --git a/src/com/dabomstew/pkrandom/newnds/NDSRom.java b/src/com/dabomstew/pkrandom/newnds/NDSRom.java index c0fe637..d0951c9 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSRom.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSRom.java @@ -117,11 +117,11 @@ public class NDSRom { fat = new byte[fatSize]; baseRom.readFully(fat); - Map<Integer, String> directoryPaths = new HashMap<Integer, String>(); + Map<Integer, String> directoryPaths = new HashMap<>(); directoryPaths.put(0xF000, ""); int dircount = readFromFile(baseRom, fntOffset + 0x6, 2); - files = new HashMap<String, NDSFile>(); - filesByID = new HashMap<Integer, NDSFile>(); + files = new HashMap<>(); + filesByID = new HashMap<>(); // read fnt table baseRom.seek(fntOffset); @@ -136,8 +136,8 @@ public class NDSRom { // get dirnames String[] directoryNames = new String[dircount]; - Map<Integer, String> filenames = new TreeMap<Integer, String>(); - Map<Integer, Integer> fileDirectories = new HashMap<Integer, Integer>(); + Map<Integer, String> filenames = new TreeMap<>(); + Map<Integer, Integer> fileDirectories = new HashMap<>(); for (int i = 0; i < dircount && i < 0x1000; i++) { firstPassDirectory(i, subTableOffsets[i], firstFileIDs[i], directoryNames, filenames, fileDirectories); } @@ -146,13 +146,13 @@ public class NDSRom { for (int i = 1; i < dircount && i < 0x1000; i++) { String dirname = directoryNames[i]; if (dirname != null) { - String fullDirName = ""; + StringBuilder fullDirName = new StringBuilder(); int curDir = i; while (dirname != null && !dirname.isEmpty()) { - if (!fullDirName.isEmpty()) { - fullDirName = "/" + fullDirName; + if (fullDirName.length() > 0) { + fullDirName.insert(0, "/"); } - fullDirName = dirname + fullDirName; + fullDirName.insert(0, dirname); int parentDir = parentDirIDs[curDir]; if (parentDir >= 0xF001 && parentDir <= 0xFFFF) { curDir = parentDir - 0xF000; @@ -161,7 +161,7 @@ public class NDSRom { break; } } - directoryPaths.put(i + 0xF000, fullDirName); + directoryPaths.put(i + 0xF000, fullDirName.toString()); } else { directoryPaths.put(i + 0xF000, ""); } @@ -193,7 +193,7 @@ public class NDSRom { int arm9_ovl_count = arm9_ovl_table_size / 32; byte[] y9table = new byte[arm9_ovl_table_size]; arm9overlays = new NDSY9Entry[arm9_ovl_count]; - arm9overlaysByFileID = new HashMap<Integer, NDSY9Entry>(); + arm9overlaysByFileID = new HashMap<>(); baseRom.seek(arm9_ovl_table_offset); baseRom.readFully(y9table); @@ -267,7 +267,7 @@ public class NDSRom { // don't actually write arm9 ovl yet // arm7 - int arm7_offset = ((int) (arm9_ovl_offset + arm9_ovl_size + arm7_align)) & (~arm7_align); + int arm7_offset = arm9_ovl_offset + arm9_ovl_size + arm7_align & (~arm7_align); int old_arm7_offset = readFromFile(this.baseRom, 0x30, 4); int arm7_size = readFromFile(this.baseRom, 0x3C, 4); // copy arm7 @@ -436,7 +436,6 @@ public class NDSRom { to.write(copybuf, 0, read); bytes -= read; } - copybuf = null; } // get rom code for opened rom @@ -526,7 +525,6 @@ public class NDSRom { if (foundOffsets2.size() == 1) { arm9_szmode = 2; arm9_szoffset = foundOffsets2.get(0); - } else { } } } @@ -553,8 +551,7 @@ public class NDSRom { } } else { if (writingEnabled) { - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpFolder + "arm9.bin"); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpFolder + "arm9.bin"); } else { byte[] newcopy = new byte[this.arm9_ramstored.length]; System.arraycopy(this.arm9_ramstored, 0, newcopy, 0, this.arm9_ramstored.length); @@ -638,7 +635,7 @@ public class NDSRom { return writingEnabled; } - public int readFromByteArr(byte[] data, int offset, int size) { + private int readFromByteArr(byte[] data, int offset, int size) { int result = 0; for (int i = 0; i < size; i++) { result |= (data[i + offset] & 0xFF) << (i * 8); @@ -646,19 +643,19 @@ public class NDSRom { return result; } - public void writeToByteArr(byte[] data, int offset, int size, int value) { + private void writeToByteArr(byte[] data, int offset, int size, int value) { for (int i = 0; i < size; i++) { data[offset + i] = (byte) ((value >> (i * 8)) & 0xFF); } } - public int readFromFile(RandomAccessFile file, int size) throws IOException { + private int readFromFile(RandomAccessFile file, int size) throws IOException { return readFromFile(file, -1, size); } // use -1 offset to read from current position // useful if you want to read blocks - public int readFromFile(RandomAccessFile file, int offset, int size) throws IOException { + private int readFromFile(RandomAccessFile file, int offset, int size) throws IOException { byte[] buf = new byte[size]; if (offset >= 0) file.seek(offset); @@ -674,7 +671,7 @@ public class NDSRom { writeToFile(file, -1, size, value); } - public void writeToFile(RandomAccessFile file, int offset, int size, int value) throws IOException { + private void writeToFile(RandomAccessFile file, int offset, int size, int value) throws IOException { byte[] buf = new byte[size]; for (int i = 0; i < size; i++) { buf[i] = (byte) ((value >> (i * 8)) & 0xFF); diff --git a/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java b/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java index a307ac8..07d8963 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java @@ -41,8 +41,8 @@ public class NDSY9Entry { public int static_start, static_end; public int compressed_size; public int compress_flag; - public Extracted status = Extracted.NOT; - public String extFilename; + private Extracted status = Extracted.NOT; + private String extFilename; public byte[] data; private boolean decompressed_data = false; @@ -67,8 +67,7 @@ public class NDSY9Entry { // make a file String tmpDir = parent.getTmpFolder(); String fullPath = String.format("overlay_%04d", overlay_id); - String tmpFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); - this.extFilename = tmpFilename; + this.extFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); File tmpFile = new File(tmpDir + extFilename); FileOutputStream fos = new FileOutputStream(tmpFile); fos.write(buf); @@ -90,8 +89,7 @@ public class NDSY9Entry { return newcopy; } else { String tmpDir = parent.getTmpFolder(); - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); } } @@ -134,7 +132,7 @@ public class NDSY9Entry { } private enum Extracted { - NOT, TO_FILE, TO_RAM; + NOT, TO_FILE, TO_RAM } } diff --git a/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java b/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java index 7e57616..12dd011 100755 --- a/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java +++ b/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java @@ -31,8 +31,8 @@ import java.util.Set; public class EncounterSet { public int rate; - public List<Encounter> encounters = new ArrayList<Encounter>(); - public Set<Pokemon> bannedPokemon = new HashSet<Pokemon>(); + public List<Encounter> encounters = new ArrayList<>(); + public Set<Pokemon> bannedPokemon = new HashSet<>(); public String displayName; public int offset; diff --git a/src/com/dabomstew/pkrandom/pokemon/Evolution.java b/src/com/dabomstew/pkrandom/pokemon/Evolution.java index 5f54f6d..f913e4a 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Evolution.java +++ b/src/com/dabomstew/pkrandom/pokemon/Evolution.java @@ -58,13 +58,7 @@ public class Evolution implements Comparable<Evolution> { if (getClass() != obj.getClass()) return false; Evolution other = (Evolution) obj; - if (from != other.from) - return false; - if (to != other.to) - return false; - if (type != other.type) - return false; - return true; + return from == other.from && to == other.to && type == other.type; } @Override @@ -77,13 +71,7 @@ public class Evolution implements Comparable<Evolution> { return -1; } else if (this.to.number > o.to.number) { return 1; - } else if (this.type.ordinal() < o.type.ordinal()) { - return -1; - } else if (this.type.ordinal() > o.type.ordinal()) { - return 1; - } else { - return 0; - } + } else return Integer.compare(this.type.ordinal(), o.type.ordinal()); } } diff --git a/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java b/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java index 3ddf21b..039143f 100755 --- a/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java +++ b/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java @@ -45,7 +45,7 @@ public enum EvolutionType { } } - private EvolutionType(int... indexes) { + EvolutionType(int... indexes) { this.indexNumbers = indexes; } diff --git a/src/com/dabomstew/pkrandom/pokemon/ItemList.java b/src/com/dabomstew/pkrandom/pokemon/ItemList.java index 6ae7dc8..636c677 100755 --- a/src/com/dabomstew/pkrandom/pokemon/ItemList.java +++ b/src/com/dabomstew/pkrandom/pokemon/ItemList.java @@ -16,17 +16,11 @@ public class ItemList { } public boolean isTM(int index) { - if (index < 0 || index >= tms.length) { - return false; - } - return tms[index]; + return index >= 0 && index < tms.length && tms[index]; } public boolean isAllowed(int index) { - if (index < 0 || index >= tms.length) { - return false; - } - return items[index]; + return index >= 0 && index < tms.length && items[index]; } public void banSingles(int... indexes) { diff --git a/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java b/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java index 9035409..70d42bf 100644 --- a/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java +++ b/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java @@ -24,5 +24,5 @@ package com.dabomstew.pkrandom.pokemon; /*----------------------------------------------------------------------------*/ public enum MoveCategory { - PHYSICAL, SPECIAL, STATUS; + PHYSICAL, SPECIAL, STATUS } diff --git a/src/com/dabomstew/pkrandom/pokemon/Pokemon.java b/src/com/dabomstew/pkrandom/pokemon/Pokemon.java index 7b81e21..cc7fb36 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Pokemon.java +++ b/src/com/dabomstew/pkrandom/pokemon/Pokemon.java @@ -55,10 +55,10 @@ public class Pokemon implements Comparable<Pokemon> { public ExpCurve growthCurve; - public List<Evolution> evolutionsFrom = new ArrayList<Evolution>(); - public List<Evolution> evolutionsTo = new ArrayList<Evolution>(); + public List<Evolution> evolutionsFrom = new ArrayList<>(); + public List<Evolution> evolutionsTo = new ArrayList<>(); - public List<Integer> shuffledStatsOrder = null; + private List<Integer> shuffledStatsOrder; // A flag to use for things like recursive stats copying. // Must not rely on the state of this flag being preserved between calls. @@ -159,7 +159,7 @@ public class Pokemon implements Comparable<Pokemon> { special = (int) Math.ceil((spatk + spdef) / 2.0f); } - public int bst() { + private int bst() { return hp + attack + defense + spatk + spdef + speed; } @@ -206,9 +206,7 @@ public class Pokemon implements Comparable<Pokemon> { if (getClass() != obj.getClass()) return false; Pokemon other = (Pokemon) obj; - if (number != other.number) - return false; - return true; + return number == other.number; } @Override diff --git a/src/com/dabomstew/pkrandom/pokemon/Trainer.java b/src/com/dabomstew/pkrandom/pokemon/Trainer.java index 0fedbbf..6f6df33 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Trainer.java +++ b/src/com/dabomstew/pkrandom/pokemon/Trainer.java @@ -28,7 +28,7 @@ import java.util.List; public class Trainer implements Comparable<Trainer> { public int offset; - public List<TrainerPokemon> pokemon = new ArrayList<TrainerPokemon>(); + public List<TrainerPokemon> pokemon = new ArrayList<>(); public String tag; public boolean importantTrainer; public int poketype; @@ -39,12 +39,12 @@ public class Trainer implements Comparable<Trainer> { public String toString() { StringBuilder sb = new StringBuilder("["); if (fullDisplayName != null) { - sb.append(fullDisplayName + " "); + sb.append(fullDisplayName).append(" "); } else if (name != null) { - sb.append(name + " "); + sb.append(name).append(" "); } if (trainerclass != 0) { - sb.append("(" + trainerclass + ") - "); + sb.append("(").append(trainerclass).append(") - "); } sb.append(String.format("%x", offset)); sb.append(" => "); @@ -53,12 +53,12 @@ public class Trainer implements Comparable<Trainer> { if (!first) { sb.append(','); } - sb.append(p.pokemon.name + " Lv" + p.level); + sb.append(p.pokemon.name).append(" Lv").append(p.level); first = false; } sb.append(']'); if (tag != null) { - sb.append(" (" + tag + ")"); + sb.append(" (").append(tag).append(")"); } return sb.toString(); } @@ -80,9 +80,7 @@ public class Trainer implements Comparable<Trainer> { if (getClass() != obj.getClass()) return false; Trainer other = (Trainer) obj; - if (offset != other.offset) - return false; - return true; + return offset == other.offset; } @Override diff --git a/src/com/dabomstew/pkrandom/pokemon/Type.java b/src/com/dabomstew/pkrandom/pokemon/Type.java index 1f244dc..2023db1 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Type.java +++ b/src/com/dabomstew/pkrandom/pokemon/Type.java @@ -37,11 +37,11 @@ public enum Type { public boolean isHackOnly; - private Type() { + Type() { this.isHackOnly = false; } - private Type(boolean isHackOnly) { + Type(boolean isHackOnly) { this.isHackOnly = isHackOnly; } diff --git a/src/compressors/DSDecmp.java b/src/compressors/DSDecmp.java index 3cf442f..05f8c59 100644 --- a/src/compressors/DSDecmp.java +++ b/src/compressors/DSDecmp.java @@ -61,7 +61,6 @@ public class DSDecmp { for (int i = 0; i < 8; i++) { flag = (flags & (0x80 >> i)) > 0; if (flag) { - disp = 0; b = data[offset++] & 0xFF; n = b >> 4; disp = (b & 0x0F) << 8; diff --git a/src/compressors/Gen1Decmp.java b/src/compressors/Gen1Decmp.java index cf6d67c..2215a5c 100644 --- a/src/compressors/Gen1Decmp.java +++ b/src/compressors/Gen1Decmp.java @@ -9,7 +9,7 @@ package compressors; */ public class Gen1Decmp { - public static int bitflip(int x, int n) { + private static int bitflip(int x, int n) { int r = 0; while (n > 0) { r = (r << 1) | (x & 1); @@ -19,8 +19,8 @@ public class Gen1Decmp { return r; } - static int[] table1, table3; - static int[][] table2 = { { 0x0, 0x1, 0x3, 0x2, 0x7, 0x6, 0x4, 0x5, 0xf, 0xe, 0xc, 0xd, 0x8, 0x9, 0xb, 0xa }, + private static int[] table1, table3; + private static int[][] table2 = { { 0x0, 0x1, 0x3, 0x2, 0x7, 0x6, 0x4, 0x5, 0xf, 0xe, 0xc, 0xd, 0x8, 0x9, 0xb, 0xa }, { 0xf, 0xe, 0xc, 0xd, 0x8, 0x9, 0xb, 0xa, 0x0, 0x1, 0x3, 0x2, 0x7, 0x6, 0x4, 0x5 }, { 0x0, 0x8, 0xc, 0x4, 0xe, 0x6, 0x2, 0xa, 0xf, 0x7, 0x3, 0xb, 0x1, 0x9, 0xd, 0x5 }, { 0xf, 0x7, 0x3, 0xb, 0x1, 0x9, 0xd, 0x5, 0x0, 0x8, 0xc, 0x4, 0xe, 0x6, 0x2, 0xa }, }; @@ -35,7 +35,7 @@ public class Gen1Decmp { } } - static int tilesize = 8; + private static int tilesize = 8; private BitStream bs; private boolean mirror, planar; @@ -47,7 +47,7 @@ public class Gen1Decmp { this(input, baseOffset, false, true); } - public Gen1Decmp(byte[] input, int baseOffset, boolean mirror, boolean planar) { + private Gen1Decmp(byte[] input, int baseOffset, boolean mirror, boolean planar) { this.bs = new BitStream(input, baseOffset); this.mirror = mirror; this.planar = planar; @@ -228,7 +228,7 @@ public class Gen1Decmp { int limiter = bits.length - 3; byte[] ret = new byte[bits.length / 4]; for (int i = 0; i < limiter; i += 4) { - int n = ((bits[i + 0] << 6) | (bits[i + 1] << 4) | (bits[i + 2] << 2) | (bits[i + 3] << 0)); + int n = ((bits[i] << 6) | (bits[i + 1] << 4) | (bits[i + 2] << 2) | (bits[i + 3])); ret[i / 4] = (byte) n; } return ret; diff --git a/src/compressors/Gen2Decmp.java b/src/compressors/Gen2Decmp.java index c0c3c75..af744b2 100644 --- a/src/compressors/Gen2Decmp.java +++ b/src/compressors/Gen2Decmp.java @@ -13,7 +13,7 @@ public class Gen2Decmp { private static final int INITIAL_BUF_SIZE = 0x1000; public byte[] data; - public int address; + private int address; private byte[] output; private int out_idx; private int cmd; @@ -159,7 +159,7 @@ public class Gen2Decmp { output = newOut; } - public int peek() { + private int peek() { return data[address] & 0xFF; } diff --git a/src/cuecompressors/BLZCoder.java b/src/cuecompressors/BLZCoder.java index dd9fd57..ea9b20f 100755 --- a/src/cuecompressors/BLZCoder.java +++ b/src/cuecompressors/BLZCoder.java @@ -27,9 +27,6 @@ import com.dabomstew.pkrandom.FileFunctions; public class BLZCoder { - /** - * @param args - */ public static void main(String[] args) { new BLZCoder(args); } @@ -118,7 +115,7 @@ public class BLZCoder { System.out.print("\n"); } - public void EXIT(String text) { + private void EXIT(String text) { System.out.print(text); System.exit(0); } @@ -160,7 +157,6 @@ public class BLZCoder { for (int i = 0; i < result.length; i++) { retbuf[i] = (byte) result.buffer[i]; } - result = null; return retbuf; } else { return null; @@ -178,7 +174,7 @@ public class BLZCoder { inc_len = readUnsigned(pak_buffer, pak_len - 4); if (inc_len < 1) { - System.out.printf(", WARNING: not coded file!"); + System.out.print(", WARNING: not coded file!"); enc_len = 0; dec_len = pak_len; pak_len = 0; @@ -318,7 +314,6 @@ public class BLZCoder { for (int i = 0; i < result.length; i++) { retbuf[i] = (byte) result.buffer[i]; } - result = null; return retbuf; } else { return null; @@ -464,7 +459,6 @@ public class BLZCoder { tmp[raw_tmp + len] = pak_buffer[len + pak_len - pak_tmp]; } - pak = 0; pak_buffer = tmp; pak = raw_tmp + pak_tmp; diff --git a/src/pptxt/PPTxtHandler.java b/src/pptxt/PPTxtHandler.java index bda9ea3..269ced9 100755 --- a/src/pptxt/PPTxtHandler.java +++ b/src/pptxt/PPTxtHandler.java @@ -19,10 +19,10 @@ import com.dabomstew.pkrandom.FileFunctions; public class PPTxtHandler { - public static Map<String, String> pokeToText = new HashMap<String, String>(); - public static Map<String, String> textToPoke = new HashMap<String, String>(); + private static Map<String, String> pokeToText = new HashMap<>(); + private static Map<String, String> textToPoke = new HashMap<>(); - public static Pattern pokeToTextPattern, textToPokePattern; + private static Pattern pokeToTextPattern, textToPokePattern; static { try { @@ -43,17 +43,18 @@ public class PPTxtHandler { pokeToTextPattern = makePattern(pokeToText.keySet()); textToPokePattern = makePattern(textToPoke.keySet()); } catch (FileNotFoundException e) { + e.printStackTrace(); } } - public static Pattern makePattern(Iterable<String> tokens) { + private static Pattern makePattern(Iterable<String> tokens) { String patternStr = "(" + implode(tokens, "|").replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]") .replace("(", "\\(").replace(")", "\\)") + ")"; return Pattern.compile(patternStr); } - public static String implode(Iterable<String> tokens, String sep) { + private static String implode(Iterable<String> tokens, String sep) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String token : tokens) { @@ -76,7 +77,7 @@ public class PPTxtHandler { * @return Decompressed list of integers corresponding to characters */ private static List<Integer> decompress(List<Integer> chars) { - List<Integer> uncomp = new ArrayList<Integer>(); + List<Integer> uncomp = new ArrayList<>(); int j = 1; int shift1 = 0; int trans = 0; @@ -129,19 +130,19 @@ public class PPTxtHandler { public static List<String> readTexts(byte[] ds) { int pos = 0; int i = 0; - lastKeys = new ArrayList<Integer>(); - lastUnknowns = new ArrayList<Integer>(); - List<String> strings = new ArrayList<String>(); + lastKeys = new ArrayList<>(); + lastUnknowns = new ArrayList<>(); + List<String> strings = new ArrayList<>(); int numSections, numEntries, tmpCharCount, tmpUnknown, tmpChar; int tmpOffset; int[] sizeSections = new int[] { 0, 0, 0 }; int[] sectionOffset = new int[] { 0, 0, 0 }; - Map<Integer, List<Integer>> tableOffsets = new HashMap<Integer, List<Integer>>(); - Map<Integer, List<Integer>> characterCount = new HashMap<Integer, List<Integer>>(); - Map<Integer, List<Integer>> unknown = new HashMap<Integer, List<Integer>>(); - Map<Integer, List<List<Integer>>> encText = new HashMap<Integer, List<List<Integer>>>(); - Map<Integer, List<List<String>>> decText = new HashMap<Integer, List<List<String>>>(); - String string = ""; + Map<Integer, List<Integer>> tableOffsets = new HashMap<>(); + Map<Integer, List<Integer>> characterCount = new HashMap<>(); + Map<Integer, List<Integer>> unknown = new HashMap<>(); + Map<Integer, List<List<Integer>>> encText = new HashMap<>(); + Map<Integer, List<List<String>>> decText = new HashMap<>(); + StringBuilder sb; int key; numSections = readWord(ds, 0); @@ -157,11 +158,11 @@ public class PPTxtHandler { pos = sectionOffset[i]; sizeSections[i] = readLong(ds, pos); pos += 4; - tableOffsets.put(i, new ArrayList<Integer>()); - characterCount.put(i, new ArrayList<Integer>()); - unknown.put(i, new ArrayList<Integer>()); - encText.put(i, new ArrayList<List<Integer>>()); - decText.put(i, new ArrayList<List<String>>()); + tableOffsets.put(i, new ArrayList<>()); + characterCount.put(i, new ArrayList<>()); + unknown.put(i, new ArrayList<>()); + encText.put(i, new ArrayList<>()); + decText.put(i, new ArrayList<>()); for (int j = 0; j < numEntries; j++) { tmpOffset = readLong(ds, pos); pos += 4; @@ -175,7 +176,7 @@ public class PPTxtHandler { lastUnknowns.add(tmpUnknown); } for (int j = 0; j < numEntries; j++) { - List<Integer> tmpEncChars = new ArrayList<Integer>(); + List<Integer> tmpEncChars = new ArrayList<>(); pos = sectionOffset[i] + tableOffsets.get(i).get(j); for (int k = 0; k < characterCount.get(i).get(j); k++) { tmpChar = readWord(ds, pos); @@ -185,7 +186,7 @@ public class PPTxtHandler { encText.get(i).add(tmpEncChars); key = encText.get(i).get(j).get(characterCount.get(i).get(j) - 1) ^ 0xFFFF; for (int k = characterCount.get(i).get(j) - 1; k >= 0; k--) { - encText.get(i).get(j).set(k, (encText.get(i).get(j).get(k).intValue()) ^ key); + encText.get(i).get(j).set(k, (encText.get(i).get(j).get(k)) ^ key); if (k == 0) { lastKeys.add(key); } @@ -195,8 +196,8 @@ public class PPTxtHandler { encText.get(i).set(j, decompress(encText.get(i).get(j))); characterCount.get(i).set(j, encText.get(i).get(j).size()); } - List<String> chars = new ArrayList<String>(); - string = ""; + List<String> chars = new ArrayList<>(); + sb = new StringBuilder(); for (int k = 0; k < characterCount.get(i).get(j); k++) { if (encText.get(i).get(j).get(k) == 0xFFFF) { chars.add("\\xFFFF"); @@ -208,10 +209,10 @@ public class PPTxtHandler { String num = String.format("%04X", encText.get(i).get(j).get(k)); chars.add("\\x" + num); } - string += chars.get(k); + sb.append(chars.get(k)); } } - strings.add(string); + strings.add(sb.toString()); decText.get(i).add(chars); } } @@ -265,12 +266,11 @@ public class PPTxtHandler { int[] newsectionOffset = new int[] { 0, 0, 0 }; // Data-Stream - byte[] ds = originalData; int pos = 0; - numSections = readWord(ds, 0); - numEntries = readWord(ds, 2); - sizeSections[0] = readLong(ds, 4); + numSections = readWord(originalData, 0); + numEntries = readWord(originalData, 2); + sizeSections[0] = readLong(originalData, 4); // unk1 readLong(ds, 8); pos += 12; @@ -280,18 +280,17 @@ public class PPTxtHandler { } else { byte[] newEntry = makeSection(text, numEntries); for (int z = 0; z < numSections; z++) { - sectionOffset[z] = readLong(ds, pos); + sectionOffset[z] = readLong(originalData, pos); pos += 4; } for (int z = 0; z < numSections; z++) { pos = sectionOffset[z]; - sizeSections[z] = readLong(ds, pos); - pos += 4; + sizeSections[z] = readLong(originalData, pos); } newsizeSections[0] = newEntry.length; - byte[] newData = new byte[ds.length - sizeSections[0] + newsizeSections[0]]; - System.arraycopy(ds, 0, newData, 0, Math.min(ds.length, newData.length)); + byte[] newData = new byte[originalData.length - sizeSections[0] + newsizeSections[0]]; + System.arraycopy(originalData, 0, newData, 0, Math.min(originalData.length, newData.length)); writeLong(newData, 4, newsizeSections[0]); if (numSections == 2) { newsectionOffset[1] = newsizeSections[0] + sectionOffset[0]; @@ -299,14 +298,14 @@ public class PPTxtHandler { } System.arraycopy(newEntry, 0, newData, sectionOffset[0], newEntry.length); if (numSections == 2) { - System.arraycopy(ds, sectionOffset[1], newData, newsectionOffset[1], sizeSections[1]); + System.arraycopy(originalData, sectionOffset[1], newData, newsectionOffset[1], sizeSections[1]); } return newData; } } private static byte[] makeSection(List<String> strings, int numEntries) { - List<List<Integer>> data = new ArrayList<List<Integer>>(); + List<List<Integer>> data = new ArrayList<>(); int size = 0; int offset = 4 + 8 * numEntries; int charCount; @@ -347,7 +346,7 @@ public class PPTxtHandler { } private static List<Integer> parseString(String string, int entry_id) { - List<Integer> chars = new ArrayList<Integer>(); + List<Integer> chars = new ArrayList<>(); for (int i = 0; i < string.length(); i++) { if (string.charAt(i) != '\\') { chars.add((int) string.charAt(i)); @@ -383,7 +382,7 @@ public class PPTxtHandler { data[offset + 1] = (byte) ((value >> 8) & 0xFF); } - protected static void writeLong(byte[] data, int offset, int value) { + private static void writeLong(byte[] data, int offset, int value) { data[offset] = (byte) (value & 0xFF); data[offset + 1] = (byte) ((value >> 8) & 0xFF); data[offset + 2] = (byte) ((value >> 16) & 0xFF); diff --git a/src/thenewpoketext/PokeTextData.java b/src/thenewpoketext/PokeTextData.java index 96a7c49..69ba349 100755 --- a/src/thenewpoketext/PokeTextData.java +++ b/src/thenewpoketext/PokeTextData.java @@ -12,7 +12,7 @@ import java.util.List; public class PokeTextData { private byte[] data; - public List<PointerEntry> ptrlist; + private List<PointerEntry> ptrlist; public List<String> strlist; public boolean compressFlag; @@ -49,7 +49,7 @@ public class PokeTextData { DecyptPtrs(read16(0), read16(2), 4); this.ptrlist = CreatePtrList(read16(0), 4); - this.strlist = new ArrayList<String>(); + this.strlist = new ArrayList<>(); int num = read16(0); @@ -85,7 +85,7 @@ public class PokeTextData { } private List<PointerEntry> CreatePtrList(int count, int sdidx) { - List<PointerEntry> ptrlist = new ArrayList<PointerEntry>(); + List<PointerEntry> ptrlist = new ArrayList<>(); for (int i = 0; i < count; i++) { ptrlist.add(new PointerEntry(read32(sdidx), read32(sdidx + 4))); sdidx += 8; @@ -106,8 +106,8 @@ public class PokeTextData { private String MakeString(int count, int idx) { StringBuilder string = new StringBuilder(); - List<Integer> chars = new ArrayList<Integer>(); - List<Integer> uncomp = new ArrayList<Integer>(); + List<Integer> chars = new ArrayList<>(); + List<Integer> uncomp = new ArrayList<>(); for (int i = 0; i < count; i++) { chars.add(read16(idx)); idx += 2; @@ -155,17 +155,17 @@ public class PokeTextData { } else { if (currChar == 0xFFFE) { i++; - string.append("\\v" + String.format("%04X", chars.get(i))); + string.append("\\v").append(String.format("%04X", chars.get(i))); i++; int total = chars.get(i); for (int z = 0; z < total; z++) { i++; - string.append("\\z" + String.format("%04X", chars.get(i))); + string.append("\\z").append(String.format("%04X", chars.get(i))); } } else if (currChar == 0xFFFF) { break; } else { - string.append("\\x" + String.format("%04X", chars.get(i))); + string.append("\\x").append(String.format("%04X", chars.get(i))); } } i++; diff --git a/src/thenewpoketext/TextToPoke.java b/src/thenewpoketext/TextToPoke.java index 98db4c5..e83239a 100755 --- a/src/thenewpoketext/TextToPoke.java +++ b/src/thenewpoketext/TextToPoke.java @@ -14,10 +14,10 @@ public class TextToPoke { public static byte[] MakeFile(List<String> textarr, boolean compressed) { int base = textarr.size() * 8 + 4; - List<PointerEntry> ptrtable = new ArrayList<PointerEntry>(); - List<List<Integer>> rawdata = new ArrayList<List<Integer>>(); - for (int i = 0; i < textarr.size(); i++) { - List<Integer> data = ToCode(textarr.get(i), compressed); + List<PointerEntry> ptrtable = new ArrayList<>(); + List<List<Integer>> rawdata = new ArrayList<>(); + for (String aTextarr : textarr) { + List<Integer> data = ToCode(aTextarr, compressed); int l = data.size(); ptrtable.add(new PointerEntry(base, l)); rawdata.add(data); @@ -30,7 +30,7 @@ public class TextToPoke { } private static List<Integer> ToCode(String text, boolean compressed) { - List<Integer> data = new ArrayList<Integer>(); + List<Integer> data = new ArrayList<>(); while (text.length() != 0) { int i = Math.max(0, 6 - text.length()); if (text.charAt(0) == '\\') { @@ -42,7 +42,7 @@ public class TextToPoke { data.add(Integer.parseInt(text.substring(2, 6), 16)); text = text.substring(6); } else if (text.charAt(1) == 'z') { - List<Integer> var = new ArrayList<Integer>(); + List<Integer> var = new ArrayList<>(); int w = 0; while (text.length() != 0) { if (text.charAt(0) == '\\' && text.charAt(1) == 'z') { @@ -90,9 +90,9 @@ public class TextToPoke { } byte[] bits = new byte[data.size() * 9]; int bc = 0; - for (int i = 0; i < data.size(); i++) { + for (Integer aData : data) { for (int j = 0; j < 9; j++) { - bits[bc++] = (byte) ((data.get(i) >> j) & 1); + bits[bc++] = (byte) ((aData >> j) & 1); } } int tmp_uint16 = 0; @@ -160,13 +160,10 @@ public class TextToPoke { } byte[] barr = new byte[tlen]; int offs = 0; - int l1 = list.size(); - for (int j = 0; j < l1; j++) { - List<Integer> slist = list.get(j); - int l2 = slist.size(); - for (int i = 0; i < l2; i++) { - barr[offs] = (byte) (slist.get(i) & 0xFF); - barr[offs + 1] = (byte) ((slist.get(i) >> 8) & 0xFF); + for (List<Integer> slist : list) { + for (Integer aSlist : slist) { + barr[offs] = (byte) (aSlist & 0xFF); + barr[offs + 1] = (byte) ((aSlist >> 8) & 0xFF); offs += 2; } } diff --git a/src/thenewpoketext/UnicodeParser.java b/src/thenewpoketext/UnicodeParser.java index b645a20..2f0b008 100755 --- a/src/thenewpoketext/UnicodeParser.java +++ b/src/thenewpoketext/UnicodeParser.java @@ -16,7 +16,7 @@ import com.dabomstew.pkrandom.FileFunctions; public class UnicodeParser { public static String[] tb = new String[65536]; - public static Map<String, Integer> d = new HashMap<String, Integer>(); + public static Map<String, Integer> d = new HashMap<>(); static { try { @@ -34,6 +34,7 @@ public class UnicodeParser { } sc.close(); } catch (FileNotFoundException e) { + e.printStackTrace(); } } |