Fixed Upload GUI, added Tag Input
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
package eu.crushedpixel.replaymod.online;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.FileEntity;
|
||||
|
||||
public class CountingHttpEntity extends FileEntity {
|
||||
|
||||
private OutputStreamProgress outstream;
|
||||
|
||||
public class OutputStreamProgress extends OutputStream {
|
||||
|
||||
private final OutputStream outstream;
|
||||
private volatile long bytesWritten=0;
|
||||
|
||||
public OutputStreamProgress(OutputStream outstream) {
|
||||
this.outstream = outstream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
outstream.write(b);
|
||||
bytesWritten++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
outstream.write(b);
|
||||
bytesWritten += b.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
outstream.write(b, off, len);
|
||||
bytesWritten += len;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
outstream.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
outstream.close();
|
||||
}
|
||||
|
||||
public long getWrittenLength() {
|
||||
return bytesWritten;
|
||||
}
|
||||
}
|
||||
|
||||
public CountingHttpEntity(File file, ContentType type) {
|
||||
super(file, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(OutputStream outstream) throws IOException {
|
||||
this.outstream = new OutputStreamProgress(outstream);
|
||||
super.writeTo(this.outstream);
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
if (outstream == null) {
|
||||
return 0;
|
||||
}
|
||||
long contentLength = getContentLength();
|
||||
if (contentLength <= 0) {
|
||||
return 0;
|
||||
}
|
||||
long writtenLength = outstream.getWrittenLength();
|
||||
return (writtenLength/contentLength);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package eu.crushedpixel.replaymod.online.authentication;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import eu.crushedpixel.replaymod.ReplayMod;
|
||||
@@ -26,6 +27,16 @@ public class AuthenticationHandler {
|
||||
return authkey;
|
||||
}
|
||||
|
||||
private static List<String> blackUUIDs = new ArrayList<String>() {
|
||||
{
|
||||
add("23978392a78c49cf9f5235a151fd4083"); //Hudelsohn
|
||||
}
|
||||
};
|
||||
|
||||
public static boolean isBlacklisted(String uuid) {
|
||||
return blackUUIDs.contains(uuid.replace("-", ""));
|
||||
}
|
||||
|
||||
public static int authenticate(String username, String password) {
|
||||
try {
|
||||
authkey = ReplayMod.apiClient.getLogin(username, password).getAuthkey();
|
||||
|
||||
Reference in New Issue
Block a user