mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
...
This commit is contained in:
parent
0f6a1d6687
commit
46bd17e2c6
@ -34,10 +34,14 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public Boolean allowFire = false;
|
||||
public double explosiveRadius = 4.0;
|
||||
public Boolean preprocessLogEnabled = false;
|
||||
public boolean nukeMonitor = false;
|
||||
public double nukeMonitorRange = 10.0;
|
||||
public boolean playersFrozen = false;
|
||||
public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||
public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||
public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
CONFIG = getConfiguration();
|
||||
@ -79,19 +83,23 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
|
||||
|
||||
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
||||
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + implodeStringList(", ", superadmins));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
log.log(Level.INFO, "[Total Freedom Mod] - Disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
@ -840,6 +848,57 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("fr"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender))
|
||||
{
|
||||
this.playersFrozen = !this.playersFrozen;
|
||||
|
||||
if (this.playersFrozen)
|
||||
{
|
||||
this.playersFrozen = true;
|
||||
sender.sendMessage("Players are now frozen.");
|
||||
tfBroadcastMessage(sender.getName() + " has temporarily frozen everyone on the server.", ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.playersFrozen = false;
|
||||
sender.sendMessage("Players are now free to move.");
|
||||
tfBroadcastMessage(sender.getName() + " has unfrozen everyone.", ChatColor.AQUA);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("nonuke"))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
this.nukeMonitorRange = Integer.parseInt(args[1]);
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
this.nukeMonitor = true;
|
||||
sender.sendMessage("Nuke monitor is enabled, range is set to " + this.nukeMonitorRange + " blocks.");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.nukeMonitor = false;
|
||||
sender.sendMessage("Nuke monitor is disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
@ -40,6 +43,29 @@ public class TotalFreedomModBlockListener extends BlockListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (plugin.nukeMonitor)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
|
||||
Location player_pos = p.getLocation();
|
||||
Location block_pos = event.getBlock().getLocation();
|
||||
|
||||
if (player_pos.distance(block_pos) > plugin.nukeMonitorRange)
|
||||
{
|
||||
p.setOp(false);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
p.getInventory().clear();
|
||||
|
||||
plugin.tfBroadcastMessage(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
|
@ -2,12 +2,14 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
class TotalFreedomModPlayerListener extends PlayerListener
|
||||
@ -54,6 +56,27 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (plugin.playersFrozen)
|
||||
{
|
||||
if (plugin.isUserSuperadmin(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo().clone();
|
||||
|
||||
to.setX(from.getX());
|
||||
to.setY(from.getY());
|
||||
to.setZ(from.getZ());
|
||||
|
||||
event.setTo(to);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
|
@ -16,6 +16,9 @@ commands:
|
||||
fire:
|
||||
description: Superadmin command - Enable/disable fire.
|
||||
usage: /<command> <on|off>
|
||||
fr:
|
||||
description: Superadmin command - Freeze all players (toggles on and off).
|
||||
usage: /<command>
|
||||
gadmin:
|
||||
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
|
||||
usage: /<command> [list | <kick|nameban|ipban|ban|op|deop|ci> <targethash>]
|
||||
@ -34,6 +37,9 @@ commands:
|
||||
mp:
|
||||
description: Use moblimiter to purge all mobs.
|
||||
usage: /<command>
|
||||
nonuke:
|
||||
description: Attempt to detect "invisible griefers" and "nukers".
|
||||
usage: /<command> <on|off> [range]
|
||||
opall:
|
||||
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||
usage: /<command> [-c|-s]
|
||||
|
Loading…
Reference in New Issue
Block a user