In sync with AMG
This commit is contained in:
parent
e9839b714f
commit
a1f1e4ccc0
|
@ -22,6 +22,7 @@ repositories {
|
|||
url = uri('https://repo.codemc.org/repository/nms/')
|
||||
content {
|
||||
includeGroup('org.spigotmc')
|
||||
includeGroup('net.ess3')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,7 @@ repositories {
|
|||
includeGroup('org.bukkit')
|
||||
includeGroup('net.goldtreeservers')
|
||||
includeGroup('de.bananaco')
|
||||
includeGroup('net.ess3')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,10 @@ public class AutoEject extends FreedomService
|
|||
player.kickPlayer(kickMessage);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FLog.warning("Unrecognized EjectMethod " + method.name() + " found, defaulting to STRIKE_THREE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package me.totalfreedom.totalfreedommod;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.Groups;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -24,6 +26,8 @@ public class EntityWiper extends FreedomService
|
|||
);
|
||||
private BukkitTask wiper;
|
||||
|
||||
private static final boolean enabled = ConfigEntry.AUTO_ENTITY_WIPE.getBoolean();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
@ -33,7 +37,10 @@ public class EntityWiper extends FreedomService
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
wipeEntities(false);
|
||||
if (enabled)
|
||||
{
|
||||
wipeEntities(false);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 600L, 600L); // 30 second delay after startup + run every 30 seconds
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.command.Command_sit;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
public class Sitter extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDismount(EntityDismountEvent e)
|
||||
{
|
||||
Entity dm = e.getDismounted();
|
||||
if (dm instanceof ArmorStand)
|
||||
{
|
||||
if (Command_sit.STANDS.contains(dm))
|
||||
{
|
||||
Command_sit.STANDS.remove(dm);
|
||||
dm.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -123,7 +123,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
public WorldRestrictions wr;
|
||||
public SignBlocker snp;
|
||||
public EntityWiper ew;
|
||||
public Sitter st;
|
||||
public VanishHandler vh;
|
||||
public Pterodactyl ptero;
|
||||
//
|
||||
|
@ -328,7 +327,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
gr = new GameRuleHandler();
|
||||
snp = new SignBlocker();
|
||||
ew = new EntityWiper();
|
||||
st = new Sitter();
|
||||
vh = new VanishHandler();
|
||||
ptero = new Pterodactyl();
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class IndefiniteBan implements IConfig
|
|||
@Override
|
||||
public void saveTo(ConfigurationSection cs)
|
||||
{
|
||||
// The indefinite ban list is only intended to be modified manually. It is not intended to save.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -171,6 +171,11 @@ public class BlockBlocker extends FreedomService
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Groups.BANNERS.contains(event.getBlockPlaced().getType()))
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package me.totalfreedom.totalfreedommod.blocking;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
|
@ -9,29 +10,23 @@ import org.bukkit.event.EventPriority;
|
|||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class EditBlocker extends FreedomService
|
||||
{
|
||||
public class EditBlocker extends FreedomService {
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
public void onStart() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
public void onStop() {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
if (!fPlayer.isEditBlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
if (plugin.al.isAdminSync(event.getPlayer())) {
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
@ -41,16 +36,13 @@ public class EditBlocker extends FreedomService
|
|||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlocked())
|
||||
{
|
||||
if (!fPlayer.isEditBlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
if (plugin.al.isAdminSync(event.getPlayer())) {
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -36,10 +36,9 @@ public class InteractBlocker extends FreedomService
|
|||
break;
|
||||
}
|
||||
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
default:
|
||||
{
|
||||
//
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +157,11 @@ public class InteractBlocker extends FreedomService
|
|||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -75,9 +77,10 @@ public class Command_blockcmd extends FreedomCommand
|
|||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
if (!playerdata.allCommandsBlocked())
|
||||
{
|
||||
playerdata.setCommandsBlocked(true);
|
||||
FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
|
||||
playerdata.setCommandsBlocked(true);
|
||||
msg("Blocked commands for " + player.getName() + ".");
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.BLOCKCMD, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
@ -128,6 +130,7 @@ public class Command_blockedit extends FreedomCommand
|
|||
|
||||
msg(player2, "Your block modification abilities have been blocked.", ChatColor.RED);
|
||||
msg("Blocked all block modification abilities for " + player2.getName());
|
||||
plugin.pul.logPunishment(new Punishment(player2.getName(), FUtil.getIp(player2), sender.getName(), PunishmentType.BLOCKEDIT, null));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -128,6 +130,7 @@ public class Command_blockpvp extends FreedomCommand
|
|||
|
||||
msg(p, "Your PVP has been disabled.", ChatColor.RED);
|
||||
msg("Disabled PVP for " + p.getName());
|
||||
plugin.pul.logPunishment(new Punishment(p.getName(), FUtil.getIp(p), sender.getName(), PunishmentType.BLOCKPVP, null));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
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.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Clears the chat.", usage = "/<command>", aliases = "cc")
|
||||
public class Command_clearchat extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
msg(player, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Cleared chat", true);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -11,39 +11,27 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]")
|
||||
public class Command_coins extends FreedomCommand
|
||||
{
|
||||
public class Command_coins extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.SHOP_ENABLED.getBoolean())
|
||||
{
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (!ConfigEntry.SHOP_ENABLED.getBoolean()) {
|
||||
msg("The shop is currently disabled!", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
Player p;
|
||||
final String prefix = FUtil.colorize(ConfigEntry.SHOP_PREFIX.getString() + " ");
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (getPlayer(args[0]) != null)
|
||||
{
|
||||
if (args.length > 0) {
|
||||
if (getPlayer(args[0]) != null) {
|
||||
p = getPlayer(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
} else {
|
||||
if (senderIsConsole) {
|
||||
msg(prefix + ChatColor.RED + "You are not a player, use /coins <playername>");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p = playerSender;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,12 @@ public class Command_entitywipe extends FreedomCommand
|
|||
return true;
|
||||
}
|
||||
|
||||
if (type == EntityType.PLAYER)
|
||||
{
|
||||
msg("Player entities cannot be purged.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getAllEntities().contains(type))
|
||||
{
|
||||
msg(FUtil.formatName(type.name()) + " is an entity, however: it is a mob.", ChatColor.RED);
|
||||
|
|
|
@ -23,12 +23,12 @@ public class Command_freeze extends FreedomCommand
|
|||
|
||||
if (!gFreeze)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Disabling global player freeze", false);
|
||||
FUtil.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
msg("Players are now free to move.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Enabling global player freeze", false);
|
||||
FUtil.adminAction(sender.getName(), "Freezing all players", false);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!isAdmin(player))
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Command_masterbuilderinfo extends FreedomCommand
|
|||
|
||||
if (masterBuilderInfo.isEmpty())
|
||||
{
|
||||
msg("The master builder information section of the config.yml file has not been configured.", ChatColor.RED);
|
||||
msg("The master builder information section in the config.yml file has not been configured.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,13 +8,10 @@ import org.bukkit.entity.Player;
|
|||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Check the name history of a specified player.", usage = "/<command> <username>", aliases = "nh")
|
||||
public class Command_namehistory extends FreedomCommand
|
||||
{
|
||||
public class Command_namehistory extends FreedomCommand {
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
History.reportHistory(sender, args[0]);
|
||||
|
|
|
@ -116,8 +116,11 @@ public class Command_notes extends FreedomCommand
|
|||
msg("Cleared " + count + " notes.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -56,11 +58,13 @@ public class Command_orbit extends FreedomCommand
|
|||
}
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
playerdata.startOrbiting(strength);
|
||||
|
||||
player.setVelocity(new Vector(0, strength, 0));
|
||||
FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.ORBIT, null));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ public class Command_potion extends FreedomCommand
|
|||
switch (args.length)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
List<String> potionEffectTypeNames = new ArrayList<>();
|
||||
|
@ -58,8 +59,10 @@ public class Command_potion extends FreedomCommand
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
Player target = playerSender;
|
||||
|
@ -95,9 +98,11 @@ public class Command_potion extends FreedomCommand
|
|||
msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
{
|
||||
Player target = playerSender;
|
||||
|
@ -167,8 +172,11 @@ public class Command_potion extends FreedomCommand
|
|||
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -179,14 +187,17 @@ public class Command_potion extends FreedomCommand
|
|||
switch (args.length)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
List<String> arguments = new ArrayList<>(Arrays.asList("list", "clear", "add"));
|
||||
if (plugin.al.isAdmin(sender))
|
||||
{
|
||||
arguments.add("clearall");
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if (args[0].equals("clear"))
|
||||
{
|
||||
if (plugin.al.isAdmin(sender))
|
||||
|
@ -199,22 +210,28 @@ public class Command_potion extends FreedomCommand
|
|||
return getAllPotionTypes();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
return Collections.singletonList("<duration>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
return Collections.singletonList("<amplifier>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
{
|
||||
if (plugin.al.isAdmin(sender))
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
|
@ -223,6 +240,12 @@ public class Command_potion extends FreedomCommand
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
|
|
|
@ -105,6 +105,11 @@ public class Command_tag extends FreedomCommand
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
|
@ -279,6 +284,11 @@ public class Command_tag extends FreedomCommand
|
|||
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "") + from + to);
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> [-q] <username> [reason]", aliases = "noob")
|
||||
public class Command_tban extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean quiet = args[0].equalsIgnoreCase("-q");
|
||||
if (quiet)
|
||||
{
|
||||
args = org.apache.commons.lang3.ArrayUtils.subarray(args, 1, args.length);
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final String username;
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
final PlayerData entry;
|
||||
if (player == null)
|
||||
{
|
||||
entry = plugin.pl.getData(args[0]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
return true;
|
||||
}
|
||||
|
||||
username = entry.getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = plugin.pl.getData(player);
|
||||
username = player.getName();
|
||||
}
|
||||
final List<String> ips = new ArrayList<>(entry.getIps());
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
StringBuilder kick = new StringBuilder()
|
||||
.append(ChatColor.RED)
|
||||
.append("You have been temporarily banned for five minutes. Please read totalfreedom.me for more info.");
|
||||
|
||||
if (!quiet)
|
||||
{
|
||||
// Strike with lightning
|
||||
if (player != null)
|
||||
{
|
||||
final Location targetPos = player.getLocation();
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
Objects.requireNonNull(targetPos.getWorld()).strikeLightning(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
// Kill player
|
||||
player.setHealth(0.0);
|
||||
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes - Reason: " + reason, true);
|
||||
kick.append("\n")
|
||||
.append(ChatColor.RED)
|
||||
.append("Reason: ")
|
||||
.append(ChatColor.GOLD)
|
||||
.append(reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
if (reason != null)
|
||||
{
|
||||
msg("Quietly temporarily banned " + player.getName() + " for 5 minutes.");
|
||||
kick.append("\n")
|
||||
.append(ChatColor.RED)
|
||||
.append("Reason: ")
|
||||
.append(ChatColor.GOLD)
|
||||
.append(reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ban player
|
||||
Ban ban = Ban.forPlayerName(username, sender, FUtil.parseDateOffset("5m"), reason);
|
||||
for (String ip : ips)
|
||||
{
|
||||
ban.addIp(ip);
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
// Kick player
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(kick.toString());
|
||||
}
|
||||
|
||||
// Log ban
|
||||
plugin.pul.logPunishment(new Punishment(username, ips.get(0), sender.getName(), PunishmentType.TEMPBAN, reason));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
|
@ -21,7 +21,7 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [-q] <username> [duration] [reason]")
|
||||
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [-q] <username> [duration] [reason]", aliases = "tban,noob")
|
||||
public class Command_tempban extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -47,49 +47,72 @@ public class Command_tempban extends FreedomCommand
|
|||
}
|
||||
|
||||
final String username;
|
||||
final List<String> ips = new ArrayList<>();
|
||||
final String ip;
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
final PlayerData entry;
|
||||
PlayerData entry;
|
||||
if (player == null)
|
||||
{
|
||||
entry = plugin.pl.getData(args[0]);
|
||||
|
||||
if (entry == null)
|
||||
// Gets the IP using Essentials data if available
|
||||
if (plugin.esb.isEnabled() && plugin.esb.getEssentialsUser(args[0]) != null)
|
||||
{
|
||||
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
return true;
|
||||
User essUser = plugin.esb.getEssentialsUser(args[0]);
|
||||
//
|
||||
username = essUser.getName();
|
||||
ip = essUser.getLastLoginAddress();
|
||||
}
|
||||
// Last resort - Getting the first result from the username itself
|
||||
else
|
||||
{
|
||||
entry = plugin.pl.getData(args[0]);
|
||||
if (entry == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
username = entry.getName();
|
||||
ip = entry.getIps().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
username = entry.getName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = plugin.pl.getData(player);
|
||||
username = player.getName();
|
||||
ips.add(FUtil.getIp(player));
|
||||
ip = FUtil.getIp(player);
|
||||
}
|
||||
|
||||
final StringBuilder message = new StringBuilder("Temporarily banned " + username);
|
||||
|
||||
Date expires = FUtil.parseDateOffset("30m");
|
||||
// Default expiration date is 5 minutes
|
||||
Date expires = FUtil.parseDateOffset("5m");
|
||||
|
||||
// Parses what comes after as a duration
|
||||
if (args.length > 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
expires = FUtil.parseDateOffset(args[1]);
|
||||
}
|
||||
catch (NumberFormatException error)
|
||||
{
|
||||
msg("Invalid duration: " + args[1], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
message.append(" until ").append(date_format.format(expires));
|
||||
|
||||
// If a reason appears to exist, set it.
|
||||
String reason = null;
|
||||
if (args.length >= 2)
|
||||
if (args.length > 2)
|
||||
{
|
||||
Date parsed_offset = FUtil.parseDateOffset(args[1]);
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, parsed_offset == null ? 1 : 2, args.length), " ") + " (" + sender.getName() + ")";
|
||||
if (parsed_offset != null)
|
||||
{
|
||||
expires = parsed_offset;
|
||||
}
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")";
|
||||
message.append(", Reason: \"").append(reason).append("\"");
|
||||
}
|
||||
|
||||
Ban ban;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ban = Ban.forPlayer(player, sender, expires, reason);
|
||||
|
@ -98,11 +121,8 @@ public class Command_tempban extends FreedomCommand
|
|||
{
|
||||
ban = Ban.forPlayerName(username, sender, expires, reason);
|
||||
}
|
||||
ban.addIp(ip);
|
||||
|
||||
for (String ip : ips)
|
||||
{
|
||||
ban.addIp(ip);
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
if (!quiet)
|
||||
|
@ -119,6 +139,8 @@ public class Command_tempban extends FreedomCommand
|
|||
Objects.requireNonNull(targetPos.getWorld()).strikeLightningEffect(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), message.toString(), true);
|
||||
|
@ -128,19 +150,15 @@ public class Command_tempban extends FreedomCommand
|
|||
msg("Quietly temporarily banned " + username + ".");
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
if (FUtil.getIp(p).equals(ip))
|
||||
{
|
||||
if (FUtil.getIp(p).equals(FUtil.getIp(player)))
|
||||
{
|
||||
p.kickPlayer(ChatColor.RED + "You've been kicked because someone on your IP has been banned.");
|
||||
}
|
||||
p.kickPlayer(ChatColor.RED + "You've been kicked because someone on your IP has been banned.");
|
||||
}
|
||||
}
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(username, ips.get(0), sender.getName(), PunishmentType.TEMPBAN, reason));
|
||||
plugin.pul.logPunishment(new Punishment(username, ip, sender.getName(), PunishmentType.TEMPBAN, reason));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,12 @@ import org.bukkit.entity.Player;
|
|||
@CommandParameters(description = "Toggles TotalFreedomMod settings", usage = "/<command> [option] [value] [value]")
|
||||
public class Command_toggle extends FreedomCommand
|
||||
{
|
||||
private final List<String> toggles = Arrays.asList(
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
||||
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones",
|
||||
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
||||
"landmines", "tossmob", "gravity");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
|
@ -23,38 +29,10 @@ public class Command_toggle extends FreedomCommand
|
|||
if (args.length == 0)
|
||||
{
|
||||
msg("Available toggles: ");
|
||||
msg("- waterplace");
|
||||
msg("- fireplace");
|
||||
msg("- lavaplace");
|
||||
msg("- fluidspread");
|
||||
msg("- lavadmg");
|
||||
msg("- firespread");
|
||||
msg("- frostwalk");
|
||||
msg("- firework");
|
||||
msg("- prelog");
|
||||
msg("- lockdown");
|
||||
msg("- petprotect");
|
||||
msg("- entitywipe");
|
||||
msg("- nonuke [range] [count]");
|
||||
msg("- explosives [radius]");
|
||||
msg("- unsafeenchs");
|
||||
msg("- bells");
|
||||
msg("- armorstands");
|
||||
msg("- structureblocks");
|
||||
msg("- jigsaws");
|
||||
msg("- grindstones");
|
||||
msg("- jukeboxes");
|
||||
msg("- spawners");
|
||||
msg("- 4chan");
|
||||
msg("- beehives");
|
||||
msg("- respawnanchors");
|
||||
msg("- autotp");
|
||||
msg("- autoclear");
|
||||
msg("- minecarts");
|
||||
msg("- landmines");
|
||||
msg("- mp44");
|
||||
msg("- tossmob");
|
||||
msg("- gravity");
|
||||
for (String toggle : toggles)
|
||||
{
|
||||
msg("- " + toggle);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -304,6 +282,16 @@ public class Command_toggle extends FreedomCommand
|
|||
toggle("Block gravity is", ConfigEntry.ALLOW_GRAVITY);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
msg("Available toggles: ");
|
||||
for (String toggle : toggles)
|
||||
{
|
||||
msg("- " + toggle);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -53,25 +56,28 @@ public class Command_warn extends FreedomCommand
|
|||
|
||||
String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
player.sendTitle(ChatColor.RED + "You've been warned.", ChatColor.YELLOW + "Reason: " + warnReason, 20, 100, 60);
|
||||
msg(ChatColor.GREEN + "You have successfully warned " + player.getName());
|
||||
msg(player, ChatColor.RED + "[WARNING] You received a warning from " + sender.getName() + ": " + warnReason);
|
||||
plugin.pl.getPlayer(player).incrementWarnings(quiet);
|
||||
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.WARN, warnReason));
|
||||
|
||||
if (quiet)
|
||||
{
|
||||
msg("Warned " + player.getName() + " quietly");
|
||||
return true;
|
||||
msg("You have successfully warned " + player.getName() + " quietly.");
|
||||
}
|
||||
else
|
||||
{
|
||||
String adminNotice = ChatColor.RED +
|
||||
sender.getName() +
|
||||
" - " +
|
||||
"Warning: " +
|
||||
player.getName() +
|
||||
" - Reason: " +
|
||||
ChatColor.YELLOW +
|
||||
warnReason;
|
||||
plugin.al.messageAllAdmins(adminNotice);
|
||||
|
||||
msg(player, ChatColor.RED + "[WARNING] You received a warning from " + sender.getName() + ": " + warnReason);
|
||||
String adminNotice = ChatColor.RED +
|
||||
sender.getName() +
|
||||
" - " +
|
||||
"Warning: " +
|
||||
player.getName() +
|
||||
" - Reason: " +
|
||||
ChatColor.YELLOW +
|
||||
warnReason;
|
||||
plugin.al.messageAllAdmins(adminNotice);
|
||||
plugin.pl.getPlayer(player).incrementWarnings();
|
||||
msg("You have successfully warned " + player.getName() + ".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -131,7 +131,6 @@ public enum ConfigEntry
|
|||
//
|
||||
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
|
||||
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
||||
FOURCHAN_ENABLED(Boolean.class, "4chan_enabled"),
|
||||
//
|
||||
|
@ -140,6 +139,7 @@ public enum ConfigEntry
|
|||
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nukemonitor.count_place"),
|
||||
NUKE_MONITOR_RANGE(Double.class, "nukemonitor.range"),
|
||||
//
|
||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
|
||||
AUTOKICK_TIME(Integer.class, "autokick.time"),
|
||||
//
|
||||
|
|
|
@ -128,7 +128,7 @@ public class ItemFun extends FreedomService
|
|||
|
||||
LivingEntity livingEntity = (LivingEntity)event.getRightClicked();
|
||||
EntityType entityType = livingEntity.getType();
|
||||
if (!(entityType == fPlayer.mobThrowerCreature()))
|
||||
if (entityType != fPlayer.mobThrowerCreature())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class ItemFun extends FreedomService
|
|||
{
|
||||
final int RADIUS_HIT = 5;
|
||||
final int STRENGTH = 4;
|
||||
|
||||
|
||||
if (plugin.lp.CLOWNFISH_TOGGLE.contains(player.getName()))
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "An admin has disabled your ability to use clownfish.");
|
||||
|
@ -304,6 +304,11 @@ public class ItemFun extends FreedomService
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Landminer extends FreedomService
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!(player.getLocation().distanceSquared(location) <= (landmine.radius * landmine.radius)))
|
||||
if (player.getLocation().distanceSquared(location) > (landmine.radius * landmine.radius))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package me.totalfreedom.totalfreedommod.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.caging.CageData;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
|
@ -16,8 +14,12 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FPlayer
|
||||
{
|
||||
|
||||
public static final long AUTO_PURGE_TICKS = 5L * 60L * 20L;
|
||||
|
||||
|
||||
|
@ -247,7 +249,7 @@ public class FPlayer
|
|||
public void startArrowShooter(TotalFreedomMod plugin)
|
||||
{
|
||||
this.stopArrowShooter();
|
||||
this.mp44ScheduleTask = new ArrowShooter(this.player).runTaskTimer(plugin, 1L, 1L);
|
||||
this.mp44ScheduleTask = new ArrowShooter(getPlayer()).runTaskTimer(plugin, 1L, 1L);
|
||||
this.mp44Firing = true;
|
||||
}
|
||||
|
||||
|
@ -429,14 +431,19 @@ public class FPlayer
|
|||
this.warningCount = warningCount;
|
||||
}
|
||||
|
||||
public void incrementWarnings()
|
||||
public void incrementWarnings(boolean quiet)
|
||||
{
|
||||
this.warningCount++;
|
||||
|
||||
if (this.warningCount % 2 == 0)
|
||||
{
|
||||
Player p = getPlayer();
|
||||
p.getWorld().strikeLightning(p.getLocation());
|
||||
|
||||
if (!quiet)
|
||||
{
|
||||
p.getWorld().strikeLightning(p.getLocation());
|
||||
}
|
||||
|
||||
FUtil.playerMsg(p, ChatColor.RED + "You have been warned at least twice now, make sure to read the rules at " + ConfigEntry.SERVER_BAN_URL.getString());
|
||||
}
|
||||
}
|
||||
|
@ -704,8 +711,11 @@ public class FPlayer
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot = player.launchProjectile(Arrow.class);
|
||||
shot.setVelocity(shot.getVelocity().multiply(2.0));
|
||||
if (player != null)
|
||||
{
|
||||
Arrow shot = player.launchProjectile(Arrow.class);
|
||||
shot.setVelocity(shot.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,5 +7,11 @@ public enum PunishmentType
|
|||
KICK,
|
||||
TEMPBAN,
|
||||
BAN,
|
||||
WARN,
|
||||
CAGE,
|
||||
BLOCKEDIT,
|
||||
BLOCKPVP,
|
||||
BLOCKCMD,
|
||||
ORBIT,
|
||||
DOOM
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue