mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-16 12:26:12 +00:00
weSmart
sourcetype fixes; making sure in game commands work only in game
This commit is contained in:
parent
05abebea65
commit
0ae835aa04
@ -57,7 +57,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World adminWorld = null;
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes random sounds to everyone online.", usage = "/<command>")
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Makes random sounds.", usage = "/<command>")
|
||||
public class Command_deafen extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class Command_hubworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World hubWorld = null;
|
||||
@ -198,5 +198,4 @@ public class Command_hubworld extends FreedomCommand
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Toggles jumppads on/off, view the status of jumppads, or make them sideways.", usage = "/<command> <on | off | info | sideways <on | off>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ public class Command_masterbuilderworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World masterBuilderWorld = null;
|
||||
|
@ -70,19 +70,17 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(playerSender))
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (senderIsConsole)
|
||||
{
|
||||
msg("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||
{
|
||||
@ -113,19 +111,17 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(playerSender))
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
|
||||
if (potion_effect_type == null)
|
||||
|
@ -15,7 +15,7 @@ public class Command_rank extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (isConsole() && args.length == 0)
|
||||
if (senderIsConsole && args.length == 0)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = false)
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
|
||||
public class Command_ro extends FreedomCommand
|
||||
{
|
||||
@ -58,7 +58,7 @@ public class Command_ro extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
int radius = 20;
|
||||
int radius = 50;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
|
@ -15,7 +15,6 @@ public class Command_spectate extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
@ -39,8 +38,12 @@ public class Command_spectate extends FreedomCommand
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
playerSender.setSpectatorTarget(player);
|
||||
if (playerSender.getWorld() != player.getWorld())
|
||||
{
|
||||
playerSender.teleport(player);
|
||||
}
|
||||
|
||||
playerSender.setSpectatorTarget(player);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -138,6 +138,12 @@ public class Command_tag extends FreedomCommand
|
||||
}
|
||||
else if ("set".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("\"/tag set\" can't be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String inputTag = StringUtils.join(args, " ", 1, args.length);
|
||||
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
||||
new String[]
|
||||
@ -183,6 +189,12 @@ public class Command_tag extends FreedomCommand
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("gradient"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("\"/tag gradient\" can't be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String from = "", to = "";
|
||||
java.awt.Color awt1, awt2;
|
||||
try
|
||||
|
@ -2,6 +2,6 @@ name: TotalFreedomMod
|
||||
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
||||
version: ${project.version}
|
||||
description: Plugin for the Total Freedom server.
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, TFGuilds]
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit]
|
||||
authors: [Madgeek1450, Prozza]
|
||||
api-version: 1.15
|
Loading…
Reference in New Issue
Block a user