why dont i ever commit

This commit is contained in:
Super_ 2020-01-11 17:44:13 -05:00
parent 98ed23969a
commit 89b91598fb
9 changed files with 74 additions and 4 deletions

View File

@ -61,6 +61,13 @@ public class ChatManager extends FreedomService
message = FUtil.colorize(message);
message = message.replaceAll(ChatColor.MAGIC.toString(), "&k");
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
{
event.setCancelled(true);
playerMsg(player, "Chat is currently disabled.", ChatColor.RED);
return;
}
if (message.equals("Connected using PickaxeChat for Android"))
{
event.setCancelled(true);

View File

@ -57,6 +57,13 @@ public class Muter extends FreedomService
return;
}
if (fPlayer.isQuietMuted())
{
FSync.playerMsg(event.getPlayer(), event.getFormat());
event.setCancelled(true);
return;
}
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "You are muted, STFU! - You will be unmuted in 5 minutes.");
event.setCancelled(true);
}

View File

@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Block a player's Minecraft input. This is evil, and I never should have wrote it.", usage = "/<command> <all | purge | <<partialname> on | off>>")
public class Command_lockup extends FreedomCommand
{

View File

@ -21,7 +21,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Access the shop", usage = "/<command> <buy> <item>")
@CommandParameters(description = "Access the shop", usage = "/<command> <buy <item> | action | list>")
public class Command_shop extends FreedomCommand
{
private final List<String> locations = Arrays.asList("Sofa", "Car", "Bed", "Kitchen", "Garage", "Basement", "Home Study");
@ -70,6 +70,16 @@ public class Command_shop extends FreedomCommand
cooldown(30, args[0]);
return true;
}
case "list":
case "items":
{
msg(prefix + ChatColor.GREEN + "Available items:");
for (ShopItem item : ShopItem.values())
{
msg(prefix + ChatColor.AQUA + item.getName() + ChatColor.GREEN + " - " + ChatColor.RED + item.getCost());
}
return true;
}
default:
{
return false;

View File

@ -18,7 +18,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "mute")
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [[-s | -q] <player> [reason] | list | purge | all]", aliases = "mute")
public class Command_stfu extends FreedomCommand
{
@ -95,7 +95,9 @@ public class Command_stfu extends FreedomCommand
// -s option (smite)
boolean smite = args[0].equals("-s");
if (smite)
// -q option (shadowmute)
boolean quiet = args[0].equals("-q");
if (smite || quiet)
{
args = ArrayUtils.subarray(args, 1, args.length);
@ -121,6 +123,14 @@ public class Command_stfu extends FreedomCommand
FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.isMuted())
{
if (quiet || playerdata.isQuietMuted())
{
playerdata.setMuted(false);
playerdata.setQuietMuted(false);
msg("Unmuted " + player.getName() + " quietly");
return true;
}
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
playerdata.setMuted(false);
msg("Unmuted " + player.getName());
@ -136,6 +146,14 @@ public class Command_stfu extends FreedomCommand
return true;
}
if (quiet)
{
playerdata.setMuted(true);
playerdata.setQuietMuted(true);
msg("Muted " + player.getName() + " quietly");
return true;
}
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
playerdata.setMuted(true);

View File

@ -0,0 +1,21 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Toggle the server chat.", usage = "/<command>", aliases = "tc")
public class Command_togglechat extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
ConfigEntry.TOGGLE_CHAT.setBoolean(!ConfigEntry.TOGGLE_CHAT.getBoolean());
FUtil.adminAction(sender.getName(), "Chat " + (ConfigEntry.TOGGLE_CHAT.getBoolean() ? "enabled" : "disabled") + ".", true);
return true;
}
}

View File

@ -141,6 +141,7 @@ public enum ConfigEntry
VOTING_INFO(List.class, "votinginfo"),
MASTER_BUILDER_INFO(List.class, "masterbuilderinfo"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
TOGGLE_CHAT(Boolean.class, "toggle_chat"),
//
AMP_ENABLED(Boolean.class, "amp.enabled"),
AMP_USERNAME(String.class, "amp.username"),

View File

@ -76,6 +76,9 @@ public class FPlayer
@Getter
@Setter
private boolean invSee = false;
@Setter
@Getter
private boolean quietMuted = false;
public FPlayer(TotalFreedomMod plugin, Player player)
{

View File

@ -304,6 +304,9 @@ flatlands:
# Admin-Only Mode
admin_only_mode: false
# Toggle Chat
toggle_chat: true
# Protected Areas - Protect areas so that only admins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.
protectarea:
enabled: true