Archived
0

Add gamemode check, bump version

This commit is contained in:
Dico
2018-01-01 17:48:57 +01:00
committed by GitHub
parent a1e7b0beef
commit 13a34891c8

View File

@@ -7,6 +7,7 @@ import com.redstoner.misc.CommandHolderType;
import com.redstoner.modules.Module;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Nameable;
import org.bukkit.block.Block;
@@ -26,7 +27,7 @@ import java.util.Arrays;
import java.util.Set;
@Commands(CommandHolderType.File)
@Version(major = 4, minor = 0, revision = 0, compatible = 4)
@Version(major = 4, minor = 0, revision = 1, compatible = 4)
public class SignalStrength implements Module
{
@@ -51,14 +52,19 @@ public class SignalStrength implements Module
@Command(hook = "ssm")
public boolean ssm(CommandSender sender, int strength, String material)
{
Player player = (Player) sender;
if (player.getGameMode() != GameMode.CREATIVE) {
getLogger().message(sender, true, "You must be in creative mode to do that");
return true;
}
Material itemType = Material.matchMaterial(material);
if (itemType == null)
{
getLogger().message(sender, true, "The material " + material + " could not be recognized");
return true;
}
Player player = (Player) sender;
// Empty set in the first argument would make it always return the first block, because no block types are
// considered to be transparent. Only a value of null is treated as "air only".
Block targetBlock = player.getTargetBlock((Set<Material>) null, 5);