mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-23 16:08:18 -05:00
Add null check
This commit is contained in:
parent
41b16d11d6
commit
fdfe46d9bf
2 changed files with 17 additions and 1 deletions
|
@ -137,8 +137,10 @@ class PlayerConnection implements Listener {
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (player != null) {
|
||||||
player.setPlayerProfile(profile);
|
player.setPlayerProfile(profile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}.runTask(JavaPlugin.getPlugin(Main.class));
|
}.runTask(JavaPlugin.getPlugin(Main.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,9 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.BlockCommandSender;
|
import org.bukkit.command.BlockCommandSender;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.CommandBlock;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
@ -14,10 +17,21 @@ import org.bukkit.event.server.ServerCommandEvent;
|
||||||
class ServerCommand implements Listener {
|
class ServerCommand implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onServerCommand(ServerCommandEvent event) {
|
void onServerCommand(ServerCommandEvent event) {
|
||||||
|
event.setCancelled(true);
|
||||||
final String[] arr = event.getCommand().split(" ");
|
final String[] arr = event.getCommand().split(" ");
|
||||||
final String command = event.getCommand();
|
final String command = event.getCommand();
|
||||||
|
|
||||||
if (event.getSender() instanceof BlockCommandSender) {
|
if (event.getSender() instanceof BlockCommandSender) {
|
||||||
|
/*Block block = ((BlockCommandSender)event.getSender()).getBlock();
|
||||||
|
CommandBlock state = (CommandBlock)block.getState();
|
||||||
|
|
||||||
|
System.out.println(state.getName());
|
||||||
|
state.setName("@");
|
||||||
|
|
||||||
|
if (state.getName() == null) {
|
||||||
|
state.setName("");
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (Main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
|
if (Main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue