summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-02-13 17:17:14 +0000
committerKHobbits <rob@khobbits.co.uk>2012-02-13 17:17:14 +0000
commit0ab2e745cf27502abbe64ab73810ed75b16fb027 (patch)
treea03ea5fdd992a7e5226b7a5e2c1492900f27a8e5
parent57a2ef08d4b1f80f8794c1fafe0e7f22c88177a6 (diff)
parent62cd219b4ecd48464037dd898ed14ab7de4972b2 (diff)
downloadEssentials-0ab2e745cf27502abbe64ab73810ed75b16fb027.tar
Essentials-0ab2e745cf27502abbe64ab73810ed75b16fb027.tar.gz
Essentials-0ab2e745cf27502abbe64ab73810ed75b16fb027.tar.lz
Essentials-0ab2e745cf27502abbe64ab73810ed75b16fb027.tar.xz
Essentials-0ab2e745cf27502abbe64ab73810ed75b16fb027.zip
Merge branch 'master' of github.com:essentials/Essentials
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 21f2e38ea..3ee7c1777 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -32,15 +32,20 @@ import com.earth2me.essentials.signs.SignPlayerListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.lang.reflect.Array;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
+import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
@@ -277,7 +282,29 @@ public class Essentials extends JavaPlugin implements IEssentials
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
- return pc.execute(sender, commandLabel, args);
+ try
+ {
+ return pc.execute(sender, commandLabel, args);
+ }
+ catch (final Exception ex)
+ {
+ final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
+ elements.remove(0);
+ final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
+ for (final StackTraceElement e : elements)
+ {
+ if (e.getClassName().equals("com.earth2me.essentials.Essentials"))
+ {
+ toRemove.add(e);
+ }
+ }
+ elements.removeAll(toRemove);
+ final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
+ ex.setStackTrace(trace);
+ ex.printStackTrace();
+ sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
+ return true;
+ }
}
}