EpicKnarvik97 23c023a027 Various improvements to the interface
More time units are supported, which makes long temporary durations more readable
Makes right-clicking a sign display a full description, and requires sneaking while clicking to perform the transaction
Makes signs only be destroyed when sneaking
Improves sign protection a bit, but improvements are required
Prevents a creative player breaking a sign from also interacting with it
2022-01-17 18:42:15 +01:00

29 lines
925 B
Java

package net.knarcraft.permissionsigns.utility;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
/**
* A helper class for dealing with files
*/
public class FileHelper {
/**
* Gets a buffered reader for
*
* @return <p>A buffered read for reading the file</p>
* @throws FileNotFoundException <p>If unable to get an input stream for the given file</p>
*/
public static BufferedReader getBufferedReaderForInternalFile(String file) throws FileNotFoundException {
InputStream inputStream = FileHelper.class.getResourceAsStream(file);
if (inputStream == null) {
throw new FileNotFoundException("Unable to read the given file");
}
return new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
}
}