mirror of
https://github.com/DerTyp7/mc-collect-random-items.git
synced 2025-10-31 21:47:07 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce20236a12 |
@@ -36,7 +36,10 @@ public class MaterialManager {
|
|||||||
System.out.println("Loading save files...");
|
System.out.println("Loading save files...");
|
||||||
loadFromFile();
|
loadFromFile();
|
||||||
System.out.println("Updating wanted material...");
|
System.out.println("Updating wanted material...");
|
||||||
updateWantedMaterial();
|
if (wantedMaterial == null) {
|
||||||
|
updateWantedMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getRandomMaterial() {
|
public Material getRandomMaterial() {
|
||||||
@@ -158,6 +161,15 @@ public class MaterialManager {
|
|||||||
|
|
||||||
public void loadFromFile() {
|
public void loadFromFile() {
|
||||||
System.out.println("Loading from files...");
|
System.out.println("Loading from files...");
|
||||||
|
System.out.println("Loading file plugins/wantedItem.txt...");
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader("plugins/wantedItem.txt"));
|
||||||
|
setWantedMaterial(Material.getMaterial(reader.readLine()));
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Loading file plugins/skippedItems.txt...");
|
System.out.println("Loading file plugins/skippedItems.txt...");
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader("plugins/skippedItems.txt"));
|
BufferedReader reader = new BufferedReader(new FileReader("plugins/skippedItems.txt"));
|
||||||
@@ -191,6 +203,15 @@ public class MaterialManager {
|
|||||||
public void saveToFile() {
|
public void saveToFile() {
|
||||||
System.out.println("Saving to files...");
|
System.out.println("Saving to files...");
|
||||||
|
|
||||||
|
System.out.println("Saving wantedItem");
|
||||||
|
try {
|
||||||
|
PrintWriter writer = new PrintWriter("plugins/wantedItem.txt", "UTF-8");
|
||||||
|
writer.println(wantedMaterial.name());
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Saving skippedItems");
|
System.out.println("Saving skippedItems");
|
||||||
try {
|
try {
|
||||||
PrintWriter writer = new PrintWriter("plugins/skippedItems.txt", "UTF-8");
|
PrintWriter writer = new PrintWriter("plugins/skippedItems.txt", "UTF-8");
|
||||||
|
|||||||
Reference in New Issue
Block a user