@@ -37,7 +37,7 @@ public URL paste(PlayerBalancer plugin) throws Exception {
3737 try (FileInputStream stream = new FileInputStream (file )) {
3838 try (InputStreamReader reader = new InputStreamReader (stream , "UTF-8" )) {
3939 String content = CharStreams .toString (reader );
40- HastebinPaste paste = new HastebinPaste ("https://file.properties/paste/" , content );
40+ HastebinPaste paste = new HastebinPaste (HASTEBIN_HOST , content );
4141 return paste .paste ();
4242 }
4343 }
@@ -62,7 +62,7 @@ public URL paste(PlayerBalancer plugin) throws Exception {
6262 try (InputStreamReader reader = new InputStreamReader (stream , StandardCharsets .UTF_8 )) {
6363 String content = CharStreams .toString (reader );
6464 content = content .replaceAll ("[0-9]{1,3}\\ .[0-9]{1,3}\\ .[0-9]{1,3}\\ .[0-9]{1,3}" , "?.?.?.?" );
65- HastebinPaste paste = new HastebinPaste ("https://file.properties/paste/" , content );
65+ HastebinPaste paste = new HastebinPaste (HASTEBIN_HOST , content );
6666 return paste .paste ();
6767 }
6868 }
@@ -86,14 +86,16 @@ public URL paste(PlayerBalancer plugin) throws Exception {
8686 try (FileInputStream stream = new FileInputStream (file )) {
8787 try (InputStreamReader reader = new InputStreamReader (stream , StandardCharsets .UTF_8 )) {
8888 String content = CharStreams .toString (reader );
89- HastebinPaste paste = new HastebinPaste ("https://file.properties/paste/" , content );
89+ HastebinPaste paste = new HastebinPaste (HASTEBIN_HOST , content );
9090 return paste .paste ();
9191 }
9292 }
9393 }
9494 };
9595
96- private URL url ;
96+ private static final String HASTEBIN_HOST = "https://hastebin.com/" ;
97+
98+ private URL lastPasteUrl ;
9799
98100 private final BiConsumer <CommandSender , URL > consumer ;
99101 private final boolean cache ;
@@ -104,9 +106,9 @@ public URL paste(PlayerBalancer plugin) throws Exception {
104106 }
105107
106108 public void send (PlayerBalancer plugin , CommandSender sender ) {
107- if (url == null || !cache ) {
109+ if (lastPasteUrl == null || !cache ) {
108110 try {
109- url = paste (plugin );
111+ lastPasteUrl = paste (plugin );
110112 } catch (PasteException e ) {
111113 sender .sendMessage (new ComponentBuilder ("An exception occurred while trying to send the paste: " + e .getMessage ())
112114 .color (ChatColor .RED )
@@ -127,8 +129,8 @@ public void send(PlayerBalancer plugin, CommandSender sender) {
127129 );
128130 }
129131
130- if (url != null ) {
131- consumer .accept (sender , url );
132+ if (lastPasteUrl != null ) {
133+ consumer .accept (sender , lastPasteUrl );
132134 } else {
133135 sender .sendMessage (new ComponentBuilder ("Could not create the paste, try again..." )
134136 .color (ChatColor .RED )
@@ -137,15 +139,15 @@ public void send(PlayerBalancer plugin, CommandSender sender) {
137139 }
138140 }
139141
140- public URL getURL () {
141- return url ;
142+ public URL getLastPasteURL () {
143+ return lastPasteUrl ;
142144 }
143145
144146 public abstract URL paste (PlayerBalancer plugin ) throws Exception ;
145147
146148 public static void reset () {
147149 for (PasteHelper helper : values ()) {
148- helper .url = null ;
150+ helper .lastPasteUrl = null ;
149151 }
150152 }
151153}
0 commit comments