From 52ecf3a83d9a0ce736d7a357f319168712778706 Mon Sep 17 00:00:00 2001 From: xISRAPILx Date: Sat, 20 Aug 2022 00:53:03 +0300 Subject: [PATCH] Make Nukkit more kotlin friendly: Commands --- pom.xml | 5 +++++ src/main/java/cn/nukkit/command/Command.java | 3 ++- src/main/java/cn/nukkit/command/FormattedCommandAlias.java | 3 ++- src/main/java/cn/nukkit/command/PluginCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/BanCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/BanIpCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/BanListCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/DebugPasteCommand.java | 4 +++- .../cn/nukkit/command/defaults/DefaultGamemodeCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/DeopCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/DifficultyCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/EffectCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/EnchantCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/GamemodeCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/GameruleCommand.java | 3 ++- .../cn/nukkit/command/defaults/GarbageCollectorCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/GiveCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/HelpCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/KickCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/KillCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/ListCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/MeCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/OpCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/PardonCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/PardonIpCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/ParticleCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/PluginsCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/ReloadCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/SaveCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/SaveOffCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/SaveOnCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/SayCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/SeedCommand.java | 3 ++- .../cn/nukkit/command/defaults/SetWorldSpawnCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/SpawnpointCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/StatusCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/StopCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/TeleportCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/TellCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/TimeCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/TimingsCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/TitleCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/VersionCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/WeatherCommand.java | 3 ++- .../java/cn/nukkit/command/defaults/WhitelistCommand.java | 3 ++- src/main/java/cn/nukkit/command/defaults/XpCommand.java | 3 ++- src/main/java/cn/nukkit/command/simple/SimpleCommand.java | 3 ++- 47 files changed, 98 insertions(+), 46 deletions(-) diff --git a/pom.xml b/pom.xml index 32be8b47aab..e6fd38b88b2 100644 --- a/pom.xml +++ b/pom.xml @@ -167,6 +167,11 @@ ${jline.version} compile + + org.jetbrains + annotations + 23.0.0 + diff --git a/src/main/java/cn/nukkit/command/Command.java b/src/main/java/cn/nukkit/command/Command.java index fbbd4954eb7..928264335bf 100644 --- a/src/main/java/cn/nukkit/command/Command.java +++ b/src/main/java/cn/nukkit/command/Command.java @@ -9,6 +9,7 @@ import cn.nukkit.utils.TextFormat; import co.aikar.timings.Timing; import co.aikar.timings.Timings; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -135,7 +136,7 @@ public Map getOverloads() { return this.commandData.overloads; } - public abstract boolean execute(CommandSender sender, String commandLabel, String[] args); + public abstract boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args); public String getName() { return name; diff --git a/src/main/java/cn/nukkit/command/FormattedCommandAlias.java b/src/main/java/cn/nukkit/command/FormattedCommandAlias.java index 8e84261e176..f52fa152ce7 100644 --- a/src/main/java/cn/nukkit/command/FormattedCommandAlias.java +++ b/src/main/java/cn/nukkit/command/FormattedCommandAlias.java @@ -4,6 +4,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.MainLogger; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -27,7 +28,7 @@ public FormattedCommandAlias(String alias, List formatStrings) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { boolean result = false; ArrayList commands = new ArrayList<>(); for (String formatString : formatStrings) { diff --git a/src/main/java/cn/nukkit/command/PluginCommand.java b/src/main/java/cn/nukkit/command/PluginCommand.java index 597ecedfb43..e47163e8072 100644 --- a/src/main/java/cn/nukkit/command/PluginCommand.java +++ b/src/main/java/cn/nukkit/command/PluginCommand.java @@ -2,6 +2,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -21,7 +22,7 @@ public PluginCommand(String name, T owner) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.owningPlugin.isEnabled()) { return false; } diff --git a/src/main/java/cn/nukkit/command/defaults/BanCommand.java b/src/main/java/cn/nukkit/command/defaults/BanCommand.java index ca437e55712..4b571523366 100644 --- a/src/main/java/cn/nukkit/command/defaults/BanCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/BanCommand.java @@ -7,6 +7,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.event.player.PlayerKickEvent; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -26,7 +27,7 @@ public BanCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/BanIpCommand.java b/src/main/java/cn/nukkit/command/defaults/BanIpCommand.java index 7a1b48bb89e..5c9f76abcf0 100644 --- a/src/main/java/cn/nukkit/command/defaults/BanIpCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/BanIpCommand.java @@ -9,6 +9,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.nbt.NBTIO; import cn.nukkit.nbt.tag.CompoundTag; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.FileInputStream; @@ -40,7 +41,7 @@ public BanIpCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/BanListCommand.java b/src/main/java/cn/nukkit/command/defaults/BanListCommand.java index 0ca654c4e88..1eb5dbce8c2 100644 --- a/src/main/java/cn/nukkit/command/defaults/BanListCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/BanListCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.permission.BanEntry; import cn.nukkit.permission.BanList; +import org.jetbrains.annotations.NotNull; import java.util.Iterator; @@ -24,7 +25,7 @@ public BanListCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/DebugPasteCommand.java b/src/main/java/cn/nukkit/command/defaults/DebugPasteCommand.java index 57e765d08bb..77866f8bc78 100644 --- a/src/main/java/cn/nukkit/command/defaults/DebugPasteCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/DebugPasteCommand.java @@ -9,6 +9,8 @@ import cn.nukkit.utils.HastebinUtility; import cn.nukkit.utils.MainLogger; import cn.nukkit.utils.Utils; +import org.jetbrains.annotations.NotNull; + import java.io.File; import java.io.IOException; import java.lang.management.ManagementFactory; @@ -22,7 +24,7 @@ public DebugPasteCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/DefaultGamemodeCommand.java b/src/main/java/cn/nukkit/command/defaults/DefaultGamemodeCommand.java index 73604ce3cd3..1154b8990ad 100644 --- a/src/main/java/cn/nukkit/command/defaults/DefaultGamemodeCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/DefaultGamemodeCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.command.data.CommandParamType; import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -26,7 +27,7 @@ public DefaultGamemodeCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/DeopCommand.java b/src/main/java/cn/nukkit/command/defaults/DeopCommand.java index 4934da84e69..e1f955d3076 100644 --- a/src/main/java/cn/nukkit/command/defaults/DeopCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/DeopCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -23,7 +24,7 @@ public DeopCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/DifficultyCommand.java b/src/main/java/cn/nukkit/command/defaults/DifficultyCommand.java index 1b0dcf97a53..55402037726 100644 --- a/src/main/java/cn/nukkit/command/defaults/DifficultyCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/DifficultyCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.network.protocol.SetDifficultyPacket; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -30,7 +31,7 @@ public DifficultyCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/EffectCommand.java b/src/main/java/cn/nukkit/command/defaults/EffectCommand.java index 760db564e36..d1da5077c82 100644 --- a/src/main/java/cn/nukkit/command/defaults/EffectCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/EffectCommand.java @@ -11,6 +11,7 @@ import cn.nukkit.potion.InstantEffect; import cn.nukkit.utils.ServerException; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -48,7 +49,7 @@ public EffectCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/EnchantCommand.java b/src/main/java/cn/nukkit/command/defaults/EnchantCommand.java index 205e8724d3f..325e9f37c5a 100644 --- a/src/main/java/cn/nukkit/command/defaults/EnchantCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/EnchantCommand.java @@ -10,6 +10,7 @@ import cn.nukkit.item.enchantment.Enchantment; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created by Pub4Game on 23.01.2016. @@ -38,7 +39,7 @@ public EnchantCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/GamemodeCommand.java b/src/main/java/cn/nukkit/command/defaults/GamemodeCommand.java index 3f07ae5b1a1..0df6baee0a4 100644 --- a/src/main/java/cn/nukkit/command/defaults/GamemodeCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/GamemodeCommand.java @@ -9,6 +9,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/13 by xtypr. @@ -36,7 +37,7 @@ public GamemodeCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (args.length == 0) { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); return false; diff --git a/src/main/java/cn/nukkit/command/defaults/GameruleCommand.java b/src/main/java/cn/nukkit/command/defaults/GameruleCommand.java index 1015a4cc662..8fd4e6e6160 100644 --- a/src/main/java/cn/nukkit/command/defaults/GameruleCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/GameruleCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.GameRule; import cn.nukkit.level.GameRules; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Arrays; @@ -73,7 +74,7 @@ public GameruleCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/GarbageCollectorCommand.java b/src/main/java/cn/nukkit/command/defaults/GarbageCollectorCommand.java index 94cb5c126c9..c1e8d1526a5 100644 --- a/src/main/java/cn/nukkit/command/defaults/GarbageCollectorCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/GarbageCollectorCommand.java @@ -4,6 +4,7 @@ import cn.nukkit.level.Level; import cn.nukkit.math.NukkitMath; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/11 by xtypr. @@ -18,7 +19,7 @@ public GarbageCollectorCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/GiveCommand.java b/src/main/java/cn/nukkit/command/defaults/GiveCommand.java index d3cef0469d9..818fcee2129 100644 --- a/src/main/java/cn/nukkit/command/defaults/GiveCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/GiveCommand.java @@ -9,6 +9,7 @@ import cn.nukkit.item.Item; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/12/9 by xtypr. @@ -40,7 +41,7 @@ public GiveCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/HelpCommand.java b/src/main/java/cn/nukkit/command/defaults/HelpCommand.java index 124c35b46f1..025fc45d4c6 100644 --- a/src/main/java/cn/nukkit/command/defaults/HelpCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/HelpCommand.java @@ -7,6 +7,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.TreeMap; @@ -27,7 +28,7 @@ public HelpCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/KickCommand.java b/src/main/java/cn/nukkit/command/defaults/KickCommand.java index 1caf85ac982..bc564f3eb83 100644 --- a/src/main/java/cn/nukkit/command/defaults/KickCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/KickCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.event.player.PlayerKickEvent; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/11 by xtypr. @@ -26,7 +27,7 @@ public KickCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/KillCommand.java b/src/main/java/cn/nukkit/command/defaults/KillCommand.java index fcb84d2c710..38e2664595d 100644 --- a/src/main/java/cn/nukkit/command/defaults/KillCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/KillCommand.java @@ -12,6 +12,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.Level; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.StringJoiner; @@ -32,7 +33,7 @@ public KillCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/ListCommand.java b/src/main/java/cn/nukkit/command/defaults/ListCommand.java index 7417211d0c2..abfccdada2d 100644 --- a/src/main/java/cn/nukkit/command/defaults/ListCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/ListCommand.java @@ -3,6 +3,7 @@ import cn.nukkit.Player; import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/11 by xtypr. @@ -17,7 +18,7 @@ public ListCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/MeCommand.java b/src/main/java/cn/nukkit/command/defaults/MeCommand.java index 57a35cfc010..6a0405b3a2a 100644 --- a/src/main/java/cn/nukkit/command/defaults/MeCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/MeCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -23,7 +24,7 @@ public MeCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/OpCommand.java b/src/main/java/cn/nukkit/command/defaults/OpCommand.java index 6afc9fdcc6c..4ce88c7aa69 100644 --- a/src/main/java/cn/nukkit/command/defaults/OpCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/OpCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -25,7 +26,7 @@ public OpCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/PardonCommand.java b/src/main/java/cn/nukkit/command/defaults/PardonCommand.java index 0ffd5296b72..f0d97880a83 100644 --- a/src/main/java/cn/nukkit/command/defaults/PardonCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/PardonCommand.java @@ -5,6 +5,7 @@ import cn.nukkit.command.data.CommandParamType; import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -23,7 +24,7 @@ public PardonCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/PardonIpCommand.java b/src/main/java/cn/nukkit/command/defaults/PardonIpCommand.java index d3ae0695a85..4ae4cbf0694 100644 --- a/src/main/java/cn/nukkit/command/defaults/PardonIpCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/PardonIpCommand.java @@ -5,6 +5,7 @@ import cn.nukkit.command.data.CommandParamType; import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; import java.net.InetAddress; import java.net.UnknownHostException; @@ -27,7 +28,7 @@ public PardonIpCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/ParticleCommand.java b/src/main/java/cn/nukkit/command/defaults/ParticleCommand.java index aea1e78c51e..8a49273cfd7 100644 --- a/src/main/java/cn/nukkit/command/defaults/ParticleCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/ParticleCommand.java @@ -11,6 +11,7 @@ import cn.nukkit.level.Position; import cn.nukkit.level.particle.*; import cn.nukkit.math.Vector3; +import org.jetbrains.annotations.NotNull; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -37,7 +38,7 @@ public ParticleCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/PluginsCommand.java b/src/main/java/cn/nukkit/command/defaults/PluginsCommand.java index b3377bfd251..12fc3edafe1 100644 --- a/src/main/java/cn/nukkit/command/defaults/PluginsCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/PluginsCommand.java @@ -4,6 +4,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.plugin.Plugin; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -24,7 +25,7 @@ public PluginsCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/ReloadCommand.java b/src/main/java/cn/nukkit/command/defaults/ReloadCommand.java index 718c140b5b5..0f95ab5a03e 100644 --- a/src/main/java/cn/nukkit/command/defaults/ReloadCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/ReloadCommand.java @@ -4,6 +4,7 @@ import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -18,7 +19,7 @@ public ReloadCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SaveCommand.java b/src/main/java/cn/nukkit/command/defaults/SaveCommand.java index 9e119f2d104..f84169a5556 100644 --- a/src/main/java/cn/nukkit/command/defaults/SaveCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SaveCommand.java @@ -5,6 +5,7 @@ import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.Level; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/13 by xtypr. @@ -19,7 +20,7 @@ public SaveCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SaveOffCommand.java b/src/main/java/cn/nukkit/command/defaults/SaveOffCommand.java index 762cd3140bb..f6e0cb22ebc 100644 --- a/src/main/java/cn/nukkit/command/defaults/SaveOffCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SaveOffCommand.java @@ -3,6 +3,7 @@ import cn.nukkit.command.Command; import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/13 by xtypr. @@ -17,7 +18,7 @@ public SaveOffCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SaveOnCommand.java b/src/main/java/cn/nukkit/command/defaults/SaveOnCommand.java index a3f6a5dfdd3..0e050550ccc 100644 --- a/src/main/java/cn/nukkit/command/defaults/SaveOnCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SaveOnCommand.java @@ -3,6 +3,7 @@ import cn.nukkit.command.Command; import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/13 by xtypr. @@ -17,7 +18,7 @@ public SaveOnCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SayCommand.java b/src/main/java/cn/nukkit/command/defaults/SayCommand.java index a55d3c459cf..fb9308d33fc 100644 --- a/src/main/java/cn/nukkit/command/defaults/SayCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SayCommand.java @@ -7,6 +7,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -24,7 +25,7 @@ public SayCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SeedCommand.java b/src/main/java/cn/nukkit/command/defaults/SeedCommand.java index 3c70e7dd5f1..00ef0fe2b17 100644 --- a/src/main/java/cn/nukkit/command/defaults/SeedCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SeedCommand.java @@ -3,6 +3,7 @@ import cn.nukkit.Player; import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -17,7 +18,7 @@ public SeedCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SetWorldSpawnCommand.java b/src/main/java/cn/nukkit/command/defaults/SetWorldSpawnCommand.java index fcb93688eb2..0f2735d90c2 100644 --- a/src/main/java/cn/nukkit/command/defaults/SetWorldSpawnCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SetWorldSpawnCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.Level; import cn.nukkit.math.Vector3; +import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; @@ -26,7 +27,7 @@ public SetWorldSpawnCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/SpawnpointCommand.java b/src/main/java/cn/nukkit/command/defaults/SpawnpointCommand.java index bf10543d072..9d9a8c85b87 100644 --- a/src/main/java/cn/nukkit/command/defaults/SpawnpointCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/SpawnpointCommand.java @@ -9,6 +9,7 @@ import cn.nukkit.level.Level; import cn.nukkit.level.Position; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; @@ -28,7 +29,7 @@ public SpawnpointCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/StatusCommand.java b/src/main/java/cn/nukkit/command/defaults/StatusCommand.java index ac1e3ca13a6..09a47320857 100644 --- a/src/main/java/cn/nukkit/command/defaults/StatusCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/StatusCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.level.Level; import cn.nukkit.math.NukkitMath; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -27,7 +28,7 @@ public StatusCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/StopCommand.java b/src/main/java/cn/nukkit/command/defaults/StopCommand.java index 0c89133e00f..d934026606f 100644 --- a/src/main/java/cn/nukkit/command/defaults/StopCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/StopCommand.java @@ -3,6 +3,7 @@ import cn.nukkit.command.Command; import cn.nukkit.command.CommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; /** * author: MagicDroidX @@ -17,7 +18,7 @@ public StopCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/TeleportCommand.java b/src/main/java/cn/nukkit/command/defaults/TeleportCommand.java index e69aa948808..7813f845373 100644 --- a/src/main/java/cn/nukkit/command/defaults/TeleportCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/TeleportCommand.java @@ -10,6 +10,7 @@ import cn.nukkit.level.Location; import cn.nukkit.math.NukkitMath; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by Pub4Game and milkice. @@ -41,7 +42,7 @@ public TeleportCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/TellCommand.java b/src/main/java/cn/nukkit/command/defaults/TellCommand.java index 37dc1426bd7..dddc44108e7 100644 --- a/src/main/java/cn/nukkit/command/defaults/TellCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/TellCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.Objects; @@ -26,7 +27,7 @@ public TellCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/TimeCommand.java b/src/main/java/cn/nukkit/command/defaults/TimeCommand.java index 5d6f39ad95d..401db23621f 100644 --- a/src/main/java/cn/nukkit/command/defaults/TimeCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/TimeCommand.java @@ -9,6 +9,7 @@ import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.Level; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/11 by xtypr. @@ -41,7 +42,7 @@ public TimeCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (args.length < 1) { sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage)); diff --git a/src/main/java/cn/nukkit/command/defaults/TimingsCommand.java b/src/main/java/cn/nukkit/command/defaults/TimingsCommand.java index beb9354e2ba..3d83305f42b 100644 --- a/src/main/java/cn/nukkit/command/defaults/TimingsCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/TimingsCommand.java @@ -6,6 +6,7 @@ import cn.nukkit.lang.TranslationContainer; import co.aikar.timings.Timings; import co.aikar.timings.TimingsExport; +import org.jetbrains.annotations.NotNull; /** * @author fromgate @@ -23,7 +24,7 @@ public TimingsCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/TitleCommand.java b/src/main/java/cn/nukkit/command/defaults/TitleCommand.java index 2bdf150c741..744cfe320ef 100644 --- a/src/main/java/cn/nukkit/command/defaults/TitleCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/TitleCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * @author Tee7even @@ -41,7 +42,7 @@ public TitleCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/VersionCommand.java b/src/main/java/cn/nukkit/command/defaults/VersionCommand.java index 0fbfe8a6949..6e818ea6165 100644 --- a/src/main/java/cn/nukkit/command/defaults/VersionCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/VersionCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.plugin.Plugin; import cn.nukkit.plugin.PluginDescription; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -31,7 +32,7 @@ public VersionCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/WeatherCommand.java b/src/main/java/cn/nukkit/command/defaults/WeatherCommand.java index f85de3c6d19..9c0ba068cf6 100644 --- a/src/main/java/cn/nukkit/command/defaults/WeatherCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/WeatherCommand.java @@ -8,6 +8,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.level.Level; +import org.jetbrains.annotations.NotNull; /** * author: Angelic47 @@ -26,7 +27,7 @@ public WeatherCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/WhitelistCommand.java b/src/main/java/cn/nukkit/command/defaults/WhitelistCommand.java index 39b3a487e21..f3024f0aab4 100644 --- a/src/main/java/cn/nukkit/command/defaults/WhitelistCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/WhitelistCommand.java @@ -7,6 +7,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created on 2015/11/12 by xtypr. @@ -35,7 +36,7 @@ public WhitelistCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/defaults/XpCommand.java b/src/main/java/cn/nukkit/command/defaults/XpCommand.java index 26a5a5f9323..a0aaafaccb1 100644 --- a/src/main/java/cn/nukkit/command/defaults/XpCommand.java +++ b/src/main/java/cn/nukkit/command/defaults/XpCommand.java @@ -7,6 +7,7 @@ import cn.nukkit.command.data.CommandParameter; import cn.nukkit.lang.TranslationContainer; import cn.nukkit.utils.TextFormat; +import org.jetbrains.annotations.NotNull; /** * Created by Snake1999 on 2016/1/22. @@ -28,7 +29,7 @@ public XpCommand(String name) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (!this.testPermission(sender)) { return true; } diff --git a/src/main/java/cn/nukkit/command/simple/SimpleCommand.java b/src/main/java/cn/nukkit/command/simple/SimpleCommand.java index 6fae8ab119f..92079242ba3 100644 --- a/src/main/java/cn/nukkit/command/simple/SimpleCommand.java +++ b/src/main/java/cn/nukkit/command/simple/SimpleCommand.java @@ -5,6 +5,7 @@ import cn.nukkit.command.CommandSender; import cn.nukkit.command.ConsoleCommandSender; import cn.nukkit.lang.TranslationContainer; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Method; @@ -47,7 +48,7 @@ public void sendInGameMessage(CommandSender sender) { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, String commandLabel, String[] args) { if (this.forbidConsole && sender instanceof ConsoleCommandSender) { this.sendInGameMessage(sender); return false;