mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Don't kick players if a command failed from an exception
This commit is contained in:
parent
e544fb71c3
commit
a5ca3e1c12
1 changed files with 14 additions and 2 deletions
|
@ -3,12 +3,15 @@ package net.minecraft.server;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockDamageLevel;
|
import org.bukkit.block.BlockDamageLevel;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
|
@ -624,8 +627,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean targetPluginFound = server.dispatchCommand(player, s.substring(1));
|
boolean targetPluginFound = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
targetPluginFound = server.dispatchCommand(player, s.substring(1));
|
||||||
|
} catch (CommandException ex) {
|
||||||
|
player.sendMessage(ChatColor.RED + "An internal error occured while attempting to perform this command");
|
||||||
|
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (targetPluginFound) {
|
if (targetPluginFound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue