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)
|
if (!(sender instanceof Player) || playerSender == null)
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
World adminWorld = null;
|
World adminWorld = null;
|
||||||
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Makes random sounds to everyone online.", usage = "/<command>")
|
@CommandParameters(description = "Makes random sounds.", usage = "/<command>")
|
||||||
public class Command_deafen extends FreedomCommand
|
public class Command_deafen extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class Command_hubworld extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!(sender instanceof Player) || playerSender == null)
|
if (!(sender instanceof Player) || playerSender == null)
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
World hubWorld = null;
|
World hubWorld = null;
|
||||||
@ -198,5 +198,4 @@ public class Command_hubworld extends FreedomCommand
|
|||||||
super(string);
|
super(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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")
|
@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
|
public class Command_jumppads extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ public class Command_masterbuilderworld extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!(sender instanceof Player) || playerSender == null)
|
if (!(sender instanceof Player) || playerSender == null)
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
World masterBuilderWorld = null;
|
World masterBuilderWorld = null;
|
||||||
|
@ -70,20 +70,18 @@ public class Command_potion extends FreedomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.equals(playerSender))
|
if (senderIsConsole)
|
||||||
{
|
|
||||||
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.");
|
msg("You must specify a target player when using this command from the console.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!plugin.al.isAdmin(sender))
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||||
{
|
{
|
||||||
target.removePotionEffect(potion_effect.getType());
|
target.removePotionEffect(potion_effect.getType());
|
||||||
@ -113,20 +111,18 @@ public class Command_potion extends FreedomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.equals(playerSender))
|
if (senderIsConsole)
|
||||||
{
|
|
||||||
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.");
|
sender.sendMessage("You must specify a target player when using this command from the console.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!plugin.al.isAdmin(sender))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
|
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
|
||||||
if (potion_effect_type == null)
|
if (potion_effect_type == null)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ public class Command_rank extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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]")
|
@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
|
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)
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -15,7 +15,6 @@ public class Command_spectate extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -39,8 +38,12 @@ public class Command_spectate extends FreedomCommand
|
|||||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerSender.setSpectatorTarget(player);
|
if (playerSender.getWorld() != player.getWorld())
|
||||||
|
{
|
||||||
|
playerSender.teleport(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
playerSender.setSpectatorTarget(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -138,6 +138,12 @@ public class Command_tag extends FreedomCommand
|
|||||||
}
|
}
|
||||||
else if ("set".equalsIgnoreCase(args[0]))
|
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 inputTag = StringUtils.join(args, " ", 1, args.length);
|
||||||
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
||||||
new String[]
|
new String[]
|
||||||
@ -183,6 +189,12 @@ public class Command_tag extends FreedomCommand
|
|||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("gradient"))
|
else if (args[0].equalsIgnoreCase("gradient"))
|
||||||
{
|
{
|
||||||
|
if (senderIsConsole)
|
||||||
|
{
|
||||||
|
msg("\"/tag gradient\" can't be used from the console.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String from = "", to = "";
|
String from = "", to = "";
|
||||||
java.awt.Color awt1, awt2;
|
java.awt.Color awt1, awt2;
|
||||||
try
|
try
|
||||||
|
@ -2,6 +2,6 @@ name: TotalFreedomMod
|
|||||||
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
description: Plugin for the Total Freedom server.
|
description: Plugin for the Total Freedom server.
|
||||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, TFGuilds]
|
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit]
|
||||||
authors: [Madgeek1450, Prozza]
|
authors: [Madgeek1450, Prozza]
|
||||||
api-version: 1.15
|
api-version: 1.15
|
Loading…
Reference in New Issue
Block a user