Made potatoes default to not sending
This commit is contained in:
parent
7c6d0214f9
commit
7719f016e5
1 changed files with 39 additions and 16 deletions
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -29,6 +28,15 @@ import com.google.gson.JsonObject;
|
|||
import com.google.gson.JsonParser;
|
||||
|
||||
public final class TBMCCoreAPI {
|
||||
static List<String> coders = new ArrayList<String>() {
|
||||
private static final long serialVersionUID = -4462159250738367334L;
|
||||
{
|
||||
add("Alisolarflare");
|
||||
add("NorbiPeti");
|
||||
add("iie");
|
||||
add("thewindmillman");
|
||||
add("mayskam1995");
|
||||
}};
|
||||
/**
|
||||
* Updates or installs the specified plugin. The plugin must use Maven.
|
||||
*
|
||||
|
@ -154,6 +162,9 @@ public final class TBMCCoreAPI {
|
|||
* The exception to send
|
||||
*/
|
||||
public static void SendException(String sourcemsg, Throwable e){
|
||||
SendException(sourcemsg, e, false);
|
||||
}
|
||||
public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) {
|
||||
SendUnsentExceptions();
|
||||
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
@ -161,16 +172,28 @@ public final class TBMCCoreAPI {
|
|||
exceptionsToSend.put(sourcemsg, e);
|
||||
Bukkit.getLogger().warning(sourcemsg);
|
||||
e.printStackTrace();
|
||||
Optional<? extends Player> randomPlayer = Bukkit.getOnlinePlayers().stream().findAny();
|
||||
if (randomPlayer.isPresent()) {
|
||||
if (debugPotato){
|
||||
List<Player> devsOnline = new ArrayList<Player>();
|
||||
for (Player player : Bukkit.getOnlinePlayers()){
|
||||
if (coders.contains(player.getName())){
|
||||
devsOnline.add(player);
|
||||
}
|
||||
};
|
||||
if (!devsOnline.isEmpty()) {
|
||||
DebugPotato potato = new DebugPotato()
|
||||
.setMessage(new String[] { //
|
||||
"§b§o" + e.getClass().getSimpleName(), //
|
||||
"§c§o" + sourcemsg, //
|
||||
"§a§oFind a dev to fix this issue" })
|
||||
.setType(e instanceof IOException ? "Potato on a Stick"
|
||||
: e instanceof ClassCastException ? "Square Potato" : "Plain Potato");
|
||||
potato.Send(randomPlayer.get());
|
||||
.setType(e instanceof IOException ? "Throwable Potato"
|
||||
: e instanceof ClassCastException ? "Squished Potato"
|
||||
: e instanceof NullPointerException ? "Plain Potato"
|
||||
: e instanceof StackOverflowError ? "Chips"
|
||||
: "Error Potato");
|
||||
for (Player dev : devsOnline){
|
||||
potato.Send(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue