mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-27 05:05:19 +01:00
Fixed the ConnectionIntent class and hastebin support
This commit is contained in:
parent
25d70548c9
commit
124ebaeb41
@ -33,7 +33,7 @@ public abstract class ConnectionIntent {
|
||||
return exclusions;
|
||||
}
|
||||
|
||||
public boolean execute() {
|
||||
public void execute() {
|
||||
MessageUtils.send(player, plugin.getSettings().getMessagesProps().getConnectingMessage(),
|
||||
(str) -> str.replace("{section}", section.getName())
|
||||
.replace("{alias}", safeNull(section.getProps().getAlias()))
|
||||
@ -68,8 +68,6 @@ public abstract class ConnectionIntent {
|
||||
MessageUtils.send(player, plugin.getSettings().getMessagesProps().getFailureMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private ServerInfo fetchServer(ProxiedPlayer player, ServerSection section, ProviderType provider, List<ServerInfo> servers) {
|
||||
|
@ -2,8 +2,8 @@ package com.jaimemartz.playerbalancer.helper;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.jaimemartz.playerbalancer.PlayerBalancer;
|
||||
import com.jaimemartz.playerbalancer.utils.GuestPaste;
|
||||
import com.jaimemartz.playerbalancer.utils.GuestPaste.PasteException;
|
||||
import com.jaimemartz.playerbalancer.utils.HastebinPaste;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
@ -34,18 +34,7 @@ public enum PasteHelper {
|
||||
try (FileInputStream stream = new FileInputStream(file)) {
|
||||
try (InputStreamReader reader = new InputStreamReader(stream, "UTF-8")) {
|
||||
String content = CharStreams.toString(reader);
|
||||
GuestPaste paste = new GuestPaste("e3ff18d8fb001a3ece08ae0d7d4a87bd", content);
|
||||
|
||||
paste.setName("{name} ({version} on {bungee_version})"
|
||||
.replace("{name}", plugin.getDescription().getName())
|
||||
.replace("{version}", plugin.getDescription().getVersion())
|
||||
.replace("{bungee_version}", plugin.getProxy().getVersion())
|
||||
);
|
||||
|
||||
paste.setExpiration(GuestPaste.Expiration.ONE_MONTH);
|
||||
paste.setExposure(GuestPaste.Exposure.UNLISTED);
|
||||
paste.setFormat("properties");
|
||||
|
||||
HastebinPaste paste = new HastebinPaste("https://file.properties/paste/", content);
|
||||
return paste.paste();
|
||||
}
|
||||
}
|
||||
@ -70,17 +59,7 @@ public enum PasteHelper {
|
||||
try (InputStreamReader reader = new InputStreamReader(stream, "UTF-8")) {
|
||||
String content = CharStreams.toString(reader);
|
||||
content = content.replaceAll("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}", "?.?.?.?");
|
||||
GuestPaste paste = new GuestPaste("e3ff18d8fb001a3ece08ae0d7d4a87bd", content);
|
||||
|
||||
paste.setName("{name} ({version})"
|
||||
.replace("{name}", plugin.getProxy().getName())
|
||||
.replace("{version}", plugin.getProxy().getVersion())
|
||||
);
|
||||
|
||||
paste.setExpiration(GuestPaste.Expiration.ONE_MONTH);
|
||||
paste.setExposure(GuestPaste.Exposure.UNLISTED);
|
||||
paste.setFormat("yaml");
|
||||
|
||||
HastebinPaste paste = new HastebinPaste("https://file.properties/paste/", content);
|
||||
return paste.paste();
|
||||
}
|
||||
}
|
||||
@ -100,20 +79,10 @@ public enum PasteHelper {
|
||||
}, false) {
|
||||
@Override
|
||||
public URL paste(PlayerBalancer plugin) throws Exception {
|
||||
GuestPaste paste = new GuestPaste("e3ff18d8fb001a3ece08ae0d7d4a87bd",
|
||||
HastebinPaste paste = new HastebinPaste("https://file.properties/paste/",
|
||||
plugin.getLogsBuilder().toString()
|
||||
);
|
||||
|
||||
paste.setName("{name} ({version} on {bungee_version})"
|
||||
.replace("{name}", plugin.getDescription().getName())
|
||||
.replace("{version}", plugin.getDescription().getVersion())
|
||||
.replace("{bungee_version}", plugin.getProxy().getVersion())
|
||||
);
|
||||
|
||||
paste.setExpiration(GuestPaste.Expiration.ONE_MONTH);
|
||||
paste.setExposure(GuestPaste.Exposure.UNLISTED);
|
||||
paste.setFormat("text");
|
||||
|
||||
return paste.paste();
|
||||
}
|
||||
};
|
||||
|
@ -3,11 +3,23 @@ import org.junit.Test;
|
||||
|
||||
public class HastebinPasteTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
public void test() {
|
||||
HastebinPaste paste = new HastebinPaste("https://file.properties/paste/",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed iaculis, sapien et vehicula tristique, diam libero bibendum nunc, et rutrum nisl nulla quis diam. Cras ipsum enim, molestie eget bibendum nec, porta quis ex. Nunc ac sem lorem. Duis eget vestibulum libero. Phasellus vitae venenatis arcu, ac volutpat sem. Nunc porttitor lacus nulla, vitae dictum justo porta at. Aliquam erat volutpat. Vestibulum aliquet eget diam eget commodo. Integer facilisis ipsum sit amet sem pharetra ultrices. Nulla diam orci, posuere malesuada ante non, elementum vehicula libero."
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed " +
|
||||
"iaculis, sapien et vehicula tristique, diam libero bibendum " +
|
||||
"nunc, et rutrum nisl nulla quis diam. Cras ipsum enim, molestie" +
|
||||
" eget bibendum nec, porta quis ex. Nunc ac sem lorem. Duis eget" +
|
||||
" vestibulum libero. Phasellus vitae venenatis arcu, ac volutpat " +
|
||||
"sem. Nunc porttitor lacus nulla, vitae dictum justo porta at. " +
|
||||
"Aliquam erat volutpat. Vestibulum aliquet eget diam eget commodo." +
|
||||
" Integer facilisis ipsum sit amet sem pharetra ultrices. Nulla diam" +
|
||||
" orci, posuere malesuada ante non, elementum vehicula libero."
|
||||
);
|
||||
|
||||
System.out.println(paste.paste());
|
||||
try {
|
||||
System.out.println(paste.paste());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user