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.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
@ -29,6 +28,15 @@ import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
public final class TBMCCoreAPI {
|
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.
|
* Updates or installs the specified plugin. The plugin must use Maven.
|
||||||
*
|
*
|
||||||
|
@ -153,7 +161,10 @@ public final class TBMCCoreAPI {
|
||||||
* @param e
|
* @param e
|
||||||
* The exception to send
|
* The exception to send
|
||||||
*/
|
*/
|
||||||
public static void SendException(String sourcemsg, Throwable e) {
|
public static void SendException(String sourcemsg, Throwable e){
|
||||||
|
SendException(sourcemsg, e, false);
|
||||||
|
}
|
||||||
|
public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) {
|
||||||
SendUnsentExceptions();
|
SendUnsentExceptions();
|
||||||
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
|
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
@ -161,16 +172,28 @@ public final class TBMCCoreAPI {
|
||||||
exceptionsToSend.put(sourcemsg, e);
|
exceptionsToSend.put(sourcemsg, e);
|
||||||
Bukkit.getLogger().warning(sourcemsg);
|
Bukkit.getLogger().warning(sourcemsg);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Optional<? extends Player> randomPlayer = Bukkit.getOnlinePlayers().stream().findAny();
|
if (debugPotato){
|
||||||
if (randomPlayer.isPresent()) {
|
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()
|
DebugPotato potato = new DebugPotato()
|
||||||
.setMessage(new String[] { //
|
.setMessage(new String[] { //
|
||||||
"§b§o" + e.getClass().getSimpleName(), //
|
"§b§o" + e.getClass().getSimpleName(), //
|
||||||
"§c§o" + sourcemsg, //
|
"§c§o" + sourcemsg, //
|
||||||
"§a§oFind a dev to fix this issue" })
|
"§a§oFind a dev to fix this issue" })
|
||||||
.setType(e instanceof IOException ? "Potato on a Stick"
|
.setType(e instanceof IOException ? "Throwable Potato"
|
||||||
: e instanceof ClassCastException ? "Square Potato" : "Plain Potato");
|
: e instanceof ClassCastException ? "Squished Potato"
|
||||||
potato.Send(randomPlayer.get());
|
: e instanceof NullPointerException ? "Plain Potato"
|
||||||
|
: e instanceof StackOverflowError ? "Chips"
|
||||||
|
: "Error Potato");
|
||||||
|
for (Player dev : devsOnline){
|
||||||
|
potato.Send(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue